diff --git a/.changeset/gold-humans-peel.md b/.changeset/gold-humans-peel.md new file mode 100644 index 0000000..69bdee6 --- /dev/null +++ b/.changeset/gold-humans-peel.md @@ -0,0 +1,5 @@ +--- +"backstage-blockchain-actions": patch +--- + +feat: add tags to reports diff --git a/src/core/access-key-collector.ts b/src/core/access-key-collector.ts index f5d4593..426b14a 100644 --- a/src/core/access-key-collector.ts +++ b/src/core/access-key-collector.ts @@ -64,6 +64,7 @@ export class AccessKeyCollector extends BaseCollector { title: component.metadata.title || component.metadata.name, component, contracts, + tags: component.metadata.tags?.join(", ") || "None", }, ]; } @@ -90,6 +91,7 @@ export class AccessKeyCollector extends BaseCollector { .map((entity) => ({ entity, keys: this.collectKeys(entity), + tags: entity.metadata.tags?.join(", "), })); } diff --git a/src/core/multisigs-collector.ts b/src/core/multisigs-collector.ts index 07d0df3..0110970 100644 --- a/src/core/multisigs-collector.ts +++ b/src/core/multisigs-collector.ts @@ -77,6 +77,7 @@ export class MultisigsCollector extends BaseCollector { title: component.metadata.title || component.metadata.name, component, multisigs: this.collectMultisigs(componentRef), + tags: component.metadata.tags?.join(", ") || "None", }, ]; }, []) @@ -94,9 +95,10 @@ export class MultisigsCollector extends BaseCollector { r.targetRef === componentRef.targetRef, ), ) - .map((ms) => ({ - entity: ms, - signers: this.collectSigners(ms), + .map((entity) => ({ + entity: entity, + signers: this.collectSigners(entity), + tags: entity.metadata.tags?.join(", "), })); } @@ -113,6 +115,7 @@ export class MultisigsCollector extends BaseCollector { return { signer, owner, + tags: signer.metadata.tags?.join(", ") || "None", }; }) .sort((a, b) => diff --git a/src/core/rbac-collector.ts b/src/core/rbac-collector.ts index f44ce1b..e513deb 100644 --- a/src/core/rbac-collector.ts +++ b/src/core/rbac-collector.ts @@ -65,6 +65,7 @@ export class RbacCollector extends BaseCollector { title: component.metadata.title || component.metadata.name, component, contracts, + tags: component.metadata.tags?.join(", ") || "None", }, ]; } @@ -92,6 +93,7 @@ export class RbacCollector extends BaseCollector { entity, admins: this.collectAdmins(entity), roles: this.collectRoles(entity), + tags: entity.metadata.tags?.join(", "), })); } diff --git a/src/types.ts b/src/types.ts index 9ce2cbf..4bd9c94 100644 --- a/src/types.ts +++ b/src/types.ts @@ -20,6 +20,7 @@ export type ComponentInfo = { component: Entity; contracts?: ContractInfo[]; multisigs?: MultisigInfo[]; + tags?: string; }; export type ContractInfo = { @@ -27,11 +28,13 @@ export type ContractInfo = { keys?: KeyInfo[]; admins?: AdminInfo[]; roles?: RoleInfo[]; + tags?: string; }; export type MultisigInfo = { entity: Entity; signers: SignerInfo[]; + tags?: string; }; export type AdminInfo = { @@ -55,6 +58,7 @@ export type KeyInfo = OwnedEntity<{ export type SignerInfo = OwnedEntity<{ signer: Entity; keys?: Entity[]; + tags?: string; }>; type OwnedEntity = { diff --git a/templates/backstage/access-keys.md.hbs b/templates/backstage/access-keys.md.hbs index aa08645..02d8f48 100644 --- a/templates/backstage/access-keys.md.hbs +++ b/templates/backstage/access-keys.md.hbs @@ -9,14 +9,14 @@ {{/if}} {{#each components~}} - ### [{{title}}]({{backstageLink component}}) + ### [{{title}}]({{backstageLink component}}) (Tags: {{tags}}) {{#if component.metadata.description~}} {{component.metadata.description}} {{/if}} {{#each contracts~}} - #### [{{entity.metadata.title}}]({{backstageLink entity}}) + #### [{{entity.metadata.title}}]({{backstageLink entity}}) (Tags: {{tags}}) {{#if entity.metadata.description~}} {{entity.metadata.description}} diff --git a/templates/backstage/multisigs.md.hbs b/templates/backstage/multisigs.md.hbs index 210eaec..5ab38df 100644 --- a/templates/backstage/multisigs.md.hbs +++ b/templates/backstage/multisigs.md.hbs @@ -9,14 +9,14 @@ {{/if}} {{#each components~}} - ### [{{component.metadata.title}}]({{backstageLink component}}) + ### [{{component.metadata.title}}]({{backstageLink component}}) (Tags: {{tags}}) {{#if component.metadata.description~}} {{component.metadata.description}} {{/if}} {{#each multisigs~}} - #### [{{entity.metadata.title}}]({{backstageLink entity}}) + #### [{{entity.metadata.title}}]({{backstageLink entity}}) (Tags: {{tags}}) {{#if entity.metadata.description~}} {{entity.metadata.description}} @@ -38,7 +38,7 @@ ##### Signers {{#each signers~}} - - [{{owner.metadata.name}}]({{backstageLink owner}}) ([{{signer.metadata.name}}]({{backstageLink signer}})) + - [{{owner.metadata.name}}]({{backstageLink owner}}) ([{{signer.metadata.name}}]({{backstageLink signer}})) (Tags: {{tags}}) {{/each}} {{/if}} diff --git a/templates/backstage/rbac.md.hbs b/templates/backstage/rbac.md.hbs index cfb9fe5..ab42607 100644 --- a/templates/backstage/rbac.md.hbs +++ b/templates/backstage/rbac.md.hbs @@ -9,14 +9,14 @@ {{/if}} {{#each components~}} - ### [{{component.metadata.name}}]({{backstageLink component}}) + ### [{{component.metadata.name}}]({{backstageLink component}}) (Tags: {{tags}}) {{#if component.metadata.description~}} {{component.metadata.description}} {{/if}} {{#each contracts~}} - #### [{{entity.metadata.title}}]({{backstageLink entity}}) + #### [{{entity.metadata.title}}]({{backstageLink entity}}) (Tags: {{tags}}) {{#if entity.metadata.description~}} {{entity.metadata.description}} diff --git a/templates/backstage/unknown.md.hbs b/templates/backstage/unknown.md.hbs index e9f6b0e..773c134 100644 --- a/templates/backstage/unknown.md.hbs +++ b/templates/backstage/unknown.md.hbs @@ -9,7 +9,7 @@ {{/if}} {{#each components~}} -### [{{title}}]({{backstageLink component}}) +### [{{title}}]({{backstageLink component}}) (Tags: {{tags}}) {{#if component.metadata.description}} {{component.metadata.description}} @@ -18,7 +18,7 @@ {{#if contracts}} {{#each contracts}} -#### [{{entity.metadata.title}}]({{backstageLink entity}}) +#### [{{entity.metadata.title}}]({{backstageLink entity}}) (Tags: {{tags}}) {{#if entity.metadata.description}} {{entity.metadata.description}}