welcome: port to new composability API

This commit is contained in:
Patrik Oldsberg
2021-02-01 18:50:17 +01:00
parent 5df0714a84
commit 5efc24a57c
3 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { plugin } from './plugin';
export { welcomePlugin, welcomePlugin as plugin, WelcomePage } from './plugin';
+2 -2
View File
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { plugin } from './plugin';
import { welcomePlugin } from './plugin';
describe('welcome', () => {
it('should export plugin', () => {
expect(plugin).toBeDefined();
expect(welcomePlugin).toBeDefined();
});
});
+15 -5
View File
@@ -14,18 +14,28 @@
* limitations under the License.
*/
import { createPlugin, createRouteRef } from '@backstage/core';
import WelcomePage from './components/WelcomePage';
import {
createPlugin,
createRoutableExtension,
createRouteRef,
} from '@backstage/core';
import WelcomePageComponent from './components/WelcomePage';
export const rootRouteRef = createRouteRef({
path: '/welcome',
title: 'Welcome',
});
export const plugin = createPlugin({
export const welcomePlugin = createPlugin({
id: 'welcome',
register({ router, featureFlags }) {
router.addRoute(rootRouteRef, WelcomePage);
router.addRoute(rootRouteRef, WelcomePageComponent);
featureFlags.register('enable-welcome-box');
},
});
export const WelcomePage = welcomePlugin.provide(
createRoutableExtension({
component: () => import('./components/WelcomePage').then(m => m.default),
mountPoint: rootRouteRef,
}),
);