Skip to content

Convert ExecutionEnvironment route tree to react-router v6 Routes - #410

Merged
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:feature/react-router-execution-environment
Jun 15, 2026
Merged

Convert ExecutionEnvironment route tree to react-router v6 Routes#410
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:feature/react-router-execution-environment

Conversation

@blaipr

@blaipr blaipr commented Jun 14, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

Continues the react-router v5 → v6 route-tree migration. Converts the ExecutionEnvironment screen's route trees from the v5 <Switch>/<Route>/<Redirect> API to v6 <Routes>/<Route> via react-router-dom-v5-compat, following the pattern used for the Application, CredentialType, NotificationTemplate and Team route trees.

UI (no behavior change — same URLs, same panels):

  • ExecutionEnvironments.js (list router): <Switch><Routes>; child routes use the element prop; the detail route is /execution_environments/:id/* so the nested <ExecutionEnvironment> tree can match the rest of the path.
  • ExecutionEnvironment.js (detail router): <Switch><Routes> with relative child paths (edit, details, templates); the exact <Redirect> becomes an index route that <Navigate replace>s to details.
  • Tests: the list test is converted to RTL and a new detail test is added, both using renderWithContexts to assert real v6 route resolution (which panel renders per URL, index redirect, 404 error).
ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
ADDITIONAL INFORMATION
  • Part of the incremental react-router v6 migration; each screen's route tree is independent and converted on its own branch off main.
  • Tests: 8 route-resolution tests across the two suites; full screens/ExecutionEnvironment directory passes (10 suites / 51 tests).
  • npm --prefix awx/ui run lint clean on the changed source.

blaipr added 2 commits June 14, 2026 05:24
Migrate the ExecutionEnvironment list and detail route trees from the
react-router v5 <Switch>/<Route>/<Redirect> API to v6 <Routes>/<Route>
via react-router-dom-v5-compat, following the pattern used for the
Application, CredentialType, NotificationTemplate and Team route trees.

- ExecutionEnvironments.js: <Switch> -> <Routes>; child routes use the
  element prop; the detail route uses /execution_environments/:id/* so
  the nested <ExecutionEnvironment> tree matches the rest of the path.
- ExecutionEnvironment.js: <Switch> -> <Routes> with relative child
  paths (edit, details, templates); the exact <Redirect> becomes an
  index route that <Navigate>s to details.
- Convert the list test and add a detail test, both with
  renderWithContexts (RTL) to assert real v6 route resolution.
Under the v6 route tree the list's v5 useRouteMatch() returns match.url='/',
so the add/detail links resolved to //add and //:id/details. Build them
from the literal /execution_environments base instead.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Continues the incremental react-router v5 → v6 migration by converting the ExecutionEnvironment screen’s list and detail route trees to v6-style <Routes>/<Route> via react-router-dom-v5-compat, while updating/adding RTL tests to validate route resolution and redirects.

Changes:

  • Migrated ExecutionEnvironments (list) route tree from <Switch> to <Routes>, including updating the detail route to /execution_environments/:id/* for nested matching.
  • Migrated ExecutionEnvironment (detail) route tree from <Switch>/<Redirect> to <Routes> with relative child paths and an index redirect via <Navigate replace>.
  • Converted/added React Testing Library tests to assert real v6 route resolution, including index redirect and 404 behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironments.js Converts the list-level routing to v6-style <Routes> and adjusts the detail path to include /* for nested routing.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironment.js Converts the detail-level routing to v6-style nested <Routes>, using an index route redirect to details.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentList.js Removes reliance on useRouteMatch and updates links to explicit execution environment routes.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironments.test.js Converts the list routing test to RTL and validates which route branch resolves for key URLs.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironment.test.js Adds RTL coverage for detail routing, index redirect behavior, and 404 handling.

Comment thread awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironments.js Outdated
@blaipr

blaipr commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Fixed the doubled /* /* in the nested-route comment in 768410eae6.

@cigamit
cigamit merged commit 723f023 into ctrliq:main Jun 15, 2026
@cigamit cigamit self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants