mirror of
https://github.com/stashapp/stash.git
synced 2025-12-15 21:03:22 +01:00
Include organized field in merge dialog (#3565)
This commit is contained in:
parent
fc7c3f588e
commit
fcfbdc47bc
2 changed files with 41 additions and 2 deletions
|
|
@ -117,6 +117,10 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||
|
||||
const [stashIDs, setStashIDs] = useState(new ScrapeResult<GQL.StashId[]>([]));
|
||||
|
||||
const [organized, setOrganized] = useState(
|
||||
new ScrapeResult<boolean>(dest.organized)
|
||||
);
|
||||
|
||||
const [image, setImage] = useState<ScrapeResult<string>>(
|
||||
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(
|
||||
new ScrapeResult(
|
||||
dest.stash_ids,
|
||||
|
|
@ -287,6 +298,7 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||
movies,
|
||||
tags,
|
||||
details,
|
||||
organized,
|
||||
stashIDs,
|
||||
image,
|
||||
]);
|
||||
|
|
@ -302,6 +314,7 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||
movies,
|
||||
tags,
|
||||
details,
|
||||
organized,
|
||||
stashIDs,
|
||||
image,
|
||||
]);
|
||||
|
|
@ -323,6 +336,9 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||
);
|
||||
}
|
||||
|
||||
const trueString = intl.formatMessage({ id: "true" });
|
||||
const falseString = intl.formatMessage({ id: "false" });
|
||||
|
||||
return (
|
||||
<>
|
||||
<ScrapedInputGroupRow
|
||||
|
|
@ -463,6 +479,27 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||
result={details}
|
||||
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
|
||||
title={intl.formatMessage({ id: "stash_id" })}
|
||||
result={stashIDs}
|
||||
|
|
@ -515,6 +552,7 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
|||
}),
|
||||
tag_ids: tags.getNewValue(),
|
||||
details: details.getNewValue(),
|
||||
organized: organized.getNewValue(),
|
||||
stash_ids: stashIDs.getNewValue(),
|
||||
cover_image: coverImage,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,10 +36,11 @@ export class ScrapeResult<T> {
|
|||
) {
|
||||
this.originalValue = originalValue ?? undefined;
|
||||
this.newValue = newValue ?? undefined;
|
||||
const hasNewValue = newValue !== undefined;
|
||||
|
||||
const valuesEqual = isEqual(originalValue, newValue);
|
||||
this.useNewValue = useNewValue ?? (!!this.newValue && !valuesEqual);
|
||||
this.scraped = !!this.newValue && !valuesEqual;
|
||||
this.useNewValue = useNewValue ?? (hasNewValue && !valuesEqual);
|
||||
this.scraped = hasNewValue && !valuesEqual;
|
||||
}
|
||||
|
||||
public setOriginalValue(value?: T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue