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 } );