Skip to content

Commit

Permalink
Merge pull request #37 from aurora-is-near/feat-add-tags-to-reports
Browse files Browse the repository at this point in the history
feat: add tags to reports
  • Loading branch information
diegofigs committed Dec 8, 2023
2 parents f0d8888 + 89d541e commit f774c41
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-humans-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"backstage-blockchain-actions": patch
---

feat: add tags to reports
2 changes: 2 additions & 0 deletions src/core/access-key-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class AccessKeyCollector extends BaseCollector {
title: component.metadata.title || component.metadata.name,
component,
contracts,
tags: component.metadata.tags?.join(", ") || "None",
},
];
}
Expand All @@ -90,6 +91,7 @@ export class AccessKeyCollector extends BaseCollector {
.map((entity) => ({
entity,
keys: this.collectKeys(entity),
tags: entity.metadata.tags?.join(", "),
}));
}

Expand Down
9 changes: 6 additions & 3 deletions src/core/multisigs-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
];
}, [])
Expand All @@ -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(", "),
}));
}

Expand All @@ -113,6 +115,7 @@ export class MultisigsCollector extends BaseCollector {
return {
signer,
owner,
tags: signer.metadata.tags?.join(", ") || "None",
};
})
.sort((a, b) =>
Expand Down
2 changes: 2 additions & 0 deletions src/core/rbac-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class RbacCollector extends BaseCollector {
title: component.metadata.title || component.metadata.name,
component,
contracts,
tags: component.metadata.tags?.join(", ") || "None",
},
];
}
Expand Down Expand Up @@ -92,6 +93,7 @@ export class RbacCollector extends BaseCollector {
entity,
admins: this.collectAdmins(entity),
roles: this.collectRoles(entity),
tags: entity.metadata.tags?.join(", "),
}));
}

Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ export type ComponentInfo = {
component: Entity;
contracts?: ContractInfo[];
multisigs?: MultisigInfo[];
tags?: string;
};

export type ContractInfo = {
entity: Entity;
keys?: KeyInfo[];
admins?: AdminInfo[];
roles?: RoleInfo[];
tags?: string;
};

export type MultisigInfo = {
entity: Entity;
signers: SignerInfo[];
tags?: string;
};

export type AdminInfo = {
Expand All @@ -55,6 +58,7 @@ export type KeyInfo = OwnedEntity<{
export type SignerInfo = OwnedEntity<{
signer: Entity;
keys?: Entity[];
tags?: string;
}>;

type OwnedEntity<T> = {
Expand Down
4 changes: 2 additions & 2 deletions templates/backstage/access-keys.md.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
6 changes: 3 additions & 3 deletions templates/backstage/multisigs.md.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand All @@ -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}}

Expand Down
4 changes: 2 additions & 2 deletions templates/backstage/rbac.md.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 2 additions & 2 deletions templates/backstage/unknown.md.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{/if}}

{{#each components~}}
### [{{title}}]({{backstageLink component}})
### [{{title}}]({{backstageLink component}}) (Tags: {{tags}})

{{#if component.metadata.description}}
{{component.metadata.description}}
Expand All @@ -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}}
Expand Down

0 comments on commit f774c41

Please sign in to comment.