From 731cf8e4ed1f1ae688ff3ba869512130a0fa4a9f Mon Sep 17 00:00:00 2001 From: Nick Thomson Date: Fri, 23 Sep 2022 19:37:30 +0100 Subject: [PATCH] Fix whitespace issues --- .../modals/BatchQuickMatchModel.vue | 62 +++++++++---------- client/layouts/default.vue | 2 +- client/store/globals.js | 1 - server/controllers/LibraryItemController.js | 30 ++++----- server/routers/ApiRouter.js | 2 +- 5 files changed, 47 insertions(+), 50 deletions(-) diff --git a/client/components/modals/BatchQuickMatchModel.vue b/client/components/modals/BatchQuickMatchModel.vue index 40a3cf25..fd30d9e9 100644 --- a/client/components/modals/BatchQuickMatchModel.vue +++ b/client/components/modals/BatchQuickMatchModel.vue @@ -10,19 +10,19 @@

Quick Match {{ selectedBookIds.length }} Books

-
- -
+
+ +
-

Provider

- -
-

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.

+

Provider

+ +
+

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.

- Update Covers + Update Covers info_outlined

@@ -43,7 +43,7 @@ Continue
- + @@ -54,26 +54,24 @@ export default { data() { return { processing: false, - options: { - provider: 'google', - overrideDetails: true, - overrideCover: true, - overrideDefaults: true - }, - tooltips: { - 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.' - } + options: { + provider: 'google', + overrideDetails: true, + overrideCover: true, + overrideDefaults: true + }, + tooltips: { + 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.' + } } }, computed: { show: { get() { - console.log("Getter") return this.$store.state.globals.showBatchQuickMatchModal }, set(val) { - console.log("Setter") this.$store.commit('globals/setShowBatchQuickMatchModal', val) } }, @@ -95,31 +93,31 @@ export default { } }, methods: { - doBatchQuickMatch() { - if (!this.selectedBookIds.length) return - if (this.processing) return - - this.processing = true - this.$store.commit('setProcessingBatch', true) - this.$axios + doBatchQuickMatch() { + if (!this.selectedBookIds.length) return + if (this.processing) return + + this.processing = true + this.$store.commit('setProcessingBatch', true) + this.$axios .$post(`/api/items/batch/quickmatch`, { - options: this.options, + options: this.options, libraryItemIds: this.selectedBookIds }) .then(() => { this.$toast.success('Batch quick match success!') this.processing = false this.$store.commit('setProcessingBatch', false) - this.show = false + this.show = false }) .catch((error) => { this.$toast.error('Batch quick match failed') console.error('Failed to batch quick match', error) this.processing = false this.$store.commit('setProcessingBatch', false) - this.show = false + this.show = false }) - } + } }, mounted() {} } diff --git a/client/layouts/default.vue b/client/layouts/default.vue index 89be096e..8998a92c 100644 --- a/client/layouts/default.vue +++ b/client/layouts/default.vue @@ -15,7 +15,7 @@ - + diff --git a/client/store/globals.js b/client/store/globals.js index 8625b22e..9e837f00 100644 --- a/client/store/globals.js +++ b/client/store/globals.js @@ -111,7 +111,6 @@ export const mutations = { state.isCasting = val }, setShowBatchQuickMatchModal(state, val) { - console.log("setShowBatchQuickMatchModal: " + val) state.showBatchQuickMatchModal = val } } \ No newline at end of file diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index 9eba9cc6..9544f299 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -307,26 +307,26 @@ class LibraryItemController { // POST: api/items/batch/quickmatch async batchQuickMatch(req, res) { - var itemsUpdated = 0 + var itemsUpdated = 0 - var matchData = req.body - var options = matchData.options || {} - var items = matchData.libraryItemIds + var matchData = req.body + var options = matchData.options || {} + var items = matchData.libraryItemIds if (!items || !items.length) { return res.sendStatus(500) } - + for (let i = 0; i < items.length; i++) { - var libraryItem = this.db.libraryItems.find(_li => _li.id === items[i]) - var matchResult = await this.scanner.quickMatchLibraryItem(libraryItem, options) - if (matchResult.updated) { - itemsUpdated++ - } - } - - res.json({ - success: itemsUpdated > 0, - updates: itemsUpdated + var libraryItem = this.db.libraryItems.find(_li => _li.id === items[i]) + var matchResult = await this.scanner.quickMatchLibraryItem(libraryItem, options) + if (matchResult.updated) { + itemsUpdated++ + } + } + + res.json({ + success: itemsUpdated > 0, + updates: itemsUpdated }) } diff --git a/server/routers/ApiRouter.js b/server/routers/ApiRouter.js index 27b8233c..241acc22 100644 --- a/server/routers/ApiRouter.js +++ b/server/routers/ApiRouter.js @@ -101,7 +101,7 @@ class ApiRouter { 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/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