Skip to content

Latest commit

 

History

History
 
 

time-saver-common

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Time Saver - common

This plugin provides an implementation of charts and statistics related to your time savings that are coming from usage of your templates. Plugins is built from frontend and backend part. Backend plugin is responsible for scheduled stats parsing process and data storage.

Dependencies

Code

https://github.com/tduniec/backstage-timesaver-plugin.git

Installation

  1. Install the plugin package in your Backstage app:
# From your Backstage root directory
yarn add --cwd packages/backend @tduniec/backstage-plugin-time-saver-common

or

# From your Backstage root directory
yarn add --cwd packages/app @tduniec/backstage-plugin-time-saver-common
  1. Wire up the API implementation to your packages/app/src/App.tsx:
import { timeSaverPermission } from '@tduniec/backstage-plugin-time-saver-common';

...

    <Route
      path="/time-saver"
      element={
        <RequirePermission permission={timeSaverPermission}>
          <TimeSaverPage />
        </RequirePermission>
      }
    />
  1. Wire up in the navigation pane the in packages/app/src/component/Root/Root.tsx:
import { timeSaverPermission } from '@tduniec/backstage-plugin-time-saver-common';

...

        <RequirePermission
          permission={timeSaverPermission}
          errorPage={<></>}
        >
          <SidebarItem
            icon={Timelapse}
            to="time-saver"
            text="TimeSaver"
          />
        </RequirePermission>
  1. Wire up in the permissions backend in packages/backend/src/plugins/permission.ts:
...
import { timeSaverPermission } from '@tduniec/backstage-plugin-time-saver-common';
...

    if (isPermission(request.permission, timeSaverPermission)) {
      if (isAdmin) { //example condition
        return {
          result: AuthorizeResult.ALLOW,
        };
      }
      return {
        result: AuthorizeResult.DENY,
      };
    }