mirror of
https://github.com/stashapp/stash.git
synced 2026-03-03 11:48:48 +01:00
Prevent creation of dupe filters (#2233)
This commit is contained in:
parent
51bb602dc2
commit
4bbf511954
2 changed files with 7 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ interface IAddFilterProps {
|
|||
onCancel: () => void;
|
||||
filterOptions: ListFilterOptions;
|
||||
editingCriterion?: Criterion<CriterionValue>;
|
||||
existingCriterions: Criterion<CriterionValue>[];
|
||||
}
|
||||
|
||||
export const AddFilterDialog: React.FC<IAddFilterProps> = ({
|
||||
|
|
@ -44,6 +45,7 @@ export const AddFilterDialog: React.FC<IAddFilterProps> = ({
|
|||
onCancel,
|
||||
filterOptions,
|
||||
editingCriterion,
|
||||
existingCriterions,
|
||||
}) => {
|
||||
const defaultValue = useRef<string | number | undefined>();
|
||||
|
||||
|
|
@ -206,6 +208,10 @@ export const AddFilterDialog: React.FC<IAddFilterProps> = ({
|
|||
|
||||
const thisOptions = [NoneCriterionOption]
|
||||
.concat(filterOptions.criterionOptions)
|
||||
.filter(
|
||||
(c) =>
|
||||
!existingCriterions.find((ec) => ec.criterionOption.type === c.type)
|
||||
)
|
||||
.map((c) => {
|
||||
return {
|
||||
value: c.type,
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ const RenderList = <
|
|||
onAddCriterion={onAddCriterion}
|
||||
onCancel={onCancelAddCriterion}
|
||||
editingCriterion={editingCriterion}
|
||||
existingCriterions={filter.criteria}
|
||||
/>
|
||||
)}
|
||||
{newCriterion &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue