Browse Source

Revert "Merge pull request #73 from hastic/restore-hooks-api-#149"

This reverts commit edc3fb0ac0, reversing
changes made to 5e9cda9391.
master
amper43 6 years ago
parent
commit
5c47c78845
  1. 18
      src/controllers/analytic_controller.ts
  2. 4
      src/partials/tab_analytics.html
  3. 2
      src/services/analytic_service.ts

18
src/controllers/analytic_controller.ts

@ -49,7 +49,7 @@ export class AnalyticController {
this._labelingDataAddedSegments = new SegmentArray<AnalyticSegment>();
this._labelingDataDeletedSegments = new SegmentArray<AnalyticSegment>();
this._analyticUnitsSet = new AnalyticUnitsSet(this._panelObject.anomalyTypes);
this.analyticUnits.forEach(a => this.runEnabledWaiter(a));
// this.analyticUnits.forEach(a => this.runEnabledWaiter(a));
}
getSegmentsSearcher(): AnalyticSegmentsSearcher {
@ -88,7 +88,7 @@ export class AnalyticController {
this._analyticUnitsSet.addItem(this._newAnalyticUnit);
this._creatingNewAnalyticType = false;
this._savingNewAnalyticUnit = false;
this.runEnabledWaiter(this._newAnalyticUnit);
// this.runEnabledWaiter(this._newAnalyticUnit);
this._runStatusWaiter(this._newAnalyticUnit);
}
@ -358,13 +358,13 @@ export class AnalyticController {
this._statusRunners.delete(analyticUnit.id);
}
async runEnabledWaiter(analyticUnit: AnalyticUnit) {
let enabled = await this._analyticService.getAlertEnabled(analyticUnit.id);
if(analyticUnit.alertEnabled !== enabled) {
analyticUnit.alertEnabled = enabled;
this._emitter.emit('anomaly-type-alert-change', analyticUnit);
}
}
// async runEnabledWaiter(analyticUnit: AnalyticUnit) {
// var enabled = await this._analyticService.getAlertEnabled(analyticUnit.id);
// if(analyticUnit.alertEnabled !== enabled) {
// analyticUnit.alertEnabled = enabled;
// this._emitter.emit('anomaly-type-alert-change', analyticUnit);
// }
// }
async toggleAlertEnabled(analyticUnit: AnalyticUnit) {
var enabled = analyticUnit.alertEnabled;

4
src/partials/tab_analytics.html

@ -49,7 +49,7 @@
</label>
<label class="gf-form-label"> Alerts: </label>
<!-- <label class="gf-form-label"> Alerts: </label>
<label
class="gf-form-label text-center"
style="width: 4rem"
@ -57,7 +57,7 @@
bs-tooltip="'Alarting status isn`t available. Wait please.'"
>
<i class="fa fa-spinner fa-spin"></i>
</label>
</label> -->
<gf-form-switch
ng-if="analyticUnit.alertEnabled !== undefined"

2
src/services/analytic_service.ts

@ -114,7 +114,6 @@ export class AnalyticService {
if(data.enabled === undefined) {
throw new Error('Server didn`t return "enabled"');
}
return data.enabled as boolean;
}
@ -123,7 +122,6 @@ export class AnalyticService {
if(id === undefined) {
throw new Error('id is undefined');
}
return this._backendSrv.post(
this._backendURL + '/alerts', { id, enabled }
);

Loading…
Cancel
Save