cost-insights: migrate to new composability API
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-cost-insights': patch
|
||||
---
|
||||
|
||||
Migrated to new composability API, exporting the plugin instance as `costInsightsPlugin`, the root `'/cost-insights'` page as `CostInsightsPage`, the `'/cost-insights/investigating-growth'` page as `CostInsightsProjectGrowthInstructionsPage`, and the `'/cost-insights/labeling-jobs'` page as `CostInsightsLabelDataflowInstructionsPage`.
|
||||
@@ -16,10 +16,10 @@
|
||||
import { createDevApp } from '@backstage/dev-utils';
|
||||
import { costInsightsApiRef } from '../src/api';
|
||||
import { ExampleCostInsightsClient } from '../src/client';
|
||||
import { plugin } from '../src/plugin';
|
||||
import { costInsightsPlugin } from '../src/plugin';
|
||||
|
||||
createDevApp()
|
||||
.registerPlugin(plugin)
|
||||
.registerPlugin(costInsightsPlugin)
|
||||
.registerApi({
|
||||
api: costInsightsApiRef,
|
||||
deps: {},
|
||||
|
||||
@@ -14,7 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { plugin } from './plugin';
|
||||
export {
|
||||
costInsightsPlugin,
|
||||
costInsightsPlugin as plugin,
|
||||
CostInsightsPage,
|
||||
CostInsightsProjectGrowthInstructionsPage,
|
||||
CostInsightsLabelDataflowInstructionsPage,
|
||||
} from './plugin';
|
||||
export * from './client';
|
||||
export * from './api';
|
||||
export { ProjectGrowthAlert, UnlabeledDataflowAlert } from './alerts';
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { plugin } from './plugin';
|
||||
import { costInsightsPlugin } from './plugin';
|
||||
|
||||
describe('cost-insights', () => {
|
||||
it('should export plugin', () => {
|
||||
expect(plugin).toBeDefined();
|
||||
expect(costInsightsPlugin).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,10 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createPlugin, createRouteRef } from '@backstage/core';
|
||||
import { CostInsightsPage } from './components/CostInsightsPage';
|
||||
import { ProjectGrowthInstructionsPage } from './components/ProjectGrowthInstructionsPage';
|
||||
import { LabelDataflowInstructionsPage } from './components/LabelDataflowInstructionsPage';
|
||||
import {
|
||||
createPlugin,
|
||||
createRouteRef,
|
||||
createRoutableExtension,
|
||||
} from '@backstage/core';
|
||||
import { CostInsightsPage as CostInsightsPageComponent } from './components/CostInsightsPage';
|
||||
import { ProjectGrowthInstructionsPage as ProjectGrowthInstructionsPageComponent } from './components/ProjectGrowthInstructionsPage';
|
||||
import { LabelDataflowInstructionsPage as LabelDataflowInstructionsPageComponent } from './components/LabelDataflowInstructionsPage';
|
||||
|
||||
export const rootRouteRef = createRouteRef({
|
||||
path: '/cost-insights',
|
||||
@@ -34,12 +38,51 @@ export const unlabeledDataflowAlertRef = createRouteRef({
|
||||
title: 'Labeling Dataflow Jobs',
|
||||
});
|
||||
|
||||
export const plugin = createPlugin({
|
||||
export const costInsightsPlugin = createPlugin({
|
||||
id: 'cost-insights',
|
||||
register({ router, featureFlags }) {
|
||||
router.addRoute(rootRouteRef, CostInsightsPage);
|
||||
router.addRoute(projectGrowthAlertRef, ProjectGrowthInstructionsPage);
|
||||
router.addRoute(unlabeledDataflowAlertRef, LabelDataflowInstructionsPage);
|
||||
router.addRoute(rootRouteRef, CostInsightsPageComponent);
|
||||
router.addRoute(
|
||||
projectGrowthAlertRef,
|
||||
ProjectGrowthInstructionsPageComponent,
|
||||
);
|
||||
router.addRoute(
|
||||
unlabeledDataflowAlertRef,
|
||||
LabelDataflowInstructionsPageComponent,
|
||||
);
|
||||
featureFlags.register('cost-insights-currencies');
|
||||
},
|
||||
routes: {
|
||||
root: rootRouteRef,
|
||||
growthAlerts: projectGrowthAlertRef,
|
||||
unlabeledDataflowAlerts: unlabeledDataflowAlertRef,
|
||||
},
|
||||
});
|
||||
|
||||
export const CostInsightsPage = costInsightsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
component: () =>
|
||||
import('./components/CostInsightsPage').then(m => m.CostInsightsPage),
|
||||
mountPoint: rootRouteRef,
|
||||
}),
|
||||
);
|
||||
|
||||
export const CostInsightsProjectGrowthInstructionsPage = costInsightsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
component: () =>
|
||||
import('./components/ProjectGrowthInstructionsPage').then(
|
||||
m => m.ProjectGrowthInstructionsPage,
|
||||
),
|
||||
mountPoint: projectGrowthAlertRef,
|
||||
}),
|
||||
);
|
||||
|
||||
export const CostInsightsLabelDataflowInstructionsPage = costInsightsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
component: () =>
|
||||
import('./components/LabelDataflowInstructionsPage').then(
|
||||
m => m.LabelDataflowInstructionsPage,
|
||||
),
|
||||
mountPoint: unlabeledDataflowAlertRef,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user