scaffolder: add editRouteRef and updated route declarations to use route refs
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -32,6 +32,12 @@ import {
|
||||
DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS,
|
||||
} from '../extensions';
|
||||
import { useElementFilter } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
actionsRouteRef,
|
||||
editRouteRef,
|
||||
scaffolderTaskRouteRef,
|
||||
selectedTemplateRouteRef,
|
||||
} from '../routes';
|
||||
|
||||
/**
|
||||
* The props for the entrypoint `ScaffolderPage` component the plugin.
|
||||
@@ -96,7 +102,6 @@ export const Router = (props: RouterProps) => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
path="/"
|
||||
element={
|
||||
<ScaffolderPage
|
||||
groups={groups}
|
||||
@@ -106,17 +111,17 @@ export const Router = (props: RouterProps) => {
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/templates/:templateName"
|
||||
path={selectedTemplateRouteRef.path}
|
||||
element={
|
||||
<SecretsContextProvider>
|
||||
<TemplatePage customFieldExtensions={fieldExtensions} />
|
||||
</SecretsContextProvider>
|
||||
}
|
||||
/>
|
||||
<Route path="/tasks/:taskId" element={<TaskPageElement />} />
|
||||
<Route path="/actions" element={<ActionsPage />} />
|
||||
<Route path={scaffolderTaskRouteRef.path} element={<TaskPageElement />} />
|
||||
<Route path={actionsRouteRef.path} element={<ActionsPage />} />
|
||||
<Route
|
||||
path="/edit"
|
||||
path={editRouteRef.path}
|
||||
element={
|
||||
<SecretsContextProvider>
|
||||
<TemplateEditorPage
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
import { useElementFilter } from '@backstage/core-plugin-api';
|
||||
import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { TemplateGroupFilter } from '../TemplateListPage/TemplateGroups';
|
||||
import { selectedTemplateRouteRef } from '../../routes';
|
||||
|
||||
/**
|
||||
* The Props for the Scaffolder Router
|
||||
@@ -77,7 +78,6 @@ export const Router = (props: PropsWithChildren<NextRouterProps>) => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
path="/"
|
||||
element={
|
||||
<TemplateListPage
|
||||
TemplateCardComponent={TemplateCardComponent}
|
||||
@@ -87,7 +87,7 @@ export const Router = (props: PropsWithChildren<NextRouterProps>) => {
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/templates/:templateName"
|
||||
path={selectedTemplateRouteRef.path}
|
||||
element={
|
||||
<SecretsContextProvider>
|
||||
<TemplateWizardPage customFieldExtensions={fieldExtensions} />
|
||||
|
||||
@@ -45,3 +45,9 @@ export const actionsRouteRef = createSubRouteRef({
|
||||
parent: rootRouteRef,
|
||||
path: '/actions',
|
||||
});
|
||||
|
||||
export const editRouteRef = createSubRouteRef({
|
||||
id: 'scaffolder/edit',
|
||||
parent: rootRouteRef,
|
||||
path: '/edit',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user