From 564533604047c2185de21fbf2762453212ae0449 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 28 Feb 2024 07:55:11 +0100 Subject: [PATCH 01/10] refs #6795 hotFix(claimSummary) fix ItemDescriptorProxy --- src/pages/Claim/Card/ClaimSummary.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index b93cbbd81..7d6def871 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -259,7 +259,7 @@ function openDialog(dmsId) { > From 09e18dfc017e2210f18e994e5cea31b3bd88bbb7 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 14 Mar 2024 09:07:34 +0100 Subject: [PATCH 02/10] refs #7033 deploy(2412): dev to test --- test/cypress/integration/worker/workerList.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cypress/integration/worker/workerList.spec.js b/test/cypress/integration/worker/workerList.spec.js index b5c57f920..bc4b2383e 100644 --- a/test/cypress/integration/worker/workerList.spec.js +++ b/test/cypress/integration/worker/workerList.spec.js @@ -16,7 +16,7 @@ describe('WorkerList', () => { it('should open the worker summary', () => { cy.openListSummary(0); cy.get('.summaryHeader div').should('have.text', '1110 - Jessica Jones'); - cy.get('.summary .header').eq(0).invoke('text').should('include', 'Basic data'); - cy.get('.summary .header').eq(1).should('have.text', 'User data'); + cy.get('.summary .header-link').eq(0).invoke('text').should('include', 'Basic data'); + cy.get('.summary .header-link').eq(1).should('have.text', 'User data'); }); }); From 78e3cff397201b110203925299b669f34ad146ae Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 14 Mar 2024 09:08:27 +0100 Subject: [PATCH 03/10] refs #7033 deploy: init version 2414 --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a679cdfc..dbf6bdcc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2414.01] - 2024-04-04 + +### Added + +### Changed + +### Fixed + ## [2400.01] - 2024-01-04 ### Added diff --git a/package.json b/package.json index beae0b7b9..a35020b66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.12.0", + "version": "24.14.0", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", From f1d21915eb55bc76b3bc21f821418a111f0f22e8 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 14 Mar 2024 09:28:28 +0000 Subject: [PATCH 04/10] fix vnlocation.spec --- test/cypress/integration/VnLocation.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cypress/integration/VnLocation.spec.js b/test/cypress/integration/VnLocation.spec.js index 02b924e4d..5892e3ad5 100644 --- a/test/cypress/integration/VnLocation.spec.js +++ b/test/cypress/integration/VnLocation.spec.js @@ -40,9 +40,9 @@ describe('VnLocation', () => { cy.waitForElement('.q-card'); }); - it('Show all options', function() { + it('Show locations options', function() { cy.get(inputLocation).click(); - cy.get(locationOptions).should('have.length', 1); + cy.get(locationOptions).should('have.length', 5); }); }); }) From 445d95057a7395dacbea495dd0daa0810df11bcd Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 15 Mar 2024 12:42:08 +0100 Subject: [PATCH 05/10] refs #6930 feat: trycatchfinally logout --- src/composables/useSession.js | 69 ++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/src/composables/useSession.js b/src/composables/useSession.js index 580efbdf8..507e63c0f 100644 --- a/src/composables/useSession.js +++ b/src/composables/useSession.js @@ -2,9 +2,11 @@ import { useState } from './useState'; import { useRole } from './useRole'; import { useUserConfig } from './useUserConfig'; import axios from 'axios'; - +import useNotify from './useNotify'; export function useSession() { + const { notify } = useNotify(); + function getToken() { const localToken = localStorage.getItem('token'); const sessionToken = sessionStorage.getItem('token'); @@ -29,37 +31,52 @@ export function useSession() { } async function destroy() { - if (localStorage.getItem('tokenMultimedia')){ - await axios.post('VnUsers/logoutMultimedia', null, { - headers: {Authorization: localStorage.getItem('tokenMultimedia') } - }); - localStorage.removeItem('tokenMultimedia') - + if (localStorage.getItem('tokenMultimedia')) { + try { + await axios.post('Accounts/logout', null, { + headers: { Authorization: localStorage.getItem('tokenMultimedia') }, + }); + } catch (error) { + notify('errors.userConfig', 'negative'); + } finally { + localStorage.removeItem('tokenMultimedia'); + } } - if (localStorage.getItem('token')){ - await axios.post('VnUsers/logout', null, { - headers: {Authorization: localStorage.getItem('token') } - }); - localStorage.removeItem('token') + if (localStorage.getItem('token')) { + try { + await axios.post('VnUsers/logout', null, { + headers: { Authorization: localStorage.getItem('token') }, + }); + } catch (error) { + notify('errors.userConfig', 'negative'); + } finally { + localStorage.removeItem('token'); + } } - - if (sessionStorage.getItem('tokenMultimedia')){ - await axios.post('VnUsers/logoutMultimedia', null, { - headers: {Authorization: sessionStorage.getItem('tokenMultimedia') } - }); - sessionStorage.removeItem('tokenMultimedia') - + if (sessionStorage.getItem('tokenMultimedia')) { + try { + await axios.post('Accounts/logout', null, { + headers: { Authorization: sessionStorage.getItem('tokenMultimedia') }, + }); + } catch (error) { + notify('errors.userConfig', 'negative'); + } finally { + sessionStorage.removeItem('tokenMultimedia'); + } } - if (sessionStorage.getItem('token')){ - await axios.post('VnUsers/logout', null, { - headers: {Authorization: sessionStorage.getItem('token') } - }); - sessionStorage.removeItem('token') + if (sessionStorage.getItem('token')) { + try { + await axios.post('VnUsers/logout', null, { + headers: { Authorization: sessionStorage.getItem('token') }, + }); + } catch (error) { + notify('errors.userConfig', 'negative'); + } finally { + sessionStorage.removeItem('token'); + } } - - const { setUser } = useState(); setUser({ From 0d3d002baf5265acbb226270ea5ac2d25e76e282 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 15 Mar 2024 12:43:56 +0100 Subject: [PATCH 06/10] refs #6930 perf: replace label --- src/composables/useSession.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/composables/useSession.js b/src/composables/useSession.js index 507e63c0f..aa20dde20 100644 --- a/src/composables/useSession.js +++ b/src/composables/useSession.js @@ -37,7 +37,7 @@ export function useSession() { headers: { Authorization: localStorage.getItem('tokenMultimedia') }, }); } catch (error) { - notify('errors.userConfig', 'negative'); + notify('errors.statusUnauthorized', 'negative'); } finally { localStorage.removeItem('tokenMultimedia'); } @@ -48,7 +48,7 @@ export function useSession() { headers: { Authorization: localStorage.getItem('token') }, }); } catch (error) { - notify('errors.userConfig', 'negative'); + notify('errors.statusUnauthorized', 'negative'); } finally { localStorage.removeItem('token'); } @@ -60,7 +60,7 @@ export function useSession() { headers: { Authorization: sessionStorage.getItem('tokenMultimedia') }, }); } catch (error) { - notify('errors.userConfig', 'negative'); + notify('errors.statusUnauthorized', 'negative'); } finally { sessionStorage.removeItem('tokenMultimedia'); } @@ -71,7 +71,7 @@ export function useSession() { headers: { Authorization: sessionStorage.getItem('token') }, }); } catch (error) { - notify('errors.userConfig', 'negative'); + notify('errors.statusUnauthorized', 'negative'); } finally { sessionStorage.removeItem('token'); } From 63d195cbbf0de82a9bc1236bc0671b5dd296e914 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 15 Mar 2024 13:21:26 +0100 Subject: [PATCH 07/10] refs #6930 perf: refactor destroy method --- src/composables/useSession.js | 65 +++++++++++------------------------ 1 file changed, 20 insertions(+), 45 deletions(-) diff --git a/src/composables/useSession.js b/src/composables/useSession.js index aa20dde20..45d439b46 100644 --- a/src/composables/useSession.js +++ b/src/composables/useSession.js @@ -29,52 +29,27 @@ export function useSession() { sessionStorage.setItem('tokenMultimedia', data.tokenMultimedia); } } - + async function destroyToken(url, storage, key) { + if (storage.getItem(key)) { + try { + await axios.post(url, null, { + headers: { Authorization: storage.getItem(key) }, + }); + } catch (error) { + notify('errors.statusUnauthorized', 'negative'); + } finally { + storage.removeItem(key); + } + } + } async function destroy() { - if (localStorage.getItem('tokenMultimedia')) { - try { - await axios.post('Accounts/logout', null, { - headers: { Authorization: localStorage.getItem('tokenMultimedia') }, - }); - } catch (error) { - notify('errors.statusUnauthorized', 'negative'); - } finally { - localStorage.removeItem('tokenMultimedia'); - } - } - if (localStorage.getItem('token')) { - try { - await axios.post('VnUsers/logout', null, { - headers: { Authorization: localStorage.getItem('token') }, - }); - } catch (error) { - notify('errors.statusUnauthorized', 'negative'); - } finally { - localStorage.removeItem('token'); - } - } - - if (sessionStorage.getItem('tokenMultimedia')) { - try { - await axios.post('Accounts/logout', null, { - headers: { Authorization: sessionStorage.getItem('tokenMultimedia') }, - }); - } catch (error) { - notify('errors.statusUnauthorized', 'negative'); - } finally { - sessionStorage.removeItem('tokenMultimedia'); - } - } - if (sessionStorage.getItem('token')) { - try { - await axios.post('VnUsers/logout', null, { - headers: { Authorization: sessionStorage.getItem('token') }, - }); - } catch (error) { - notify('errors.statusUnauthorized', 'negative'); - } finally { - sessionStorage.removeItem('token'); - } + const tokens = { + tokenMultimedia: 'Accounts/logout', + token: 'VnUsers/logout', + }; + for (const [key, url] of Object.entries(tokens)) { + await destroyToken(url, localStorage, key); + await destroyToken(url, sessionStorage, key); } const { setUser } = useState(); From 55ef37584a9f3b87a461048c4326bee385123a52 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 15 Mar 2024 14:07:28 +0100 Subject: [PATCH 08/10] refs #6993 fix test front --- test/vitest/__tests__/components/Paginate.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/vitest/__tests__/components/Paginate.spec.js b/test/vitest/__tests__/components/Paginate.spec.js index 2a22ce438..f3bf01489 100644 --- a/test/vitest/__tests__/components/Paginate.spec.js +++ b/test/vitest/__tests__/components/Paginate.spec.js @@ -57,13 +57,13 @@ describe('VnPaginate', () => { await vm.paginate(); - expect(vm.store.skip).toEqual(3); - expect(vm.store.data.length).toEqual(6); + expect(vm.store.skip).toEqual(6); + expect(vm.store.data.length).toEqual(9); await vm.paginate(); - expect(vm.store.skip).toEqual(6); - expect(vm.store.data.length).toEqual(9); + expect(vm.store.skip).toEqual(9); + expect(vm.store.data.length).toEqual(12); }); }); From 62253e228270744980194554a47e278d9e86f1ae Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 18 Mar 2024 13:33:02 +0100 Subject: [PATCH 09/10] refs #6546 test(VnPaginate) skip --- test/vitest/__tests__/components/Paginate.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/vitest/__tests__/components/Paginate.spec.js b/test/vitest/__tests__/components/Paginate.spec.js index 2a22ce438..4b87a6ea3 100644 --- a/test/vitest/__tests__/components/Paginate.spec.js +++ b/test/vitest/__tests__/components/Paginate.spec.js @@ -2,7 +2,7 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; import { createWrapper, axios } from 'app/test/vitest/helper'; import VnPaginate from 'src/components/ui/VnPaginate.vue'; -describe('VnPaginate', () => { +describe.skip('VnPaginate', () => { const expectedUrl = '/api/customers'; let vm; From 9094ae8c883e9cd89602c181c3a6cc53d9a7607f Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 18 Mar 2024 15:02:50 +0100 Subject: [PATCH 10/10] test(VnPaginate) fix --- test/vitest/__tests__/components/Paginate.spec.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/vitest/__tests__/components/Paginate.spec.js b/test/vitest/__tests__/components/Paginate.spec.js index dcd74c72b..cf5e5d2ea 100644 --- a/test/vitest/__tests__/components/Paginate.spec.js +++ b/test/vitest/__tests__/components/Paginate.spec.js @@ -2,7 +2,7 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; import { createWrapper, axios } from 'app/test/vitest/helper'; import VnPaginate from 'src/components/ui/VnPaginate.vue'; -describe.skip('VnPaginate', () => { +describe('VnPaginate', () => { const expectedUrl = '/api/customers'; let vm; @@ -49,6 +49,8 @@ describe.skip('VnPaginate', () => { ], }); vm.arrayData.hasMoreData.value = true; + await vm.$nextTick(); + vm.store.data = [ { id: 1, name: 'Tony Stark' }, { id: 2, name: 'Jessica Jones' }, @@ -57,13 +59,13 @@ describe.skip('VnPaginate', () => { await vm.paginate(); - expect(vm.store.skip).toEqual(6); - expect(vm.store.data.length).toEqual(9); + expect(vm.store.skip).toEqual(3); + expect(vm.store.data.length).toEqual(6); await vm.paginate(); - expect(vm.store.skip).toEqual(9); - expect(vm.store.data.length).toEqual(12); + expect(vm.store.skip).toEqual(6); + expect(vm.store.data.length).toEqual(9); }); });