From df6265a9320f7bb2e8422e501308b2cdf36adb56 Mon Sep 17 00:00:00 2001 From: Paul Friederichsen Date: Wed, 19 Jun 2024 19:12:30 -0500 Subject: [PATCH] Add warning about deletion records when mass deleting tags --- src/app/confirm-dialog/confirm-dialog.component.ts | 1 + .../image-list-loader/image-list-loader.component.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/confirm-dialog/confirm-dialog.component.ts b/src/app/confirm-dialog/confirm-dialog.component.ts index fab4a3a..a08f923 100644 --- a/src/app/confirm-dialog/confirm-dialog.component.ts +++ b/src/app/confirm-dialog/confirm-dialog.component.ts @@ -31,6 +31,7 @@ export class ConfirmDialogComponent { ConfirmDialogComponent, { data: {...defaultData, ...data}, + maxWidth: '560px', ...config } ); diff --git a/src/app/image-list-loader/image-list-loader.component.ts b/src/app/image-list-loader/image-list-loader.component.ts index 30667ef..41bd2ad 100644 --- a/src/app/image-list-loader/image-list-loader.component.ts +++ b/src/app/image-list-loader/image-list-loader.component.ts @@ -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, @@ -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, @@ -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, {