Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Tag Confirmation #4016

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Conversation

Flashy78
Copy link
Contributor

@Flashy78 Flashy78 commented Aug 9, 2023

Resolves #3909

Implements most of the suggestions from the ticket, except for a button to hide the dialogue in the future. I didn't see any similar functionality in Stash, and don't want to incorrectly build new features.

  • Updated descriptions for Auto Tag and Identify with more explanation
  • Auto Tag buttons should all have the confirmation dialog
  • For new users, in the Settings their Performers and Studios will be disabled by default for Auto Tag
  • For new users, removed Auto Tag as a default source from Identify

Other

  • Refactored DirectorySettingDialog.tsx to allow customization and potentially hide the directory picker. This was copied from how the Clean task dialogs were doing their own directory picking, and the Clean task was refactored to use the updated DirectorySettingDialog.tsx. So now you can have a directory picking dialog that doesn't show you any directories, but all of the directory picking code is no longer duplicated for the Clean task.
  • Added slight padding to the bottom of the directory listing to remove an inline scroll bar that was showing on my system

autotag2
autotag4
autotag3

@DingDongSoLong4
Copy link
Collaborator

Very nice, this will definitely help prevent accidental presses or unaware users from activating these irreversible features.

I have just two comments:

  • It would be nice if the Auto Tag dialogs on the studios, performers and tags pages showed different messages, explaining that it will Auto Tag for that specific studio/performer/tag only.
  • Since there's no big warning icon, I think adding a simple "Are you sure you want to continue?" message to the Auto Tag confirmation dialogs would help to emphasize that the action is irreversible.

Comment on lines +145 to +173
return (
<DirectorySelectionDialog
allowPathSelection={dialogOpen.clean}
message={msg}
header={intl.formatMessage({ id: "actions.clean" })}
icon={faTrashAlt}
acceptButtonText={intl.formatMessage({ id: "actions.clean" })}
acceptButtonVariant="danger"
onClose={(p) => {
// undefined means cancelled
if (p !== undefined) {
if (dialogOpen.cleanAlert) {
// don't provide paths
onClean();
} else {
onClean(p);
}
}

setDialogOpen({
clean: false,
cleanAlert: false,
});
}}
/>
);
}
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why couldn't this have been put into the existing CleanDialog instead of removing the CleanDialog altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I duplicated the CleanDialog code over into LibraryTasks.tsx as an AutoTagDialog.
That was almost identical code, and now a third instance of the DirectorySelectionDialog code. So I pulled CleanDialog and AutoTagDialog out into a new component file.
This new file was almost identical to DirectorySelectionDialog, except for the extra styling options, message and option to hide the directory selection.

I thought about adding the styling options to DirectorySelectionDialog and replacing the directory code in my new file with that component, but I would have to deconstruct DirectorySelectionDialog because it already has a <ModalComponent> that I couldn't wrap in my higher level <ModelComponent>.

I figured since I was already going to add all the styling options to it, adding message and the option to totally hide it was less complicated and less error prone than trying to refactor DirectorySelectionDialog and pull out the directory selection code into a sub component that could be imported into an OptionalDirectorySelectionDialog component.

I could do that if you think it would be a better approach?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I duplicated the CleanDialog code over into LibraryTasks.tsx as an AutoTagDialog.
That was almost identical code, and now a third instance of the DirectorySelectionDialog code. So I pulled CleanDialog and AutoTagDialog out into a new component file.
This new file was almost identical to DirectorySelectionDialog, except for the extra styling options, message and option to hide the directory selection.

Please do this instead for now. We can address the duplicate code later if needed.

animation,
allowEmpty = false,
initialPaths = [],
allowPathSelection = true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire concept is a bit broken from a design perspective. The component is a DirectorySelectionDialog, but we have a flag to disable the entire purpose of the dialog? I think there's a better way to do this.

ui/v2.5/src/components/Settings/Tasks/LibraryTasks.tsx Outdated Show resolved Hide resolved
@Flashy78
Copy link
Contributor Author

* It would be nice if the Auto Tag dialogs on the studios, performers and tags pages showed different messages, explaining that it will Auto Tag for that specific studio/performer/tag only.

* Since there's no big warning icon, I think adding a simple "Are you sure you want to continue?" message to the Auto Tag confirmation dialogs would help to emphasize that the action is irreversible.

Added a line confirming which object you just clicked Auto Tag for.

Took your suggestion and reworked the text into a description and warning, so I could add a warning icon along with the warning text. I've updated the PR description with screenshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Auto tag confirmation dialog and other warnings to mitigate misuse
3 participants