mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Include organized field in merge dialog (#3565)
This commit is contained in:
@@ -117,6 +117,10 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||||||
|
|
||||||
const [stashIDs, setStashIDs] = useState(new ScrapeResult<GQL.StashId[]>([]));
|
const [stashIDs, setStashIDs] = useState(new ScrapeResult<GQL.StashId[]>([]));
|
||||||
|
|
||||||
|
const [organized, setOrganized] = useState(
|
||||||
|
new ScrapeResult<boolean>(dest.organized)
|
||||||
|
);
|
||||||
|
|
||||||
const [image, setImage] = useState<ScrapeResult<string>>(
|
const [image, setImage] = useState<ScrapeResult<string>>(
|
||||||
new ScrapeResult<string>(dest.paths.screenshot)
|
new ScrapeResult<string>(dest.paths.screenshot)
|
||||||
);
|
);
|
||||||
@@ -228,6 +232,13 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setOrganized(
|
||||||
|
new ScrapeResult(
|
||||||
|
dest.organized ?? false,
|
||||||
|
sources.every((s) => s.organized)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
setStashIDs(
|
setStashIDs(
|
||||||
new ScrapeResult(
|
new ScrapeResult(
|
||||||
dest.stash_ids,
|
dest.stash_ids,
|
||||||
@@ -287,6 +298,7 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||||||
movies,
|
movies,
|
||||||
tags,
|
tags,
|
||||||
details,
|
details,
|
||||||
|
organized,
|
||||||
stashIDs,
|
stashIDs,
|
||||||
image,
|
image,
|
||||||
]);
|
]);
|
||||||
@@ -302,6 +314,7 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||||||
movies,
|
movies,
|
||||||
tags,
|
tags,
|
||||||
details,
|
details,
|
||||||
|
organized,
|
||||||
stashIDs,
|
stashIDs,
|
||||||
image,
|
image,
|
||||||
]);
|
]);
|
||||||
@@ -323,6 +336,9 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const trueString = intl.formatMessage({ id: "true" });
|
||||||
|
const falseString = intl.formatMessage({ id: "false" });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ScrapedInputGroupRow
|
<ScrapedInputGroupRow
|
||||||
@@ -463,6 +479,27 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||||||
result={details}
|
result={details}
|
||||||
onChange={(value) => setDetails(value)}
|
onChange={(value) => setDetails(value)}
|
||||||
/>
|
/>
|
||||||
|
<ScrapeDialogRow
|
||||||
|
title={intl.formatMessage({ id: "organized" })}
|
||||||
|
result={organized}
|
||||||
|
renderOriginalField={() => (
|
||||||
|
<FormControl
|
||||||
|
value={organized.originalValue ? trueString : falseString}
|
||||||
|
readOnly
|
||||||
|
onChange={() => {}}
|
||||||
|
className="bg-secondary text-white border-secondary"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
renderNewField={() => (
|
||||||
|
<FormControl
|
||||||
|
value={organized.newValue ? trueString : falseString}
|
||||||
|
readOnly
|
||||||
|
onChange={() => {}}
|
||||||
|
className="bg-secondary text-white border-secondary"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
onChange={(value) => setOrganized(value)}
|
||||||
|
/>
|
||||||
<ScrapeDialogRow
|
<ScrapeDialogRow
|
||||||
title={intl.formatMessage({ id: "stash_id" })}
|
title={intl.formatMessage({ id: "stash_id" })}
|
||||||
result={stashIDs}
|
result={stashIDs}
|
||||||
@@ -515,6 +552,7 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||||||
}),
|
}),
|
||||||
tag_ids: tags.getNewValue(),
|
tag_ids: tags.getNewValue(),
|
||||||
details: details.getNewValue(),
|
details: details.getNewValue(),
|
||||||
|
organized: organized.getNewValue(),
|
||||||
stash_ids: stashIDs.getNewValue(),
|
stash_ids: stashIDs.getNewValue(),
|
||||||
cover_image: coverImage,
|
cover_image: coverImage,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,10 +36,11 @@ export class ScrapeResult<T> {
|
|||||||
) {
|
) {
|
||||||
this.originalValue = originalValue ?? undefined;
|
this.originalValue = originalValue ?? undefined;
|
||||||
this.newValue = newValue ?? undefined;
|
this.newValue = newValue ?? undefined;
|
||||||
|
const hasNewValue = newValue !== undefined;
|
||||||
|
|
||||||
const valuesEqual = isEqual(originalValue, newValue);
|
const valuesEqual = isEqual(originalValue, newValue);
|
||||||
this.useNewValue = useNewValue ?? (!!this.newValue && !valuesEqual);
|
this.useNewValue = useNewValue ?? (hasNewValue && !valuesEqual);
|
||||||
this.scraped = !!this.newValue && !valuesEqual;
|
this.scraped = hasNewValue && !valuesEqual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setOriginalValue(value?: T) {
|
public setOriginalValue(value?: T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user