Skip to content

Commit

Permalink
refactor: enhance routing consistency by updating bucket navigation p…
Browse files Browse the repository at this point in the history
…aths and internal route matching for account-related routes
  • Loading branch information
hervedombya committed Jan 20, 2025
1 parent 77e97e3 commit 457a2a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/react/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions src/react/account/AccountRoleSelectButtonAndModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 6 additions & 1 deletion src/react/databrowser/buckets/Buckets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ export default function Buckets() {

// Redirect to the first bucket if no bucket name is provided
if (!bucketNameParam) {
return <Navigate to={`${pathname}/${buckets.value[0].name}`} replace />;
return (
<Navigate
to={`${basePath}/accounts/${account?.Name}/buckets/${buckets.value[0].name}`}
replace
/>
);
}

// Replace the old bucket name with the new one when switching accounts
Expand Down

0 comments on commit 457a2a4

Please sign in to comment.