Skip to content

Commit ff8ecd9

Browse files
committed
Pull request 2549: AGDNS-3507-ignored-enabled
Squashed commit of the following: commit 860c6a7 Author: f.setrakov <[email protected]> Date: Fri Dec 26 12:23:39 2025 +0300 aghnet: imp doc commit 7794c9c Author: f.setrakov <[email protected]> Date: Thu Dec 25 15:18:18 2025 +0300 all: fix stats ignored enabled commit 5dd81d1 Merge: e17c2b3 eb6f332 Author: f.setrakov <[email protected]> Date: Thu Dec 25 13:26:27 2025 +0300 Merge branch 'master' into AGDNS-3507-ignored-enabled commit e17c2b3 Author: f.setrakov <[email protected]> Date: Wed Dec 24 18:15:14 2025 +0300 all: add ignored_enabled field to config modifier commit 565666f Author: Ildar Kamalov <[email protected]> Date: Tue Dec 23 14:40:50 2025 +0300 ADG-11272 add ignore enabled settings for logs and stats config commit 6f426bc Author: f.setrakov <[email protected]> Date: Tue Dec 16 13:46:26 2025 +0300 openapi: imp changelog commit 0210a1e Author: f.setrakov <[email protected]> Date: Tue Dec 16 13:41:55 2025 +0300 all: imp docs commit 2f73d46 Author: f.setrakov <[email protected]> Date: Mon Dec 15 17:54:06 2025 +0300 all: imp docs commit b972b73 Author: f.setrakov <[email protected]> Date: Mon Dec 15 15:29:06 2025 +0300 all: add ignored_enabled to api and cfg
1 parent eb6f332 commit ff8ecd9

File tree

27 files changed

+510
-50
lines changed

27 files changed

+510
-50
lines changed

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,44 @@ See also the [v0.107.72 GitHub milestone][ms-v0.107.72].
1717
1818
NOTE: Add new changes BELOW THIS COMMENT.
1919
-->
20+
21+
### Added
22+
23+
- New field `"ignored_enabled"` in `GetStatsConfigResponse` or `GetQueryLogConfigResponse`. See `openapi/openapi.yaml` for details.
24+
25+
#### Configuration changes
26+
27+
In this release, the schema version has changed from 32 to 33.
28+
29+
- Added a new boolean field `ignored_enabled` in querylog and statistics config.
30+
31+
```yaml
32+
# BEFORE:
33+
'querylog':
34+
#
35+
'ignored':
36+
- '|.^'
37+
'statistics':
38+
#
39+
'ignored':
40+
- '|.^'
41+
42+
# AFTER:
43+
'querylog':
44+
#
45+
'ignored':
46+
- '|.^'
47+
'ignored_enabled': true
48+
'statistics':
49+
#
50+
'ignored':
51+
- '|.^'
52+
'ignored_enabled': true
53+
```
54+
55+
To roll back this change, set the `schema_version` back to `32`.
56+
57+
2058
<!--
2159
NOTE: Add new changes ABOVE THIS COMMENT.
2260
-->

client/src/__locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@
570570
"statistics_enable": "Enable statistics",
571571
"ignore_domains": "Ignored domains (separated by newline)",
572572
"ignore_domains_title": "Ignored domains",
573-
"ignore_domains_desc_stats": "Queries matching these rules are not written to the statistics",
574-
"ignore_domains_desc_query": "Queries matching these rules are not written to the query log",
573+
"ignore_domains_desc_stats": "If enabled, queries matching these rules are not written to the statistics",
574+
"ignore_domains_desc_query": "If enabled, queries matching these rules are not written to the query log",
575575
"interval_hours": "{{count}} hour",
576576
"interval_hours_plural": "{{count}} hours",
577577
"filters_configuration": "Filters configuration",

client/src/components/Settings/LogsConfig/Form.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type FormValues = {
3030
interval: number;
3131
customInterval?: number | null;
3232
ignored: string;
33+
ignored_enabled: boolean;
3334
};
3435

3536
type Props = {
@@ -57,6 +58,7 @@ export const Form = ({ initialValues, processing, processingReset, onSubmit, onR
5758
interval: initialValues.interval || DAY,
5859
customInterval: initialValues.customInterval || null,
5960
ignored: initialValues.ignored || '',
61+
ignored_enabled: initialValues.ignored_enabled ?? true,
6062
},
6163
});
6264

@@ -180,12 +182,20 @@ export const Form = ({ initialValues, processing, processingReset, onSubmit, onR
180182
</div>
181183
</div>
182184

183-
<label className="form__label form__label--with-desc">
184-
<Trans>ignore_domains_title</Trans>
185-
</label>
186-
187-
<div className="form__desc form__desc--top">
188-
<Trans>ignore_domains_desc_query</Trans>
185+
<div className="form__group form__group--settings">
186+
<Controller
187+
name="ignored_enabled"
188+
control={control}
189+
render={({ field }) => (
190+
<Checkbox
191+
{...field}
192+
data-testid="logs_config_ignored_enabled"
193+
title={t('ignore_domains_title')}
194+
subtitle={t('ignore_domains_desc_query')}
195+
disabled={processing}
196+
/>
197+
)}
198+
/>
189199
</div>
190200

191201
<div className="form__group form__group--settings">

client/src/components/Settings/LogsConfig/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface LogsConfigProps {
1313
anonymize_client_ip: boolean;
1414
processing: boolean;
1515
ignored: unknown[];
16+
ignoredEnabled: boolean;
1617
processingClear: boolean;
1718
setLogsConfig: (...args: unknown[]) => unknown;
1819
clearLogs: (...args: unknown[]) => unknown;
@@ -59,6 +60,7 @@ class LogsConfig extends Component<LogsConfigProps> {
5960
processingClear,
6061
anonymize_client_ip,
6162
ignored,
63+
ignoredEnabled,
6264
customInterval,
6365
} = this.props;
6466

@@ -72,6 +74,7 @@ class LogsConfig extends Component<LogsConfigProps> {
7274
customInterval,
7375
anonymize_client_ip,
7476
ignored: ignored?.join('\n'),
77+
ignored_enabled: ignoredEnabled,
7578
}}
7679
processing={processing}
7780
processingReset={processingClear}

client/src/components/Settings/StatsConfig/Form.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ export type FormValues = {
2727
interval: number;
2828
customInterval?: number | null;
2929
ignored: string;
30+
ignored_enabled: boolean;
3031
};
3132

3233
const defaultFormValues = {
3334
enabled: false,
3435
interval: DAY,
3536
customInterval: null,
3637
ignored: '',
38+
ignored_enabled: true,
3739
};
3840

3941
type Props = {
@@ -162,12 +164,20 @@ export const Form = ({ initialValues, processing, processingReset, onSubmit, onR
162164
</div>
163165
</div>
164166

165-
<div className="form__label form__label--with-desc">
166-
<Trans>ignore_domains_title</Trans>
167-
</div>
168-
169-
<div className="form__desc form__desc--top">
170-
<Trans>ignore_domains_desc_stats</Trans>
167+
<div className="form__group form__group--settings">
168+
<Controller
169+
name="ignored_enabled"
170+
control={control}
171+
render={({ field }) => (
172+
<Checkbox
173+
{...field}
174+
data-testid="stats_config_ignored_enabled"
175+
title={t('ignore_domains_title')}
176+
subtitle={t('ignore_domains_desc_stats')}
177+
disabled={processing}
178+
/>
179+
)}
180+
/>
171181
</div>
172182

173183
<div className="form__group form__group--settings">

client/src/components/Settings/StatsConfig/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface StatsConfigProps {
1010
interval: number;
1111
customInterval?: number;
1212
ignored: unknown[];
13+
ignoredEnabled: boolean;
1314
enabled: boolean;
1415
processing: boolean;
1516
processingReset: boolean;
@@ -19,14 +20,15 @@ interface StatsConfigProps {
1920
}
2021

2122
class StatsConfig extends Component<StatsConfigProps> {
22-
handleFormSubmit = ({ enabled, interval, ignored, customInterval }: FormValues) => {
23+
handleFormSubmit = ({ enabled, interval, ignored, ignored_enabled, customInterval }: FormValues) => {
2324
const { t, interval: prevInterval } = this.props;
2425
const newInterval = customInterval ? customInterval * HOUR : interval;
2526

2627
const config = {
2728
enabled,
2829
interval: newInterval,
2930
ignored: ignored ? ignored.split('\n') : [],
31+
ignored_enabled,
3032
};
3133

3234
if (config.interval < prevInterval) {
@@ -54,6 +56,7 @@ class StatsConfig extends Component<StatsConfigProps> {
5456
processing,
5557
processingReset,
5658
ignored,
59+
ignoredEnabled,
5760
enabled,
5861
} = this.props;
5962

@@ -66,6 +69,7 @@ class StatsConfig extends Component<StatsConfigProps> {
6669
customInterval,
6770
enabled,
6871
ignored: ignored.join('\n'),
72+
ignored_enabled: ignoredEnabled,
6973
}}
7074
processing={processing}
7175
processingReset={processingReset}

client/src/components/Settings/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ interface SettingsProps {
5858
customInterval?: number;
5959
enabled?: boolean;
6060
ignored?: unknown[];
61+
ignored_enabled?: boolean;
6162
processingSetConfig?: boolean;
6263
processingReset?: boolean;
6364
};
@@ -70,6 +71,7 @@ interface SettingsProps {
7071
processingClear?: boolean;
7172
processingGetConfig?: boolean;
7273
ignored?: unknown[];
74+
ignored_enabled?: boolean;
7375
};
7476
filtering?: {
7577
interval?: number;
@@ -195,6 +197,7 @@ class Settings extends Component<SettingsProps> {
195197
<LogsConfig
196198
enabled={queryLogs.enabled}
197199
ignored={queryLogs.ignored}
200+
ignoredEnabled={queryLogs.ignored_enabled}
198201
interval={queryLogs.interval}
199202
customInterval={queryLogs.customInterval}
200203
anonymize_client_ip={queryLogs.anonymize_client_ip}
@@ -210,6 +213,7 @@ class Settings extends Component<SettingsProps> {
210213
interval={stats.interval}
211214
customInterval={stats.customInterval}
212215
ignored={stats.ignored}
216+
ignoredEnabled={stats.ignored_enabled}
213217
enabled={stats.enabled}
214218
processing={stats.processingSetConfig}
215219
processingReset={stats.processingReset}

client/src/initialState.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export type StatsData = {
197197
processingReset: boolean;
198198
interval: number;
199199
customInterval?: number;
200+
ignored_enabled: boolean;
200201
dnsQueries: number[];
201202
blockedFiltering: number[];
202203
replacedParental: number[];
@@ -372,6 +373,7 @@ export type QueryLogsData = {
372373
isDetailed: boolean;
373374
isEntireLog: boolean;
374375
customInterval: any;
376+
ignored_enabled: boolean;
375377
};
376378

377379
export type ServicesData = {
@@ -576,6 +578,7 @@ export const initialState: RootState = {
576578
isDetailed: true,
577579
isEntireLog: false,
578580
customInterval: null,
581+
ignored_enabled: true,
579582
},
580583
rewrites: {
581584
processing: true,
@@ -607,6 +610,7 @@ export const initialState: RootState = {
607610
processingReset: false,
608611
interval: DAY,
609612
customInterval: null,
613+
ignored_enabled: true,
610614
dnsQueries: [],
611615
blockedFiltering: [],
612616
replacedParental: [],

client/src/reducers/queryLogs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ const queryLogs = handleActions(
137137
isDetailed: true,
138138
isEntireLog: false,
139139
customInterval: null,
140+
ignored_enabled: true,
140141
},
141142
);
142143

client/src/reducers/stats.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const stats = handleActions(
129129
processingReset: false,
130130
interval: DAY,
131131
customInterval: null,
132+
ignored_enabled: true,
132133
...defaultStats,
133134
},
134135
);

0 commit comments

Comments
 (0)