mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Identify: Options to skip multiple results and single name performers (#3707)
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -311,7 +311,7 @@ export const FieldOptionsList: React.FC<IFieldOptionsList> = ({
|
||||
}
|
||||
|
||||
return (
|
||||
<Form.Group className="scraper-sources">
|
||||
<Form.Group className="scraper-sources mt-3">
|
||||
<h5>
|
||||
<FormattedMessage id="config.tasks.identify.field_options" />
|
||||
</h5>
|
||||
|
||||
@@ -50,6 +50,10 @@ export const IdentifyDialog: React.FC<IIdentifyDialogProps> = ({
|
||||
includeMalePerformers: true,
|
||||
setCoverImage: true,
|
||||
setOrganized: false,
|
||||
skipMultipleMatches: true,
|
||||
skipMultipleMatchTag: undefined,
|
||||
skipSingleNamePerformers: true,
|
||||
skipSingleNamePerformerTag: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -240,6 +244,8 @@ export const IdentifyDialog: React.FC<IIdentifyDialogProps> = ({
|
||||
const autoTagCopy = { ...autoTag };
|
||||
autoTagCopy.options = {
|
||||
setOrganized: false,
|
||||
skipMultipleMatches: true,
|
||||
skipSingleNamePerformers: true,
|
||||
};
|
||||
newSources.push(autoTagCopy);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React from "react";
|
||||
import { Form } from "react-bootstrap";
|
||||
import { Col, Form, Row } from "react-bootstrap";
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
import { FormattedMessage, useIntl } from "react-intl";
|
||||
import { IScraperSource } from "./constants";
|
||||
import { FieldOptionsList } from "./FieldOptions";
|
||||
import { ThreeStateBoolean } from "./ThreeStateBoolean";
|
||||
import { TagSelect } from "src/components/Shared/Select";
|
||||
|
||||
interface IOptionsEditor {
|
||||
options: GQL.IdentifyMetadataOptionsInput;
|
||||
@@ -35,8 +36,76 @@ export const OptionsEditor: React.FC<IOptionsEditor> = ({
|
||||
indeterminateClassname: "text-muted",
|
||||
};
|
||||
|
||||
function maybeRenderMultipleMatchesTag() {
|
||||
if (!options.skipMultipleMatches) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<Form.Group controlId="match_tags" className="ml-3 mt-1 mb-0" as={Row}>
|
||||
<Form.Label
|
||||
column
|
||||
sm={{ span: 4, offset: 1 }}
|
||||
title={intl.formatMessage({
|
||||
id: "config.tasks.identify.tag_skipped_matches_tooltip",
|
||||
})}
|
||||
>
|
||||
<FormattedMessage id="config.tasks.identify.tag_skipped_matches" />
|
||||
</Form.Label>
|
||||
<Col sm>
|
||||
<TagSelect
|
||||
onSelect={(tags) =>
|
||||
setOptions({
|
||||
skipMultipleMatchTag: tags[0]?.id,
|
||||
})
|
||||
}
|
||||
ids={
|
||||
options.skipMultipleMatchTag ? [options.skipMultipleMatchTag] : []
|
||||
}
|
||||
noSelectionString="Select/create tag..."
|
||||
/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
);
|
||||
}
|
||||
|
||||
function maybeRenderPerformersTag() {
|
||||
if (!options.skipSingleNamePerformers) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<Form.Group controlId="match_tags" className="ml-3 mt-1 mb-0" as={Row}>
|
||||
<Form.Label
|
||||
column
|
||||
sm={{ span: 4, offset: 1 }}
|
||||
title={intl.formatMessage({
|
||||
id: "config.tasks.identify.tag_skipped_performer_tooltip",
|
||||
})}
|
||||
>
|
||||
<FormattedMessage id="config.tasks.identify.tag_skipped_performers" />
|
||||
</Form.Label>
|
||||
<Col sm>
|
||||
<TagSelect
|
||||
onSelect={(tags) =>
|
||||
setOptions({
|
||||
skipSingleNamePerformerTag: tags[0]?.id,
|
||||
})
|
||||
}
|
||||
ids={
|
||||
options.skipSingleNamePerformerTag
|
||||
? [options.skipSingleNamePerformerTag]
|
||||
: []
|
||||
}
|
||||
noSelectionString="Select/create tag..."
|
||||
/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Form.Group>
|
||||
<Form.Group className="mb-0">
|
||||
<Form.Group>
|
||||
<h5>
|
||||
<FormattedMessage
|
||||
@@ -52,7 +121,7 @@ export const OptionsEditor: React.FC<IOptionsEditor> = ({
|
||||
</Form.Text>
|
||||
)}
|
||||
</Form.Group>
|
||||
<Form.Group>
|
||||
<Form.Group className="mb-0">
|
||||
<ThreeStateBoolean
|
||||
id="include-male-performers"
|
||||
value={
|
||||
@@ -104,6 +173,50 @@ export const OptionsEditor: React.FC<IOptionsEditor> = ({
|
||||
{...checkboxProps}
|
||||
/>
|
||||
</Form.Group>
|
||||
<ThreeStateBoolean
|
||||
id="skip-multiple-match"
|
||||
value={
|
||||
options.skipMultipleMatches === null
|
||||
? undefined
|
||||
: options.skipMultipleMatches
|
||||
}
|
||||
setValue={(v) =>
|
||||
setOptions({
|
||||
skipMultipleMatches: v,
|
||||
})
|
||||
}
|
||||
label={intl.formatMessage({
|
||||
id: "config.tasks.identify.skip_multiple_matches",
|
||||
})}
|
||||
defaultValue={defaultOptions?.skipMultipleMatches ?? undefined}
|
||||
tooltip={intl.formatMessage({
|
||||
id: "config.tasks.identify.skip_multiple_matches_tooltip",
|
||||
})}
|
||||
{...checkboxProps}
|
||||
/>
|
||||
{maybeRenderMultipleMatchesTag()}
|
||||
<ThreeStateBoolean
|
||||
id="skip-single-name-performers"
|
||||
value={
|
||||
options.skipSingleNamePerformers === null
|
||||
? undefined
|
||||
: options.skipSingleNamePerformers
|
||||
}
|
||||
setValue={(v) =>
|
||||
setOptions({
|
||||
skipSingleNamePerformers: v,
|
||||
})
|
||||
}
|
||||
label={intl.formatMessage({
|
||||
id: "config.tasks.identify.skip_single_name_performers",
|
||||
})}
|
||||
defaultValue={defaultOptions?.skipSingleNamePerformers ?? undefined}
|
||||
tooltip={intl.formatMessage({
|
||||
id: "config.tasks.identify.skip_single_name_performers_tooltip",
|
||||
})}
|
||||
{...checkboxProps}
|
||||
/>
|
||||
{maybeRenderPerformersTag()}
|
||||
|
||||
<FieldOptionsList
|
||||
fieldOptions={options.fieldOptions ?? undefined}
|
||||
|
||||
@@ -10,6 +10,7 @@ interface IThreeStateBoolean {
|
||||
label?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
defaultValue?: boolean;
|
||||
tooltip?: string | undefined;
|
||||
}
|
||||
|
||||
export const ThreeStateBoolean: React.FC<IThreeStateBoolean> = ({
|
||||
@@ -20,6 +21,7 @@ export const ThreeStateBoolean: React.FC<IThreeStateBoolean> = ({
|
||||
label,
|
||||
disabled,
|
||||
defaultValue,
|
||||
tooltip,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
|
||||
@@ -31,6 +33,7 @@ export const ThreeStateBoolean: React.FC<IThreeStateBoolean> = ({
|
||||
checked={value}
|
||||
label={label}
|
||||
onChange={() => setValue(!value)}
|
||||
title={tooltip}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -79,7 +82,7 @@ export const ThreeStateBoolean: React.FC<IThreeStateBoolean> = ({
|
||||
|
||||
return (
|
||||
<Form.Group>
|
||||
<h6>{label}</h6>
|
||||
<h6 title={tooltip}>{label}</h6>
|
||||
<Form.Group>
|
||||
{renderModeButton(undefined)}
|
||||
{renderModeButton(false)}
|
||||
|
||||
@@ -6,3 +6,13 @@
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
h6,
|
||||
label {
|
||||
&[title]:not([title=""]) {
|
||||
cursor: help;
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user