chore: tidying up a little bit and added changeset
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': minor
|
||||
'@backstage/plugin-scaffolder-backend': minor
|
||||
---
|
||||
|
||||
Added the ability to support running of templates that are not in the `default` namespace
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { ComponentType } from 'react';
|
||||
import React, { ComponentType, useEffect } from 'react';
|
||||
import { Routes, Route, useOutlet, Navigate, useParams } from 'react-router';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
@@ -101,10 +101,20 @@ export const Router = (props: RouterProps) => {
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
/**
|
||||
* This component can be deleted once the older routes have been deprecated.
|
||||
*/
|
||||
const RedirectingComponent = () => {
|
||||
const { templateName } = useParams();
|
||||
const newLink = useRouteRef(selectedTemplateRouteRef);
|
||||
// eslint-disable-next-line no-console
|
||||
useEffect(
|
||||
() =>
|
||||
console.warn(
|
||||
'The route /template/:templateName is deprecated, please use the new /template/:namespace/:templateName route instead',
|
||||
),
|
||||
[],
|
||||
);
|
||||
return <Navigate to={newLink({ namespace: 'default', templateName })} />;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ export const rootRouteRef = createRouteRef({
|
||||
id: 'scaffolder',
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated This is the old template route, can be deleted before next major release
|
||||
*/
|
||||
export const legacySelectedTemplateRouteRef = createSubRouteRef({
|
||||
id: 'scaffolder/legacy/selected-template',
|
||||
parent: rootRouteRef,
|
||||
|
||||
Reference in New Issue
Block a user