Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: static source locations for RoleGroup entities #104

Merged
merged 1 commit into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/metal-radios-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aurora-is-near/backstage-plugin-blockchainradar-backend': patch
---

feat: use static source location for RoleGroup entities
17 changes: 14 additions & 3 deletions plugins/blockchainradar-backend/src/entities/RoleGroup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Entity, stringifyEntityRef } from '@backstage/catalog-model';
import {
Entity,
EntityMeta,
stringifyEntityRef,
} from '@backstage/catalog-model';
import * as crypto from 'crypto';
import * as bs58 from 'bs58';

@@ -11,6 +15,8 @@ function base58EncodeSha256(str: string): string {
}

const ROLE = 'role-group';
const ACCESS_CONTROL_SOURCE =
'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControl.sol';

export class RoleGroup extends BlockchainAddress {
roleId: string;
@@ -73,13 +79,18 @@ export class RoleGroup extends BlockchainAddress {
return `${super.entityTitle()} ${this.roleName}`;
}

entityMetadata() {
entityMetadata(): EntityMeta {
const tags = ['role-group', this.network];
if (this.stub) tags.push('stub');
const meta = super.entityMetadata();
return {
...super.entityMetadata(),
...meta,
description: `${this.address} (${this.role})`,
tags,
annotations: {
...meta.annotations,
'backstage.io/source-location': ACCESS_CONTROL_SOURCE,
},
};
}