@@ -73,7 +73,7 @@ describe('collectLegacyRoutes', () => {
|
||||
defaultConfig: {},
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.scoringdata.service',
|
||||
id: 'api:score-card/plugin.scoringdata.service',
|
||||
attachTo: { id: 'root', input: 'apis' },
|
||||
disabled: false,
|
||||
},
|
||||
@@ -89,7 +89,7 @@ describe('collectLegacyRoutes', () => {
|
||||
defaultConfig: {},
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.stackstorm.service',
|
||||
id: 'api:stackstorm/plugin.stackstorm.service',
|
||||
attachTo: { id: 'root', input: 'apis' },
|
||||
disabled: false,
|
||||
},
|
||||
@@ -111,7 +111,7 @@ describe('collectLegacyRoutes', () => {
|
||||
defaultConfig: {},
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.puppetdb.service',
|
||||
id: 'api:puppetDb/plugin.puppetdb.service',
|
||||
attachTo: { id: 'root', input: 'apis' },
|
||||
disabled: false,
|
||||
},
|
||||
@@ -209,7 +209,7 @@ describe('collectLegacyRoutes', () => {
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.catalog.service',
|
||||
id: 'api:catalog/plugin.catalog.service',
|
||||
attachTo: {
|
||||
id: 'root',
|
||||
input: 'apis',
|
||||
@@ -218,7 +218,7 @@ describe('collectLegacyRoutes', () => {
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
id: 'api:catalog-react.starred-entities',
|
||||
id: 'api:catalog/catalog-react.starred-entities',
|
||||
attachTo: {
|
||||
id: 'root',
|
||||
input: 'apis',
|
||||
@@ -227,7 +227,7 @@ describe('collectLegacyRoutes', () => {
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.catalog.entity-presentation',
|
||||
id: 'api:catalog/plugin.catalog.entity-presentation',
|
||||
attachTo: {
|
||||
id: 'root',
|
||||
input: 'apis',
|
||||
@@ -241,7 +241,7 @@ describe('collectLegacyRoutes', () => {
|
||||
id: 'score-card',
|
||||
extensions: [
|
||||
{
|
||||
id: 'api:plugin.scoringdata.service',
|
||||
id: 'api:score-card/plugin.scoringdata.service',
|
||||
attachTo: { id: 'root', input: 'apis' },
|
||||
disabled: false,
|
||||
},
|
||||
|
||||
@@ -269,7 +269,7 @@ export function collectLegacyRoutes(
|
||||
...extensions,
|
||||
...Array.from(plugin.getApis()).map(factory =>
|
||||
ApiBlueprint.make({
|
||||
namespace: factory.api.id,
|
||||
name: factory.api.id,
|
||||
params: { factory },
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('convertLegacyApp', () => {
|
||||
defaultConfig: {},
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.scoringdata.service',
|
||||
id: 'api:score-card/plugin.scoringdata.service',
|
||||
attachTo: { id: 'root', input: 'apis' },
|
||||
disabled: false,
|
||||
},
|
||||
@@ -81,7 +81,7 @@ describe('convertLegacyApp', () => {
|
||||
defaultConfig: {},
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.stackstorm.service',
|
||||
id: 'api:stackstorm/plugin.stackstorm.service',
|
||||
attachTo: { id: 'root', input: 'apis' },
|
||||
disabled: false,
|
||||
},
|
||||
@@ -103,7 +103,7 @@ describe('convertLegacyApp', () => {
|
||||
defaultConfig: {},
|
||||
},
|
||||
{
|
||||
id: 'api:plugin.puppetdb.service',
|
||||
id: 'api:puppetDb/plugin.puppetdb.service',
|
||||
attachTo: { id: 'root', input: 'apis' },
|
||||
disabled: false,
|
||||
},
|
||||
|
||||
@@ -23,11 +23,12 @@ import React, {
|
||||
} from 'react';
|
||||
import {
|
||||
ExtensionOverrides,
|
||||
FrontendModule,
|
||||
FrontendPlugin,
|
||||
coreExtensionData,
|
||||
createExtension,
|
||||
createExtensionInput,
|
||||
createExtensionOverrides,
|
||||
createFrontendModule,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { getComponentData } from '@backstage/core-plugin-api';
|
||||
import { collectLegacyRoutes } from './collectLegacyRoutes';
|
||||
@@ -61,7 +62,7 @@ function selectChildren(
|
||||
/** @public */
|
||||
export function convertLegacyApp(
|
||||
rootElement: React.JSX.Element,
|
||||
): (FrontendPlugin | ExtensionOverrides)[] {
|
||||
): (FrontendPlugin | FrontendModule)[] {
|
||||
if (getComponentData(rootElement, 'core.type') === 'FlatRoutes') {
|
||||
return collectLegacyRoutes(rootElement);
|
||||
}
|
||||
@@ -104,7 +105,6 @@ export function convertLegacyApp(
|
||||
const [routesEl] = routesEls;
|
||||
|
||||
const CoreLayoutOverride = createExtension({
|
||||
namespace: 'app',
|
||||
name: 'layout',
|
||||
attachTo: { id: 'app', input: 'root' },
|
||||
inputs: {
|
||||
@@ -127,7 +127,6 @@ export function convertLegacyApp(
|
||||
},
|
||||
});
|
||||
const CoreNavOverride = createExtension({
|
||||
namespace: 'app',
|
||||
name: 'nav',
|
||||
attachTo: { id: 'app/layout', input: 'nav' },
|
||||
output: [],
|
||||
@@ -139,7 +138,8 @@ export function convertLegacyApp(
|
||||
|
||||
return [
|
||||
...collectedRoutes,
|
||||
createExtensionOverrides({
|
||||
createFrontendModule({
|
||||
pluginId: 'app',
|
||||
extensions: [CoreLayoutOverride, CoreNavOverride],
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -84,7 +84,7 @@ describe('convertLegacyPlugin', () => {
|
||||
});
|
||||
expect(internalConverted.featureFlags).toEqual([{ name: 'test-flag' }]);
|
||||
expect(internalConverted.extensions.map(e => e.id)).toEqual([
|
||||
'api:plugin.test.client',
|
||||
'api:test/plugin.test.client',
|
||||
'page:test',
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ import { BackstagePlugin as LegacyBackstagePlugin } from '@backstage/core-plugin
|
||||
import {
|
||||
ApiBlueprint,
|
||||
ExtensionDefinition,
|
||||
BackstagePlugin as NewBackstagePlugin,
|
||||
FrontendPlugin as NewBackstagePlugin,
|
||||
createFrontendPlugin,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { convertLegacyRouteRefs } from './convertLegacyRouteRef';
|
||||
@@ -29,7 +29,7 @@ export function convertLegacyPlugin(
|
||||
options: { extensions: ExtensionDefinition[] },
|
||||
): NewBackstagePlugin {
|
||||
const apiExtensions = Array.from(legacyPlugin.getApis()).map(factory =>
|
||||
ApiBlueprint.make({ namespace: factory.api.id, params: { factory } }),
|
||||
ApiBlueprint.make({ name: factory.api.id, params: { factory } }),
|
||||
);
|
||||
return createFrontendPlugin({
|
||||
id: legacyPlugin.getId(),
|
||||
|
||||
Reference in New Issue
Block a user