refactor: move blueprints to react package
Signed-off-by: secustor <sebastian@poxhofer.at>
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
"@backstage/errors": "workspace:^",
|
||||
"@backstage/frontend-plugin-api": "workspace:^",
|
||||
"@backstage/plugin-devtools-common": "workspace:^",
|
||||
"@backstage/plugin-devtools-react": "workspace:^",
|
||||
"@backstage/plugin-permission-react": "workspace:^",
|
||||
"@material-ui/core": "^4.9.13",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
createExtensionBlueprint,
|
||||
ExtensionBoundary,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { devToolsRouteDataRef } from './devToolsRouteDataRef';
|
||||
import { JSX } from 'react';
|
||||
|
||||
/**
|
||||
* Parameters for creating a DevTools route extension
|
||||
* @alpha
|
||||
*/
|
||||
export interface DevToolsRouteBlueprintParams {
|
||||
path: string;
|
||||
title: string;
|
||||
loader: () => Promise<JSX.Element>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension blueprint for creating DevTools routes
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* const myDevToolsRoute = DevToolsRouteBlueprint.make({
|
||||
* params: {
|
||||
* path: 'my-feature',
|
||||
* title: 'My Feature',
|
||||
* loader: () => import('./MyContent').then(m => ({ default: m.MyContent }))
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @alpha
|
||||
*/
|
||||
export const DevToolsRouteBlueprint = createExtensionBlueprint({
|
||||
kind: 'devtools-route',
|
||||
attachTo: { id: 'page:devtools', input: 'routes' },
|
||||
output: [devToolsRouteDataRef],
|
||||
factory(params: DevToolsRouteBlueprintParams, { node }) {
|
||||
const children = ExtensionBoundary.lazy(node, params.loader);
|
||||
|
||||
return [
|
||||
devToolsRouteDataRef({
|
||||
path: params.path,
|
||||
title: params.title,
|
||||
children,
|
||||
}),
|
||||
];
|
||||
},
|
||||
dataRefs: {
|
||||
route: devToolsRouteDataRef,
|
||||
},
|
||||
});
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
import { JSX } from 'react';
|
||||
|
||||
/**
|
||||
* Represents a DevTools route that can be contributed by extensions
|
||||
* @alpha
|
||||
*/
|
||||
export interface DevToolsRouteData {
|
||||
path: string;
|
||||
title: string;
|
||||
children: JSX.Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension data reference for DevTools routes
|
||||
* @alpha
|
||||
*/
|
||||
export const devToolsRouteDataRef =
|
||||
createExtensionDataRef<DevToolsRouteData>().with({
|
||||
id: 'devtools.route',
|
||||
});
|
||||
@@ -15,7 +15,3 @@
|
||||
*/
|
||||
|
||||
export { default } from './plugin';
|
||||
export { DevToolsRouteBlueprint } from './devToolsRouteBlueprint';
|
||||
export { devToolsRouteDataRef } from './devToolsRouteDataRef';
|
||||
export type { DevToolsRouteData } from './devToolsRouteDataRef';
|
||||
export type { DevToolsRouteBlueprintParams } from './devToolsRouteBlueprint';
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
} from '@backstage/core-compat-api';
|
||||
import BuildIcon from '@material-ui/icons/Build';
|
||||
import { rootRouteRef } from '../routes';
|
||||
import { devToolsRouteDataRef } from './devToolsRouteDataRef';
|
||||
import { devToolsRouteDataRef } from '@backstage/plugin-devtools-react';
|
||||
|
||||
/** @alpha */
|
||||
export const devToolsApi = ApiBlueprint.make({
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ConfigContent } from '../Content/ConfigContent';
|
||||
import { DevToolsLayout } from '../DevToolsLayout';
|
||||
import { InfoContent } from '../Content/InfoContent';
|
||||
import { RequirePermission } from '@backstage/plugin-permission-react';
|
||||
import { DevToolsRouteData } from '../../alpha/devToolsRouteDataRef';
|
||||
import { DevToolsRouteData } from '@backstage/plugin-devtools-react';
|
||||
|
||||
export interface DefaultDevToolsPageProps {
|
||||
extensionRoutes?: DevToolsRouteData[];
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { useOutlet } from 'react-router-dom';
|
||||
import { DefaultDevToolsPage } from '../DefaultDevToolsPage';
|
||||
import { DevToolsRouteData } from '../../alpha/devToolsRouteDataRef';
|
||||
import { DevToolsRouteData } from '@backstage/plugin-devtools-react';
|
||||
|
||||
export interface DevToolsPageProps {
|
||||
extensionRoutes?: DevToolsRouteData[];
|
||||
|
||||
Reference in New Issue
Block a user