|
|
|
@ -504,13 +504,13 @@ export class AnalyticController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async getHSR(from: number, to: number): Promise<HSRTimeSeries | null> { |
|
|
|
|
// 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) { |
|
|
|
|