diff --git a/CHANGELOG.md b/CHANGELOG.md index 10b7c73f7..dd75a00a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,187 @@ +# Version 25.10 - 2025-03-11 + +### Added 🆕 + +- chore: refs #6695 empty commit by:alexm +- chore: refs #6695 get docker compose version by:alexm +- chore: refs #6695 try use docker compose by:alexm +- feat: add --browser chromium by:Javier Segarra +- feat: docker pull back image by:alexm +- feat(jenkinsE2E): refs #6695 new image by:alexm +- feat(jenkinsE2E): refs #6695 try fix db by:alexm +- feat(jenkinsE2E): refs #6695 try new sintax by:alexm +- feat(Jenkinsfile): refs #8714 add CHANGE_TARGET environment variable logging (origin/8714-devToTest, 8714-devToTest) by:alexm +- feat: refs #6695 add additional test directories for Cypress integration tests in Jenkinsfile by:alexm +- feat: refs #6695 add cypress-cache volume to docker-compose.e2e.yml by:alexm +- feat: refs #6695 add Dockerfile for Cypress setup and update Jenkinsfile for installation steps by:alexm +- feat: refs #6695 add setup and e2e testing by:alexm +- feat: refs #6695 better stages for e2e by:alexm +- feat: refs #6695 better stages for e2e rollback by:alexm +- feat: refs #6695 install Cypress during Jenkins pipeline setup by:alexm +- feat: refs #6695 jenkins run e2e by:alexm +- feat: refs #6695 jenkins run e2e front deteach by:alexm +- feat: refs #6695 jenkins run e2e rebuild by:alexm +- feat: refs #6695 jenkins run e2e remove ports by:alexm +- feat: refs #6695 jenkins run e2e try down and rm by:alexm +- feat: refs #6695 jenkins run e2e try fix db by:alexm +- feat: refs #6695 jenkins run e2e whitout rebuild by:alexm +- feat: refs #6695 pull salix-back image and use by:alexm +- feat: refs #6695 run e2e in docker by:alexm +- feat: refs #6695 run front by:alexm +- feat: refs #6695 run front quasar build by:alexm +- feat: refs #6695 run parallel e2e in local by:alexm +- feat: refs #6695 update cypress cache path command in Jenkinsfile by:alexm +- feat: refs #6695 update cypress-cache volume path in docker-compose.e2e.yml by:alexm +- feat: refs #6695 update cypress command in Jenkinsfile and docker-compose.e2e.yml by:alexm +- feat: refs #6695 update Docker configurations and Cypress settings for improved local development (origin/6695-docker_push_2, 6695-docker_push_2) by:alexm +- feat: refs #6695 when failure, clean by:alexm +- feat: refs #7937 add import claim button to ClaimAction component by:jgallego +- feat: refs #7937 add shelving selection to claim actions with data fetching by:jgallego +- feat: refs #8348 Added grouping by:guillermo +- feat: refs #8402 added lost filters from Salix by:Jon +- feat: refs #8484 add addressId to createForm in CustomerDescriptor by:jorgep +- feat: refs #8484 overwrite Cypress visit command to ensure main element exists by:jorgep +- feat: refs #8555 added new filter field and translations by:Jon +- feat: refs #8593 added summary button & modified e2e tests by:provira +- feat: refs #8593 changed parking to VnTable and modified e2e tests by:provira +- feat: refs #8599 added new test and translations by:Jon +- feat: refs #8599 modified tests to be more complete and added new ones by:Jon +- feat: refs #8697 enable data-cy attribute for VnTable, update test cases to remove skips and adjust selectors by:pablone +- feat: rename test:unit by test:front by:Javier Segarra +- feat: try run salix back by:alexm +- fix: style w-80 by:Javier Segarra +- Merge pull request 'fix: style' (!1425) from warmfix_vntable_card_style into test by:Javier Segarra + +### Changed 📦 + +- ci: refs #6695 Docker & Jenkinsfile fixes/refactor by:Juan Ferrer Toribio +- ci: refs #6695 refactor Cypress setup in Jenkinsfile and replace local docker-compose with new configuration by:alexm +- perf: refs #6695 only necessary by:alexm +- refactor: adjust translation to standardize it by:Jon +- refactor: refs #6695 comment out vnComponent tests in Jenkinsfile by:alexm +- refactor: refs #6695 improve group size calculation for parallel test execution in Jenkinsfile by:alexm +- refactor: refs #6695 improve parallel test execution logic in Jenkinsfile by:alexm +- refactor: refs #6695 simplify Docker cleanup commands in Jenkinsfile by:alexm +- refactor: refs #6695 update Docker setup for Cypress and remove obsolete files by:alexm +- refactor: refs #6695 update E2E test execution to support parallel groups and improve by:alexm +- refactor: refs #6695 update Jenkinsfile and Dockerfile to use 'developer' by:alexm +- refactor: refs #6695 update Jenkinsfile to run E2E tests in parallel and simplify docker-compose command by:alexm +- refactor: refs #6897 clean up Cypress configuration and improve entry list filtering (origin/6897-fixEntryE2e) by:pablone +- refactor: refs #7414 update VnLog component to change display order value changes on update action by:jtubau +- refactor: refs #7937 align columns to the right and add shelvingCode to ClaimSummaryAction by:jgallego +- refactor: refs #8484 add data-cy attribute for claim photo image and update test to use it by:jorgep +- refactor: refs #8484 clean up test files by removing commented issue references and updating test cases by:jorgep +- refactor: refs #8484 enhance login command with session management and clean up unused commands by:jtubau +- refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load by:jtubau +- refactor: refs #8484 improve selectOption command with retry logic for visibility checks by:jtubau +- refactor: refs #8484 remove comment in wagonCreate.spec.js by:jtubau +- refactor: refs #8484 remove redundant visit command overwrite by:jorgep +- refactor: refs #8484 remove unnecessary domContentLoad calls from client tests by:jorgep +- refactor: refs #8484 remove unnecessary intercepts and waits in ticket and zone tests by:jorgep +- refactor: refs #8484 simplify image dialog test by using aliases for elements by:jorgep +- refactor: refs #8484 streamline assertions in ClaimNotes test by:jorgep +- refactor: refs #8484 streamline login command and remove commented code by:jorgep +- refactor: refs #8484 update specPattern to include all spec files and remove data-cy attribute by:jorgep +- refactor: refs #8594 update vehicle summary tests to use expected variable for consistency by:jtubau +- refactor: refs #8599 corrected it name by:Jon +- refactor: refs #8599 invoice out list e2e by:Jon +- refactor: refs #8599 requested changes by:Jon +- refactor: refs #8606 modified table height and deleted void file by:Jon +- refactor: refs #8606 modified table width and order by:Jon +- refactor: refs #8606 modified upcoming deliveries view by:Jon +- refactor: refs #8606 translations by:Jon +- refactor: refs #8618 simplify selectors and improve test readability in routeExtendedList.spec.js by:jtubau +- refactor: refs #8620 update RouteAutonomous to notify on data save and change invoice reference display by:jtubau +- refactor: remove default browser setting from Cypress configuration by:alexm +- refactor: remove unused variables by:alexm +- refactor: skip claimNotes by:alexm +- refactor: update labels and conditions in Claim components by:jgallego +- refactor: use constant for account input selector in VnAccountNumber tests by:alexm + +### Fixed 🛠️ + +- build: refs #6695 cypress-setup fix volume by:alexm +- build: refs #6695 cypress-setup fix volume (origin/6695-docker_push, 6695-docker_push) by:alexm +- ci: refs #6695 cypress reporter fix by:Juan Ferrer Toribio +- ci: refs #6695 Docker & Jenkinsfile fixes/refactor by:Juan Ferrer Toribio +- ci: refs #6695 JUnit report fixes by:Juan Ferrer Toribio +- ci: refs #6695 vitest junit file fix by:Juan Ferrer Toribio +- feat(jenkinsE2E): refs #6695 try fix db by:alexm +- feat: refs #6695 jenkins run e2e try fix db by:alexm +- fix: add data-cy attribute to card button for improved testing by:jtubau +- fix: added lost code by:Jon +- fix: add --init flag to Cypress Docker container for improved stability by:alexm +- fix: add mapper before Save by:Javier Segarra +- fix: cy.domContentLoad(); not exist by:alexm +- fix: elements position by:Javier Segarra +- fix: fixed select not filtering when typing by:Jon +- fix: fixed wagonTypeCreate test (origin/wagonTypeTestFix) by:PAU ROVIRA ROSALENY +- fix: fix sctions by:carlossa +- fix(Jenkinsfile): enhance Docker registry credentials handling with dynamic URL (origin/warmFix_use_withDockerRegistry, warmFix_use_withDockerRegistry) by:alexm +- fix(Jenkinsfile): update Docker registry credentials handling in E2E stage by:alexm +- fix: junit report by:alexm +- fix: merge revert by:alexm +- fix: merge test to dev by:alexm +- fix: prevent 'cypress run' error to show junit by:alexm +- fix: refs #6695 add --volumes flag to docker-compose down command by:alexm +- fix: refs #6695 checkErrors(folderName) by:alexm +- fix: refs #6695 clientBasicData by:alexm +- fix: refs #6695 dockerFile by:alexm +- fix: refs #6695 e2e.sh by:alexm +- fix: refs #6695 e2e stockBought by:alexm +- fix: refs #6695 fix e2e's by:alexm +- fix: refs #6695 storage by:alexm +- fix: refs #6695 try by:alexm +- fix: refs #6695 try parallel by:alexm +- fix: refs #6695 update Cypress cache handling and increase wait timeout for elements by:alexm +- fix: refs #6695 update Cypress configuration and Docker setup for improved testing by:alexm +- fix: refs #6695 update E2E stages to run tests in parallel for specific folders by:alexm +- fix: refs #6695 update remove Cypress installation by:alexm +- fix: refs #6695 zoneWarehouse est by:alexm +- fix: refs #6943 e2e clientList, formModel by:carlossa +- fix: refs #6943 formModel workerDepartment by:carlossa +- fix: refs #7323 e2e (origin/7323-fixe2e) by:carlossa +- fix: refs #7323 notification manager by:carlossa +- fix: refs #7414 updated default value rendering for non-update scenarios by:jtubau +- fix: refs #7414 update VnLog.vue to correctly display log actions and values by:jtubau +- fix: refs #7937 update claimId in ClaimAction test to reflect correct value (origin/7937-claimAgile) by:jgallego +- fix: refs #8484 ensure document is fully loaded before visiting pages in tests by:jorgep +- fix: refs #8484 fixed some tests to enable previously skipped cases and enhance functionality by:jtubau +- fix: refs #8484 remove unused addressId from createForm in CustomerDescriptor.vue by:jtubau +- fix: refs #8484 rollback by:jorgep +- fix: refs #8484 update Boss field type to 'selectWorker' and add selectWorkerOption command by:jtubau +- fix: refs #8484 update Boss type from 'selectWorker' to 'select' by:jorgep +- fix: refs #8484 update parking list URL to correct shelving path in integration test by:jtubau +- fix: refs #8484 update selector for buyLabel button in myEntry test by:jtubau +- fix: refs #8484 update selector for removing wagon type in wagonCreate.spec.js by:jtubau +- fix: refs #8484 update wagon type deletion selector and clean up unused code in commands.js by:jtubau +- fix: refs #8593 fixed parking e2e tests by:provira +- fix: refs #8606 fixed list e2e test by:Jon +- fix: refs #8620 add module name to InvoiceInSummary by:jtubau +- fix: refs #8623 fixed different errors by:Jon +- fix: remove info by:carlossa +- fix: remove old end-to-end test files before building Docker image by:alexm +- fix: revert cypress.config by:alexm +- fix: style w-80 by:Javier Segarra +- fix: unnecessary function by:alexm +- fix: update docker-compose command to remove volumes on teardown by:alexm +- fix: update Jenkinsfile to remove specific end-to-end test files by:alexm +- fix: update Jenkinsfile to use environment variable for Docker registry credentials by:alexm +- fix: warmFix vnInput dataCy by:alexm +- Merge pull request 'fix: style' (!1425) from warmfix_vntable_card_style into test by:Javier Segarra +- revert: browser chromium package.json by:Javier Segarra +- Revert "revert 1015acefb7e400be2d8b5958dba69b4d98276b34" by:alexm +- test: refs #6695 e2e fix allowedHosts by:alexm +- test: refs #6695 e2e fix back image by:alexm +- test: refs #6695 e2e fix base urls by:alexm +- test: refs #6695 e2e fix command by:alexm +- test: refs #6695 e2e fix connection db by:alexm +- test: refs #6695 e2e fix network by:alexm +- test: refs #6695 e2e fix sequential by:alexm +- test: refs #6695 fix e2e by:alexm +- test: refs #6695 fix e2e command by:alexm +- test: refs #6695 fix selectOption command by:alexm + # Version 25.08 - 2025-03-04 ### Added 🆕 diff --git a/Jenkinsfile b/Jenkinsfile index 63577dad5..2f11556b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -120,6 +120,8 @@ pipeline { def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs') sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY' + sh "docker-compose ${env.COMPOSE_PARAMS} pull back" + sh "docker-compose ${env.COMPOSE_PARAMS} pull db" sh "docker-compose ${env.COMPOSE_PARAMS} up -d" image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") { diff --git a/README.md b/README.md index 262e12e58..d280e29ce 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,18 @@ pnpm run test:front pnpm run test:e2e ``` +### Run e2e parallel + +```bash +pnpm run test:e2e:parallel +``` + +### View e2e parallel report + +```bash +pnpm run test:e2e:summary +``` + ### Build the app for production ```bash diff --git a/docs/Dockerfile.dev b/docs/Dockerfile.dev index 84a4d80bc..3117e2c20 100644 --- a/docs/Dockerfile.dev +++ b/docs/Dockerfile.dev @@ -25,6 +25,8 @@ RUN apt-get update \ libnss3 \ libxss1 \ libxtst6 \ + mesa-vulkan-drivers \ + vulkan-tools \ xauth \ xvfb \ && apt-get clean \ diff --git a/package.json b/package.json index 33b730b9e..076cbbb14 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore", "test:e2e": "cypress open", "test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run", - "test:e2e:parallel": "bash ./test/cypress/cypressParallel.sh", + "test:e2e:parallel": "bash ./test/cypress/run.sh", "test:e2e:summary": "bash ./test/cypress/summary.sh", "test": "echo \"See package.json => scripts for available tests.\" && exit 0", "test:front": "vitest", @@ -56,6 +56,7 @@ "eslint-plugin-cypress": "^4.1.0", "eslint-plugin-vue": "^9.32.0", "husky": "^8.0.0", + "junit-merge": "^2.0.0", "mocha": "^11.1.0", "postcss": "^8.4.23", "prettier": "^3.4.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 168fb9e0d..51fc75469 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -91,6 +91,9 @@ devDependencies: husky: specifier: ^8.0.0 version: 8.0.3 + junit-merge: + specifier: ^2.0.0 + version: 2.0.0 mocha: specifier: ^11.1.0 version: 11.1.0 @@ -4860,6 +4863,10 @@ packages: universalify: 2.0.1 dev: true + /fs-readdir-recursive@1.1.0: + resolution: {integrity: sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==} + dev: true + /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} @@ -5640,6 +5647,16 @@ packages: verror: 1.10.0 dev: true + /junit-merge@2.0.0: + resolution: {integrity: sha512-qwENzBWcdHPazNqPO0fKyFIqEyaSKyO0iyBeIU4Y/scjkXYpwTi88P2S/PWecqgMhzG2MOCwXk8QB9ucvXeIPw==} + hasBin: true + dependencies: + commander: 2.20.3 + fs-readdir-recursive: 1.1.0 + mkdirp: 0.5.6 + xmldoc: 1.3.0 + dev: true + /keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} dependencies: @@ -6037,7 +6054,6 @@ packages: hasBin: true dependencies: minimist: 1.2.8 - dev: false /mlly@1.7.4: resolution: {integrity: sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==} @@ -7253,6 +7269,10 @@ packages: resolution: {integrity: sha512-5f3k2PbGGp+YtKJjOItpg3P99IMD84E4HOvcfleTb5joCHNXYLsR9yWFPOYGgaeMPDubQILTCMdsFb2OMeOjtg==} dev: true + /sax@1.4.1: + resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} + dev: true + /scheduler@0.25.0: resolution: {integrity: sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==} dev: true @@ -8689,6 +8709,12 @@ packages: engines: {node: '>=4.0'} dev: true + /xmldoc@1.3.0: + resolution: {integrity: sha512-y7IRWW6PvEnYQZNZFMRLNJw+p3pezM4nKYPfr15g4OOW9i8VpeydycFuipE2297OvZnh3jSb2pxOt9QpkZUVng==} + dependencies: + sax: 1.4.1 + dev: true + /xunit-viewer@10.6.1(@babel/runtime@7.26.9)(@codemirror/autocomplete@6.18.6)(@codemirror/language@6.10.8)(@codemirror/lint@6.8.4)(@codemirror/search@6.5.10)(@codemirror/state@6.5.2)(@codemirror/theme-one-dark@6.1.2)(@codemirror/view@6.36.3)(codemirror@6.0.1)(react-dom@19.0.0)(react@19.0.0): resolution: {integrity: sha512-ZMprLPVhCQJf2KD56tv2hlOjc4T+KnUe1E9DkEBHnuliOq7IOXWJf61pxyBMo/7H83B7Ln0DIeWNMMbx/3I7Jg==} hasBin: true diff --git a/src/components/FilterItemForm.vue b/src/components/FilterItemForm.vue index cacfde1b3..cca8d80c3 100644 --- a/src/components/FilterItemForm.vue +++ b/src/components/FilterItemForm.vue @@ -188,7 +188,7 @@ const selectItem = ({ id }) => { > diff --git a/src/components/FilterTravelForm.vue b/src/components/FilterTravelForm.vue index c522d0269..4aad327b2 100644 --- a/src/components/FilterTravelForm.vue +++ b/src/components/FilterTravelForm.vue @@ -196,7 +196,7 @@ const selectTravel = ({ id }) => { > diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index 9a9949499..8e83bf579 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -77,6 +77,7 @@ watch( function findMatches(search, item) { const matches = []; function findRoute(search, item) { + if (!item?.children) return; for (const child of item.children) { if (search?.indexOf(child.name) > -1) { matches.push(child); @@ -92,7 +93,7 @@ function findMatches(search, item) { } function addChildren(module, route, parent) { - const menus = route?.meta?.menu ?? route?.menus?.[props.source]; //backwards compatible + const menus = route?.meta?.menu; if (!menus) return; const matches = findMatches(menus, route); @@ -107,11 +108,7 @@ function getRoutes() { main: getMainRoutes, card: getCardRoutes, }; - try { - handleRoutes[props.source](); - } catch (error) { - throw new Error(`Method is not defined`); - } + handleRoutes[props.source](); } function getMainRoutes() { const modules = Object.assign([], navigation.getModules().value); @@ -122,7 +119,6 @@ function getMainRoutes() { ); if (!moduleDef) continue; item.children = []; - addChildren(item.module, moduleDef, item.children); } @@ -132,21 +128,16 @@ function getMainRoutes() { function getCardRoutes() { const currentRoute = route.matched[1]; const currentModule = toLowerCamel(currentRoute.name); - let moduleDef = routes.find((route) => toLowerCamel(route.name) === currentModule); + let moduleDef; - if (!moduleDef) return; - if (!moduleDef?.menus) moduleDef = betaGetRoutes(); - addChildren(currentModule, moduleDef, items.value); -} - -function betaGetRoutes() { - let menuRoute; let index = route.matched.length - 1; - while (!menuRoute && index > 0) { - if (route.matched[index]?.meta?.menu) menuRoute = route.matched[index]; + while (!moduleDef && index > 0) { + if (route.matched[index]?.meta?.menu) moduleDef = route.matched[index]; index--; } - return menuRoute; + + if (!moduleDef) return; + addChildren(currentModule, moduleDef, items.value); } async function togglePinned(item, event) { diff --git a/src/components/TicketProblems.vue b/src/components/TicketProblems.vue index 255bea9cd..59be95035 100644 --- a/src/components/TicketProblems.vue +++ b/src/components/TicketProblems.vue @@ -28,6 +28,17 @@ defineProps({ row: { type: Object, required: true } }); {{ t('ticketSale.reserved') }} + + + {{ t('Ticket deleted') }} + + { (data) => ( (rectificativeTypeOptions = data), (transferInvoiceParams.cplusRectificationTypeFk = data.filter( - (type) => type.description == 'I – Por diferencias' + (type) => type.description == 'I – Por diferencias', )[0].id) ) " @@ -100,7 +100,7 @@ const makeInvoice = async () => { (data) => ( (siiTypeInvoiceOutsOptions = data), (transferInvoiceParams.siiTypeInvoiceOutFk = data.filter( - (type) => type.code == 'R4' + (type) => type.code == 'R4', )[0].id) ) " @@ -122,7 +122,6 @@ const makeInvoice = async () => { { :row-index="index" > @@ -1136,9 +1148,13 @@ es: .grid-create { display: grid; - grid-template-columns: repeat(auto-fit, minmax(150px, max-content)); + grid-template-columns: 1fr 1fr; + max-width: 100%; grid-gap: 20px; margin: 0 auto; + .col-span-2 { + grid-column: span 2; + } } .flex-one { diff --git a/src/components/__tests__/Leftmenu.spec.js b/src/components/__tests__/Leftmenu.spec.js index 4ab8b527f..0bcc587ac 100644 --- a/src/components/__tests__/Leftmenu.spec.js +++ b/src/components/__tests__/Leftmenu.spec.js @@ -15,10 +15,7 @@ vi.mock('src/router/modules', () => ({ meta: { title: 'customers', icon: 'vn:client', - }, - menus: { - main: ['CustomerList', 'CustomerCreate'], - card: ['CustomerBasicData'], + menu: ['CustomerList', 'CustomerCreate'], }, children: [ { @@ -50,14 +47,6 @@ vi.mock('src/router/modules', () => ({ ], }, }, - { - path: 'create', - name: 'CustomerCreate', - meta: { - title: 'createCustomer', - icon: 'vn:addperson', - }, - }, ], }, ], @@ -98,7 +87,7 @@ vi.spyOn(vueRouter, 'useRoute').mockReturnValue({ icon: 'vn:client', moduleName: 'Customer', keyBinding: 'c', - menu: 'customer', + menu: ['customer'], }, }, ], @@ -260,15 +249,6 @@ describe('Leftmenu as main', () => { }); }); - it('should handle a single matched route with a menu', () => { - const route = { - matched: [{ meta: { menu: 'customer' } }], - }; - - const result = vm.betaGetRoutes(); - - expect(result.meta.menu).toEqual(route.matched[0].meta.menu); - }); it('should get routes for main source', () => { vm.props.source = 'main'; vm.getRoutes(); @@ -351,8 +331,9 @@ describe('addChildren', () => { it('should handle routes with no meta menu', () => { const route = { - meta: {}, - menus: {}, + meta: { + menu: [], + }, }; const parent = []; diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index 44002c22a..620dc2ad2 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -1,50 +1,56 @@ diff --git a/src/components/common/VnCardBeta.vue b/src/components/common/VnCardBeta.vue deleted file mode 100644 index 620dc2ad2..000000000 --- a/src/components/common/VnCardBeta.vue +++ /dev/null @@ -1,74 +0,0 @@ - - diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index a29d1d429..744f84e6d 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -5,7 +5,7 @@ import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue'; import { useArrayData } from 'composables/useArrayData'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useState } from 'src/composables/useState'; -import { useRoute } from 'vue-router'; +import { useRoute, useRouter } from 'vue-router'; import { useClipboard } from 'src/composables/useClipboard'; import VnMoreOptions from './VnMoreOptions.vue'; @@ -42,6 +42,7 @@ const $props = defineProps({ const state = useState(); const route = useRoute(); +const router = useRouter(); const { t } = useI18n(); const { copyText } = useClipboard(); const { viewSummary } = useSummaryDialog(); @@ -50,6 +51,9 @@ let store; let entity; const isLoading = ref(false); const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName); +const DESCRIPTOR_PROXY = 'DescriptorProxy'; +const moduleName = ref(); +const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value; defineExpose({ getData }); onBeforeMount(async () => { @@ -76,15 +80,18 @@ onBeforeMount(async () => { ); }); -const routeName = computed(() => { - const DESCRIPTOR_PROXY = 'DescriptorProxy'; - +function getName() { let name = $props.dataKey; if ($props.dataKey.includes(DESCRIPTOR_PROXY)) { name = name.split(DESCRIPTOR_PROXY)[0]; } - return `${name}Summary`; + return name; +} +const routeName = computed(() => { + let routeName = getName(); + return `${routeName}Summary`; }); + async function getData() { store.url = $props.url; store.filter = $props.filter ?? {}; @@ -120,20 +127,35 @@ function copyIdText(id) { const emit = defineEmits(['onFetch']); -const iconModule = computed(() => route.matched[1].meta.icon); -const toModule = computed(() => - route.matched[1].path.split('/').length > 2 - ? route.matched[1].redirect - : route.matched[1].children[0].redirect, -); +const iconModule = computed(() => { + moduleName.value = getName(); + if (isSameModuleName) { + return router.options.routes[1].children.find((r) => r.name === moduleName.value) + ?.meta?.icon; + } else { + return route.matched[1].meta.icon; + } +}); + +const toModule = computed(() => { + moduleName.value = getName(); + if (isSameModuleName) { + return router.options.routes[1].children.find((r) => r.name === moduleName.value) + ?.children[0]?.redirect; + } else { + return route.matched[1].path.split('/').length > 2 + ? route.matched[1].redirect + : route.matched[1].children[0].redirect; + } +}); diff --git a/src/pages/Account/Alias/Card/AliasCard.vue b/src/pages/Account/Alias/Card/AliasCard.vue index f37bd7d0f..f3faa5bee 100644 --- a/src/pages/Account/Alias/Card/AliasCard.vue +++ b/src/pages/Account/Alias/Card/AliasCard.vue @@ -1,10 +1,10 @@