From 75eb6a610ddd48aca3612512dfe2b508810e51de Mon Sep 17 00:00:00 2001 From: sanke Date: Fri, 13 Jul 2018 17:40:54 +0300 Subject: [PATCH] remove passed variable use property instead --- src/controllers/analytic_controller.ts | 3 ++- src/models/analytic_unit.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/analytic_controller.ts b/src/controllers/analytic_controller.ts index 8348f9e..499f2ac 100644 --- a/src/controllers/analytic_controller.ts +++ b/src/controllers/analytic_controller.ts @@ -68,9 +68,10 @@ export class AnalyticController { } createNew() { - this._newAnalyticUnit = new AnalyticUnit(undefined, ANALYTIC_UNIT_COLORS[this._currentColorIndex]); + this._newAnalyticUnit = new AnalyticUnit(); this._creatingNewAnalyticType = true; this._savingNewAnalyticUnit = false; + this._newAnalyticUnit.color = ANALYTIC_UNIT_COLORS[this._currentColorIndex]; this._currentColorIndex++; this._currentColorIndex %= ANALYTIC_UNIT_COLORS.length; } diff --git a/src/models/analytic_unit.ts b/src/models/analytic_unit.ts index 301e19a..ba5a4a5 100644 --- a/src/models/analytic_unit.ts +++ b/src/models/analytic_unit.ts @@ -4,6 +4,7 @@ import { Segment, SegmentId } from './segment'; import { Metric } from './metric'; import _ from 'lodash'; +import { ANALYTIC_UNIT_COLORS } from '../colors'; export type AnalyticSegmentPair = { anomalyType: AnalyticUnit, segment: AnalyticSegment }; @@ -32,12 +33,12 @@ export class AnalyticUnit { private _alertEnabled?: boolean; - constructor(private _panelObject?: any, color?: string) { + constructor(private _panelObject?: any) { if(_panelObject === undefined) { this._panelObject = {}; } _.defaults(this._panelObject, { - name: 'AnalyticUnitName', confidence: 0.2, color, type: 'general' + name: 'AnalyticUnitName', confidence: 0.2, color: ANALYTIC_UNIT_COLORS[0], type: 'general' }); //this._metric = new Metric(_panelObject.metric);