From 126655565a2449a60008b61bd67bf316832db4e4 Mon Sep 17 00:00:00 2001 From: Diego Figueroa Date: Fri, 31 May 2024 19:03:08 -0400 Subject: [PATCH] feat: static source locations for RoleGroup entities --- .changeset/metal-radios-flash.md | 5 +++++ .../src/entities/RoleGroup.ts | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .changeset/metal-radios-flash.md diff --git a/.changeset/metal-radios-flash.md b/.changeset/metal-radios-flash.md new file mode 100644 index 0000000..99edf58 --- /dev/null +++ b/.changeset/metal-radios-flash.md @@ -0,0 +1,5 @@ +--- +'@aurora-is-near/backstage-plugin-blockchainradar-backend': patch +--- + +feat: use static source location for RoleGroup entities diff --git a/plugins/blockchainradar-backend/src/entities/RoleGroup.ts b/plugins/blockchainradar-backend/src/entities/RoleGroup.ts index 9c8d0a5..66e5433 100644 --- a/plugins/blockchainradar-backend/src/entities/RoleGroup.ts +++ b/plugins/blockchainradar-backend/src/entities/RoleGroup.ts @@ -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, + }, }; }