+ client: submit retention form after confirm
This commit is contained in:
@@ -7,7 +7,7 @@ import flow from 'lodash/flow';
|
||||
import { renderSelectField, renderRadioField, toNumber } from '../../../helpers/form';
|
||||
import { QUERY_LOG_INTERVALS_DAYS } from '../../../helpers/constants';
|
||||
|
||||
const getIntervalFields = (processing, t, handleChange, toNumber) =>
|
||||
const getIntervalFields = (processing, t, toNumber) =>
|
||||
QUERY_LOG_INTERVALS_DAYS.map((interval) => {
|
||||
const title =
|
||||
interval === 1 ? t('interval_24_hour') : t('interval_days', { count: interval });
|
||||
@@ -20,7 +20,6 @@ const getIntervalFields = (processing, t, handleChange, toNumber) =>
|
||||
component={renderRadioField}
|
||||
value={interval}
|
||||
placeholder={title}
|
||||
onChange={handleChange}
|
||||
normalize={toNumber}
|
||||
disabled={processing}
|
||||
/>
|
||||
@@ -29,48 +28,56 @@ const getIntervalFields = (processing, t, handleChange, toNumber) =>
|
||||
|
||||
const Form = (props) => {
|
||||
const {
|
||||
handleSubmit, handleChange, processing, t,
|
||||
handleSubmit, submitting, invalid, processing, processingClear, handleClear, t,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<div className="form__group form__group--settings">
|
||||
<Field
|
||||
name="enabled"
|
||||
type="checkbox"
|
||||
component={renderSelectField}
|
||||
placeholder={t('query_log_enable')}
|
||||
onChange={handleChange}
|
||||
disabled={processing}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<label className="form__label">
|
||||
<Trans>query_log_retention</Trans>
|
||||
</label>
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<div className="form__group form__group--settings">
|
||||
<div className="custom-controls-stacked">
|
||||
{getIntervalFields(processing, t, handleChange, toNumber)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="form__group form__group--settings">
|
||||
<Field
|
||||
name="enabled"
|
||||
type="checkbox"
|
||||
component={renderSelectField}
|
||||
placeholder={t('query_log_enable')}
|
||||
disabled={processing}
|
||||
/>
|
||||
</div>
|
||||
<label className="form__label">
|
||||
<Trans>query_log_retention</Trans>
|
||||
</label>
|
||||
<div className="form__group form__group--settings">
|
||||
<div className="custom-controls-stacked">
|
||||
{getIntervalFields(processing, t, toNumber)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-success btn-standard btn-large"
|
||||
disabled={submitting || invalid || processing}
|
||||
>
|
||||
<Trans>save_btn</Trans>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-outline-secondary btn-standard ml-5"
|
||||
onClick={() => handleClear()}
|
||||
disabled={processingClear}
|
||||
>
|
||||
<Trans>query_log_clear</Trans>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
|
||||
Form.propTypes = {
|
||||
handleSubmit: PropTypes.func.isRequired,
|
||||
handleChange: PropTypes.func,
|
||||
change: PropTypes.func.isRequired,
|
||||
handleClear: PropTypes.func.isRequired,
|
||||
submitting: PropTypes.bool.isRequired,
|
||||
invalid: PropTypes.bool.isRequired,
|
||||
processing: PropTypes.bool.isRequired,
|
||||
processingClear: PropTypes.bool.isRequired,
|
||||
t: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user