mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Make path criterion default modifier includes instead of equals (#5968)
This commit is contained in:
@@ -3,11 +3,11 @@ import { CriterionModifier } from "src/core/generated-graphql";
|
||||
import { getCountryByISO } from "src/utils/country";
|
||||
import { StringCriterion, StringCriterionOption } from "./criterion";
|
||||
|
||||
export const CountryCriterionOption = new StringCriterionOption(
|
||||
"country",
|
||||
"country",
|
||||
() => new CountryCriterion()
|
||||
);
|
||||
export const CountryCriterionOption = new StringCriterionOption({
|
||||
messageID: "country",
|
||||
type: "country",
|
||||
makeCriterion: () => new CountryCriterion(),
|
||||
});
|
||||
|
||||
export class CountryCriterion extends StringCriterion {
|
||||
constructor() {
|
||||
|
||||
@@ -526,13 +526,12 @@ export class IHierarchicalLabeledIdCriterion extends ModifierCriterion<IHierarch
|
||||
|
||||
export class StringCriterionOption extends ModifierCriterionOption {
|
||||
constructor(
|
||||
messageID: string,
|
||||
value: CriterionType,
|
||||
makeCriterion?: () => ModifierCriterion<CriterionValue>
|
||||
options: Partial<
|
||||
Omit<IModifierCriterionOptionParams, "messageID" | "type">
|
||||
> &
|
||||
Pick<IModifierCriterionOptionParams, "messageID" | "type">
|
||||
) {
|
||||
super({
|
||||
messageID,
|
||||
type: value,
|
||||
modifierOptions: [
|
||||
CriterionModifier.Equals,
|
||||
CriterionModifier.NotEquals,
|
||||
@@ -545,9 +544,8 @@ export class StringCriterionOption extends ModifierCriterionOption {
|
||||
],
|
||||
defaultModifier: CriterionModifier.Equals,
|
||||
inputType: "text",
|
||||
makeCriterion: makeCriterion
|
||||
? makeCriterion
|
||||
: () => new StringCriterion(this),
|
||||
makeCriterion: () => new StringCriterion(this),
|
||||
...options,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -556,7 +554,7 @@ export function createStringCriterionOption(
|
||||
type: CriterionType,
|
||||
messageID?: string
|
||||
) {
|
||||
return new StringCriterionOption(messageID ?? type, type);
|
||||
return new StringCriterionOption({ messageID: messageID ?? type, type });
|
||||
}
|
||||
|
||||
export class MandatoryStringCriterionOption extends ModifierCriterionOption {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { CriterionModifier } from "src/core/generated-graphql";
|
||||
import { StringCriterion, StringCriterionOption } from "./criterion";
|
||||
|
||||
export const PathCriterionOption = new StringCriterionOption(
|
||||
"path",
|
||||
"path",
|
||||
() => new PathCriterion()
|
||||
);
|
||||
export const PathCriterionOption = new StringCriterionOption({
|
||||
messageID: "path",
|
||||
type: "path",
|
||||
defaultModifier: CriterionModifier.Includes,
|
||||
makeCriterion: () => new PathCriterion(),
|
||||
});
|
||||
|
||||
export class PathCriterion extends StringCriterion {
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user