Skip to content

Commit

Permalink
[webapp] fix bulletin with multiple rows of results (#2761)
Browse files Browse the repository at this point in the history
Signed-off-by: tomsun28 <[email protected]>
  • Loading branch information
tomsun28 authored Oct 7, 2024
1 parent bad49ce commit 2856c3f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 9 additions & 7 deletions web-app/src/app/routes/bulletin/bulletin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,20 @@
</td>
<td nzAlign="center" [rowSpan]="1">{{ content.host }}</td>
<ng-container *ngFor="let metric of content.metrics">
<ng-container *ngFor="let field of metric.fields">
<ng-container *ngFor="let item of field">
<td nzAlign="center">
<ng-container *ngFor="let field of metric.fields[0]">
<td nzAlign="center">
<ng-container *ngFor="let item of combine(field, metric.fields)">
<ng-container *ngIf="item.value === 'NO_DATA'; else hasData">
<nz-tag nzColor="warning">No Data Available</nz-tag>
</ng-container>
<ng-template #hasData>
{{ item.value }}
<nz-tag *ngIf="item.unit !== ''" nzColor="success">{{ item.unit }}</nz-tag>
<div style="display: flex; justify-content: space-between">
{{ item.value }}
<nz-tag *ngIf="item.unit !== ''" nzColor="success">{{ item.unit }}</nz-tag>
</div>
</ng-template>
</td>
</ng-container>
</ng-container>
</td>
</ng-container>
</ng-container>
</tr>
Expand Down
14 changes: 14 additions & 0 deletions web-app/src/app/routes/bulletin/bulletin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,18 @@ export class BulletinComponent implements OnInit, OnDestroy {
this.countDownTime = this.deadline;
this.cdr.detectChanges();
}

combine(field: any, fields: any): any[] {
let result: any[] = [];
if (fields.length == 0) {
return result;
}
for (let i = 0; i < fields.length; i++) {
let find = fields[i].filter((item: any) => {
return item.key == field.key;
});
result = result.concat(find);
}
return result;
}
}

0 comments on commit 2856c3f

Please sign in to comment.