diff --git a/src/panel/graph_panel/controllers/analytic_controller.ts b/src/panel/graph_panel/controllers/analytic_controller.ts index e27ffc4..311fbf9 100644 --- a/src/panel/graph_panel/controllers/analytic_controller.ts +++ b/src/panel/graph_panel/controllers/analytic_controller.ts @@ -504,13 +504,13 @@ export class AnalyticController { } async getHSR(from: number, to: number): Promise { - // Returns HSR (Hastic Signal Representation) for analytic unit with enabled "Show HSR" - // Returns null when there is no analytic units which have "Show HSR" enabled - if(this.hsrAnalyticUnit === null) { + // Returns HSR (Hastic Signal Representation) for analytic unit in "Inspect" mode + // Returns null when there is no analytic units in "Inspect" mode + if(this.inspectedAnalyticUnit === null) { return null; } - const hsr = await this._analyticService.getHSR(this.hsrAnalyticUnit.id, from, to); + const hsr = await this._analyticService.getHSR(this.inspectedAnalyticUnit.id, from, to); const datapoints = hsr.values.map(value => value.reverse() as [number, number]); return { target: 'HSR', datapoints }; } @@ -521,8 +521,8 @@ export class AnalyticController { if(hsr === null) { return []; } - if(this.hsrAnalyticUnit.detectorType === DetectorType.ANOMALY) { - const confidence = (this.hsrAnalyticUnit as AnomalyAnalyticUnit).confidence; + if(this.inspectedAnalyticUnit.detectorType === DetectorType.ANOMALY) { + const confidence = (this.inspectedAnalyticUnit as AnomalyAnalyticUnit).confidence; // TODO: looks bad return [ { @@ -562,16 +562,6 @@ export class AnalyticController { return null; } - get hsrAnalyticUnit(): AnalyticUnit | null { - // TODO: remove inspectedAnalyticUnit duplication - for(let analyticUnit of this.analyticUnits) { - if(analyticUnit.showHSR) { - return analyticUnit; - } - }; - return null; - } - public get conditions() { return _.values(Condition); } @@ -682,18 +672,9 @@ export class AnalyticController { } public toggleInspect(id: AnalyticUnitId) { - const analyticUnit = this._analyticUnitsSet.byId(id); - if(!analyticUnit.inspect) { - this.analyticUnits.forEach(unit => unit.inspect = false); - } - } - - public toggleHSR(id: AnalyticUnitId) { - // TODO: remove toggleInspect duplication - const analyticUnit = this._analyticUnitsSet.byId(id); - if(!analyticUnit.showHSR) { - this.analyticUnits.forEach(unit => unit.showHSR = false); - } + this.analyticUnits + .filter(analyticUnit => analyticUnit.id !== id) + .forEach(unit => unit.inspect = false); } public onAnalyticUnitDetectorChange(analyticUnitTypes: any) { diff --git a/src/panel/graph_panel/graph_ctrl.ts b/src/panel/graph_panel/graph_ctrl.ts index 4c08c41..8ef5d9b 100644 --- a/src/panel/graph_panel/graph_ctrl.ts +++ b/src/panel/graph_panel/graph_ctrl.ts @@ -683,11 +683,6 @@ class GraphCtrl extends MetricsPanelCtrl { this.refresh(); } - onToggleHSR(id: AnalyticUnitId) { - this.analyticsController.toggleHSR(id); - this.refresh(); - } - private async _updatePanelInfo() { let datasource = undefined; if(this.panel.datasource) { diff --git a/src/panel/graph_panel/models/analytic_units/analytic_unit.ts b/src/panel/graph_panel/models/analytic_units/analytic_unit.ts index a395706..b2fddee 100644 --- a/src/panel/graph_panel/models/analytic_units/analytic_unit.ts +++ b/src/panel/graph_panel/models/analytic_units/analytic_unit.ts @@ -55,7 +55,6 @@ export class AnalyticUnit { private _segmentSet = new SegmentArray(); private _detectionSpans: DetectionSpan[]; private _inspect = false; - private _showHSR = false; private _status: string; private _error: string; @@ -116,9 +115,6 @@ export class AnalyticUnit { get inspect(): boolean { return this._inspect; } set inspect(value: boolean) { this._inspect = value; } - get showHSR(): boolean { return this._showHSR; } - set showHSR(value: boolean) { this._showHSR = value; } - get visible(): boolean { return (this._serverObject.visible === undefined) ? true : this._serverObject.visible } diff --git a/src/panel/graph_panel/partials/tab_analytics.html b/src/panel/graph_panel/partials/tab_analytics.html index 3c054ec..5001cd1 100644 --- a/src/panel/graph_panel/partials/tab_analytics.html +++ b/src/panel/graph_panel/partials/tab_analytics.html @@ -106,24 +106,16 @@ ng-blur="ctrl.onAnalyticUnitChange(analyticUnit)" /> - - - + - - - -