|
|
@ -7,6 +7,7 @@ import { GraphRenderer } from './graph_renderer'; |
|
|
|
import { GraphLegend } from './graph_legend'; |
|
|
|
import { GraphLegend } from './graph_legend'; |
|
|
|
import { DataProcessor } from './data_processor'; |
|
|
|
import { DataProcessor } from './data_processor'; |
|
|
|
import { Metric, MetricExpanded } from './model/metric'; |
|
|
|
import { Metric, MetricExpanded } from './model/metric'; |
|
|
|
|
|
|
|
import { DatasourceRequest } from './model/datasource'; |
|
|
|
import { AnomalyKey, AnomalyType } from './model/anomaly'; |
|
|
|
import { AnomalyKey, AnomalyType } from './model/anomaly'; |
|
|
|
import { AnomalyService } from './services/anomaly_service'; |
|
|
|
import { AnomalyService } from './services/anomaly_service'; |
|
|
|
import { AnomalyController } from './controllers/anomaly_controller'; |
|
|
|
import { AnomalyController } from './controllers/anomaly_controller'; |
|
|
@ -38,8 +39,9 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
subTabIndex: number; |
|
|
|
subTabIndex: number; |
|
|
|
processor: DataProcessor; |
|
|
|
processor: DataProcessor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
datasourceRequest: DatasourceRequest; |
|
|
|
backendURL: string; |
|
|
|
backendURL: string; |
|
|
|
analyticsTypes: Array<String> = ['Anomaly detection', 'Pettern Detection (not implemented yet)']; |
|
|
|
analyticsTypes: Array<String> = ['Anomaly detection', 'Pattern Detection (not implemented yet)']; |
|
|
|
anomalyTypes = []; // TODO: remove it later. Only for alert tab
|
|
|
|
anomalyTypes = []; // TODO: remove it later. Only for alert tab
|
|
|
|
anomalyController: AnomalyController; |
|
|
|
anomalyController: AnomalyController; |
|
|
|
|
|
|
|
|
|
|
@ -135,8 +137,8 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
|
|
|
|
|
|
|
|
/** @ngInject */ |
|
|
|
/** @ngInject */ |
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
$scope, $injector, private annotationsSrv,
|
|
|
|
$scope, $injector, private annotationsSrv, |
|
|
|
private keybindingSrv, private backendSrv,
|
|
|
|
private keybindingSrv, private backendSrv, |
|
|
|
private popoverSrv, private contextSrv |
|
|
|
private popoverSrv, private contextSrv |
|
|
|
) { |
|
|
|
) { |
|
|
|
super($scope, $injector); |
|
|
|
super($scope, $injector); |
|
|
@ -172,7 +174,17 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
this.render(this.seriesList); |
|
|
|
this.render(this.seriesList); |
|
|
|
this.$scope.$digest(); |
|
|
|
this.$scope.$digest(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
appEvents.on('ds-request-response', data => { |
|
|
|
|
|
|
|
let requestConfig = data.config; |
|
|
|
|
|
|
|
this.datasourceRequest = { |
|
|
|
|
|
|
|
url: requestConfig.url, |
|
|
|
|
|
|
|
type: requestConfig.inspect.type, |
|
|
|
|
|
|
|
method: requestConfig.method, |
|
|
|
|
|
|
|
data: requestConfig.data, |
|
|
|
|
|
|
|
params: requestConfig.params |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.anomalyController.fetchAnomalyTypesStatuses(); |
|
|
|
this.anomalyController.fetchAnomalyTypesStatuses(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -472,8 +484,10 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async saveAnomalyType() { |
|
|
|
async saveAnomalyType() { |
|
|
|
|
|
|
|
this.refresh(); |
|
|
|
await this.anomalyController.saveNewAnomalyType( |
|
|
|
await this.anomalyController.saveNewAnomalyType( |
|
|
|
new MetricExpanded(this.panel.datasource, this.panel.targets), |
|
|
|
new MetricExpanded(this.panel.datasource, this.panel.targets), |
|
|
|
|
|
|
|
this.datasourceRequest, |
|
|
|
this.panel.id |
|
|
|
this.panel.id |
|
|
|
); |
|
|
|
); |
|
|
|
this.$scope.$digest(); |
|
|
|
this.$scope.$digest(); |
|
|
|