|
@@ -34,7 +34,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|
|
var module = angular.module('kibana.panels.graphite', []);
|
|
var module = angular.module('kibana.panels.graphite', []);
|
|
|
app.useModule(module);
|
|
app.useModule(module);
|
|
|
|
|
|
|
|
- module.controller('graphite', function($scope, $rootScope, filterSrv, graphiteSrv, $timeout, annotationsSrv) {
|
|
|
|
|
|
|
+ module.controller('graphite', function($scope, $rootScope, filterSrv, datasourceSrv, $timeout, annotationsSrv) {
|
|
|
|
|
|
|
|
$scope.panelMeta = {
|
|
$scope.panelMeta = {
|
|
|
modals : [],
|
|
modals : [],
|
|
@@ -82,6 +82,9 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|
|
|
|
|
|
|
// Set and populate defaults
|
|
// Set and populate defaults
|
|
|
var _d = {
|
|
var _d = {
|
|
|
|
|
+
|
|
|
|
|
+ datasource: null,
|
|
|
|
|
+
|
|
|
/** @scratch /panels/histogram/3
|
|
/** @scratch /panels/histogram/3
|
|
|
* renderer:: sets client side (flot) or native graphite png renderer (png)
|
|
* renderer:: sets client side (flot) or native graphite png renderer (png)
|
|
|
*/
|
|
*/
|
|
@@ -220,6 +223,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|
|
$scope.editor = {index: 1};
|
|
$scope.editor = {index: 1};
|
|
|
$scope.editorTabs = _.union(['General'],_.pluck($scope.panelMeta.fullEditorTabs,'title'));
|
|
$scope.editorTabs = _.union(['General'],_.pluck($scope.panelMeta.fullEditorTabs,'title'));
|
|
|
$scope.hiddenSeries = {};
|
|
$scope.hiddenSeries = {};
|
|
|
|
|
+
|
|
|
|
|
+ $scope.datasources = datasourceSrv.listOptions();
|
|
|
|
|
+ $scope.datasource = datasourceSrv.get($scope.panel.datasource);
|
|
|
|
|
+
|
|
|
// Always show the query if an alias isn't set. Users can set an alias if the query is too
|
|
// Always show the query if an alias isn't set. Users can set an alias if the query is too
|
|
|
// long
|
|
// long
|
|
|
$scope.panel.tooltip.query_as_alias = true;
|
|
$scope.panel.tooltip.query_as_alias = true;
|
|
@@ -227,6 +234,11 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|
|
$scope.get_data();
|
|
$scope.get_data();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ $scope.datasourceChanged = function() {
|
|
|
|
|
+ $scope.datasource = datasourceSrv.get($scope.panel.datasource);
|
|
|
|
|
+ $scope.get_data();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
$scope.remove_panel_from_row = function(row, panel) {
|
|
$scope.remove_panel_from_row = function(row, panel) {
|
|
|
if ($scope.fullscreen) {
|
|
if ($scope.fullscreen) {
|
|
|
$rootScope.$emit('panel-fullscreen-exit');
|
|
$rootScope.$emit('panel-fullscreen-exit');
|
|
@@ -284,12 +296,13 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
|
|
range: $scope.rangeUnparsed,
|
|
range: $scope.rangeUnparsed,
|
|
|
targets: $scope.panel.targets,
|
|
targets: $scope.panel.targets,
|
|
|
format: $scope.panel.renderer === 'png' ? 'png' : 'json',
|
|
format: $scope.panel.renderer === 'png' ? 'png' : 'json',
|
|
|
- maxDataPoints: $scope.panel.span * 50
|
|
|
|
|
|
|
+ maxDataPoints: $scope.panel.span * 50,
|
|
|
|
|
+ datasource: $scope.panel.datasource
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
$scope.annotationsPromise = annotationsSrv.getAnnotations($scope.rangeUnparsed);
|
|
$scope.annotationsPromise = annotationsSrv.getAnnotations($scope.rangeUnparsed);
|
|
|
|
|
|
|
|
- return graphiteSrv.query(graphiteQuery)
|
|
|
|
|
|
|
+ return $scope.datasource.query(graphiteQuery)
|
|
|
.then($scope.receiveGraphiteData)
|
|
.then($scope.receiveGraphiteData)
|
|
|
.then(null, function(err) {
|
|
.then(null, function(err) {
|
|
|
$scope.panel.error = err.message || "Graphite HTTP Request Error";
|
|
$scope.panel.error = err.message || "Graphite HTTP Request Error";
|