From 17dba2ac99b351337d714614c7dadc5fd525878c Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 6 Nov 2024 12:51:06 +0100 Subject: [PATCH 1/3] feat: refs #7925 redirect to not found --- src/composables/useArrayData.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index a2eaa649a..e5742f771 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -260,9 +260,15 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { }); const { matched: matches } = router.currentRoute.value; const { path } = matches.at(-1); + const rowsNumber = store.data.length; + + if (path.includes(':id') && !rowsNumber) + return router.push({ + name: 'NotFound', + }); const to = - store?.data?.length === 1 + rowsNumber === 1 ? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`) : path.replace(/:id.*/, ''); -- 2.40.1 From c64f87533d264d3a62d8cc066f5ef71f475236db Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 7 Nov 2024 14:34:33 +0100 Subject: [PATCH 2/3] feat: refs #7925 wip redirect not found --- src/composables/useArrayData.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index e5742f771..8258b673e 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -262,15 +262,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { const { path } = matches.at(-1); const rowsNumber = store.data.length; - if (path.includes(':id') && !rowsNumber) - return router.push({ - name: 'NotFound', - }); - - const to = - rowsNumber === 1 - ? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`) - : path.replace(/:id.*/, ''); + let to; + if (path.includes(':id') && !rowsNumber) { + return router.push({ name: 'NotFound' }); + } else if (rowsNumber === 1) { + to = path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`); + } else { + to = path.replace(/:id.*/, ''); + } if (route.path != to) { const pushUrl = { path: to }; -- 2.40.1 From 1f79d871e3d8930877bd89fbe15b00230d6216a6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 7 Nov 2024 14:36:43 +0100 Subject: [PATCH 3/3] feat: refs #7925 w/o card redirect --- src/components/VnTable/VnTable.vue | 4 ++-- src/composables/useArrayData.js | 1 + src/router/modules/Supplier.js | 1 - src/router/modules/account.js | 1 - src/router/modules/agency.js | 1 - src/router/modules/claim.js | 1 - src/router/modules/customer.js | 1 - src/router/modules/department.js | 1 - src/router/modules/entry.js | 1 - src/router/modules/invoiceIn.js | 1 - src/router/modules/invoiceOut.js | 1 - src/router/modules/item.js | 1 - src/router/modules/itemType.js | 1 - src/router/modules/mailAlias.js | 1 - src/router/modules/order.js | 1 - src/router/modules/parking.js | 1 - src/router/modules/roadmap.js | 1 - src/router/modules/role.js | 1 - src/router/modules/route.js | 1 - src/router/modules/shelving.js | 1 - src/router/modules/ticket.js | 1 - src/router/modules/travel.js | 1 - src/router/modules/worker.js | 1 - src/router/modules/zone.js | 1 - 24 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index dc8671369..f30ac8cb0 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -274,7 +274,7 @@ const rowCtrlClickFunction = computed(() => { }); function redirectFn(id) { - router.push({ path: `/${$props.redirect}/${id}` }); + router.push({ path: `/${$props.redirect}/${id}/summary` }); } function stopEventPropagation(event) { @@ -599,7 +599,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {