Browse Source

Analytics subtabs for different detectors #111 (#118)

master
rozetko 6 years ago committed by GitHub
parent
commit
3766be4eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/controllers/analytic_controller.ts
  2. 4
      src/models/analytic_unit.ts
  3. 4
      src/module.ts
  4. 14
      src/partials/tab_analytics.html

4
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();
}

4
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; }

4
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(

14
src/partials/tab_analytics.html

@ -114,11 +114,23 @@
ng-model="ctrl.analyticsController.newAnalyticUnit.name"
>
<label class="gf-form-label width-8"> Detector Type </label>
<div class="gf-form-select-wrapper">
<select class="gf-form-input width-12"
ng-model="ctrl.analyticsController.newAnalyticUnit.detectorType"
ng-options="analyticUnitDetectorType for analyticUnitDetectorType in ctrl.analyticUnitDetectorTypes"
ng-change="ctrl.analyticsController.onAnalyticUnitDetectorChange(ctrl.analyticUnitTypes);"
/>
</div>
<label class="gf-form-label width-8"> Type </label>
<div class="gf-form-select-wrapper">
<select class="gf-form-input width-12"
ng-model="ctrl.analyticsController.newAnalyticUnit.type"
ng-options="type.value as type.name for type in ctrl.analyticUnitTypes.pattern"
ng-options="
type.value as type.name
for type in ctrl.analyticUnitTypes[ctrl.analyticsController.newAnalyticUnit.detectorType]
"
/>
</div>

Loading…
Cancel
Save