From a1a5d94fddf000c09c08ca641d17f256b36f23e0 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Sun, 19 Mar 2023 13:07:03 -0700 Subject: [PATCH] fix(filters): remove requirement for numberfields (#758) * fix(filters): remove requirement for logScore. * default to zero on numberfield clear * code comment for parseInt --------- Co-authored-by: soup --- web/src/components/inputs/input.tsx | 42 ++++++++++++++++------------- web/src/screens/filters/action.tsx | 8 +----- web/src/screens/filters/details.tsx | 12 ++++----- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/web/src/components/inputs/input.tsx b/web/src/components/inputs/input.tsx index 0e9b244..bf3490b 100644 --- a/web/src/components/inputs/input.tsx +++ b/web/src/components/inputs/input.tsx @@ -207,15 +207,15 @@ export const PasswordField = ({ }; interface NumberFieldProps { - name: string; - label?: string; - placeholder?: string; - step?: number; - disabled?: boolean; - required?: boolean; - min?: number; - max?: number; - tooltip?: JSX.Element; + name: string; + label?: string; + placeholder?: string; + step?: number; + disabled?: boolean; + required?: boolean; + min?: number; + max?: number; + tooltip?: JSX.Element; } export const NumberField = ({ @@ -230,20 +230,18 @@ export const NumberField = ({ required }: NumberFieldProps) => (
-
diff --git a/web/src/screens/filters/action.tsx b/web/src/screens/filters/action.tsx index 13bd3cc..8954bc6 100644 --- a/web/src/screens/filters/action.tsx +++ b/web/src/screens/filters/action.tsx @@ -202,13 +202,11 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => { name={`actions.${idx}.limit_download_speed`} label="Limit download speed (KiB/s)" placeholder="Takes any number (0 is no limit)" - min={0} required={true} /> @@ -217,14 +215,12 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => { name={`actions.${idx}.limit_ratio`} label="Ratio limit" placeholder="Takes any number (0 is no limit)" - min={0} required={true} - step={0.5} + step={1} // 0.5 does not work /> @@ -263,12 +259,10 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => { name={`actions.${idx}.reannounce_interval`} label="Reannounce interval. Run every X seconds" placeholder="7 is default and recommended" - min={1} required={true} /> diff --git a/web/src/screens/filters/details.tsx b/web/src/screens/filters/details.tsx index 23e7330..be484b9 100644 --- a/web/src/screens/filters/details.tsx +++ b/web/src/screens/filters/details.tsx @@ -238,8 +238,8 @@ export default function FilterDetails() { min_size: filter.min_size, max_size: filter.max_size, delay: filter.delay, - priority: filter.priority ?? 0, - max_downloads: filter.max_downloads ?? 0, + priority: filter.priority, + max_downloads: filter.max_downloads, max_downloads_unit: filter.max_downloads_unit, use_regex: filter.use_regex || false, shows: filter.shows, @@ -276,7 +276,7 @@ export default function FilterDetails() { quality: filter.quality || [], media: filter.media || [], match_release_types: filter.match_release_types || [], - log_score: filter.log_score ?? 0, + log_score: filter.log_score, log: filter.log, cue: filter.cue, perfect_flac: filter.perfect_flac, @@ -351,8 +351,8 @@ export function General() {

Supports units such as MB, MiB, GB, etc.

https://autobrr.com/filters#rules} />

Supports units such as MB, MiB, GB, etc.

https://autobrr.com/filters#rules} />

Number of seconds to wait before running actions.

https://autobrr.com/filters#rules} /> -

Filters are checked in order of priority. Higher number = higher priority.

https://autobrr.com/filters#rules} /> -

Number of max downloads as specified by the respective unit.

https://autobrr.com/filters#rules} /> +

Filters are checked in order of priority. Higher number = higher priority.

https://autobrr.com/filters#rules} /> +

Number of max downloads as specified by the respective unit.

https://autobrr.com/filters#rules} />