This is an automated email from the ASF dual-hosted git repository.

shown pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git


The following commit(s) were added to refs/heads/master by this push:
     new 2856c3fe6 [webapp] fix bulletin with multiple rows of results (#2761)
2856c3fe6 is described below

commit 2856c3fe65d3c0b61f97556e22245c7e14667b96
Author: tomsun28 <[email protected]>
AuthorDate: Mon Oct 7 19:45:57 2024 +0800

    [webapp] fix bulletin with multiple rows of results (#2761)
    
    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]

Reply via email to