From a6a60e9781bd8e0bc3a117eb321d5bc001ebab93 Mon Sep 17 00:00:00 2001 From: amper43 Date: Thu, 27 Sep 2018 23:40:51 +0300 Subject: [PATCH] fix according review --- src/controllers/analytic_controller.ts | 2 +- src/services/analytic_service.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/analytic_controller.ts b/src/controllers/analytic_controller.ts index 92cecc7..aab7741 100644 --- a/src/controllers/analytic_controller.ts +++ b/src/controllers/analytic_controller.ts @@ -359,7 +359,7 @@ export class AnalyticController { } async runEnabledWaiter(analyticUnit: AnalyticUnit) { - var enabled = await this._analyticService.getAlertEnabled(analyticUnit.id); + let enabled = await this._analyticService.getAlertEnabled(analyticUnit.id); if(analyticUnit.alertEnabled !== enabled) { analyticUnit.alertEnabled = enabled; this._emitter.emit('anomaly-type-alert-change', analyticUnit); diff --git a/src/services/analytic_service.ts b/src/services/analytic_service.ts index 8b4ae89..f1d7729 100644 --- a/src/services/analytic_service.ts +++ b/src/services/analytic_service.ts @@ -114,7 +114,7 @@ export class AnalyticService { if(data.enabled === undefined) { throw new Error('Server didn`t return "enabled"'); } - console.log(`Try to enable alerts, got ${data.enabled as boolean}`); + return data.enabled as boolean; } @@ -123,7 +123,7 @@ export class AnalyticService { if(id === undefined) { throw new Error('id is undefined'); } - console.log(`Enable alert url:${this._backendURL + '/alerts'} id:${id} enabled:${enabled}`); + return this._backendSrv.post( this._backendURL + '/alerts', { id, enabled } );