mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(filters): add match logic for tags and except tags (#810)
* feat(filters): add fields for tag and except tag matching logic * refactor(filters): rearrange and simplify logic for containsAllMatch --------- Co-authored-by: Gustavo Machado <me@gstv.dev>
This commit is contained in:
parent
d48e94ff33
commit
ef75b67b25
9 changed files with 364 additions and 76 deletions
|
@ -251,6 +251,7 @@ export interface SelectFieldProps {
|
|||
label: string;
|
||||
optionDefaultText: string;
|
||||
options: SelectFieldOption[];
|
||||
columns?: COL_WIDTHS;
|
||||
tooltip?: JSX.Element;
|
||||
}
|
||||
|
||||
|
@ -259,10 +260,15 @@ export const Select = ({
|
|||
label,
|
||||
tooltip,
|
||||
optionDefaultText,
|
||||
options
|
||||
options,
|
||||
columns
|
||||
}: SelectFieldProps) => {
|
||||
return (
|
||||
<div className="col-span-6">
|
||||
<div
|
||||
className={classNames(
|
||||
columns ? `col-span-${columns}` : "col-span-6"
|
||||
)}
|
||||
>
|
||||
<Field name={name} type="select">
|
||||
{({
|
||||
field,
|
||||
|
|
|
@ -500,3 +500,14 @@ export const FeedDownloadTypeOptions: OptionBasicTyped<FeedDownloadType>[] = [
|
|||
value: "TORRENT"
|
||||
}
|
||||
];
|
||||
|
||||
export const tagsMatchLogicOptions: OptionBasic[] = [
|
||||
{
|
||||
label: "any",
|
||||
value: "ANY"
|
||||
},
|
||||
{
|
||||
label: "all",
|
||||
value: "ALL"
|
||||
}
|
||||
];
|
|
@ -18,7 +18,8 @@ import {
|
|||
RELEASE_TYPE_MUSIC_OPTIONS,
|
||||
RESOLUTION_OPTIONS,
|
||||
SOURCES_MUSIC_OPTIONS,
|
||||
SOURCES_OPTIONS
|
||||
SOURCES_OPTIONS,
|
||||
tagsMatchLogicOptions
|
||||
} from "../../domain/constants";
|
||||
import { queryClient } from "../../App";
|
||||
import { APIClient } from "../../api/APIClient";
|
||||
|
@ -265,6 +266,8 @@ export default function FilterDetails() {
|
|||
except_categories: filter.except_categories,
|
||||
tags: filter.tags,
|
||||
except_tags: filter.except_tags,
|
||||
tags_match_logic: filter.tags_match_logic,
|
||||
except_tags_match_logic: filter.except_tags_match_logic,
|
||||
match_uploaders: filter.match_uploaders,
|
||||
except_uploaders: filter.except_uploaders,
|
||||
match_language: filter.match_language || [],
|
||||
|
@ -509,8 +512,10 @@ export function Advanced({ values }: AdvancedProps) {
|
|||
<TextField name="match_categories" label="Match categories" columns={6} placeholder="eg. *category*,category1" tooltip={<div><p>Comma separated list of categories to match.</p><a href='https://autobrr.com/filters/categories' className='text-blue-400 visited:text-blue-400' target='_blank'>https://autobrr.com/filters/categories</a></div>} />
|
||||
<TextField name="except_categories" label="Except categories" columns={6} placeholder="eg. *category*" tooltip={<div><p>Comma separated list of categories to ignore (takes priority over Match releases).</p><a href='https://autobrr.com/filters/categories' className='text-blue-400 visited:text-blue-400' target='_blank'>https://autobrr.com/filters/categories</a></div>} />
|
||||
|
||||
<TextField name="tags" label="Match tags" columns={6} placeholder="eg. tag1,tag2" tooltip={<div><p>Comma separated list of tags to match.</p><a href='https://autobrr.com/filters#advanced' className='text-blue-400 visited:text-blue-400' target='_blank'>https://autobrr.com/filters#advanced</a></div>} />
|
||||
<TextField name="except_tags" label="Except tags" columns={6} placeholder="eg. tag1,tag2" tooltip={<div><p>Comma separated list of tags to ignore (takes priority over Match releases).</p><a href='https://autobrr.com/filters#advanced' className='text-blue-400 visited:text-blue-400' target='_blank'>hhttps://autobrr.com/filters#advanced</a></div>} />
|
||||
<TextField name="tags" label="Match tags" columns={4} placeholder="eg. tag1,tag2" tooltip={<div><p>Comma separated list of tags to match.</p><a href='https://autobrr.com/filters#advanced' className='text-blue-400 visited:text-blue-400' target='_blank'>https://autobrr.com/filters#advanced</a></div>} />
|
||||
<Select name="tags_match_logic" label="Tags logic" columns={2} options={tagsMatchLogicOptions} optionDefaultText="any" tooltip={<div><p>Logic used to match filter tags.</p><a href='https://autobrr.com/filters#advanced' className='text-blue-400 visited:text-blue-400' target='_blank'>https://autobrr.com/filters#advanced</a></div>} />
|
||||
<TextField name="except_tags" label="Except tags" columns={4} placeholder="eg. tag1,tag2" tooltip={<div><p>Comma separated list of tags to ignore (takes priority over Match releases).</p><a href='https://autobrr.com/filters#advanced' className='text-blue-400 visited:text-blue-400' target='_blank'>hhttps://autobrr.com/filters#advanced</a></div>} />
|
||||
<Select name="except_tags_match_logic" label="Except tags logic" columns={2} options={tagsMatchLogicOptions} optionDefaultText="any" tooltip={<div><p>Logic used to match except tags.</p><a href='https://autobrr.com/filters#advanced' className='text-blue-400 visited:text-blue-400' target='_blank'>https://autobrr.com/filters#advanced</a></div>} />
|
||||
</CollapsableSection>
|
||||
|
||||
<CollapsableSection defaultOpen={true} title="Uploaders" subtitle="Match or ignore uploaders.">
|
||||
|
|
2
web/src/types/Filter.d.ts
vendored
2
web/src/types/Filter.d.ts
vendored
|
@ -57,6 +57,8 @@ interface Filter {
|
|||
except_tags: string;
|
||||
tags_any: string;
|
||||
except_tags_any: string;
|
||||
tags_match_logic: string;
|
||||
except_tags_match_logic: string;
|
||||
actions_count: number;
|
||||
actions: Action[];
|
||||
indexers: Indexer[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue