core-app-api, create-app, dev-utils: updates to use withDefaults

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-10-26 19:46:26 +02:00
parent e551a44c65
commit 44976c138c
3 changed files with 47 additions and 42 deletions
+16 -15
View File
@@ -27,12 +27,12 @@ import { Route } from 'react-router';
import {
AlertDisplay,
defaultAppComponents,
OAuthRequestDialog,
Sidebar,
SidebarItem,
SidebarPage,
SidebarSpacer,
withDefaults,
} from '@backstage/core-components';
import {
@@ -174,21 +174,22 @@ export class DevAppBuilder {
);
}
const app = createApp({
apis,
plugins: this.plugins,
themes: this.themes,
components: defaultAppComponents(),
bindRoutes: ({ bind }) => {
for (const plugin of this.plugins ?? []) {
const targets: Record<string, RouteRef<any>> = {};
for (const routeKey of Object.keys(plugin.externalRoutes)) {
targets[routeKey] = dummyRouteRef;
const app = createApp(
withDefaults({
apis,
plugins: this.plugins,
themes: this.themes,
bindRoutes: ({ bind }) => {
for (const plugin of this.plugins ?? []) {
const targets: Record<string, RouteRef<any>> = {};
for (const routeKey of Object.keys(plugin.externalRoutes)) {
targets[routeKey] = dummyRouteRef;
}
bind(plugin.externalRoutes, targets);
}
bind(plugin.externalRoutes, targets);
}
},
});
},
}),
);
const AppProvider = app.getProvider();
const AppRouter = app.getRouter();