@tduniec/backstage-plugin-time-saver-common
v0.4.0
Published
Common functionalities for the time-saver plugin
Downloads
784
Readme
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
- 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
- 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>
}
/>
- 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>
- 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,
};
}