From f41d6d5c77060967eadfa01649cf7a6d4408b4fe Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 28 May 2022 15:54:04 -0500 Subject: [PATCH] Update multi-series edit for match and make into separate component with inner modal --- .../modals/EditSeriesInputInnerModal.vue | 120 ++++++++++++++++++ client/components/modals/Modal.vue | 1 + client/components/modals/item/tabs/Match.vue | 68 +++++++--- client/components/widgets/BookDetailsEdit.vue | 87 +------------ .../components/widgets/SeriesInputWidget.vue | 111 ++++++++++++++++ client/store/index.js | 4 + server/controllers/LibraryItemController.js | 1 - 7 files changed, 284 insertions(+), 108 deletions(-) create mode 100644 client/components/modals/EditSeriesInputInnerModal.vue create mode 100644 client/components/widgets/SeriesInputWidget.vue diff --git a/client/components/modals/EditSeriesInputInnerModal.vue b/client/components/modals/EditSeriesInputInnerModal.vue new file mode 100644 index 00000000..dd993841 --- /dev/null +++ b/client/components/modals/EditSeriesInputInnerModal.vue @@ -0,0 +1,120 @@ + + + \ No newline at end of file diff --git a/client/components/modals/Modal.vue b/client/components/modals/Modal.vue index 1dfd2d71..5f289141 100644 --- a/client/components/modals/Modal.vue +++ b/client/components/modals/Modal.vue @@ -104,6 +104,7 @@ export default { } }, hotkey(action) { + if (this.$store.state.innerModalOpen) return if (action === this.$hotkeys.Modal.CLOSE) { this.show = false } diff --git a/client/components/modals/item/tabs/Match.vue b/client/components/modals/item/tabs/Match.vue index 5ce43ed3..8d057a4b 100644 --- a/client/components/modals/item/tabs/Match.vue +++ b/client/components/modals/item/tabs/Match.vue @@ -1,5 +1,5 @@ @@ -97,8 +76,6 @@ export default { }, data() { return { - selectedSeries: {}, - showSeriesForm: false, details: { title: null, subtitle: null, @@ -146,24 +123,6 @@ export default { }, filterData() { return this.$store.state.libraries.filterData || {} - }, - existingSeriesNames() { - // Only show series names not already selected - var alreadySelectedSeriesIds = this.details.series.map((se) => se.id) - return this.series.filter((se) => !alreadySelectedSeriesIds.includes(se.id)).map((se) => se.name) - }, - seriesItems: { - get() { - return this.details.series.map((se) => { - return { - displayName: se.sequence ? `${se.name} #${se.sequence}` : se.name, - ...se - } - }) - }, - set(val) { - this.details.series = val - } } }, methods: { @@ -214,50 +173,6 @@ export default { this.$refs.tagsSelect.forceBlur() } }, - cancelSeriesForm() { - this.showSeriesForm = false - }, - editSeriesItem(series) { - var _series = this.details.series.find((se) => se.id === series.id) - if (!_series) return - this.selectedSeries = { - ..._series - } - this.showSeriesForm = true - }, - addNewSeries() { - this.selectedSeries = { - id: `new-${Date.now()}`, - name: '', - sequence: '' - } - this.showSeriesForm = true - }, - submitSeriesForm() { - if (!this.selectedSeries.name) { - this.$toast.error('Must enter a series') - return - } - if (this.$refs.newSeriesSelect) { - this.$refs.newSeriesSelect.blur() - } - var existingSeriesIndex = this.details.series.findIndex((se) => se.id === this.selectedSeries.id) - - var seriesSameName = this.series.find((se) => se.name.toLowerCase() === this.selectedSeries.name.toLowerCase()) - if (existingSeriesIndex < 0 && seriesSameName) { - this.selectedSeries.id = seriesSameName.id - } - - if (existingSeriesIndex >= 0) { - this.details.series.splice(existingSeriesIndex, 1, { ...this.selectedSeries }) - } else { - this.details.series.push({ - ...this.selectedSeries - }) - } - - this.showSeriesForm = false - }, stringArrayEqual(array1, array2) { // return false if different if (array1.length !== array2.length) return false diff --git a/client/components/widgets/SeriesInputWidget.vue b/client/components/widgets/SeriesInputWidget.vue new file mode 100644 index 00000000..d57b3272 --- /dev/null +++ b/client/components/widgets/SeriesInputWidget.vue @@ -0,0 +1,111 @@ + + + \ No newline at end of file diff --git a/client/store/index.js b/client/store/index.js index 2b9a70ea..00af664b 100644 --- a/client/store/index.js +++ b/client/store/index.js @@ -20,6 +20,7 @@ export const state = () => ({ backups: [], bookshelfBookIds: [], openModal: null, + innerModalOpen: false, selectedBookshelfTexture: '/textures/wood_default.jpg', lastBookshelfScrollData: {} }) @@ -177,6 +178,9 @@ export const mutations = { setOpenModal(state, val) { state.openModal = val }, + setInnerModalOpen(state, val) { + state.innerModalOpen = val + }, setBookshelfTexture(state, val) { state.selectedBookshelfTexture = val } diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index 9bd34c75..0499e4c0 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -51,7 +51,6 @@ class LibraryItemController { var hasUpdates = libraryItem.update(req.body) if (hasUpdates) { - // Turn on podcast auto download cron if not already on if (libraryItem.mediaType == 'podcast' && req.body.media.autoDownloadEpisodes && !this.podcastManager.episodeScheduleTask) { this.podcastManager.schedulePodcastEpisodeCron()