From 9fedca0c58766bcacee1a05c99491e158028c68d Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Wed, 23 Feb 2022 11:28:37 +0100 Subject: [PATCH] manual refresh fixes (#4070) --- scripts/appConfig.ts | 8 ++++++++ scripts/apps/monitoring/directives/MonitoringGroup.ts | 9 ++++++++- scripts/apps/search/directives/ItemList.tsx | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/appConfig.ts b/scripts/appConfig.ts index c4e8ec1374..e6626aba2d 100644 --- a/scripts/appConfig.ts +++ b/scripts/appConfig.ts @@ -19,6 +19,14 @@ if (appConfig.ui == null) { } } +if (appConfig.features == null) { + appConfig.features = {}; +} + +if (appConfig.features.autorefreshContent == null) { + appConfig.features.autorefreshContent = true; // default to true +} + export const dashboardRoute = '/workspace'; export const IDENTITY_KEY = 'sess:user'; diff --git a/scripts/apps/monitoring/directives/MonitoringGroup.ts b/scripts/apps/monitoring/directives/MonitoringGroup.ts index 5b4186a7f0..3b5991fa79 100644 --- a/scripts/apps/monitoring/directives/MonitoringGroup.ts +++ b/scripts/apps/monitoring/directives/MonitoringGroup.ts @@ -360,7 +360,14 @@ export function MonitoringGroup( }); // refreshes the list for matching group or view type only or if swimlane view is ON. - scope.$on('refresh:list', (event, group) => { + scope.$on('refresh:list', (event, group, options) => { + /** + * When manual refreshing is enabled, scrolling should not automatically refresh the list. + */ + if (scope.showRefresh === true && options.event_origin === 'scroll') { + return; + } + const currentScope: IScope = event.currentScope as IScope; const _viewType = currentScope.viewType || ''; const viewTypeMatches = [ diff --git a/scripts/apps/search/directives/ItemList.tsx b/scripts/apps/search/directives/ItemList.tsx index 468c5651b2..3a419ee9c9 100644 --- a/scripts/apps/search/directives/ItemList.tsx +++ b/scripts/apps/search/directives/ItemList.tsx @@ -320,7 +320,7 @@ export function ItemList( .some((item) => item.selected === true); if (elem[0].scrollTop === 0 && !multiSelectInProgress) { - $rootScope.$broadcast('refresh:list', scope.group); + $rootScope.$broadcast('refresh:list', scope.group, {event_origin: 'scroll'}); } if (scope.rendering) { // ignore