mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 05:29:41 +00:00
feat: Add 'Write Metadata Files' button to Library Tools modal
This commit is contained in:
parent
a73ce12945
commit
b5caadd4c2
5 changed files with 99 additions and 1 deletions
|
|
@ -1,5 +1,17 @@
|
|||
<template>
|
||||
<div class="w-full h-full px-1 md:px-2 py-1 mb-4">
|
||||
<div class="w-full border border-black-200 p-4 my-8">
|
||||
<div class="flex flex-wrap items-center">
|
||||
<div>
|
||||
<p class="text-lg">{{ $strings.LabelWriteMetadataFiles }}</p>
|
||||
<p class="max-w-sm text-sm pt-2 text-gray-300">{{ $strings.LabelWriteMetadataFilesHelp }}</p>
|
||||
</div>
|
||||
<div class="grow" />
|
||||
<div>
|
||||
<ui-btn @click.stop="writeMetadataFilesClick">{{ $strings.LabelWriteMetadataFiles }}</ui-btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full border border-black-200 p-4 my-8">
|
||||
<div class="flex flex-wrap items-center">
|
||||
<div>
|
||||
|
|
@ -89,6 +101,34 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
writeMetadataFilesClick() {
|
||||
const payload = {
|
||||
message: this.$strings.MessageConfirmWriteMetadataFiles,
|
||||
persistent: true,
|
||||
callback: (confirmed) => {
|
||||
if (confirmed) {
|
||||
this.writeMetadataFiles()
|
||||
}
|
||||
},
|
||||
type: 'yesNo'
|
||||
}
|
||||
this.$store.commit('globals/setConfirmPrompt', payload)
|
||||
},
|
||||
writeMetadataFiles() {
|
||||
this.$emit('update:processing', true)
|
||||
this.$axios
|
||||
.$post(`/api/libraries/${this.libraryId}/write-metadata-files`)
|
||||
.then((data) => {
|
||||
this.$toast.success(this.$getString('ToastWriteMetadataFilesSuccess', [data.created, data.skipped]))
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to write metadata files', error)
|
||||
this.$toast.error(this.$strings.ToastWriteMetadataFilesFailed)
|
||||
})
|
||||
.finally(() => {
|
||||
this.$emit('update:processing', false)
|
||||
})
|
||||
},
|
||||
removeAllMetadataClick(ext) {
|
||||
const payload = {
|
||||
message: this.$getString('MessageConfirmRemoveMetadataFiles', [ext]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue