implement change requests

Signed-off-by: secustor <sebastian@poxhofer.at>
This commit is contained in:
secustor
2025-10-22 22:32:29 +02:00
parent f23d44eff8
commit 45c2618e1f
9 changed files with 36 additions and 70 deletions
@@ -21,13 +21,12 @@ import {
RouteRef,
} from '@backstage/frontend-plugin-api';
import { JSX } from 'react';
import { contentTitleDataRef } from './extensionData';
/**
* Parameters for creating a DevTools route extension
* @public
*/
export interface DevToolsRouteBlueprintParams {
export interface DevToolsContentBlueprintParams {
path: string;
title: string;
loader: () => Promise<JSX.Element>;
@@ -35,11 +34,11 @@ export interface DevToolsRouteBlueprintParams {
}
/**
* Extension blueprint for creating DevTools routes
* Extension blueprint for creating DevTools content pages (appearing as tabs)
*
* @example
* ```tsx
* const myDevToolsRoute = DevToolsRouteBlueprint.make({
* const myDevToolsRoute = DevToolsContentBlueprint.make({
* params: {
* path: 'my-feature',
* title: 'My Feature',
@@ -56,18 +55,15 @@ export const DevToolsContentBlueprint = createExtensionBlueprint({
coreExtensionData.reactElement,
coreExtensionData.routePath,
coreExtensionData.routeRef.optional(),
contentTitleDataRef,
coreExtensionData.title,
],
dataRefs: {
title: contentTitleDataRef,
},
config: {
schema: {
path: z => z.string().optional(),
title: z => z.string().optional(),
},
},
*factory(params: DevToolsRouteBlueprintParams, { node, config }) {
*factory(params: DevToolsContentBlueprintParams, { node, config }) {
const path = config.path ?? params.path;
const title = config.title ?? params.title;
@@ -77,7 +73,7 @@ export const DevToolsContentBlueprint = createExtensionBlueprint({
yield coreExtensionData.routePath(path);
yield contentTitleDataRef(title);
yield coreExtensionData.title(title);
if (params.routeRef) {
yield coreExtensionData.routeRef(params.routeRef);
@@ -1,21 +0,0 @@
/*
* Copyright 2025 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';
/** @public */
export const contentTitleDataRef = createExtensionDataRef<string>().with({
id: 'devtools.content-title',
});
+1 -2
View File
@@ -20,7 +20,6 @@
* @packageDocumentation
*/
export {
type DevToolsRouteBlueprintParams,
type DevToolsContentBlueprintParams,
DevToolsContentBlueprint,
} from './devToolsContentBlueprint.tsx';
export { contentTitleDataRef } from './extensionData';