Skip to content

Commit e495a55

Browse files
committed
review fix
1 parent 2ba671b commit e495a55

17 files changed

Lines changed: 81 additions & 273 deletions

File tree

client_v2/.eslintrc.cjs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,7 @@ module.exports = {
4040
argsIgnorePattern: '^_',
4141
},
4242
],
43-
'import/extensions': [
44-
'error',
45-
'ignorePackages',
46-
{
47-
js: 'never',
48-
jsx: 'never',
49-
ts: 'never',
50-
tsx: 'never',
51-
},
52-
],
43+
'import/extensions': 'off',
5344
'class-methods-use-this': 'off',
5445
'no-shadow': 'off',
5546
camelcase: 'off',

client_v2/package-lock.json

Lines changed: 0 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client_v2/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"eslint-config-airbnb": "^19.0.4",
8686
"eslint-config-prettier": "^9.1.0",
8787
"eslint-import-resolver-typescript": "^3.5.5",
88-
"eslint-import-resolver-webpack": "^0.13.10",
8988
"eslint-plugin-jsx-a11y": "^6.8.0",
9089
"eslint-plugin-prettier": "^5.1.3",
9190
"eslint-plugin-react": "^7.34.1",

client_v2/src/common/controls/Radio/Radio.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export const Radio = <T extends number | string | boolean = string>({
2727
{options.map((o) => (
2828
<label
2929
key={`${o.value}`}
30-
htmlFor={name ? `${name}-${String(o.value)}` : String(o.value)}
30+
htmlFor={name ? `${name}-${o.value}` : String(o.value)}
3131
className={cn(s.radio, className)}>
3232
<input
33-
id={name ? `${name}-${String(o.value)}` : String(o.value)}
33+
id={name ? `${name}-${o.value}` : String(o.value)}
3434
type="radio"
3535
className={s.input}
3636
name={name}

client_v2/src/common/ui/ConfirmDialog/ConfirmDialog.module.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
width: 100%;
44

55
@media (min-width: 768px) {
6+
max-width: 100%;
67
width: 720px;
78
}
89
}

client_v2/src/components/App/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Sidebar } from 'panel/common/ui/Sidebar';
77
import { Icons } from 'panel/common/ui/Icons';
88
import { Footer } from 'panel/common/ui/Footer';
99
import { Header } from 'panel/common/ui/Header';
10-
import Settings from 'panel/containers/Settings';
10+
import { Settings } from 'panel/components/Settings';
1111

1212
import { LocalesType } from 'panel/common/intl';
1313
import Toasts from '../Toasts';

client_v2/src/components/Settings/FiltersConfig.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import theme from 'panel/lib/theme';
66
import { RoutePath } from 'panel/components/Routes/Paths';
77
import { Link } from 'panel/common/ui/Link';
88

9+
import { setFiltersConfig } from 'panel/actions/filtering';
10+
import { useDispatch } from 'react-redux';
911
import { SwitchGroup } from './SettingsGroup';
1012

1113
export type FormValues = {
@@ -15,11 +17,12 @@ export type FormValues = {
1517

1618
type Props = {
1719
initialValues: FormValues;
18-
setFiltersConfig: (values: FormValues) => void;
1920
processing: boolean;
2021
};
2122

22-
export const FiltersConfig = ({ initialValues, setFiltersConfig, processing }: Props) => {
23+
export const FiltersConfig = ({ initialValues, processing }: Props) => {
24+
const dispatch = useDispatch();
25+
2326
const { watch, control, setValue } = useForm({
2427
mode: 'onBlur',
2528
defaultValues: initialValues,
@@ -28,7 +31,7 @@ export const FiltersConfig = ({ initialValues, setFiltersConfig, processing }: P
2831
const enabled = watch('enabled');
2932

3033
useEffect(() => {
31-
setFiltersConfig({ ...initialValues, enabled });
34+
dispatch(setFiltersConfig({ ...initialValues, enabled }));
3235
}, [enabled]);
3336

3437
return (

client_v2/src/components/Settings/IgnoredDomains/IgnoredDomains.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const IgnoredDomains = ({ control, processing, ignoreEnabled, setValue, s
3131
onChange={(e) => setValue('ignore_enabled', e.target.checked)}
3232
disabled={processing}>
3333
<Controller
34-
name={'ignored'}
34+
name="ignored"
3535
control={control}
3636
render={({ field, fieldState }) => (
3737
<Textarea
@@ -71,7 +71,7 @@ export const IgnoredDomains = ({ control, processing, ignoreEnabled, setValue, s
7171
</a>
7272
</div>
7373
}
74-
placeholder={'example.com\n*.example.com\n||example.com^'}
74+
placeholder="example.com\n*.example.com\n||example.com^"
7575
size="large"
7676
disabled={processing || !ignoreEnabled}
7777
errorMessage={fieldState.error?.message}

client_v2/src/components/Settings/LogsConfig/LogsConfig.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { ConfirmDialog } from 'panel/common/ui/ConfirmDialog';
44
import intl from 'panel/common/intl';
55
import { HOUR } from 'panel/helpers/constants';
66
import { formatIntervalText } from 'panel/components/Settings/helpers';
7+
import { useDispatch } from 'react-redux';
8+
import { clearLogs, setLogsConfig } from 'panel/actions/queryLogs';
79
import { Form, FormValues } from './Form';
810

911
export type LogsConfigPayload = {
@@ -22,8 +24,6 @@ type Props = {
2224
processing: boolean;
2325
ignored: string[];
2426
processingClear: boolean;
25-
setLogsConfig: (values: LogsConfigPayload) => unknown;
26-
clearLogs: () => void;
2727
};
2828

2929
export const LogsConfig = ({
@@ -34,9 +34,9 @@ export const LogsConfig = ({
3434
processing,
3535
processingClear,
3636
ignored,
37-
setLogsConfig,
38-
clearLogs,
3937
}: Props) => {
38+
const dispatch = useDispatch();
39+
4040
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
4141
const [confirmConfig, setConfirmConfig] = useState<LogsConfigPayload | null>(null);
4242

@@ -49,7 +49,7 @@ export const LogsConfig = ({
4949
};
5050

5151
const handleClearConfirm = () => {
52-
clearLogs();
52+
dispatch(clearLogs());
5353
handleClose();
5454
};
5555

@@ -69,7 +69,7 @@ export const LogsConfig = ({
6969
return;
7070
}
7171

72-
setLogsConfig(data);
72+
dispatch(setLogsConfig(data));
7373
};
7474

7575
return (
@@ -91,7 +91,7 @@ export const LogsConfig = ({
9191
<ConfirmDialog
9292
onClose={() => setConfirmConfig(null)}
9393
onConfirm={() => {
94-
setLogsConfig(confirmConfig);
94+
dispatch(setLogsConfig(confirmConfig));
9595
setConfirmConfig(null);
9696
}}
9797
buttonText={intl.getMessage('settings_yes_decrease')}

client_v2/src/components/Settings/RetentionCustomInput.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ export const RetentionCustomInput = <TFormValues extends { customInterval?: numb
2626
placeholder,
2727
}: Props<TFormValues>) => {
2828
const inputRef = useRef<HTMLInputElement>(null);
29+
const prevIntervalRef = useRef(intervalValue);
2930

3031
useEffect(() => {
31-
if (intervalValue === RETENTION_CUSTOM && !processing) {
32-
inputRef.current?.focus();
32+
const wasCustom = prevIntervalRef.current === RETENTION_CUSTOM;
33+
const isCustom = intervalValue === RETENTION_CUSTOM;
34+
35+
prevIntervalRef.current = intervalValue;
36+
37+
if (!wasCustom && isCustom && !processing) {
38+
inputRef.current?.focus({ preventScroll: true });
3339
}
3440
}, [intervalValue, processing]);
3541

@@ -51,11 +57,7 @@ export const RetentionCustomInput = <TFormValues extends { customInterval?: numb
5157
}}
5258
onBlur={field.onBlur}
5359
disabled={processing || intervals.includes(intervalValue)}
54-
error={
55-
intervalValue === RETENTION_CUSTOM &&
56-
fieldState.isTouched &&
57-
String(field.value ?? '').trim() === ''
58-
}
60+
error={!!fieldState.error}
5961
min={RETENTION_RANGE.MIN}
6062
max={RETENTION_RANGE.MAX}
6163
/>

0 commit comments

Comments
 (0)