Skip to content

Commit a331c04

Browse files
LL-LINtomsun28
andauthored
[bugfix] retain sorting state after monitor list auto-refresh (apache#3156)
Co-authored-by: tomsun28 <[email protected]>
1 parent 63d3d18 commit a331c04

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

web-app/src/app/routes/monitor/monitor-list/monitor-list.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ export class MonitorListComponent implements OnInit, OnDestroy {
7272
appSearchOrigin: any[] = [];
7373
appSearchLoading = false;
7474
intervalId: any;
75+
// save the current sorting status
76+
currentSortField: string | null = null;
77+
currentSortOrder: string | null = null;
7578

7679
switchExportTypeModalFooter: ModalButtonOptions[] = [
7780
{ label: this.i18nSvc.fanyi('common.button.cancel'), type: 'default', onClick: () => (this.isSwitchExportTypeModalVisible = false) }
@@ -149,7 +152,7 @@ export class MonitorListComponent implements OnInit, OnDestroy {
149152
}
150153

151154
sync() {
152-
this.loadMonitorTable();
155+
this.loadMonitorTable(this.currentSortField, this.currentSortOrder);
153156
}
154157

155158
getAppIconName(app: string | undefined): string {
@@ -499,9 +502,9 @@ export class MonitorListComponent implements OnInit, OnDestroy {
499502
this.pageIndex = pageIndex;
500503
this.pageSize = pageSize;
501504
const currentSort = sort.find(item => item.value !== null);
502-
const sortField = (currentSort && currentSort.key) || null;
503-
const sortOrder = (currentSort && currentSort.value) || null;
504-
this.changeMonitorTable(sortField, sortOrder);
505+
this.currentSortField = (currentSort && currentSort.key) || null;
506+
this.currentSortOrder = (currentSort && currentSort.value) || null;
507+
this.changeMonitorTable(this.currentSortField, this.currentSortOrder);
505508
}
506509

507510
// begin: app type search filter

0 commit comments

Comments
 (0)