This is an automated email from the ASF dual-hosted git repository. gongchao pushed a commit to branch fix-multi in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
commit 561edcc5392c60a983b390a12e63180810241fca Author: tomsun28 <[email protected]> AuthorDate: Fri Oct 4 12:10:53 2024 +0800 [webapp] fix bulletin with multiple rows of results Signed-off-by: tomsun28 <[email protected]> --- web-app/src/app/routes/bulletin/bulletin.component.html | 16 +++++++++------- web-app/src/app/routes/bulletin/bulletin.component.ts | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/web-app/src/app/routes/bulletin/bulletin.component.html b/web-app/src/app/routes/bulletin/bulletin.component.html index ff6ea9c2a..b602a708b 100644 --- a/web-app/src/app/routes/bulletin/bulletin.component.html +++ b/web-app/src/app/routes/bulletin/bulletin.component.html @@ -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> diff --git a/web-app/src/app/routes/bulletin/bulletin.component.ts b/web-app/src/app/routes/bulletin/bulletin.component.ts index ac5b8d217..21fc346c6 100644 --- a/web-app/src/app/routes/bulletin/bulletin.component.ts +++ b/web-app/src/app/routes/bulletin/bulletin.component.ts @@ -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; + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
