SCION Workbench Client - v1.0.0-beta.40
    Preparing search index...

    Interface WorkbenchNotificationCapability

    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 WorkbenchNotification handle (and ActivatedMicrofrontend if 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.

    • WorkbenchNotification
    • WorkbenchNotificationService
    interface WorkbenchNotificationCapability {
        params?: ParamDefinition[];
        properties: {
            cssClass?: string | string[];
            groupParamsReducer?: string;
            path: string;
            showSplash?: boolean;
            size?: WorkbenchNotificationSize;
            [key: string]: unknown;
        };
        qualifier: Qualifier;
        type: Notification;
    }

    Hierarchy

    • Capability
      • WorkbenchNotificationCapability
    Index

    Properties

    params?: ParamDefinition[]

    Specifies parameters required by the notification.

    Parameters can be:

    • read in the microfrontend by injecting the WorkbenchNotification handle (or ActivatedMicrofrontend if a host microfrontend)
    • referenced in the path using the colon syntax
    properties: {
        cssClass?: string | string[];
        groupParamsReducer?: string;
        path: string;
        showSplash?: boolean;
        size?: WorkbenchNotificationSize;
        [key: string]: unknown;
    }

    Type Declaration

    • [key: string]: unknown

      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?: string

      Enables 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};
      });
    • path: string

      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?: boolean

      Instructs 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.

      WorkbenchNotification.signalReady

    • Optionalsize?: WorkbenchNotificationSize

      Specifies 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.

      import {Beans} from '@scion/toolkit/bean-manager';
      import {PreferredSizeService} from '@scion/microfrontend-platform';

      Beans.get(PreferredSizeService).fromDimension(<Microfrontend HTMLElement>);
    qualifier: Qualifier

    Qualifies the notification. The qualifier is required for a notification.