From 457a2a40df5db7421a75e1b1e7718f1e7bb18adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Dombya?= <135591453+hervedombya@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:51:31 +0100 Subject: [PATCH] refactor: enhance routing consistency by updating bucket navigation paths and internal route matching for account-related routes --- src/react/Routes.tsx | 3 ++- src/react/account/AccountRoleSelectButtonAndModal.tsx | 4 ++-- src/react/databrowser/buckets/Buckets.tsx | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/react/Routes.tsx b/src/react/Routes.tsx index 2d4ccf33d..246893778 100644 --- a/src/react/Routes.tsx +++ b/src/react/Routes.tsx @@ -304,7 +304,8 @@ function InternalRoutes() { doesRouteMatch('/buckets') || doesRouteMatch('/accounts/:accountName/buckets') || doesRouteMatch('/accounts/:accountName/data/buckets') || - doesRouteMatch('/accounts/:accountName/data/buckets/:bucketName'), + doesRouteMatch('/accounts/:accountName/data/buckets/:bucketName') || + doesRouteMatch('/accounts/:accountName/buckets/:bucketName'), }, { label: 'Workflows', diff --git a/src/react/account/AccountRoleSelectButtonAndModal.tsx b/src/react/account/AccountRoleSelectButtonAndModal.tsx index d7078283c..7c47d020b 100644 --- a/src/react/account/AccountRoleSelectButtonAndModal.tsx +++ b/src/react/account/AccountRoleSelectButtonAndModal.tsx @@ -199,9 +199,9 @@ const ModalFooter = ({ const replacePath = location.pathname.replace(accountName, assumedAccount); if (replacePath.includes('/buckets')) { - navigateWithBasename(`/accounts/${assumedAccount}/data/buckets`); + navigateWithBasename(`/accounts/${assumedAccount}/buckets`); } else if (replacePath.includes('/workflows')) { - navigateWithBasename(`/accounts/${assumedAccount}/data/workflows`); + navigateWithBasename(`/accounts/${assumedAccount}/workflows`); } else { navigate(replacePath); } diff --git a/src/react/databrowser/buckets/Buckets.tsx b/src/react/databrowser/buckets/Buckets.tsx index 67492722d..1b4ac23e4 100644 --- a/src/react/databrowser/buckets/Buckets.tsx +++ b/src/react/databrowser/buckets/Buckets.tsx @@ -81,7 +81,12 @@ export default function Buckets() { // Redirect to the first bucket if no bucket name is provided if (!bucketNameParam) { - return ; + return ( + + ); } // Replace the old bucket name with the new one when switching accounts