Convert Job route tree to react-router v6 Routes - #417
Merged
Conversation
Migrate the Job list and detail route trees, including the job-type
disambiguation redirects, from the react-router v5
<Switch>/<Route>/<Redirect> API to v6 <Routes>/<Route> via
react-router-dom-v5-compat.
- Jobs.js: <Switch> -> <Routes> with explicit /jobs paths (the
useRouteMatch match.path is gone); the typed detail route uses
/jobs/:typeSegment/:id/* so the nested <Job> tree matches
details/output; the untyped /jobs/:id and /jobs/:id/(details|output)
routes still funnel through <JobTypeRedirect>; the legacy
/jobs/system/:id redirect becomes a dedicated /jobs/system/:id/* route
that <Navigate>s to /jobs/management/:id, preserving any sub-path.
- JobTypeRedirect.js: the standalone <Redirect from={path} to> becomes
<Navigate to replace>, dropping the path/useRouteMatch dependency.
- Job.js: <Switch> -> <Routes> with relative child paths (details,
output); the exact index <Redirect> becomes an index route that
<Navigate>s to output; isWorkflow is derived from typeSegment instead
of match.url; tab links built from the typeSegment/id route params.
- Tests: Jobs.test.js rewritten with renderWithContexts (RTL) to assert
real v6 route resolution (list, typed detail subtree, untyped type
redirects, and the system->management redirect); Job.test.js useParams
mock pointed at react-router-dom-v5-compat.
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the Job screen’s routing from react-router v5 (Switch/Redirect) to react-router v6-style route resolution (Routes/Route/Navigate) via react-router-dom-v5-compat, keeping existing URLs and redirect behavior while updating tests to assert v6 route matching.
Changes:
- Converted
JobsandJobroute trees to v6<Routes>withNavigate-based redirects (including legacy/jobs/system/:id/*handling). - Simplified
JobTypeRedirectby removing v5from/useRouteMatchusage and usingNavigate replace. - Rewrote
Jobs.test.jsto use RTL + memory history for real v6 route resolution; updatedJob.test.jsto mockuseParamsfrom the compat module.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| awx/ui/src/screens/Job/JobTypeRedirect.js | Replaces v5 Redirect with compat Navigate and removes path dependency. |
| awx/ui/src/screens/Job/Jobs.js | Converts the Jobs route tree to v6 Routes, adds legacy system→management redirect with splat preservation. |
| awx/ui/src/screens/Job/Job.js | Converts Job detail subroutes to v6 Routes with index redirect to output and param-based tab URLs. |
| awx/ui/src/screens/Job/Jobs.test.js | Moves from Enzyme to RTL and asserts route-branch selection/redirect outcomes. |
| awx/ui/src/screens/Job/Job.test.js | Updates router mocking to align with react-router-dom-v5-compat imports. |
- Make the JobTypeRedirect mock mirror the real view='output' default, and assert the untyped /jobs/:id route resolves to 'output' instead of a loose regex that also matched undefined. - Add a test that the legacy /jobs/system/:id/* redirect preserves the trailing sub-path (/jobs/system/5/output -> /jobs/management/5/output).
Contributor
Author
|
Thanks for the review. Addressed in |
cigamit
approved these changes
Jun 15, 2026
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.
SUMMARY
Continues the react-router v5 → v6 route-tree migration. Converts the Job screen's route trees - including the job-type disambiguation redirects - from the v5
<Switch>/<Route>/<Redirect>API to v6<Routes>/<Route>viareact-router-dom-v5-compat.UI (no behavior change - same URLs, same panels):
Jobs.js(list/redirect router):<Switch>-><Routes>with explicit/jobspaths (theuseRouteMatchmatch.pathis gone); the typed detail route is/jobs/:typeSegment/:id/*so the nested<Job>tree matchesdetails/output; the untyped/jobs/:idand/jobs/:id/(details|output)routes still funnel through<JobTypeRedirect>; the legacy/jobs/system/:idredirect becomes a dedicated/jobs/system/:id/*route that<Navigate>s to/jobs/management/:id, preserving any sub-path.JobTypeRedirect.js: the standalone<Redirect from={path} to>becomes<Navigate to replace>, which drops thepath/useRouteMatchdependency entirely.Job.js(detail router):<Switch>-><Routes>with relative child paths (details,output); the exact index<Redirect>becomes an index route that<Navigate>s tooutput;isWorkflowis derived fromtypeSegmentinstead ofmatch.url; tab links are built from thetypeSegment/idroute params.Jobs.test.jsrewritten withrenderWithContexts(RTL) to assert real v6 route resolution (list, typed detail subtree, untyped type redirects, and the system->management redirect);Job.test.jsuseParams mock pointed atreact-router-dom-v5-compat.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
main./jobs/:id/details,/jobs/:id/outputand/jobs/system/...routes ahead of the all-dynamic/jobs/:typeSegment/:id/*splat, preserving the original v5<Switch>order.screens/Jobdirectory passes (19 suites / 157 tests).npm --prefix awx/ui run lintclean on the changed source.