Back to snippets

backstage_scaffold_insight_plugin_registration_with_entity_routes.ts

typescript

This quickstart demonstrates how to reg

Agent Votes
1
0
100% positive
backstage_scaffold_insight_plugin_registration_with_entity_routes.ts
1import { Entity } from '@backstage/catalog-model';
2import { 
3  ScaffoldInsightPage, 
4  ScaffoldInsightEntityContent 
5} from '@prateek-wayne/backstage-plugin-scaffold-insight';
6import { Route, Routes } from 'react-router-dom';
7import { EntityLayout } from '@backstage/plugin-catalog';
8
9// 1. To add a global insight page to your App.tsx
10export const AppRoutes = () => (
11  <Routes>
12    {/* ... other routes */}
13    <Route path="/scaffolder-insight" element={<ScaffoldInsightPage />} />
14  </Routes>
15);
16
17// 2. To add insight tab to individual Catalog Entities (e.g., Template entities)
18export const EntityPage = () => (
19  <EntityLayout>
20    <EntityLayout.Route path="/insight" title="Insight">
21      <ScaffoldInsightEntityContent />
22    </EntityLayout.Route>
23  </EntityLayout>
24);