HDDS-15148. Prevent 404 when toggling between Old/New UI on UI-exclusive routes#10168
Open
chihsuan wants to merge 2 commits intoapache:masterfrom
Open
HDDS-15148. Prevent 404 when toggling between Old/New UI on UI-exclusive routes#10168chihsuan wants to merge 2 commits intoapache:masterfrom
chihsuan wants to merge 2 commits intoapache:masterfrom
Conversation
…ive routes Recon's Old and New UIs share most routes but have asymmetric paths: /Capacity exists only in New UI, /MissingContainers only in Old UI. The "Switch to" toggle previously swapped the routes table without rewriting the URL hash, so users on a UI-exclusive path saw a 404 after toggling. Validate the current path against the destination route table on toggle. If absent, redirect to /Overview and show an info toast explaining where the view actually lives. Skip parameterized routes when checking membership so the v1 /:NotFound catch-all does not falsely match every path.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Recon UI’s Old/New toggle behavior so switching UIs from a route that only exists in one UI no longer drops users into the 404 fallback. Instead, the toggle validates the current hash path against the destination UI’s route table and redirects to a safe default when needed, with a brief informational toast.
Changes:
- Add UI-toggle handling that detects UI-exclusive routes, redirects to
#/Overviewwhen the destination UI can’t serve the current path, and shows an antdmessage.infoexplanation when applicable. - Add
/Capacityto the v2 breadcrumb name map so breadcrumb/toast text uses “Cluster Capacity”. - Centralize the fallback path (
/Overview) into a constant used by both toggle logic and the root redirect.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/constants/breadcrumbs.constants.tsx |
Adds breadcrumb label for the v2-only /Capacity route (“Cluster Capacity”). |
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/app.tsx |
Implements route-table validation + redirect/toast behavior when toggling between UIs on UI-exclusive paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Recon's Old and New UIs share most routes but have asymmetric paths:
/Capacityexists only in the New UI,/MissingContainersonly in the Old UI. The "Switch to" toggle in the header previously swapped the active routes table without rewriting the URL hash, so users on a UI-exclusive path were dropped onto the bottom<Route component={NotFound}>fallback after toggling, producing a "404 Page Not Found :(" screen.This change validates the current path against the destination UI's route table on toggle. If the path is absent, the toggle:
/Overviewso the destination UI lands on its dashboardmessage.infotoast (4s) explaining where the view actually livesenableOldUItosessionStorageas before (no behavior change there)Both directions are covered: New → Old on
/Capacity(the case the Jira filed) and Old → New on/MissingContainers(a symmetric pre-existing bug with the same root cause). Parameterized routes are filtered when checking route-table membership so the v1/:NotFoundcatch-all does not falsely match every path./Capacitywas also added to the v2 breadcrumb name map so the toast text and breadcrumb display both refer to it as "Cluster Capacity".What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15148
How was this patch tested?
Manually verified using the Recon UI dev server (
pnpm devunderhadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web).Test 1 — New → Old on a New-UI-only path (the case the Jira filed)
http://localhost:3000/#/Capacitywhile on the New UI.#/Overview, the Old UI Overview renders, and an info toast appears: "The 'Cluster Capacity' view is only available in the New UI. We've returned you to the Overview dashboard."Before:
Screen.Recording.2026-05-01.at.8.31.10.PM.mov
After:
Screen.Recording.2026-05-01.at.9.08.01.PM.mov
Test 2 — Old → New on an Old-UI-only path (symmetric reverse case)
http://localhost:3000/#/MissingContainers.#/Overview, the New UI Overview renders, and the toast text reflects the Old UI as the source: "The 'Missing Containers' view is only available in the Old UI. We've returned you to the Overview dashboard."Before:
Screen.Recording.2026-05-01.at.8.37.56.PM.mov
After:
Screen.Recording.2026-05-01.at.9.08.22.PM.mov
Test 3 — No regression on shared paths
http://localhost:3000/#/Volumes(or any path that exists in both UIs)./Volumes, no toast, no redirect — same behavior as before this patch.Screen.Recording.2026-05-01.at.9.25.30.PM.mov
Test 4 — Non-existent / typo'd path
http://localhost:3000/#/RandomGarbage.#/Overviewwith no misleading "only available in..." toast (the path did not exist in either UI, so no source-UI message is meaningful).