feat: add /view/config and /view/views iframe embed routes#2893
feat: add /view/config and /view/views iframe embed routes#2893
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR introduces embedded routes for config resources and views with a new context-based configuration system. It removes the TopologyCardPage component, adds ConfigDetailsBaseRouteContext for managing base routes and embedded state, updates routing to support Changes
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Remove /view/topology/:id embed route and TopologyCard page - Add /view/config/:id/[changes|relationships|access|playbooks] routes without sidebar - Add /view/views/:id and /view/views/:namespace/:name routes without sidebar - Parameterise useConfigDetailsTabs with baseRoute (default /catalog) so tab links stay within the embed layout via ConfigDetailsBaseRouteContext
b27e398 to
c8aff8f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/App.tsx`:
- Around line 505-570: Add missing embed routes for the config tabs so embedded
tab links don't break: register Route entries for
path="/embed/config/:id/insights", "/embed/config/:id/checks",
"/embed/config/:id/access-logs", and "/embed/config/:id/view/:viewId" using the
same pattern as the existing embed routes—wrap each element in
<ConfigDetailsBaseRouteProvider baseRoute="/embed/config" embedded> and pass the
corresponding page components (e.g., ConfigDetailsInsightsPage,
ConfigDetailsChecksPage, ConfigDetailsAccessLogsPage, ConfigDetailsViewPage)
through withAuthorizationAccessCheck with tables.database, "read", true to
preserve auth and embed context. Ensure component names match the imported page
components used elsewhere.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
src/App.tsxsrc/components/Configs/ConfigDetailsBaseRouteContext.tsxsrc/components/Configs/ConfigDetailsTabs.tsxsrc/components/Configs/ConfigTabsLinks.tsxsrc/pages/TopologyCard.tsxsrc/pages/views/components/SingleView.tsxsrc/pages/views/components/ViewLayout.tsxsrc/ui/Layout/SearchLayout.tsx
💤 Files with no reviewable changes (1)
- src/pages/TopologyCard.tsx
| {/* Config embed routes — no sidebar */} | ||
| <Route | ||
| path="/embed/config/:id" | ||
| element={ | ||
| <ConfigDetailsBaseRouteProvider baseRoute="/embed/config" embedded> | ||
| {withAuthorizationAccessCheck( | ||
| <ConfigDetailsPage />, | ||
| tables.database, | ||
| "read", | ||
| true | ||
| )} | ||
| </ConfigDetailsBaseRouteProvider> | ||
| } | ||
| /> | ||
| <Route | ||
| path="/embed/config/:id/changes" | ||
| element={ | ||
| <ConfigDetailsBaseRouteProvider baseRoute="/embed/config" embedded> | ||
| {withAuthorizationAccessCheck( | ||
| <ConfigDetailsChangesPage />, | ||
| tables.database, | ||
| "read", | ||
| true | ||
| )} | ||
| </ConfigDetailsBaseRouteProvider> | ||
| } | ||
| /> | ||
| <Route | ||
| path="/embed/config/:id/relationships" | ||
| element={ | ||
| <ConfigDetailsBaseRouteProvider baseRoute="/embed/config" embedded> | ||
| {withAuthorizationAccessCheck( | ||
| <ConfigDetailsRelationshipsPage />, | ||
| tables.database, | ||
| "read", | ||
| true | ||
| )} | ||
| </ConfigDetailsBaseRouteProvider> | ||
| } | ||
| /> | ||
| <Route | ||
| path="/embed/config/:id/access" | ||
| element={ | ||
| <ConfigDetailsBaseRouteProvider baseRoute="/embed/config" embedded> | ||
| {withAuthorizationAccessCheck( | ||
| <ConfigDetailsAccessPage />, | ||
| tables.database, | ||
| "read", | ||
| true | ||
| )} | ||
| </ConfigDetailsBaseRouteProvider> | ||
| } | ||
| /> | ||
| <Route | ||
| path="/embed/config/:id/playbooks" | ||
| element={ | ||
| <ConfigDetailsBaseRouteProvider baseRoute="/embed/config" embedded> | ||
| {withAuthorizationAccessCheck( | ||
| <ConfigDetailsPlaybooksPage />, | ||
| tables.database, | ||
| "read", | ||
| true | ||
| )} | ||
| </ConfigDetailsBaseRouteProvider> | ||
| } | ||
| /> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
rg -n "path:" src/components/Configs/ConfigTabsLinks.tsxRepository: flanksource/flanksource-ui
Length of output: 434
🏁 Script executed:
# Check if there are more embed/config routes beyond what's shown in the snippet (lines 505-570)
rg -n "path=\"/embed/config" src/App.tsxRepository: flanksource/flanksource-ui
Length of output: 293
🏁 Script executed:
# Check if ConfigTabsLinks has any conditional logic for embed mode
cat -n src/components/Configs/ConfigTabsLinks.tsx | head -160Repository: flanksource/flanksource-ui
Length of output: 5234
Add missing embed config routes for insights, checks, access-logs, and view tabs.
The ConfigTabsLinks hook generates tabs for Insights, Checks, Access Logs, and View tabs regardless of the base route. When baseRoute="/embed/config", these tabs are rendered but lack corresponding /embed/config/:id/insights, /embed/config/:id/checks, /embed/config/:id/access-logs, and /embed/config/:id/view/:viewId routes, causing navigation breakage or context loss when users click them.
Implement the missing embed routes to maintain embed context consistency.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/App.tsx` around lines 505 - 570, Add missing embed routes for the config
tabs so embedded tab links don't break: register Route entries for
path="/embed/config/:id/insights", "/embed/config/:id/checks",
"/embed/config/:id/access-logs", and "/embed/config/:id/view/:viewId" using the
same pattern as the existing embed routes—wrap each element in
<ConfigDetailsBaseRouteProvider baseRoute="/embed/config" embedded> and pass the
corresponding page components (e.g., ConfigDetailsInsightsPage,
ConfigDetailsChecksPage, ConfigDetailsAccessLogsPage, ConfigDetailsViewPage)
through withAuthorizationAccessCheck with tables.database, "read", true to
preserve auth and embed context. Ensure component names match the imported page
components used elsewhere.
Summary
/view/topology/:idembed route and deletesTopologyCardpage component/view/config/:idand sub-routes (/changes,/relationships,/access,/playbooks) that render the config detail tabs without the app sidebar — suitable for iframe embedding/view/views/:idand/view/views/:namespace/:nameroutes that render a View CRD without the app sidebarConfigDetailsBaseRouteContextso tab links inside the embed layout resolve to/view/config/:id/*instead of/catalog/:id/*, keeping navigation within the sidebar-free layoutTest plan
/view/config/:idrenders config Spec tab with tab strip, no sidebar/view/config/:idnavigates to/view/config/:id/<tab>(not/catalog/)/view/config/:id/changes,/relationships,/access,/playbookseach render their tab/view/views/:idrenders a View CRD without sidebar/view/views/:namespace/:nameresolves view by name and renders/view/healthis unaffected/catalog/:id/*routes still use/catalogtab links (no regression)Summary by CodeRabbit