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

gongchao 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 b5c7705f4 [bugfix] fixed issue of status-page (#2182)
b5c7705f4 is described below

commit b5c7705f4ad7905cfbe24d612ec743a93662bbbe
Author: Kerwin Bryant <[email protected]>
AuthorDate: Thu Jul 4 09:02:16 2024 +0800

    [bugfix] fixed issue of status-page (#2182)
    
    Co-authored-by: Logic <[email protected]>
---
 .../routes/setting/status/status.component.html    | 16 +++++++-------
 .../app/routes/setting/status/status.component.ts  | 25 ++++------------------
 2 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/web-app/src/app/routes/setting/status/status.component.html 
b/web-app/src/app/routes/setting/status/status.component.html
index 5a31a33a0..51733fa55 100644
--- a/web-app/src/app/routes/setting/status/status.component.html
+++ b/web-app/src/app/routes/setting/status/status.component.html
@@ -34,7 +34,7 @@
         </nz-form-label>
         <nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | 
i18n">
           <input
-            [(ngModel)]="statusOrg.name"
+            [(ngModel)]="statusOrgForEdit.name"
             nz-input
             name="name"
             type="text"
@@ -50,7 +50,7 @@
         </nz-form-label>
         <nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | 
i18n">
           <input
-            [(ngModel)]="statusOrg.description"
+            [(ngModel)]="statusOrgForEdit.description"
             nz-input
             required
             name="desc"
@@ -66,7 +66,7 @@
         </nz-form-label>
         <nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | 
i18n">
           <input
-            [(ngModel)]="statusOrg.home"
+            [(ngModel)]="statusOrgForEdit.home"
             nz-input
             required
             name="home"
@@ -82,7 +82,7 @@
         </nz-form-label>
         <nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | 
i18n">
           <input
-            [(ngModel)]="statusOrg.logo"
+            [(ngModel)]="statusOrgForEdit.logo"
             nz-input
             required
             name="logo"
@@ -98,7 +98,7 @@
         </nz-form-label>
         <nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | 
i18n">
           <input
-            [(ngModel)]="statusOrg.feedback"
+            [(ngModel)]="statusOrgForEdit.feedback"
             nz-input
             required
             name="feedback"
@@ -114,17 +114,17 @@
         </nz-form-label>
         <nz-form-control [nzSpan]="8">
           <input
-            [(colorPicker)]="statusOrg.color"
+            [(colorPicker)]="statusOrgForEdit.color"
             cpFallbackColor="#e9f3d3"
             cpOutputFormat="hex"
-            [style.background]="statusOrg.color"
+            [style.background]="statusOrgForEdit.color"
             style="width: 100%"
             nz-input
             required
             name="color"
             type="text"
             id="color"
-            [placeholder]="statusOrg.color == undefined ? 
('status.org.color.tip' | i18n) : ''"
+            [placeholder]="statusOrgForEdit.color == undefined ? 
('status.org.color.tip' | i18n) : ''"
           />
         </nz-form-control>
       </nz-form-item>
diff --git a/web-app/src/app/routes/setting/status/status.component.ts 
b/web-app/src/app/routes/setting/status/status.component.ts
index 3789d0f49..1258c2c00 100644
--- a/web-app/src/app/routes/setting/status/status.component.ts
+++ b/web-app/src/app/routes/setting/status/status.component.ts
@@ -51,6 +51,7 @@ export class StatusComponent implements OnInit {
   @ViewChild('incidentForm') incidentForm!: NgForm;
   @ViewChild('componentForm') componentForm!: NgForm;
   statusOrg: StatusPageOrg = new StatusPageOrg();
+  statusOrgForEdit: StatusPageOrg = new StatusPageOrg();
   statusComponents!: StatusPageComponent[];
   statusIncidences!: StatusPageIncident[];
   loading: boolean = false;
@@ -84,25 +85,6 @@ export class StatusComponent implements OnInit {
     this.loadIncidenceInfo();
   }
 
-  loadOrgInfo() {
-    this.orgLoading = true;
-    let orgLoad$ = this.statusPageService.getStatusPageOrg().subscribe(
-      message => {
-        if (message.code === 0) {
-          this.statusOrg = message.data;
-        } else {
-          console.log(message.msg);
-        }
-        this.orgLoading = false;
-        orgLoad$.unsubscribe();
-      },
-      error => {
-        this.orgLoading = false;
-        orgLoad$.unsubscribe();
-      }
-    );
-  }
-
   loadComponentInfo() {
     this.currentComponentLoading = true;
     let componentLoad$ = 
this.statusPageService.getStatusPageComponents().subscribe(
@@ -153,6 +135,7 @@ export class StatusComponent implements OnInit {
             this.statusOrg = new StatusPageOrg();
             console.log(message.msg);
           }
+          this.statusOrgForEdit = { ...this.statusOrg };
           return this.statusPageService.getStatusPageComponents();
         })
       )
@@ -179,7 +162,7 @@ export class StatusComponent implements OnInit {
       });
       return;
     }
-    let saveStatus$ = 
this.statusPageService.saveStatusPageOrg(this.statusOrg).subscribe(
+    let saveStatus$ = 
this.statusPageService.saveStatusPageOrg(this.statusOrgForEdit).subscribe(
       (message: Message<StatusPageOrg>) => {
         if (message.code === 0) {
           this.statusOrg = message.data;
@@ -236,7 +219,7 @@ export class StatusComponent implements OnInit {
 
   onEditOneComponent(data: StatusPageComponent) {
     this.isComponentModalAdd = false;
-    this.currentStatusComponent = data;
+    this.currentStatusComponent = { ...data };
     if (this.currentStatusComponent.tag != undefined) {
       this.matchTag = this.sliceTagName(this.currentStatusComponent.tag);
       this.tagsOption.push({


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to