Commit 795cee13 by Torkel Ödegaard

KairosDB data source plugin is messy, needs a lot of clean up & refactoring, please help

parent 15188c4a
...@@ -217,7 +217,7 @@ function (angular, _, kbn) { ...@@ -217,7 +217,7 @@ function (angular, _, kbn) {
if(chosenAggregator.sampling_rate) { if(chosenAggregator.sampling_rate) {
returnedAggregator.sampling = KairosDBDatasource.prototype.convertToKairosInterval(chosenAggregator.sampling_rate); returnedAggregator.sampling = KairosDBDatasource.prototype.convertToKairosInterval(chosenAggregator.sampling_rate);
returnedAggregator.align_sampling = true; returnedAggregator.align_sampling = true;
returnedAggregator.align_start_time=true; returnedAggregator.align_start_time =true;
} }
if(chosenAggregator.unit) { if(chosenAggregator.unit) {
returnedAggregator.unit = chosenAggregator.unit+'s'; returnedAggregator.unit = chosenAggregator.unit+'s';
......
...@@ -53,30 +53,26 @@ function (angular, _) { ...@@ -53,30 +53,26 @@ function (angular, _) {
_.move($scope.panel.targets, fromIndex, toIndex); _.move($scope.panel.targets, fromIndex, toIndex);
}; };
////////////////////////////// // Fetch metric list
// SUGGESTION QUERIES
//////////////////////////////
$scope.updateMetricList = function() { $scope.updateMetricList = function() {
$scope.metricListLoading = true; $scope.metricListLoading = true;
metricList = []; metricList = [];
$scope.datasource.performMetricSuggestQuery().then(function(series) { $scope.datasource.performMetricSuggestQuery().then(function(series) {
metricList = series; metricList = series;
$scope.metric.list = series; $scope.metric.list = series;
if ($scope.target.metric) if ($scope.target.metric) {
$scope.metric.value = $scope.target.metric; $scope.metric.value = $scope.target.metric;
else }
else {
$scope.metric.value = ""; $scope.metric.value = "";
}
$scope.metricListLoading = false; $scope.metricListLoading = false;
return metricList; return metricList;
}); });
}; };
$scope.suggestTagKeys = function(query, callback) { $scope.suggestTagKeys = function(query, callback) {
$scope.updateTimeRange(); callback($scope.datasource.performTagSuggestQuery($scope.target.metric, $scope.rangeUnparsed, 'key',''));
callback($scope.datasource
.performTagSuggestQuery($scope.target.metric,$scope.rangeUnparsed, 'key',''));
}; };
$scope.suggestTagValues = function(query, callback) { $scope.suggestTagValues = function(query, callback) {
...@@ -84,10 +80,7 @@ function (angular, _) { ...@@ -84,10 +80,7 @@ function (angular, _) {
.performTagSuggestQuery($scope.target.metric,$scope.rangeUnparsed, 'value',$scope.target.currentTagKey)); .performTagSuggestQuery($scope.target.metric,$scope.rangeUnparsed, 'value',$scope.target.currentTagKey));
}; };
////////////////////////////// // Filter metric by tag
// FILTER by TAG
//////////////////////////////
$scope.addFilterTag = function() { $scope.addFilterTag = function() {
if (!$scope.addFilterTagMode) { if (!$scope.addFilterTagMode) {
$scope.addFilterTagMode = true; $scope.addFilterTagMode = true;
...@@ -333,10 +326,7 @@ function (angular, _) { ...@@ -333,10 +326,7 @@ function (angular, _) {
alert(message); alert(message);
}; };
////////////////////////////// // Validation
// VALIDATION
//////////////////////////////
function MetricListToObject(MetricList) { function MetricListToObject(MetricList) {
var result = {}; var result = {};
var Metric; var Metric;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment