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 a331c045ae [bugfix] retain sorting state after monitor list 
auto-refresh (#3156)
a331c045ae is described below

commit a331c045aede72652987f58445ea192bdbfaea46
Author: LL-LIN <[email protected]>
AuthorDate: Sat Mar 22 11:48:34 2025 +0800

    [bugfix] retain sorting state after monitor list auto-refresh (#3156)
    
    Co-authored-by: tomsun28 <[email protected]>
---
 .../app/routes/monitor/monitor-list/monitor-list.component.ts | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/web-app/src/app/routes/monitor/monitor-list/monitor-list.component.ts 
b/web-app/src/app/routes/monitor/monitor-list/monitor-list.component.ts
index f977a6e90a..70ff6aa4df 100644
--- a/web-app/src/app/routes/monitor/monitor-list/monitor-list.component.ts
+++ b/web-app/src/app/routes/monitor/monitor-list/monitor-list.component.ts
@@ -72,6 +72,9 @@ export class MonitorListComponent implements OnInit, 
OnDestroy {
   appSearchOrigin: any[] = [];
   appSearchLoading = false;
   intervalId: any;
+  // save the current sorting status
+  currentSortField: string | null = null;
+  currentSortOrder: string | null = null;
 
   switchExportTypeModalFooter: ModalButtonOptions[] = [
     { label: this.i18nSvc.fanyi('common.button.cancel'), type: 'default', 
onClick: () => (this.isSwitchExportTypeModalVisible = false) }
@@ -149,7 +152,7 @@ export class MonitorListComponent implements OnInit, 
OnDestroy {
   }
 
   sync() {
-    this.loadMonitorTable();
+    this.loadMonitorTable(this.currentSortField, this.currentSortOrder);
   }
 
   getAppIconName(app: string | undefined): string {
@@ -499,9 +502,9 @@ export class MonitorListComponent implements OnInit, 
OnDestroy {
     this.pageIndex = pageIndex;
     this.pageSize = pageSize;
     const currentSort = sort.find(item => item.value !== null);
-    const sortField = (currentSort && currentSort.key) || null;
-    const sortOrder = (currentSort && currentSort.value) || null;
-    this.changeMonitorTable(sortField, sortOrder);
+    this.currentSortField = (currentSort && currentSort.key) || null;
+    this.currentSortOrder = (currentSort && currentSort.value) || null;
+    this.changeMonitorTable(this.currentSortField, this.currentSortOrder);
   }
 
   // begin: app type search filter


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

Reply via email to