You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by sa...@apache.org on 2019/10/31 20:30:36 UTC
[metron] branch master updated: METRON-2302 [UI] Change the default
polling interval for Alerts UI to longer time (tiborm via sardell) closes
apache/metron#1547
This is an automated email from the ASF dual-hosted git repository.
sardell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metron.git
The following commit(s) were added to refs/heads/master by this push:
new eb1dda6 METRON-2302 [UI] Change the default polling interval for Alerts UI to longer time (tiborm via sardell) closes apache/metron#1547
eb1dda6 is described below
commit eb1dda62eccc5f6e9ae402d743b11564b4506ba5
Author: tiborm <ti...@gmail.com>
AuthorDate: Thu Oct 31 15:22:07 2019 -0500
METRON-2302 [UI] Change the default polling interval for Alerts UI to longer time (tiborm via sardell) closes apache/metron#1547
---
.../auto-polling/auto-polling.service.spec.ts | 17 ++++++++++-------
.../alerts-list/auto-polling/auto-polling.service.ts | 3 ++-
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.spec.ts b/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.spec.ts
index 366e023..d13eab1 100644
--- a/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.spec.ts
+++ b/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.spec.ts
@@ -26,6 +26,9 @@ import { Spy } from 'jasmine-core';
import { DialogService } from 'app/service/dialog.service';
import { RestError } from 'app/model/rest-error';
import { DialogType } from 'app/model/dialog-type';
+import { RefreshInterval } from 'app/alerts/configure-rows/configure-rows-enums';
+
+const DEFAULT_POLLING_INTERVAL = RefreshInterval.TEN_MIN;
class QueryBuilderFake {
private _filter = '';
@@ -447,13 +450,13 @@ describe('AutoPollingService', () => {
it('should persist polling state on start', () => {
spyOn(localStorage, 'setItem');
autoPollingService.start();
- expect(localStorage.setItem).toHaveBeenCalledWith('autoPolling', '{"isActive":true,"refreshInterval":10}');
+ expect(localStorage.setItem).toHaveBeenCalledWith('autoPolling', `{"isActive":true,"refreshInterval":${DEFAULT_POLLING_INTERVAL}}`);
});
it('should persist polling state on stop', () => {
spyOn(localStorage, 'setItem');
autoPollingService.stop();
- expect(localStorage.setItem).toHaveBeenCalledWith('autoPolling', '{"isActive":false,"refreshInterval":10}');
+ expect(localStorage.setItem).toHaveBeenCalledWith('autoPolling', `{"isActive":false,"refreshInterval":${DEFAULT_POLLING_INTERVAL}}`);
});
it('should persist polling state on interval change', () => {
@@ -464,7 +467,7 @@ describe('AutoPollingService', () => {
it('should restore polling state on construction', () => {
const queryBuilderFake = TestBed.get(QueryBuilder);
- const dialogServiceFake = TestBed.get(QueryBuilder);
+ const dialogServiceFake = TestBed.get(DialogService);
spyOn(localStorage, 'getItem').and.returnValue('{"isActive":true,"refreshInterval":443}');
@@ -477,7 +480,7 @@ describe('AutoPollingService', () => {
it('should start polling on construction when persisted isActive==true', fakeAsync(() => {
const queryBuilderFake = TestBed.get(QueryBuilder);
- const dialogServiceFake = TestBed.get(QueryBuilder);
+ const dialogServiceFake = TestBed.get(DialogService);
spyOn(searchServiceFake, 'search').and.callThrough();
spyOn(localStorage, 'getItem').and.returnValue('{"isActive":true,"refreshInterval":10}');
@@ -486,10 +489,10 @@ describe('AutoPollingService', () => {
expect(searchServiceFake.search).toHaveBeenCalledTimes(1);
- tick(getIntervalInMS());
+ tick(localAutoPollingSvc.getInterval() * 1000);
expect(searchServiceFake.search).toHaveBeenCalledTimes(2);
- tick(getIntervalInMS());
+ tick(localAutoPollingSvc.getInterval() * 1000);
expect(searchServiceFake.search).toHaveBeenCalledTimes(3);
localAutoPollingSvc.stop();
@@ -497,7 +500,7 @@ describe('AutoPollingService', () => {
it('should start polling on construction with the persisted interval', fakeAsync(() => {
const queryBuilderFake = TestBed.get(QueryBuilder);
- const dialogServiceFake = TestBed.get(QueryBuilder);
+ const dialogServiceFake = TestBed.get(DialogService);
spyOn(searchServiceFake, 'search').and.callThrough();
spyOn(localStorage, 'getItem').and.returnValue('{"isActive":true,"refreshInterval":4}');
diff --git a/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.ts b/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.ts
index 1530109..4f6cdba 100755
--- a/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.ts
+++ b/metron-interface/metron-alerts/src/app/alerts/alerts-list/auto-polling/auto-polling.service.ts
@@ -25,6 +25,7 @@ import { POLLING_DEFAULT_STATE } from 'app/utils/constants';
import { RestError } from 'app/model/rest-error';
import { DialogType } from 'app/shared/metron-dialog/metron-dialog.component';
import { DialogService } from 'app/service/dialog.service';
+import { RefreshInterval } from '../../configure-rows/configure-rows-enums';
interface AutoPollingStateModel {
isActive: boolean,
@@ -36,7 +37,7 @@ export class AutoPollingService {
data = new Subject<SearchResponse>();
private isCongestion = false;
- private refreshInterval = 10;
+ private refreshInterval = RefreshInterval.TEN_MIN;
private isPollingActive = POLLING_DEFAULT_STATE;
private isPending = false;
private isPollingSuppressed = false;