Remove NavItemBlueprint in favor of page-based nav discovery
Drop the deprecated NavItemBlueprint from the public API and migrate core plugins to set title and icon on PageBlueprint instead. AppNav keeps backward compatibility for legacy nav-item extensions via an internal core.nav-item.target data ref. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,12 +22,12 @@ import { ConfigReader } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import {
|
||||
createExtension,
|
||||
createExtensionDataRef,
|
||||
ExtensionDefinition,
|
||||
coreExtensionData,
|
||||
RouteRef,
|
||||
useRouteRef,
|
||||
IconComponent,
|
||||
NavItemBlueprint,
|
||||
createFrontendPlugin,
|
||||
FrontendFeature,
|
||||
createFrontendModule,
|
||||
@@ -49,6 +49,13 @@ const DEFAULT_MOCK_CONFIG = {
|
||||
backend: { baseUrl: 'http://localhost:7007' },
|
||||
};
|
||||
|
||||
// Must match the data ref in @backstage/plugin-app/src/extensions/legacyNavItem.ts
|
||||
const legacyNavItemTargetDataRef = createExtensionDataRef<{
|
||||
title: string;
|
||||
icon: IconComponent;
|
||||
routeRef: RouteRef<undefined>;
|
||||
}>().with({ id: 'core.nav-item.target' });
|
||||
|
||||
/**
|
||||
* Options to customize the behavior of the test app.
|
||||
* @public
|
||||
@@ -143,7 +150,7 @@ const appPluginOverride = appPlugin.withOverrides({
|
||||
{inputs.items.map(
|
||||
(item: (typeof inputs.items)[number], index: number) => {
|
||||
const { icon, title, routeRef } = item.get(
|
||||
NavItemBlueprint.dataRefs.target,
|
||||
legacyNavItemTargetDataRef,
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user