Skip to content

Commit

Permalink
feat(orb-ui): #699 Agent View, show how many policies are applied and…
Browse files Browse the repository at this point in the history
… how many are running
  • Loading branch information
joaoguilherme2003 committed May 2, 2023
1 parent 0bc174e commit 6df4725
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<nb-card>
<nb-card-header>Active Policies/Datasets</nb-card-header>
<nb-card-body>
<label *ngIf="policies?.length > 0" > <span class="code"> {{ amountRunningPolicies }}</span>
out of <span class="code"> {{ policies?.length }} </span>
policies are running.
</label>
<nb-accordion *ngFor="let policy of policies">
<nb-accordion-item>
<nb-accordion-item-header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ nb-card {
color: #969fb9 !important;
}

.code {
color: #fff;
line-height: 2.5 !important;
}

header p {
align-items: center;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class AgentPoliciesDatasetsComponent implements OnInit, OnChanges {

errors;

amountRunningPolicies;

constructor(
private router: Router,
private route: ActivatedRoute,
Expand All @@ -46,10 +48,21 @@ export class AgentPoliciesDatasetsComponent implements OnInit, OnChanges {
this.datasets = {};
this.policies = [];
this.errors = {};
this.amountRunningPolicies = 0;
}

ngOnInit(): void {}

ngOnInit(): void {
this.getAmountRunningPolicies()
}

getAmountRunningPolicies() {
this.policies.forEach(element => {
if (element.state == 'running') {
this.amountRunningPolicies++;
}
});
}

ngOnChanges(changes: SimpleChanges): void {
if (changes.agent) {
const policiesStates = this.agent?.last_hb_data?.policy_state;
Expand Down

0 comments on commit 6df4725

Please sign in to comment.