From a9921749bd9f422fa660388232f9ae21d61bd3ea Mon Sep 17 00:00:00 2001 From: grnd-alt Date: Tue, 28 Jul 2026 10:03:14 +0200 Subject: [PATCH] refactor(store): move cardStore to pinia Signed-off-by: grnd-alt --- src/CardMoveDialog.vue | 14 +- src/components/board/Board.vue | 6 +- src/components/board/GanttView.vue | 10 +- src/components/board/Stack.vue | 26 +- src/components/card/CardSidebar.vue | 10 +- src/components/card/CardSidebarTabDetails.vue | 28 +- .../card/DependentCardsSelector.vue | 14 +- src/components/card/Description.vue | 7 +- src/components/card/DueDateSelector.vue | 10 +- src/components/cards/CardCover.vue | 8 +- src/components/cards/CardItem.vue | 28 +- src/components/cards/CardMenuEntries.vue | 23 +- src/store/card.js | 425 ------------------ src/store/main.js | 4 - src/stores/attachment.js | 16 +- src/stores/card.js | 418 +++++++++++++++++ src/stores/overview.js | 4 +- src/stores/stack.js | 12 +- src/stores/trashbin.js | 3 +- 19 files changed, 572 insertions(+), 494 deletions(-) delete mode 100644 src/store/card.js create mode 100644 src/stores/card.js diff --git a/src/CardMoveDialog.vue b/src/CardMoveDialog.vue index 831c2d25d1..05f4779f45 100644 --- a/src/CardMoveDialog.vue +++ b/src/CardMoveDialog.vue @@ -38,8 +38,9 @@ import { generateOcsUrl } from '@nextcloud/router' import axios from '@nextcloud/axios' import { subscribe, unsubscribe } from '@nextcloud/event-bus' import { mapGetters } from 'vuex' -import { mapState } from 'pinia' +import { mapActions, mapState } from 'pinia' import { useStackStore } from './stores/stack.js' +import { useCardStore } from './stores/card.js' export default { name: 'CardMoveDialog', @@ -79,6 +80,11 @@ export default { unsubscribe('deck:card:show-move-dialog', this.openModal) }, methods: { + ...mapActions(useCardStore, { + moveCardInStore: 'moveCard', + addNewCardInStore: 'addNewCard', + cloneCardInStore: 'cloneCard', + }), openModal(card) { this.card = card this.selectedStack = this.stackById(this.card.stackId) @@ -98,14 +104,14 @@ export default { async moveCard() { this.copiedCard = Object.assign({}, this.card) this.copiedCard.stackId = this.selectedStack.id - this.$store.dispatch('moveCard', { card: this.copiedCard, oldBoardId: this.selectedBoard.id }) + await this.moveCardInStore({ card: this.copiedCard, oldBoardId: this.selectedBoard.id }) if (parseInt(this.selectedBoard.id) === parseInt(this.selectedStack.boardId)) { - await this.$store.commit('addNewCard', { ...this.copiedCard }) + this.addNewCardInStore({ ...this.copiedCard }) } this.modalShow = false }, async cloneCard() { - this.$store.dispatch('cloneCard', { cardId: this.card.id, targetStackId: this.selectedStack.id }) + await this.cloneCardInStore({ cardId: this.card.id, targetStackId: this.selectedStack.id }) this.modalShow = false }, }, diff --git a/src/components/board/Board.vue b/src/components/board/Board.vue index 0af01efd9a..522a97ebe5 100644 --- a/src/components/board/Board.vue +++ b/src/components/board/Board.vue @@ -100,6 +100,7 @@ import { createSession } from '../../sessions.js' import CardSidebar from '../card/CardSidebar.vue' import { mapActions, mapState } from 'pinia' import { useStackStore } from '../../stores/stack.js' +import { useCardStore } from '../../stores/card.js' export default { name: 'Board', components: { @@ -139,6 +140,7 @@ export default { }, computed: { ...mapState(useStackStore, ['stacksByBoard']), + ...mapState(useCardStore, ['cardById']), ...mapStateVuex({ isFullApp: state => state.isFullApp, board: state => state.currentBoard, @@ -192,10 +194,10 @@ export default { const routeCardId = this.$route?.params?.cardId ? parseInt(this.$route.params.cardId) : null // If an archived card is requested, and we cannot find it in the current we load the archived stacks instead - if (routeCardId && !this.$store.getters.cardById(routeCardId)) { + if (routeCardId && !this.cardById(routeCardId)) { await this.loadArchivedStacks(this.id) - if (this.$store.getters.cardById(routeCardId)) { + if (this.cardById(routeCardId)) { this.$store.commit('toggleShowArchived', true) } } diff --git a/src/components/board/GanttView.vue b/src/components/board/GanttView.vue index f0c06f8a5d..6afd783d00 100644 --- a/src/components/board/GanttView.vue +++ b/src/components/board/GanttView.vue @@ -60,12 +60,14 @@