Pull request: 3403 use checkbox to disable statistics
Closes #3403 Squashed commit of the following: commit 25eaa0a70cb5ac7de51c456d2f611522f334846c Author: Ildar Kamalov <ik@adguard.com> Date: Fri Aug 27 15:42:29 2021 +0300 fix enabling stats commit 1e2897651a84cf32ae01a79b8a61aeb5aa9f6405 Author: Ildar Kamalov <ik@adguard.com> Date: Mon Aug 16 18:46:21 2021 +0300 client: use checkbox to disable statistics
This commit is contained in:
@@ -8,13 +8,14 @@ import Form from './Form';
|
||||
class StatsConfig extends Component {
|
||||
handleFormSubmit = (values) => {
|
||||
const { t, interval: prevInterval } = this.props;
|
||||
const config = { interval: values.interval };
|
||||
|
||||
if (values.interval < prevInterval) {
|
||||
if (config.interval < prevInterval) {
|
||||
if (window.confirm(t('statistics_retention_confirm'))) {
|
||||
this.props.setStatsConfig(values);
|
||||
this.props.setStatsConfig(config);
|
||||
}
|
||||
} else {
|
||||
this.props.setStatsConfig(values);
|
||||
this.props.setStatsConfig(config);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -39,7 +40,10 @@ class StatsConfig extends Component {
|
||||
>
|
||||
<div className="form">
|
||||
<Form
|
||||
initialValues={{ interval }}
|
||||
initialValues={{
|
||||
interval,
|
||||
enabled: !!interval,
|
||||
}}
|
||||
onSubmit={this.handleFormSubmit}
|
||||
processing={processing}
|
||||
processingReset={processingReset}
|
||||
|
||||
Reference in New Issue
Block a user