Skip to content

feat: add /view/config and /view/views iframe embed routes#2893

Open
moshloop wants to merge 1 commit intomainfrom
feat/embed-config-views
Open

feat: add /view/config and /view/views iframe embed routes#2893
moshloop wants to merge 1 commit intomainfrom
feat/embed-config-views

Conversation

@moshloop
Copy link
Member

@moshloop moshloop commented Feb 27, 2026

Summary

  • Removes /view/topology/:id embed route and deletes TopologyCard page component
  • Adds /view/config/:id and sub-routes (/changes, /relationships, /access, /playbooks) that render the config detail tabs without the app sidebar — suitable for iframe embedding
  • Adds /view/views/:id and /view/views/:namespace/:name routes that render a View CRD without the app sidebar
  • Introduces ConfigDetailsBaseRouteContext so tab links inside the embed layout resolve to /view/config/:id/* instead of /catalog/:id/*, keeping navigation within the sidebar-free layout

Test plan

  • /view/config/:id renders config Spec tab with tab strip, no sidebar
  • Clicking tabs within /view/config/:id navigates to /view/config/:id/<tab> (not /catalog/)
  • /view/config/:id/changes, /relationships, /access, /playbooks each render their tab
  • /view/views/:id renders a View CRD without sidebar
  • /view/views/:namespace/:name resolves view by name and renders
  • /view/health is unaffected
  • Existing /catalog/:id/* routes still use /catalog tab links (no regression)
  • Auth redirect works correctly when embedded in an iframe

Summary by CodeRabbit

  • New Features
    • Added embedded pages for configuration resources with authorization controls
    • Added embedded view pages with access management
    • Chrome interface elements now conditionally hide in embedded contexts
    • Configuration detail routes are now configurable for flexible routing

@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aws-preview Ready Ready Preview Feb 27, 2026 0:19am
flanksource-ui Ready Ready Preview Feb 27, 2026 0:19am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

Walkthrough

This 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 /embed paths, and propagates a hideChrome prop through layout components to control UI chrome visibility in embedded contexts.

Changes

Cohort / File(s) Summary
Route Configuration & Context Setup
src/App.tsx, src/components/Configs/ConfigDetailsBaseRouteContext.tsx
Added /embed routes for config resources and views with authorization wrappers; replaced TopologyCardPage with ViewPage; introduced ConfigDetailsBaseRouteContext provider to manage base route and embedded state across config detail routes.
Config Details Components
src/components/Configs/ConfigDetailsTabs.tsx, src/components/Configs/ConfigTabsLinks.tsx
Updated ConfigDetailsTabs to consume ConfigDetailsBaseRouteContext and accept optional baseRoute prop; modified useConfigDetailsTabs hook to accept configurable baseRoute parameter and updated all tab path generation to use the new base route.
Layout & Chrome Control
src/ui/Layout/SearchLayout.tsx, src/pages/views/components/ViewLayout.tsx, src/pages/views/components/SingleView.tsx
Added hideChrome prop to SearchLayout and ViewLayout; implemented conditional chrome rendering (RefreshButton only when hideChrome is true); SingleView now computes hideChrome based on /embed/views/ path prefix and propagates it through layout components.
Removed Component
src/pages/TopologyCard.tsx
Deleted TopologyCardPage component which fetched and displayed topology data; functionality replaced by ViewPage used in new embed routes.

Possibly related PRs

Suggested reviewers

  • adityathebe
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding iframe embed routes for config and views resources under /view paths, with proper authorization handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/embed-config-views

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- 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
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between f5f9c44 and c8aff8f.

📒 Files selected for processing (8)
  • src/App.tsx
  • src/components/Configs/ConfigDetailsBaseRouteContext.tsx
  • src/components/Configs/ConfigDetailsTabs.tsx
  • src/components/Configs/ConfigTabsLinks.tsx
  • src/pages/TopologyCard.tsx
  • src/pages/views/components/SingleView.tsx
  • src/pages/views/components/ViewLayout.tsx
  • src/ui/Layout/SearchLayout.tsx
💤 Files with no reviewable changes (1)
  • src/pages/TopologyCard.tsx

Comment on lines +505 to +570
{/* 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>
}
/>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

rg -n "path:" src/components/Configs/ConfigTabsLinks.tsx

Repository: 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.tsx

Repository: 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 -160

Repository: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant