diff --git a/client/components/modals/libraries/LibraryTools.vue b/client/components/modals/libraries/LibraryTools.vue index 6e84ecf46..69659b7be 100644 --- a/client/components/modals/libraries/LibraryTools.vue +++ b/client/components/modals/libraries/LibraryTools.vue @@ -13,6 +13,18 @@ +
+
+
+

{{ $strings.LabelRemoveItemsWithIssues }}

+

{{ $strings.LabelRemoveItemsWithIssuesHelp }}

+
+
+
+ {{ $strings.ButtonRemove }} +
+
+
@@ -74,6 +86,34 @@ export default { .finally(() => { this.$emit('update:processing', false) }) + }, + removeItemsWithIssuesClick() { + const payload = { + message: this.$strings.MessageConfirmRemoveItemsWithIssues, + persistent: true, + callback: (confirmed) => { + if (confirmed) { + this.removeItemsWithIssuesInLibrary() + } + }, + type: 'yesNo' + } + this.$store.commit('globals/setConfirmPrompt', payload) + }, + removeItemsWithIssuesInLibrary() { + this.$emit('update:processing', true) + this.$axios + .$delete(`/api/libraries/${this.libraryId}/issues`) + .then(() => { + this.$toast.success(this.$strings.ToastLibraryItemsWithIssuesRemoved) + }) + .catch((error) => { + console.error('Failed to remove items with issues', error) + this.$toast.error(this.$strings.ToastLibraryItemsWithIssuesRemoveFailed) + }) + .finally(() => { + this.$emit('update:processing', false) + }) } }, mounted() {} diff --git a/client/strings/en-us.json b/client/strings/en-us.json index f0433b92c..567cfcf3b 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -564,6 +564,8 @@ "LabelRemoveAllMetadataJson": "Remove all metadata.json files", "LabelRemoveAudibleBranding": "Remove Audible intro and outro from chapters", "LabelRemoveCover": "Remove cover", + "LabelRemoveItemsWithIssues": "Remove items with issues", + "LabelRemoveItemsWithIssuesHelp": "Remove all items that are missing or invalid.", "LabelRemoveMetadataFile": "Remove metadata files in library item folders", "LabelRemoveMetadataFileHelp": "Remove all metadata.json and metadata.abs files in your {0} folders.", "LabelRowsPerPage": "Rows per page", @@ -797,6 +799,7 @@ "MessageConfirmRemoveAuthor": "Are you sure you want to remove author \"{0}\"?", "MessageConfirmRemoveCollection": "Are you sure you want to remove collection \"{0}\"?", "MessageConfirmRemoveEpisode": "Are you sure you want to remove episode \"{0}\"?", + "MessageConfirmRemoveItemsWithIssues": "Are you sure you want to remove all items with issues?", "MessageConfirmRemoveEpisodeNote": "Note: This does not delete the audio file unless toggling \"Hard delete file\"", "MessageConfirmRemoveEpisodes": "Are you sure you want to remove {0} episodes?", "MessageConfirmRemoveListeningSessions": "Are you sure you want to remove {0} listening sessions?", @@ -1079,6 +1082,9 @@ "ToastLibraryDeleteFailed": "Failed to delete library", "ToastLibraryDeleteSuccess": "Library deleted", "ToastLibraryScanFailedToStart": "Failed to start scan", + "ToastLibraryItemsWithIssuesNoneFound": "No items with issues found", + "ToastLibraryItemsWithIssuesRemoved": "Removed items with issues", + "ToastLibraryItemsWithIssuesRemoveFailed": "Failed to remove items with issues", "ToastLibraryScanStarted": "Library scan started", "ToastLibraryUpdateSuccess": "Library \"{0}\" updated", "ToastMatchAllAuthorsFailed": "Failed to match all authors",