mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat(filters): add download limits (#266)
* feat(filters): add download limits
This commit is contained in:
parent
2903e7b493
commit
2a23ed0185
9 changed files with 458 additions and 82 deletions
|
@ -267,7 +267,7 @@ export const Select = ({
|
|||
{label}
|
||||
</Listbox.Label>
|
||||
<div className="mt-2 relative">
|
||||
<Listbox.Button className="bg-white dark:bg-gray-800 relative w-full border border-gray-300 dark:border-gray-700 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:focus:ring-blue-500 focus:border-indigo-500 dark:focus:border-blue-500 dark:text-gray-200 sm:text-sm">
|
||||
<Listbox.Button className="bg-white dark:bg-gray-800 relative w-full border border-gray-300 dark:border-gray-700 rounded-md shadow-sm pl-3 pr-10 py-2.5 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:focus:ring-blue-500 focus:border-indigo-500 dark:focus:border-blue-500 dark:text-gray-200 sm:text-sm">
|
||||
<span className="block truncate">
|
||||
{field.value
|
||||
? options.find((c) => c.value === field.value)?.label
|
||||
|
|
|
@ -263,6 +263,33 @@ export const NotificationTypeOptions: OptionBasic[] = [
|
|||
}
|
||||
];
|
||||
|
||||
export const downloadsPerUnitOptions: OptionBasic[] = [
|
||||
{
|
||||
label: "Select",
|
||||
value: ""
|
||||
},
|
||||
{
|
||||
label: "HOUR",
|
||||
value: "HOUR"
|
||||
},
|
||||
{
|
||||
label: "DAY",
|
||||
value: "DAY"
|
||||
},
|
||||
{
|
||||
label: "WEEK",
|
||||
value: "WEEK"
|
||||
},
|
||||
{
|
||||
label: "MONTH",
|
||||
value: "MONTH"
|
||||
},
|
||||
{
|
||||
label: "EVER",
|
||||
value: "EVER"
|
||||
}
|
||||
];
|
||||
|
||||
export interface SelectOption {
|
||||
label: string;
|
||||
description: string;
|
||||
|
|
|
@ -25,7 +25,10 @@ import {
|
|||
FORMATS_OPTIONS,
|
||||
SOURCES_MUSIC_OPTIONS,
|
||||
QUALITY_MUSIC_OPTIONS,
|
||||
RELEASE_TYPE_MUSIC_OPTIONS, OTHER_OPTIONS, ORIGIN_OPTIONS
|
||||
RELEASE_TYPE_MUSIC_OPTIONS,
|
||||
OTHER_OPTIONS,
|
||||
ORIGIN_OPTIONS,
|
||||
downloadsPerUnitOptions
|
||||
} from "../../domain/constants";
|
||||
import { queryClient } from "../../App";
|
||||
import { APIClient } from "../../api/APIClient";
|
||||
|
@ -247,6 +250,8 @@ export default function FilterDetails() {
|
|||
max_size: filter.max_size,
|
||||
delay: filter.delay,
|
||||
priority: filter.priority,
|
||||
max_downloads: filter.max_downloads,
|
||||
max_downloads_unit: filter.max_downloads_unit,
|
||||
use_regex: filter.use_regex || false,
|
||||
shows: filter.shows,
|
||||
years: filter.years,
|
||||
|
@ -338,12 +343,6 @@ function General() {
|
|||
const opts = indexers && indexers.length > 0 ? indexers.map(v => ({
|
||||
label: v.name,
|
||||
value: v.id
|
||||
// value: {
|
||||
// id: v.id,
|
||||
// name: v.name,
|
||||
// identifier: v.identifier,
|
||||
// enabled: v.enabled
|
||||
// }
|
||||
})) : [];
|
||||
|
||||
return (
|
||||
|
@ -367,6 +366,9 @@ function General() {
|
|||
<TextField name="max_size" label="Max size" columns={6} placeholder="" />
|
||||
<NumberField name="delay" label="Delay" placeholder="" />
|
||||
<NumberField name="priority" label="Priority" placeholder="" />
|
||||
|
||||
<NumberField name="max_downloads" label="Max downloads" placeholder="" />
|
||||
<Select name="max_downloads_unit" label="Max downloads per" options={downloadsPerUnitOptions} optionDefaultText="Select unit" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
2
web/src/types/Filter.d.ts
vendored
2
web/src/types/Filter.d.ts
vendored
|
@ -8,6 +8,8 @@ interface Filter {
|
|||
max_size: string;
|
||||
delay: number;
|
||||
priority: number;
|
||||
max_downloads: number;
|
||||
max_downloads_unit: string;
|
||||
match_releases: string;
|
||||
except_releases: string;
|
||||
use_regex: boolean;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue