Fix whitespace issues

This commit is contained in:
Nick Thomson 2022-09-23 19:37:30 +01:00
parent c3f2e606dd
commit 731cf8e4ed
5 changed files with 47 additions and 50 deletions

View File

@ -10,19 +10,19 @@
<div v-if="show" class="w-full h-full"> <div v-if="show" class="w-full h-full">
<div class="py-4 px-4"> <div class="py-4 px-4">
<h1 class="text-2xl">Quick Match {{ selectedBookIds.length }} Books</h1> <h1 class="text-2xl">Quick Match {{ selectedBookIds.length }} Books</h1>
</div> </div>
<div class="w-full overflow-y-auto overflow-x-hidden max-h-96"> <div class="w-full overflow-y-auto overflow-x-hidden max-h-96">
<div class="flex px-8 items-center py-2"> <div class="flex px-8 items-center py-2">
<p class="pr-4">Provider</p> <p class="pr-4">Provider</p>
<ui-dropdown v-model="options.provider" :items="providers" small /> <ui-dropdown v-model="options.provider" :items="providers" small />
</div> </div>
<p class="text-base px-8 py-2">Quick Match will attempt to add missing covers and metadata for the selected books. Enable the options below to allow Quick Match to overwrite existing covers and/or metadata.</p> <p class="text-base px-8 py-2">Quick Match will attempt to add missing covers and metadata for the selected books. Enable the options below to allow Quick Match to overwrite existing covers and/or metadata.</p>
<div class="flex px-8 items-end py-2"> <div class="flex px-8 items-end py-2">
<ui-toggle-switch v-model="options.overrideCover"/> <ui-toggle-switch v-model="options.overrideCover"/>
<ui-tooltip :text="tooltips.updateCovers"> <ui-tooltip :text="tooltips.updateCovers">
<p class="pl-4"> <p class="pl-4">
Update Covers Update Covers
<span class="material-icons icon-text text-sm">info_outlined</span> <span class="material-icons icon-text text-sm">info_outlined</span>
</p> </p>
</ui-tooltip> </ui-tooltip>
@ -43,7 +43,7 @@
<ui-btn color="success" @click="doBatchQuickMatch">Continue</ui-btn> <ui-btn color="success" @click="doBatchQuickMatch">Continue</ui-btn>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</modals-modal> </modals-modal>
@ -54,26 +54,24 @@ export default {
data() { data() {
return { return {
processing: false, processing: false,
options: { options: {
provider: 'google', provider: 'google',
overrideDetails: true, overrideDetails: true,
overrideCover: true, overrideCover: true,
overrideDefaults: true overrideDefaults: true
}, },
tooltips: { tooltips: {
updateCovers: 'Allow overwriting of existing covers for the selected books when a match is located.', updateCovers: 'Allow overwriting of existing covers for the selected books when a match is located.',
updateDetails: 'Allow overwriting of existing details for the selected books when a match is located.' updateDetails: 'Allow overwriting of existing details for the selected books when a match is located.'
} }
} }
}, },
computed: { computed: {
show: { show: {
get() { get() {
console.log("Getter")
return this.$store.state.globals.showBatchQuickMatchModal return this.$store.state.globals.showBatchQuickMatchModal
}, },
set(val) { set(val) {
console.log("Setter")
this.$store.commit('globals/setShowBatchQuickMatchModal', val) this.$store.commit('globals/setShowBatchQuickMatchModal', val)
} }
}, },
@ -95,31 +93,31 @@ export default {
} }
}, },
methods: { methods: {
doBatchQuickMatch() { doBatchQuickMatch() {
if (!this.selectedBookIds.length) return if (!this.selectedBookIds.length) return
if (this.processing) return if (this.processing) return
this.processing = true this.processing = true
this.$store.commit('setProcessingBatch', true) this.$store.commit('setProcessingBatch', true)
this.$axios this.$axios
.$post(`/api/items/batch/quickmatch`, { .$post(`/api/items/batch/quickmatch`, {
options: this.options, options: this.options,
libraryItemIds: this.selectedBookIds libraryItemIds: this.selectedBookIds
}) })
.then(() => { .then(() => {
this.$toast.success('Batch quick match success!') this.$toast.success('Batch quick match success!')
this.processing = false this.processing = false
this.$store.commit('setProcessingBatch', false) this.$store.commit('setProcessingBatch', false)
this.show = false this.show = false
}) })
.catch((error) => { .catch((error) => {
this.$toast.error('Batch quick match failed') this.$toast.error('Batch quick match failed')
console.error('Failed to batch quick match', error) console.error('Failed to batch quick match', error)
this.processing = false this.processing = false
this.$store.commit('setProcessingBatch', false) this.$store.commit('setProcessingBatch', false)
this.show = false this.show = false
}) })
} }
}, },
mounted() {} mounted() {}
} }

View File

@ -15,7 +15,7 @@
<modals-podcast-edit-episode /> <modals-podcast-edit-episode />
<modals-podcast-view-episode /> <modals-podcast-view-episode />
<modals-authors-edit-modal /> <modals-authors-edit-modal />
<modals-batch-quick-match-model /> <modals-batch-quick-match-model />
<prompt-confirm /> <prompt-confirm />
<readers-reader /> <readers-reader />
</div> </div>

View File

@ -111,7 +111,6 @@ export const mutations = {
state.isCasting = val state.isCasting = val
}, },
setShowBatchQuickMatchModal(state, val) { setShowBatchQuickMatchModal(state, val) {
console.log("setShowBatchQuickMatchModal: " + val)
state.showBatchQuickMatchModal = val state.showBatchQuickMatchModal = val
} }
} }

View File

@ -307,26 +307,26 @@ class LibraryItemController {
// POST: api/items/batch/quickmatch // POST: api/items/batch/quickmatch
async batchQuickMatch(req, res) { async batchQuickMatch(req, res) {
var itemsUpdated = 0 var itemsUpdated = 0
var matchData = req.body var matchData = req.body
var options = matchData.options || {} var options = matchData.options || {}
var items = matchData.libraryItemIds var items = matchData.libraryItemIds
if (!items || !items.length) { if (!items || !items.length) {
return res.sendStatus(500) return res.sendStatus(500)
} }
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
var libraryItem = this.db.libraryItems.find(_li => _li.id === items[i]) var libraryItem = this.db.libraryItems.find(_li => _li.id === items[i])
var matchResult = await this.scanner.quickMatchLibraryItem(libraryItem, options) var matchResult = await this.scanner.quickMatchLibraryItem(libraryItem, options)
if (matchResult.updated) { if (matchResult.updated) {
itemsUpdated++ itemsUpdated++
} }
} }
res.json({ res.json({
success: itemsUpdated > 0, success: itemsUpdated > 0,
updates: itemsUpdated updates: itemsUpdated
}) })
} }

View File

@ -101,7 +101,7 @@ class ApiRouter {
this.router.post('/items/batch/delete', LibraryItemController.batchDelete.bind(this)) this.router.post('/items/batch/delete', LibraryItemController.batchDelete.bind(this))
this.router.post('/items/batch/update', LibraryItemController.batchUpdate.bind(this)) this.router.post('/items/batch/update', LibraryItemController.batchUpdate.bind(this))
this.router.post('/items/batch/get', LibraryItemController.batchGet.bind(this)) this.router.post('/items/batch/get', LibraryItemController.batchGet.bind(this))
this.router.post('/items/batch/quickmatch', LibraryItemController.batchQuickMatch.bind(this)) this.router.post('/items/batch/quickmatch', LibraryItemController.batchQuickMatch.bind(this))
// //
// User Routes // User Routes