Socket
Book a DemoInstallSign in
Socket

@marek.libra/backstage-plugin-notifications

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marek.libra/backstage-plugin-notifications

Frontend part of the notifications providing the Notifications API, Notifications page, left-side menu item and other REACT components.

latest
Source
npmnpm
Version
1.0.11
Version published
Maintainers
1
Created
Source

Notifications

This Backstage front-end plugin provides:

  • the Notifications page listing notifications from the logged-in user's perspective
  • the NotificationsApi for accessing the notifications backend from front-end plugins
  • an active item to the main left side menu to both notify the user about new messages and provide navigation to the Notifications page
  • an alert about new system notifications

Getting started

Prerequisities

Have @janus-idp/plugin-notifications-backend installed and running.

Add NPM dependency

cd packages/app
yarn add @janus-idp/plugin-notifications

Add left-side menu item

In the packages/app/src/components/Root/Root.tsx:

import { NotificationsSidebarItem } from '@janus-idp/plugin-notifications';

...
export const Root = ({ children }: PropsWithChildren<{}>) => (
    ...
      {/* New code: */}
      <SidebarDivider />
      <NotificationsSidebarItem pollingInterval={5000} />

      {/* Existing code for reference: */}
      <SidebarSpace />
      <SidebarSpace />
      <SidebarDivider />
      <SidebarDivider />
      <SidebarGroup
        <SidebarGroup label="Settings"

Add to router

In the packages/app/src/App.tsx:

import { NOTIFICATIONS_ROUTE, NotificationsPage } from '@janus-idp/plugin-notifications';
...

export const AppBase = () => {
    ...
      {/* New code: */}
      <Route path={NOTIFICATIONS_ROUTE} element={<NotificationsPage />} />

How to use the NotificationApi

import { notificationsApiRef, Notification } from '@janus-idp/plugin-notifications';

...

const notificationsApi = useApi(notificationsApiRef);
const notifications: Notification[] = await notificationsApi.getNotifications(params);

See src/api/notificationsApi.ts for more details.

Keywords

backstage

FAQs

Package last updated on 23 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts