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

gongchao pushed a commit to branch alarm-center-ui-update
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git

commit c592bfabef37b395e261952abd813b06dce17bb7
Author: tomsun28 <tomsu...@outlook.com>
AuthorDate: Sun Jan 5 14:10:06 2025 +0800

    [improve] update alarm center
    
    Signed-off-by: tomsun28 <tomsu...@outlook.com>
---
 .../routes/alert/alert-center/alert-center.component.html | 14 +++++---------
 .../routes/alert/alert-center/alert-center.component.ts   |  4 ----
 .../alert/alert-setting/alert-setting.component.html      | 15 ++-------------
 3 files changed, 7 insertions(+), 26 deletions(-)

diff --git 
a/web-app/src/app/routes/alert/alert-center/alert-center.component.html 
b/web-app/src/app/routes/alert/alert-center/alert-center.component.html
index c475971a0..8784b746e 100644
--- a/web-app/src/app/routes/alert/alert-center/alert-center.component.html
+++ b/web-app/src/app/routes/alert/alert-center/alert-center.component.html
@@ -68,9 +68,7 @@
     <div class="alert-header">
       <div class="alert-info">
         <div class="alert-labels">
-          <nz-tag *ngFor="let label of recordEntries(group.groupLabels)">
-            {{ label[0] + ':' + label[1] }}
-          </nz-tag>
+          <nz-tag *ngFor="let item of group.groupLabels | keyvalue">{{ 
item.key }}:{{ item.value }}</nz-tag>
         </div>
         <div class="alert-meta-info">
           <span class="alert-time">
@@ -139,9 +137,7 @@
           <div class="detail-section" *ngIf="item.labels">
             <div class="section-title">{{ 'alert.center.labels' | i18n }}</div>
             <div class="alert-labels">
-              <nz-tag *ngFor="let label of recordEntries(item.labels)">
-                {{ label[0] + ':' + label[1] }}
-              </nz-tag>
+              <nz-tag *ngFor="let label of item.labels | keyvalue">{{ 
label.key }}:{{ label.value }}</nz-tag>
             </div>
           </div>
 
@@ -149,9 +145,9 @@
           <div class="detail-section" *ngIf="item.annotations">
             <div class="section-title">{{ 'annotation' | i18n }}</div>
             <div class="alert-annotations">
-              <div *ngFor="let anno of recordEntries(item.annotations)" 
class="annotation-item">
-                <span class="annotation-key">{{ anno[0] }}:</span>
-                <span class="annotation-value">{{ anno[1] }}</span>
+              <div *ngFor="let anno of item.annotations | keyvalue" 
class="annotation-item">
+                <span class="annotation-key">{{ anno.key }}:</span>
+                <span class="annotation-value">{{ anno.value }}</span>
               </div>
             </div>
           </div>
diff --git 
a/web-app/src/app/routes/alert/alert-center/alert-center.component.ts 
b/web-app/src/app/routes/alert/alert-center/alert-center.component.ts
index 3e89ebf33..3b9a728f1 100644
--- a/web-app/src/app/routes/alert/alert-center/alert-center.component.ts
+++ b/web-app/src/app/routes/alert/alert-center/alert-center.component.ts
@@ -204,8 +204,4 @@ export class AlertCenterComponent implements OnInit {
       }
     );
   }
-
-  recordEntries(record: Record<any, any>) {
-    return Object.entries(record);
-  }
 }
diff --git 
a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html 
b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html
index 70ffce663..dad7fa8f4 100644
--- a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html
+++ b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html
@@ -96,7 +96,7 @@
       <th nzAlign="center" nzWidth="8%">{{ 'alert.setting.type' | i18n }}</th>
       <th nzAlign="center" nzWidth="24%">{{ 'alert.setting.expr' | i18n }}</th>
       <th nzAlign="center" nzWidth="20%">{{ 'alert.setting.template' | i18n 
}}</th>
-      <th nzAlign="center" nzWidth="8%">{{ 'alert.severity' | i18n }}</th>
+      <th nzAlign="center" nzWidth="8%">{{ 'label.bind' | i18n }}</th>
       <th nzAlign="center" nzWidth="8%">{{ 'alert.setting.enable' | i18n 
}}</th>
       <th nzAlign="center" nzWidth="8%">{{ 'common.edit' | i18n }}</th>
     </tr>
@@ -120,18 +120,7 @@
       </td>
       <td nzAlign="center">{{ data.template }}</td>
       <td nzAlign="center">
-        <nz-tag *ngIf="data.labels?.severity == 'emergency'" nzColor="red">
-          <i nz-icon nzType="bell" nzTheme="outline"></i>
-          <span>{{ 'alert.severity.0' | i18n }}</span>
-        </nz-tag>
-        <nz-tag *ngIf="data.labels?.severity == 'critical'" nzColor="orange">
-          <i nz-icon nzType="bell" nzTheme="outline"></i>
-          <span>{{ 'alert.severity.1' | i18n }}</span>
-        </nz-tag>
-        <nz-tag *ngIf="data.labels?.severity == 'warning'" nzColor="yellow">
-          <i nz-icon nzType="bell" nzTheme="outline"></i>
-          <span>{{ 'alert.severity.2' | i18n }}</span>
-        </nz-tag>
+        <nz-tag *ngFor="let item of data.labels | keyvalue">{{ item.key }}:{{ 
item.value }}</nz-tag>
       </td>
       <td nzAlign="center">
         <nz-switch [(ngModel)]="data.enable" 
(ngModelChange)="updateAlertDefine(data)" name="enable"></nz-switch>


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org
For additional commands, e-mail: notifications-h...@hertzbeat.apache.org

Reply via email to