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
+4 -14
View File
@@ -4,23 +4,15 @@
```ts
import { AnyRouteRefParams } from '@backstage/frontend-plugin-api';
import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api';
import { ExtensionBlueprint } from '@backstage/frontend-plugin-api';
import { ExtensionDataRef } from '@backstage/frontend-plugin-api';
import { JSX as JSX_2 } from 'react';
import { RouteRef } from '@backstage/frontend-plugin-api';
// @public (undocumented)
export const contentTitleDataRef: ConfigurableExtensionDataRef<
string,
'devtools.content-title',
{}
>;
// @public
export const DevToolsContentBlueprint: ExtensionBlueprint<{
kind: 'devtools-content';
params: DevToolsRouteBlueprintParams;
params: DevToolsContentBlueprintParams;
output:
| ExtensionDataRef<string, 'core.routing.path', {}>
| ExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
@@ -31,7 +23,7 @@ export const DevToolsContentBlueprint: ExtensionBlueprint<{
optional: true;
}
>
| ExtensionDataRef<string, 'devtools.content-title', {}>;
| ExtensionDataRef<string, 'core.title', {}>;
inputs: {};
config: {
path: string | undefined;
@@ -41,13 +33,11 @@ export const DevToolsContentBlueprint: ExtensionBlueprint<{
title?: string | undefined;
path?: string | undefined;
};
dataRefs: {
title: ConfigurableExtensionDataRef<string, 'devtools.content-title', {}>;
};
dataRefs: never;
}>;
// @public
export interface DevToolsRouteBlueprintParams {
export interface DevToolsContentBlueprintParams {
// (undocumented)
loader: () => Promise<JSX_2.Element>;
// (undocumented)
@@ -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';