diff --git a/packages/dev-utils/api-report.md b/packages/dev-utils/api-report.md index c44f7328b9..d30df29200 100644 --- a/packages/dev-utils/api-report.md +++ b/packages/dev-utils/api-report.md @@ -14,7 +14,6 @@ import { GridProps } from '@material-ui/core/Grid'; import { IconComponent } from '@backstage/core-plugin-api'; import { PropsWithChildren } from 'react'; import { ReactNode } from 'react'; -import { RouteRef } from '@backstage/core-plugin-api'; // @public export function createDevApp(): DevAppBuilder; @@ -43,8 +42,7 @@ export type DevAppPageOptions = { children?: JSX.Element; title?: string; icon?: IconComponent; - sideBarItem?: JSX.Element; - routeRef?: RouteRef; + sidebarItem?: JSX.Element; }; // @public (undocumented) diff --git a/packages/dev-utils/src/devApp/render.tsx b/packages/dev-utils/src/devApp/render.tsx index 1b57a4b9b7..26fd96052b 100644 --- a/packages/dev-utils/src/devApp/render.tsx +++ b/packages/dev-utils/src/devApp/render.tsx @@ -80,9 +80,7 @@ export type DevAppPageOptions = { children?: JSX.Element; title?: string; icon?: IconComponent; - sideBarItem?: JSX.Element; - - routeRef?: RouteRef; + sidebarItem?: JSX.Element; }; /** @@ -144,8 +142,8 @@ export class DevAppBuilder { this.defaultPage = path; } - if (opts.sideBarItem) { - this.sidebarItems.push(opts.sideBarItem); + if (opts.sidebarItem) { + this.sidebarItems.push(opts.sidebarItem); } else if (opts.title) { this.sidebarItems.push( <>{opts.element}; - attachComponentData(Elem, 'core.mountPoint', opts.routeRef); - - this.routes.push( - } - children={opts.children} - />, - ); - } else { - this.routes.push( - , - ); - } + this.routes.push( + , + ); return this; } diff --git a/plugins/notifications-backend/dev/index.ts b/plugins/notifications-backend/dev/index.ts index 987f984dcb..fe35606dd2 100644 --- a/plugins/notifications-backend/dev/index.ts +++ b/plugins/notifications-backend/dev/index.ts @@ -35,8 +35,7 @@ const notificationsDebug = createBackendPlugin({ interval = setInterval(async () => { await notifications.send({ recipients: { - type: 'entity', - entityRef: 'user:development/guest', + type: 'broadcast', }, payload: { title: 'Test notification' }, }); diff --git a/plugins/notifications-backend/src/service/router.ts b/plugins/notifications-backend/src/service/router.ts index 0bce3d4bb3..4c38d2ba2a 100644 --- a/plugins/notifications-backend/src/service/router.ts +++ b/plugins/notifications-backend/src/service/router.ts @@ -470,7 +470,7 @@ export async function createRouter( if (!recipients || !title) { logger.error(`Invalid notification request received`); - throw new InputError(); + throw new InputError(`Invalid notification request received`); } const origin = credentials.principal.subject; @@ -496,8 +496,10 @@ export async function createRouter( try { users = await getUsersForEntityRef(entityRef); } catch (e) { - throw new InputError(); + logger.error(`Failed to resolve notification receivers: ${e}`); + throw new InputError('Failed to resolve notification receivers', e); } + const userNotifications = await sendUserNotifications( baseNotification, users, diff --git a/plugins/notifications/dev/index.tsx b/plugins/notifications/dev/index.tsx index 27bfe23842..1406f55b59 100644 --- a/plugins/notifications/dev/index.tsx +++ b/plugins/notifications/dev/index.tsx @@ -15,10 +15,8 @@ */ import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; -import { notificationsPlugin } from '../src/plugin'; -import { NotificationsPage } from '../src/components/NotificationsPage'; +import { NotificationsPage, notificationsPlugin } from '../src/plugin'; import { NotificationsSidebarItem } from '../src'; -import { rootRouteRef } from '../src/routes'; // TODO: How to sign in here as guest user? createDevApp() @@ -26,7 +24,6 @@ createDevApp() .addPage({ element: , path: '/notifications', - sideBarItem: , - routeRef: rootRouteRef, + sidebarItem: , }) .render();