create-app: Update scaffolder routes
This commit is contained in:
@@ -10,7 +10,11 @@ import { apis } from './apis';
|
||||
import * as plugins from './plugins';
|
||||
import { AppSidebar } from './sidebar';
|
||||
import { Route, Navigate } from 'react-router';
|
||||
import { Router as CatalogRouter } from '@backstage/plugin-catalog';
|
||||
import {
|
||||
catalogPlugin,
|
||||
CatalogIndexPage,
|
||||
CatalogEntityPage,
|
||||
} from '@backstage/plugin-catalog';
|
||||
import { Router as DocsRouter } from '@backstage/plugin-techdocs';
|
||||
import { CatalogImportPage } from '@backstage/plugin-catalog-import';
|
||||
import { Router as TechRadarRouter } from '@backstage/plugin-tech-radar';
|
||||
@@ -18,10 +22,16 @@ import { SearchPage as SearchRouter } from '@backstage/plugin-search';
|
||||
import { Router as SettingsRouter } from '@backstage/plugin-user-settings';
|
||||
|
||||
import { EntityPage } from './components/catalog/EntityPage';
|
||||
import { scaffolderPlugin, ScaffolderPage } from '@backstage/plugin-scaffolder';
|
||||
|
||||
const app = createApp({
|
||||
apis,
|
||||
plugins: Object.values(plugins),
|
||||
bindRoutes({ bind }) {
|
||||
bind(catalogPlugin.externalRoutes, {
|
||||
createComponent: scaffolderPlugin.routes.root,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const AppProvider = app.getProvider();
|
||||
@@ -37,11 +47,15 @@ const App = () => (
|
||||
<AppSidebar />
|
||||
<FlatRoutes>
|
||||
<Navigate key="/" to="/catalog" />
|
||||
<Route path="/catalog" element={<CatalogIndexPage />} />
|
||||
<Route
|
||||
path="/catalog"
|
||||
element={<CatalogRouter EntityPage={EntityPage} />}
|
||||
/>
|
||||
path="/catalog/:namespace/:kind/:name"
|
||||
element={<CatalogEntityPage />}
|
||||
>
|
||||
<EntityPage />
|
||||
</Route>
|
||||
<Route path="/docs" element={<DocsRouter />} />
|
||||
<Route path="/create" element={<ScaffolderPage />} />
|
||||
<Route
|
||||
path="/tech-radar"
|
||||
element={<TechRadarRouter width={1500} height={800} />}
|
||||
|
||||
+3
-3
@@ -5,11 +5,11 @@ import {
|
||||
Publishers,
|
||||
CreateReactAppTemplater,
|
||||
Templaters,
|
||||
CatalogEntityClient,
|
||||
} from '@backstage/plugin-scaffolder-backend';
|
||||
import { SingleHostDiscovery } from '@backstage/backend-common';
|
||||
import type { PluginEnvironment } from '../types';
|
||||
import Docker from 'dockerode';
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
|
||||
export default async function createPlugin({
|
||||
logger,
|
||||
@@ -29,7 +29,7 @@ export default async function createPlugin({
|
||||
const dockerClient = new Docker();
|
||||
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
const entityClient = new CatalogEntityClient({ discovery });
|
||||
const catalogClient = new CatalogClient({ discoveryApi: discovery })
|
||||
|
||||
return await createRouter({
|
||||
preparers,
|
||||
@@ -38,7 +38,7 @@ export default async function createPlugin({
|
||||
logger,
|
||||
config,
|
||||
dockerClient,
|
||||
entityClient,
|
||||
database,
|
||||
catalogClient,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user