diff --git a/cypress/integration/list/namespaces.spec.js b/cypress/integration/list/namespaces.spec.js index dbdba9156..9d3125b59 100644 --- a/cypress/integration/list/namespaces.spec.js +++ b/cypress/integration/list/namespaces.spec.js @@ -3,7 +3,6 @@ import {UserFactory} from '../../factories/user' import '../../support/authenticateUser' import {ListFactory} from '../../factories/list' import {NamespaceFactory} from '../../factories/namespace' -import {TaskFactory} from '../../factories/task' describe('Namepaces', () => { let namespaces @@ -99,4 +98,48 @@ describe('Namepaces', () => { cy.get('.namespace-container .menu.namespaces-lists') .should('not.contain', newNamespaces[0].title) }) + + it('Should not show archived lists & namespaces if the filter is not checked', () => { + const n = NamespaceFactory.create(1, { + id: 2, + is_archived: true, + }, false) + ListFactory.create(1, { + id: 2, + namespace_id: n[0].id, + }, false) + + ListFactory.create(1, { + id: 3, + is_archived: true, + }, false) + + // Initial + cy.visit('/namespaces') + cy.get('.namespaces-list .namespace') + .should('not.contain', 'Archived') + + // Show archived + cy.get('.namespaces-list .fancycheckbox.show-archived-check label.check span') + .should('be.visible') + .click() + cy.get('.namespaces-list .fancycheckbox.show-archived-check input') + .should('be.checked') + cy.get('.namespaces-list .namespace') + .should('contain', 'Archived') + + // Don't show archived + cy.get('.namespaces-list .fancycheckbox.show-archived-check label.check span') + .should('be.visible') + .click() + cy.get('.namespaces-list .fancycheckbox.show-archived-check input') + .should('not.be.checked') + + // Second time visiting after unchecking + cy.visit('/namespaces') + cy.get('.namespaces-list .fancycheckbox.show-archived-check input') + .should('not.be.checked') + cy.get('.namespaces-list .namespace') + .should('not.contain', 'Archived') + }) }) diff --git a/cypress/support/factory.js b/cypress/support/factory.js index 638464761..0c50bf8fc 100644 --- a/cypress/support/factory.js +++ b/cypress/support/factory.js @@ -21,7 +21,7 @@ export class Factory { * @param override * @returns {[]} */ - static create(count = 1, override = {}) { + static create(count = 1, override = {}, truncate = true) { const data = [] for (let i = 1; i <= count; i++) { @@ -38,7 +38,7 @@ export class Factory { data.push(entry) } - seed(this.table, data) + seed(this.table, data, truncate) return data } diff --git a/cypress/support/seed.js b/cypress/support/seed.js index acb1b2df4..d86152e2b 100644 --- a/cypress/support/seed.js +++ b/cypress/support/seed.js @@ -8,14 +8,14 @@ * @param table * @param data */ -export function seed(table, data = {}) { - if(data === null) { +export function seed(table, data = {}, truncate = true) { + if (data === null) { data = [] } cy.request({ method: 'PATCH', - url: `${Cypress.env('API_URL')}/test/${table}`, + url: `${Cypress.env('API_URL')}/test/${table}?truncate=${truncate ? 'true' : 'false'}`, headers: { 'Authorization': Cypress.env('TEST_SECRET'), }, diff --git a/package.json b/package.json index 504e3d72c..776316c88 100644 --- a/package.json +++ b/package.json @@ -19,14 +19,14 @@ "copy-to-clipboard": "3.3.1", "date-fns": "2.22.1", "dompurify": "2.2.9", - "highlight.js": "11.0.0", + "highlight.js": "11.0.1", "lodash": "4.17.21", "marked": "2.0.7", "register-service-worker": "1.7.2", - "sass": "1.34.0", + "sass": "1.34.1", "snake-case": "3.0.4", "verte": "0.0.12", - "vue": "2.6.13", + "vue": "2.6.14", "vue-advanced-cropper": "1.6.0", "vue-drag-resize": "1.5.4", "vue-easymde": "1.4.0", @@ -48,15 +48,15 @@ "babel-eslint": "10.1.0", "cypress": "7.4.0", "cypress-file-upload": "5.0.7", - "eslint": "7.27.0", + "eslint": "7.28.0", "eslint-plugin-vue": "7.10.0", "faker": "5.5.3", - "jest": "27.0.3", + "jest": "27.0.4", "sass-loader": "10.2.0", "vue-flatpickr-component": "8.1.6", "vue-notification": "1.3.20", "vue-router": "3.5.1", - "vue-template-compiler": "2.6.13", + "vue-template-compiler": "2.6.14", "wait-on": "5.3.0" }, "eslintConfig": { diff --git a/src/components/home/contentAuth.vue b/src/components/home/contentAuth.vue index cee4fadbd..576d77bf0 100644 --- a/src/components/home/contentAuth.vue +++ b/src/components/home/contentAuth.vue @@ -55,6 +55,7 @@ export default { }, created() { this.renewTokenOnFocus() + this.loadLabels() }, computed: mapState({ namespaces(state) { @@ -126,6 +127,12 @@ export default { showKeyboardShortcuts() { this.$store.commit(KEYBOARD_SHORTCUTS_ACTIVE, true) }, + loadLabels() { + this.$store.dispatch('labels/loadAllLabels') + .catch(e => { + this.error(e, this) + }) + }, }, } diff --git a/src/components/input/datepicker.vue b/src/components/input/datepicker.vue index b5fe5ff52..91ed9f617 100644 --- a/src/components/input/datepicker.vue +++ b/src/components/input/datepicker.vue @@ -118,6 +118,7 @@ import {calculateDayInterval} from '@/helpers/time/calculateDayInterval' import {calculateNearestHours} from '@/helpers/time/calculateNearestHours' import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside' import {createDateFromString} from '@/helpers/time/createDateFromString' +import {mapState} from 'vuex' export default { name: 'datepicker', @@ -127,14 +128,6 @@ export default { show: false, changed: false, - flatPickerConfig: { - altFormat: 'j M Y H:i', - altInput: true, - dateFormat: 'Y-m-d H:i', - enableTime: true, - time_24hr: true, - inline: true, - }, // Since flatpickr dates are strings, we need to convert them to native date objects. // To make that work, we need a separate variable since flatpickr does not have a change event. flatPickrDate: null, @@ -172,6 +165,19 @@ export default { this.updateData() }, }, + computed: mapState({ + flatPickerConfig: state => ({ + altFormat: 'j M Y H:i', + altInput: true, + dateFormat: 'Y-m-d H:i', + enableTime: true, + time_24hr: true, + inline: true, + locale: { + firstDayOfWeek: state.auth.settings.weekStart, + }, + }) + }), methods: { setDateValue(newVal) { if(newVal === null) { diff --git a/src/components/input/editor.vue b/src/components/input/editor.vue index 9c40a77ff..f91e2241a 100644 --- a/src/components/input/editor.vue +++ b/src/components/input/editor.vue @@ -34,11 +34,13 @@

{{ emptyText }} - Edit. +