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