From e436cb921a04c7c5956c92c2bbb88184b0a16eb7 Mon Sep 17 00:00:00 2001 From: grnd-alt Date: Tue, 29 Oct 2024 11:59:52 +0100 Subject: [PATCH 01/12] feat(cards): add card cloning ability Signed-off-by: grnd-alt --- src/App.vue | 3 + src/CardCloneDialog.vue | 122 +++++++++++++++++++++++ src/CardMoveDialog.vue | 6 +- src/components/cards/CardMenuEntries.vue | 9 ++ 4 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 src/CardCloneDialog.vue diff --git a/src/App.vue b/src/App.vue index f43f6c516..7f68bd18e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,6 +26,7 @@ + @@ -38,6 +39,7 @@ import { BoardApi } from './services/BoardApi.js' import { emit, subscribe } from '@nextcloud/event-bus' import { loadState } from '@nextcloud/initial-state' import CardMoveDialog from './CardMoveDialog.vue' +import CardCloneDialog from './CardCloneDialog.vue' const boardApi = new BoardApi() @@ -45,6 +47,7 @@ export default { name: 'App', components: { CardMoveDialog, + CardCloneDialog, AppNavigation, NcModal, NcContent, diff --git a/src/CardCloneDialog.vue b/src/CardCloneDialog.vue new file mode 100644 index 000000000..b0d1b4f27 --- /dev/null +++ b/src/CardCloneDialog.vue @@ -0,0 +1,122 @@ + + + + + + diff --git a/src/CardMoveDialog.vue b/src/CardMoveDialog.vue index 59a42a579..0593be4da 100644 --- a/src/CardMoveDialog.vue +++ b/src/CardMoveDialog.vue @@ -3,7 +3,7 @@ - SPDX-License-Identifier: AGPL-3.0-or-later --> @@ -39,7 +38,6 @@ import { BoardApi } from './services/BoardApi.js' import { emit, subscribe } from '@nextcloud/event-bus' import { loadState } from '@nextcloud/initial-state' import CardMoveDialog from './CardMoveDialog.vue' -import CardCloneDialog from './CardCloneDialog.vue' const boardApi = new BoardApi() @@ -47,7 +45,6 @@ export default { name: 'App', components: { CardMoveDialog, - CardCloneDialog, AppNavigation, NcModal, NcContent, diff --git a/src/CardCloneDialog.vue b/src/CardCloneDialog.vue deleted file mode 100644 index 821ddd824..000000000 --- a/src/CardCloneDialog.vue +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - diff --git a/src/CardMoveDialog.vue b/src/CardMoveDialog.vue index 0593be4da..aa0389b99 100644 --- a/src/CardMoveDialog.vue +++ b/src/CardMoveDialog.vue @@ -5,7 +5,7 @@ @@ -106,6 +118,10 @@ export default { } } +button{ + margin-left: 6px; +} + .modal__content button { float: right; margin-top: 50px; diff --git a/src/components/cards/CardMenuEntries.vue b/src/components/cards/CardMenuEntries.vue index 8f4401a78..af5fc6944 100644 --- a/src/components/cards/CardMenuEntries.vue +++ b/src/components/cards/CardMenuEntries.vue @@ -31,15 +31,7 @@ icon="icon-external" :close-after-click="true" @click="openCardMoveDialog"> - {{ t('deck', 'Move card') }} - - - - {{ t('deck', 'Clone card') }} + {{ t('deck', 'Move/copy card') }} From 60b7357ef41023ef3bcff5e0b4f7d04c43068038 Mon Sep 17 00:00:00 2001 From: grnd-alt Date: Thu, 19 Dec 2024 14:05:32 +0100 Subject: [PATCH 11/12] enh: make clone function use ocs Signed-off-by: grnd-alt --- appinfo/routes.php | 3 ++- cypress/e2e/cardFeatures.js | 4 ++-- src/services/CardApi.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index d56023645..0fec8568e 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -43,7 +43,6 @@ ['name' => 'card#read', 'url' => '/cards/{cardId}', 'verb' => 'GET'], ['name' => 'card#create', 'url' => '/cards', 'verb' => 'POST'], ['name' => 'card#update', 'url' => '/cards/{cardId}', 'verb' => 'PUT'], - ['name' => 'card#clone', 'url' => '/cards/{cardId}/clone', 'verb' => 'POST'], ['name' => 'card#delete', 'url' => '/cards/{cardId}', 'verb' => 'DELETE'], ['name' => 'card#deleted', 'url' => '/{boardId}/cards/deleted', 'verb' => 'GET'], ['name' => 'card#rename', 'url' => '/cards/{cardId}/rename', 'verb' => 'PUT'], @@ -138,6 +137,8 @@ ['name' => 'comments_api#update', 'url' => '/api/v{apiVersion}/cards/{cardId}/comments/{commentId}', 'verb' => 'PUT'], ['name' => 'comments_api#delete', 'url' => '/api/v{apiVersion}/cards/{cardId}/comments/{commentId}', 'verb' => 'DELETE'], + ['name' => 'card#clone', 'url' => '/api/v{apiVersion}/cards/{cardId}/clone', 'verb' => 'POST'], + ['name' => 'overview_api#upcomingCards', 'url' => '/api/v{apiVersion}/overview/upcoming', 'verb' => 'GET'], ['name' => 'search#search', 'url' => '/api/v{apiVersion}/search', 'verb' => 'GET'], diff --git a/cypress/e2e/cardFeatures.js b/cypress/e2e/cardFeatures.js index 5d5115c3d..c1628c986 100644 --- a/cypress/e2e/cardFeatures.js +++ b/cypress/e2e/cardFeatures.js @@ -303,8 +303,8 @@ describe('Card', function () { }) }) - it('clone card', () => { - cy.intercept({ method: 'POST', url: '**/apps/deck/cards/*/clone' }).as('clone') + it.only('clone card', () => { + cy.intercept({ method: 'POST', url: '**/apps/deck/**/cards/*/clone' }).as('clone') cy.get('.card:contains("Hello world")').should('be.visible').click() cy.get('#app-sidebar-vue') .find('.ProseMirror h1').contains('Hello world').should('be.visible') diff --git a/src/services/CardApi.js b/src/services/CardApi.js index a25182c99..15031aa1d 100644 --- a/src/services/CardApi.js +++ b/src/services/CardApi.js @@ -4,7 +4,7 @@ */ import axios from '@nextcloud/axios' -import { generateUrl } from '@nextcloud/router' +import { generateOcsUrl, generateUrl } from '@nextcloud/router' export class CardApi { @@ -29,7 +29,7 @@ export class CardApi { } cloneCard(cardId, targetStackId) { - return axios.post(this.url(`/cards/${cardId}/clone`), { + return axios.post(generateOcsUrl(`apps/deck/api/v1.0/cards/${cardId}/clone`), { targetStackId, }) .then( From 5aeebc1ed8cd6816990c6676041355813cc95fd5 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Thu, 19 Dec 2024 14:49:35 +0100 Subject: [PATCH 12/12] chore: Move from NcModal to NcDialog Signed-off-by: Julius Knorr --- cypress/e2e/cardFeatures.js | 4 ++-- src/CardMoveDialog.vue | 37 ++++++++----------------------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/cypress/e2e/cardFeatures.js b/cypress/e2e/cardFeatures.js index c1628c986..0e86f5b28 100644 --- a/cypress/e2e/cardFeatures.js +++ b/cypress/e2e/cardFeatures.js @@ -303,7 +303,7 @@ describe('Card', function () { }) }) - it.only('clone card', () => { + it('clone card', () => { cy.intercept({ method: 'POST', url: '**/apps/deck/**/cards/*/clone' }).as('clone') cy.get('.card:contains("Hello world")').should('be.visible').click() cy.get('#app-sidebar-vue') @@ -311,7 +311,7 @@ describe('Card', function () { cy.get('.app-sidebar-header .action-item__menutoggle').click() cy.get('.v-popper__popper button:contains("Move/copy card")').click() - cy.get('.modal__content button:contains("Copy card")').click() + cy.get('.modal-container button:contains("Copy card")').click() cy.wait('@clone', { timeout: 7000 }) cy.get('.card:contains("Hello world")').should('have.length', 2) }) diff --git a/src/CardMoveDialog.vue b/src/CardMoveDialog.vue index aa0389b99..c7d5d6fba 100644 --- a/src/CardMoveDialog.vue +++ b/src/CardMoveDialog.vue @@ -3,9 +3,8 @@ - SPDX-License-Identifier: AGPL-3.0-or-later -->