mirror of
https://git.vectorsigma.ru/public/AdGuardHome.git
synced 2026-07-28 20:19:13 +00:00
fix custom radio
This commit is contained in:
@@ -4,12 +4,12 @@ import { Controller, useForm } from 'react-hook-form';
|
||||
import intl from 'panel/common/intl';
|
||||
import { Button } from 'panel/common/ui/Button';
|
||||
import theme from 'panel/lib/theme';
|
||||
import { QUERY_LOG_INTERVALS_DAYS, DAY, RETENTION_CUSTOM } from 'panel/helpers/constants';
|
||||
import { QUERY_LOG_INTERVALS_DAYS, RETENTION_CUSTOM } from 'panel/helpers/constants';
|
||||
|
||||
import { RadioGroup } from '../SettingsGroup/RadioGroup';
|
||||
import { SwitchGroup } from '../SettingsGroup';
|
||||
import { IgnoredDomains } from '../IgnoredDomains';
|
||||
import { getIntervalTitle } from '../helpers';
|
||||
import { getIntervalTitle, getDefaultInterval } from '../helpers';
|
||||
import { RetentionCustomInput } from '../RetentionCustomInput';
|
||||
|
||||
export type FormValues = {
|
||||
@@ -41,7 +41,7 @@ export const Form = ({ initialValues, processing, processingReset, onSubmit, onR
|
||||
defaultValues: {
|
||||
enabled: initialValues.enabled || false,
|
||||
anonymize_client_ip: initialValues.anonymize_client_ip || false,
|
||||
interval: initialValues.interval || DAY,
|
||||
interval: getDefaultInterval(initialValues.customInterval, initialValues.interval),
|
||||
customInterval: initialValues.customInterval ?? undefined,
|
||||
ignored: initialValues.ignored || '',
|
||||
ignore_enabled: initialValues.ignore_enabled || true,
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Controller, useForm } from 'react-hook-form';
|
||||
import { Button } from 'panel/common/ui/Button';
|
||||
import intl from 'panel/common/intl';
|
||||
import theme from 'panel/lib/theme';
|
||||
import { getIntervalTitle } from '../helpers';
|
||||
import { getIntervalTitle, getDefaultInterval } from '../helpers';
|
||||
|
||||
import { STATS_INTERVALS_DAYS, DAY, RETENTION_CUSTOM } from '../../../helpers/constants';
|
||||
import { STATS_INTERVALS_DAYS, RETENTION_CUSTOM } from '../../../helpers/constants';
|
||||
import { RadioGroup, SwitchGroup } from '../SettingsGroup';
|
||||
import { IgnoredDomains } from '../IgnoredDomains';
|
||||
import { RetentionCustomInput } from '../RetentionCustomInput';
|
||||
@@ -38,7 +38,7 @@ export const Form = ({ initialValues, processing, processingReset, onSubmit, onR
|
||||
mode: 'onBlur',
|
||||
defaultValues: {
|
||||
enabled: initialValues.enabled || false,
|
||||
interval: initialValues.interval || DAY,
|
||||
interval: getDefaultInterval(initialValues.customInterval, initialValues.interval),
|
||||
customInterval: initialValues.customInterval ?? undefined,
|
||||
ignored: initialValues.ignored || '',
|
||||
ignore_enabled: initialValues.ignore_enabled || true,
|
||||
|
||||
@@ -22,6 +22,13 @@ export const getIntervalTitle = (intervalMs: number) => {
|
||||
return formatIntervalText(intervalMs);
|
||||
};
|
||||
|
||||
export const getDefaultInterval = (customInterval?: number, interval?: number) => {
|
||||
if (customInterval && customInterval > 0) {
|
||||
return RETENTION_CUSTOM;
|
||||
}
|
||||
return interval || DAY;
|
||||
};
|
||||
|
||||
const SAFESEARCH_TITLES: Record<string, string> = {
|
||||
bing: 'Bing',
|
||||
duckduckgo: 'DuckDuckGo',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { test } from '@playwright/test';
|
||||
import { ADMIN_USERNAME, ADMIN_PASSWORD } from '../constants';
|
||||
|
||||
test.describe('Control Panel', () => {
|
||||
|
||||
Reference in New Issue
Block a user