Browse Source

fixs

master
Alexey Velikiy 7 years ago
parent
commit
9b490a935b
  1. 11
      dist/module.js
  2. 2
      src/controllers/analytic_controller.ts
  3. 7
      src/services/analytic_service.ts

11
dist/module.js vendored

@ -5924,7 +5924,7 @@ var AnalyticController = /** @class */ (function () {
return [2 /*return*/];
}
this._statusRunners.add(anomalyType.id);
statusGenerator = this._analyticService.getAnomalyTypeStatusGenerator(anomalyType.id, 1000);
statusGenerator = this._analyticService.getStatusGenerator(anomalyType.id, 1000);
_b.label = 1;
case 1:
_b.trys.push([1, 7, 8, 13]);
@ -9023,8 +9023,8 @@ var AnalyticService = /** @class */ (function () {
});
});
};
AnalyticService.prototype.getAnomalyTypeStatusGenerator = function (id, duration) {
return __asyncGenerator(this, arguments, function getAnomalyTypeStatusGenerator_1() {
AnalyticService.prototype.getStatusGenerator = function (id, duration) {
return __asyncGenerator(this, arguments, function getStatusGenerator_1() {
var _this = this;
var statusCheck, timeout;
return __generator(this, function (_a) {
@ -9077,7 +9077,10 @@ var AnalyticService = /** @class */ (function () {
return [4 /*yield*/, this._backendSrv.get(this._backendURL + '/alerts', { id: id })];
case 1:
data = _a.sent();
return [2 /*return*/, data.enable];
if (data.enabled === undefined) {
throw new Error('Server didn`t return "enabled"');
}
return [2 /*return*/, data.enabled];
}
});
});

2
src/controllers/analytic_controller.ts

@ -298,7 +298,7 @@ export class AnalyticController {
this._statusRunners.add(anomalyType.id);
var statusGenerator = this._analyticService.getAnomalyTypeStatusGenerator(
var statusGenerator = this._analyticService.getStatusGenerator(
anomalyType.id, 1000
);

7
src/services/analytic_service.ts

@ -79,7 +79,7 @@ export class AnalyticService {
return segments.map(s => new AnalyticSegment(s.labeled, s.id, s.start, s.finish));
}
async * getAnomalyTypeStatusGenerator(id: AnalyticUnitId, duration: number) {
async * getStatusGenerator(id: AnalyticUnitId, duration: number) {
if(id === undefined) {
throw new Error('id is undefined');
}
@ -108,7 +108,10 @@ export class AnalyticService {
var data = await this._backendSrv.get(
this._backendURL + '/alerts', { id }
);
return data.enable as boolean;
if(data.enabled === undefined) {
throw new Error('Server didn`t return "enabled"');
}
return data.enabled as boolean;
}

Loading…
Cancel
Save