Skip to content

Commit

Permalink
Add warning about deletion records when mass deleting tags
Browse files Browse the repository at this point in the history
  • Loading branch information
floogulinc committed Jun 20, 2024
1 parent 9aa312f commit df6265a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/confirm-dialog/confirm-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class ConfirmDialogComponent {
ConfirmDialogComponent,
{
data: {...defaultData, ...data},
maxWidth: '560px',
...config
}
);
Expand Down
12 changes: 11 additions & 1 deletion src/app/image-list-loader/image-list-loader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ export class ImageListLoaderComponent implements OnInit, OnChanges {
try {
const serviceDialog = ServiceSelectDialogComponent.open(this.dialog, {serviceFilter: (services) => getLocalTagServices(services)})
const service = await firstValueFrom(serviceDialog.afterClosed())
if(!service) {
return;
}
const tagsDialog = TagInputDialogComponent.open(this.dialog, {
displayType: 'display',
enableOrSearch: false,
Expand All @@ -226,7 +229,10 @@ export class ImageListLoaderComponent implements OnInit, OnChanges {
async removeTags() {
try {
const serviceDialog = ServiceSelectDialogComponent.open(this.dialog, {serviceFilter: (services) => getLocalTagServices(services)})
const service = await firstValueFrom(serviceDialog.afterClosed())
const service = await firstValueFrom(serviceDialog.afterClosed());
if(!service) {
return;
}
const tagsDialog = TagInputDialogComponent.open(this.dialog, {
displayType: 'display',
enableOrSearch: false,
Expand All @@ -236,6 +242,10 @@ export class ImageListLoaderComponent implements OnInit, OnChanges {
})
const dialogResult = await firstValueFrom(tagsDialog.afterClosed());
if (dialogResult) {
if (!await ConfirmDialogComponent.confirmPromise(this.dialog, {
title: 'Delete tags from selected files?',
description: `This will attempt to delete the selected tags from ${this.numSelected()} files. A deletion record will be created for the tags on all selected files, including those that do not currently have the tags.`,
})) return;
const tags = dialogResult.flat() as string[];
await firstValueFrom(this.tagsService.deleteTagsFromLocalServiceFileIDs(Array.from(this.selected()), tags, service.service_key));
this.snackbar.open(`Tag${tags.length === 1 ? '' : 's'} removed from ${this.numSelected()} files`, undefined, {
Expand Down

0 comments on commit df6265a

Please sign in to comment.