OptionalparamsSpecifies parameters required by the notification.
Parameters can be:
ActivatedMicrofrontend if a host microfrontend)Arbitrary metadata associated with the capability.
OptionalcssClass?: string | string[]Specifies CSS class(es) to add to the notification, e.g., to locate the notification in tests.
OptionalgroupParamsReducer?: stringEnables aggregation of parameters of notifications of the same group.
To aggregate parameters, define a topic that receives a 'reduce' request before showing a new notification if one of the same group is already showing. This request contains both previous and new parameters. Respond with the parameters for the new notification.
import {Beans} from '@scion/toolkit/bean-manager';
import {MessageClient} from '@scion/microfrontend-platform';
Beans.get(MessageClient).onMessage<{prevParams: Record<string, unknown>; currParams: Record<string, unknown>}>('notifications/reducer', request => {
const {prevParams, currParams} = request.body!;
const count = (prevParams['count'] ?? 0) as number;
return {...currParams, count: count + 1};
});
Specifies the path to the microfrontend.
The path is relative to the base URL given in the application manifest, or to the origin of the manifest file if no base URL is specified.
Path segments can reference capability parameters using the colon syntax.
{
"params": [
{"name": "id", "required": true}
],
"properties": {
"path": "products/:id", // `:id` references a capability parameter
}
}
Notification capabilities of the host application require an empty path. In the route, use canMatchWorkbenchNotificationCapability guard to match the notification capability.
import {Routes} from '@angular/router';
import {canMatchWorkbenchNotificationCapability} from '@scion/workbench';
const routes: Routes = [
{path: '', canMatch: [canMatchWorkbenchNotificationCapability({notification: 'info'})], component: InfoComponent},
];
OptionalshowSplash?: booleanInstructs the workbench to show a splash, such as a skeleton or loading indicator, until the notification microfrontend signals readiness.
By default, the workbench shows a loading indicator. A custom splash can be configured in the workbench host application.
This property is not supported if a host microfrontend.
Optionalsize?: WorkbenchNotificationSizeSpecifies the size of the notification, required for notifications provided by applications other than the workbench host application.
For the notification to adapt to the size of the microfrontend content, set the size to auto and report the microfrontend's preferred size using
PreferredSizeService in the microfrontend.
Qualifies the notification. The qualifier is required for a notification.
Represents a microfrontend for display in a workbench notification.
A notification is a closable message displayed in the upper-right corner that disappears after a few seconds unless hovered or focused. It informs about system events, task completion, or errors. Severity indicates importance or urgency.
Notifications can be grouped. Only the most recent notification within a group is displayed.
The microfrontend can inject the
WorkbenchNotificationhandle (andActivatedMicrofrontendif a host microfrontend) to interact with the notification or access parameters.An explicit height must be defined in WorkbenchNotificationCapability.properties.size unless the notification is provided by the host app.
See