mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 04:22:28 +02:00
refactor(webui): use global add to collection dialog
This commit is contained in:
parent
6dd070436b
commit
b89e3b2ebb
4 changed files with 13 additions and 12 deletions
|
|
@ -24,7 +24,7 @@
|
|||
import CollectionAddToDialog from '@/components/CollectionAddToDialog.vue'
|
||||
import CollectionDeleteDialog from '@/components/CollectionDeleteDialog.vue'
|
||||
import LibraryDeleteDialog from '@/components/LibraryDeleteDialog.vue'
|
||||
import { COLLECTION_CHANGED, LIBRARY_DELETED, SERIES_CHANGED } from '@/types/events'
|
||||
import { COLLECTION_CHANGED, COLLECTION_DELETED, LIBRARY_DELETED, SERIES_CHANGED } from '@/types/events'
|
||||
import Vue from 'vue'
|
||||
|
||||
export default Vue.extend({
|
||||
|
|
@ -83,7 +83,9 @@ export default Vue.extend({
|
|||
this.$eventHub.$emit(COLLECTION_CHANGED)
|
||||
},
|
||||
collectionDeleted () {
|
||||
this.$eventHub.$emit(COLLECTION_CHANGED)
|
||||
this.$eventHub.$emit(COLLECTION_DELETED, {
|
||||
id: this.deleteCollection.id,
|
||||
} as EventCollectionDeleted)
|
||||
},
|
||||
libraryDeleted () {
|
||||
this.$eventHub.$emit(LIBRARY_DELETED, {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ interface EventSeriesChanged {
|
|||
libraryId: number
|
||||
}
|
||||
|
||||
interface EventCollectionDeleted {
|
||||
id: number
|
||||
}
|
||||
|
||||
interface EventLibraryDeleted {
|
||||
id: number
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
export const BOOK_CHANGED = 'book-changed'
|
||||
export const SERIES_CHANGED = 'series-changed'
|
||||
export const COLLECTION_DELETED = 'collection-deleted'
|
||||
export const COLLECTION_CHANGED = 'collection-changed'
|
||||
export const LIBRARY_DELETED = 'library-deleted'
|
||||
|
|
|
|||
|
|
@ -108,10 +108,6 @@
|
|||
:series.sync="editSeriesSingle"
|
||||
/>
|
||||
|
||||
<collection-add-to-dialog v-model="dialogAddToCollection"
|
||||
:series="selectedSeries"
|
||||
/>
|
||||
|
||||
<collection-edit-dialog v-model="dialogEditCollection"
|
||||
:collection="collection"
|
||||
@updated="loadCollection(collectionId)"
|
||||
|
|
@ -135,12 +131,11 @@
|
|||
<script lang="ts">
|
||||
import Badge from '@/components/Badge.vue'
|
||||
import CollectionActionsMenu from '@/components/CollectionActionsMenu.vue'
|
||||
import CollectionAddToDialog from '@/components/CollectionAddToDialog.vue'
|
||||
import CollectionEditDialog from '@/components/CollectionEditDialog.vue'
|
||||
import EditSeriesDialog from '@/components/EditSeriesDialog.vue'
|
||||
import ItemBrowser from '@/components/ItemBrowser.vue'
|
||||
import ToolbarSticky from '@/components/ToolbarSticky.vue'
|
||||
import { COLLECTION_CHANGED, SERIES_CHANGED } from '@/types/events'
|
||||
import { COLLECTION_DELETED, SERIES_CHANGED } from '@/types/events'
|
||||
import Vue from 'vue'
|
||||
|
||||
export default Vue.extend({
|
||||
|
|
@ -149,7 +144,6 @@ export default Vue.extend({
|
|||
ToolbarSticky,
|
||||
ItemBrowser,
|
||||
EditSeriesDialog,
|
||||
CollectionAddToDialog,
|
||||
CollectionEditDialog,
|
||||
CollectionActionsMenu,
|
||||
Badge,
|
||||
|
|
@ -204,11 +198,11 @@ export default Vue.extend({
|
|||
},
|
||||
},
|
||||
created () {
|
||||
this.$eventHub.$on(COLLECTION_CHANGED, this.afterDelete)
|
||||
this.$eventHub.$on(COLLECTION_DELETED, this.afterDelete)
|
||||
this.$eventHub.$on(SERIES_CHANGED, this.reloadSeries)
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$eventHub.$off(COLLECTION_CHANGED, this.afterDelete)
|
||||
this.$eventHub.$off(COLLECTION_DELETED, this.afterDelete)
|
||||
this.$eventHub.$off(SERIES_CHANGED, this.reloadSeries)
|
||||
},
|
||||
mounted () {
|
||||
|
|
@ -257,7 +251,7 @@ export default Vue.extend({
|
|||
))
|
||||
},
|
||||
addToCollection () {
|
||||
this.dialogAddToCollection = true
|
||||
this.$store.dispatch('dialogAddSeriesToCollection', this.selectedSeries)
|
||||
},
|
||||
startEditElements () {
|
||||
this.editElements = true
|
||||
|
|
|
|||
Loading…
Reference in a new issue