diff --git a/src/controllers/analytic_controller.ts b/src/controllers/analytic_controller.ts index 9119169..35e368a 100644 --- a/src/controllers/analytic_controller.ts +++ b/src/controllers/analytic_controller.ts @@ -386,6 +386,10 @@ export class AnalyticController { } } + public onAnalyticUnitDetectorChange(analyticUnitTypes: any) { + this.newAnalyticUnit.type = analyticUnitTypes[this.newAnalyticUnit.detectorType][0].value; + } + public async updateServerInfo() { this._serverInfo = await this._analyticService.getServerInfo(); } diff --git a/src/models/analytic_unit.ts b/src/models/analytic_unit.ts index 7bc8f6d..0c07ae2 100644 --- a/src/models/analytic_unit.ts +++ b/src/models/analytic_unit.ts @@ -39,6 +39,7 @@ export class AnalyticUnit { _.defaults(this._panelObject, { name: 'AnalyticUnitName', color: ANALYTIC_UNIT_COLORS[0], + detectorType: 'pattern', type: 'GENERAL', alert: false }); @@ -52,6 +53,9 @@ export class AnalyticUnit { set name(value: string) { this._panelObject.name = value; } get name(): string { return this._panelObject.name; } + set detectorType(value: string) { this._panelObject.detectorType = value; } + get detectorType(): string { return this._panelObject.detectorType; } + set type(value: string) { this._panelObject.type = value; } get type(): string { return this._panelObject.type; } diff --git a/src/module.ts b/src/module.ts index 86559fb..3d5c072 100644 --- a/src/module.ts +++ b/src/module.ts @@ -224,6 +224,10 @@ class GraphCtrl extends MetricsPanelCtrl { return this._analyticUnitTypes; } + get analyticUnitDetectorTypes () { + return _.keys(this._analyticUnitTypes); + } + async runBackendConnectivityCheck() { if(this.backendURL === '' || this.backendURL === undefined) { this.alertSrv.set( diff --git a/src/partials/tab_analytics.html b/src/partials/tab_analytics.html index 3158143..4618586 100644 --- a/src/partials/tab_analytics.html +++ b/src/partials/tab_analytics.html @@ -114,11 +114,23 @@ ng-model="ctrl.analyticsController.newAnalyticUnit.name" > + +
+
@@ -179,7 +191,7 @@ 4) Jumps: increase to a certain value without returning to the original state. - + 5) Drops: decrease to a certain value without returning to the original state.