diff --git a/src/module.ts b/src/module.ts index 94ad72a..f090d4a 100644 --- a/src/module.ts +++ b/src/module.ts @@ -26,14 +26,6 @@ const BACKEND_VARIABLE_NAME = 'HASTIC_SERVER_URL'; class GraphCtrl extends MetricsPanelCtrl { static template = template; - ANALYTIC_TYPES: Array<{name: string, value: string}> = [ - { name: 'General', value: 'GENERAL' }, - { name: 'Peaks', value: 'PEAK' }, - { name: 'Troughs', value: 'TROUGH' }, - { name: 'Jumps', value: 'JUMP' }, - { name: 'Drops', value: 'DROP' }, - { name: 'Custom', value: 'CUSTOM' } - ]; hiddenSeries: any = {}; seriesList: any = []; @@ -51,7 +43,7 @@ class GraphCtrl extends MetricsPanelCtrl { processor: DataProcessor; datasourceRequest: DatasourceRequest; - + anomalyTypes = []; // TODO: remove it later. Only for alert tab analyticsController: AnalyticController; @@ -141,6 +133,14 @@ class GraphCtrl extends MetricsPanelCtrl { seriesOverrides: [], thresholds: [], anomalyType: '', + analyticUnitTypes: [ + { name: 'General', value: 'GENERAL' }, + { name: 'Peaks', value: 'PEAK' }, + { name: 'Troughs', value: 'TROUGH' }, + { name: 'Jumps', value: 'JUMP' }, + { name: 'Drops', value: 'DROP' }, + { name: 'Custom', value: 'CUSTOM' } + ] }; /** @ngInject */ @@ -159,9 +159,9 @@ class GraphCtrl extends MetricsPanelCtrl { this.processor = new DataProcessor(this.panel); - + var anomalyService = new AnalyticService(this.backendURL, backendSrv as BackendSrv); - + this.runBackendConnectivityCheck(); this.analyticsController = new AnalyticController(this.panel, anomalyService, this.events); @@ -212,8 +212,8 @@ class GraphCtrl extends MetricsPanelCtrl { async runBackendConnectivityCheck() { if(this.backendURL === '' || this.backendURL === undefined) { this.alertSrv.set( - `Dashboard variable $${BACKEND_VARIABLE_NAME} is missing`, - `Please set $${BACKEND_VARIABLE_NAME}`, + `Dashboard variable $${BACKEND_VARIABLE_NAME} is missing`, + `Please set $${BACKEND_VARIABLE_NAME}`, 'warning', 4000 ); return; @@ -225,7 +225,7 @@ class GraphCtrl extends MetricsPanelCtrl { this.alertSrv.set( 'Can`t connect to Hastic server', `Hastic server: "${this.backendURL}"`, 'warning', 4000 ); - } + } } link(scope, elem, attrs, ctrl) { diff --git a/src/partials/tab_analytics.html b/src/partials/tab_analytics.html index 1d8ec24..69ebff7 100644 --- a/src/partials/tab_analytics.html +++ b/src/partials/tab_analytics.html @@ -13,7 +13,7 @@