From 8b40fe97a6b3523d03d5c762edc6aa38666e9c03 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Tue, 14 Jan 2025 15:17:00 +0300 Subject: [PATCH] stats config form --- .../components/Settings/LogsConfig/Form.tsx | 32 +-- .../components/Settings/LogsConfig/index.tsx | 12 +- client/src/components/Settings/Settings.css | 4 + .../components/Settings/StatsConfig/Form.tsx | 253 +++++++++++------- .../components/Settings/StatsConfig/index.tsx | 14 +- 5 files changed, 181 insertions(+), 134 deletions(-) diff --git a/client/src/components/Settings/LogsConfig/Form.tsx b/client/src/components/Settings/LogsConfig/Form.tsx index 396f0e5b..dce13997 100644 --- a/client/src/components/Settings/LogsConfig/Form.tsx +++ b/client/src/components/Settings/LogsConfig/Form.tsx @@ -10,6 +10,7 @@ import { DAY, RETENTION_CUSTOM, RETENTION_RANGE, + CUSTOM_INTERVAL, } from '../../../helpers/constants'; import '../FormButton.css'; @@ -26,7 +27,7 @@ const getIntervalTitle = (interval: number) => { } }; -type FormValues = { +export type FormValues = { enabled: boolean; anonymize_client_ip: boolean; interval: number; @@ -36,18 +37,18 @@ type FormValues = { type Props = { initialValues: Partial; - onSubmit: (values: FormValues) => void; - handleClear: () => void; processing: boolean; - processingClear: boolean; + processingReset: boolean; + onSubmit: (values: FormValues) => void; + onReset: () => void; } -export const LogsConfigForm = ({ +export const Form = ({ initialValues, - onSubmit, processing, - processingClear, - handleClear, + processingReset, + onSubmit, + onReset, }: Props) => { const { register, @@ -62,7 +63,7 @@ export const LogsConfigForm = ({ anonymize_client_ip: initialValues.anonymize_client_ip || false, interval: initialValues.interval || DAY, customInterval: initialValues.customInterval || null, - ignored: initialValues.ignored ?? '', + ignored: initialValues.ignored || '', }, }); @@ -89,8 +90,6 @@ export const LogsConfigForm = ({ processing || (intervalValue === RETENTION_CUSTOM && !customIntervalValue); - console.log(intervalValue, RETENTION_CUSTOM, customIntervalValue); - return (
@@ -132,9 +131,9 @@ export const LogsConfigForm = ({
-