From 42461a74eac137093148957e153c9404253c2c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 11 May 2023 15:16:44 +0200 Subject: [PATCH 1/3] enh: Move to native datetime picker component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/card/CardSidebarTabDetails.vue | 35 +--- src/components/card/DueDateSelector.vue | 152 +++++++++++------- 2 files changed, 102 insertions(+), 85 deletions(-) diff --git a/src/components/card/CardSidebarTabDetails.vue b/src/components/card/CardSidebarTabDetails.vue index 5fb648149..b3c4afd6d 100644 --- a/src/components/card/CardSidebarTabDetails.vue +++ b/src/components/card/CardSidebarTabDetails.vue @@ -35,7 +35,7 @@ @select="assignUserToCard" @remove="removeUserFromCard" /> - +
(a.title < b.title) ? -1 : 1) }, @@ -133,15 +131,6 @@ export default { localStorage.setItem('deck.selectedStackId', this.card.stackId) }, - async updateCardDue(val) { - this.saving = true - await this.$store.dispatch('updateCardDue', { - ...this.copiedCard, - duedate: val ? (new Date(val)).toISOString() : null, - }) - this.saving = false - }, - assignUserToCard(user) { this.$store.dispatch('assignCardToUser', { card: this.copiedCard, @@ -162,6 +151,13 @@ export default { }) }, + updateCardDue(val) { + this.$store.dispatch('updateCardDue', { + ...this.copiedCard, + duedate: val ? (new Date(val)).toISOString() : null, + }) + }, + addLabelToCard(newLabel) { this.copiedCard.labels.push(newLabel) const data = { @@ -205,15 +201,6 @@ export default { } - diff --git a/src/components/card/DueDateSelector.vue b/src/components/card/DueDateSelector.vue index a068d8bde..23b749162 100644 --- a/src/components/card/DueDateSelector.vue +++ b/src/components/card/DueDateSelector.vue @@ -4,19 +4,34 @@
- - - + :hide-label="true" + type="datetime-local" /> + + + + {{ shortcut.label }} + + + + + + {{ t('deck', 'Choose a date') }} + + {{ t('deck', 'Remove due date') }} @@ -26,17 +41,21 @@ From 7e0765adb04b4d642d78084b099addbc9c0733df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 12 Sep 2023 15:32:11 +0200 Subject: [PATCH 2/3] tests: Date time picker tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- cypress/e2e/cardFeatures.js | 41 +++++++++++++++++++++++++ src/components/card/DueDateSelector.vue | 12 ++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/cardFeatures.js b/cypress/e2e/cardFeatures.js index 6bad048d9..135fc5722 100644 --- a/cypress/e2e/cardFeatures.js +++ b/cypress/e2e/cardFeatures.js @@ -1,5 +1,6 @@ import { randUser } from '../utils/index.js' import { sampleBoard } from '../utils/sampleBoard' +import moment from '@nextcloud/moment' const user = randUser() const boardData = sampleBoard() @@ -177,6 +178,46 @@ describe('Card', function() { cy.get('#app-sidebar-vue') .find('.ProseMirror h1').contains('Hello world writing more text').should('be.visible') }) + + it('Set a due date', function() { + const newCardTitle = 'Card with a due date' + + cy.get('.button-vue[aria-label*="Add card"]') + .first().click() + cy.get('.stack__card-add form input#new-stack-input-main') + .type(newCardTitle) + cy.get('.stack__card-add form input[type=submit]') + .first().click() + cy.get(`.card:contains("${newCardTitle}")`).should('be.visible') + + cy.get('.card:contains("Card with a due date")').should('be.visible').click() + + cy.get('#app-sidebar-vue [data-cy-due-date-actions]').should('be.visible').click() + + // Set a due date through shortcut + cy.get('[data-cy-due-date-shortcut="tomorrow"] button').should('be.visible').click() + + const tomorrow = moment().add(1, 'days').hour(8).minutes(0).seconds(0) + cy.get('#card-duedate-picker').should('have.value', tomorrow.format('YYYY-MM-DDTHH:mm')) + + const now = moment().hour(11).minutes(0).seconds(0).toDate() + cy.clock(now) + cy.log(now) + cy.tick(60_000) + + cy.get(`.card:contains("${newCardTitle}")`).find('[data-due-state="Now"]').should('be.visible').should('contain', '21 hours') + + + // Remove the due date again + cy.get('#app-sidebar-vue [data-cy-due-date-actions]').should('be.visible').click() + // tick needed to show the popover menu + cy.tick(1_000) + cy.get('[data-cy-due-date-remove] button').should('be.visible').click() + + cy.get(`.card:contains("${newCardTitle}")`).find('[data-due-state]').should('not.be.visible') + + }) + }) }) diff --git a/src/components/card/DueDateSelector.vue b/src/components/card/DueDateSelector.vue index 23b749162..dfdd56671 100644 --- a/src/components/card/DueDateSelector.vue +++ b/src/components/card/DueDateSelector.vue @@ -10,19 +10,26 @@ :placeholder="t('deck', 'Set a due date')" :hide-label="true" type="datetime-local" /> - + {{ shortcut.label }} - + @@ -31,6 +38,7 @@ {{ t('deck', 'Remove due date') }} From 7f36dd2b9dbaa2a7c18308d736f53ad8eb8a3952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 18 Oct 2023 11:21:27 +0200 Subject: [PATCH 3/3] fix: remove depecated OCA.Search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/main.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main.js b/src/main.js index bfb7d761c..145d48de6 100644 --- a/src/main.js +++ b/src/main.js @@ -90,10 +90,6 @@ new Vue({ this.$store.commit('setSearchQuery', '') }) - // FIXME remove this once Nextcloud 20 is minimum required version - // eslint-disable-next-line - new OCA.Search(this.filter, this.cleanSearch) - this.interval = setInterval(() => { this.time = Date.now() }, 1000)