Browse Source

fix according review

master
amper43 6 years ago
parent
commit
a6a60e9781
  1. 2
      src/controllers/analytic_controller.ts
  2. 4
      src/services/analytic_service.ts

2
src/controllers/analytic_controller.ts

@ -359,7 +359,7 @@ export class AnalyticController {
} }
async runEnabledWaiter(analyticUnit: AnalyticUnit) { async runEnabledWaiter(analyticUnit: AnalyticUnit) {
var enabled = await this._analyticService.getAlertEnabled(analyticUnit.id); let enabled = await this._analyticService.getAlertEnabled(analyticUnit.id);
if(analyticUnit.alertEnabled !== enabled) { if(analyticUnit.alertEnabled !== enabled) {
analyticUnit.alertEnabled = enabled; analyticUnit.alertEnabled = enabled;
this._emitter.emit('anomaly-type-alert-change', analyticUnit); this._emitter.emit('anomaly-type-alert-change', analyticUnit);

4
src/services/analytic_service.ts

@ -114,7 +114,7 @@ export class AnalyticService {
if(data.enabled === undefined) { if(data.enabled === undefined) {
throw new Error('Server didn`t return "enabled"'); throw new Error('Server didn`t return "enabled"');
} }
console.log(`Try to enable alerts, got ${data.enabled as boolean}`);
return data.enabled as boolean; return data.enabled as boolean;
} }
@ -123,7 +123,7 @@ export class AnalyticService {
if(id === undefined) { if(id === undefined) {
throw new Error('id is undefined'); throw new Error('id is undefined');
} }
console.log(`Enable alert url:${this._backendURL + '/alerts'} id:${id} enabled:${enabled}`);
return this._backendSrv.post( return this._backendSrv.post(
this._backendURL + '/alerts', { id, enabled } this._backendURL + '/alerts', { id, enabled }
); );

Loading…
Cancel
Save