Commit 584f40d0 by Torkel Ödegaard

Merge branch 'master' of github.com:torkelo/grafana-private into pro

parents 72974719 d4c3463f
# 2.0.0 (unreleased)
**Enhancements**
- [Issue #1297](https://github.com/grafana/grafana/issues/1297). Graphite: Added cumulative and minimumBelow graphite functions
- [Issue #1296](https://github.com/grafana/grafana/issues/1296). InfluxDB: Auto escape column names with special characters. Thanks @steven-aerts
# 1.9.1 (2014-12-29)
**Enhancements**
......
......@@ -14,10 +14,6 @@ function () {
array.splice(toIndex, 0, array.splice(fromIndex, 1)[0]);
return array;
},
remove: function (array, index) {
array.splice(index, 1);
return array;
},
// If variable is value, then return alt. If variable is anything else, return value;
toggle: function (variable, value, alt) {
return variable === value ? alt : value;
......
......@@ -232,7 +232,10 @@ function (angular, _, $, config, kbn, moment) {
'#A', '#B', '#C', '#D',
'#E', '#F', '#G', '#H',
'#I', '#J', '#K', '#L',
'#M', '#N', '#O'
'#M', '#N', '#O', '#P',
'#Q', '#R', '#S', '#T',
'#U', '#V', '#W', '#X',
'#Y', '#Z'
];
GraphiteDatasource.prototype.buildGraphiteParams = function(options) {
......
......@@ -224,6 +224,13 @@ function (_, $) {
});
addFuncDef({
name: "cumulative",
category: categories.Special,
params: [],
defaultParams: []
});
addFuncDef({
name: "groupByNode",
category: categories.Special,
params: [
......@@ -468,6 +475,13 @@ function (_, $) {
});
addFuncDef({
name: 'minimumBelow',
category: categories.Filter,
params: [{ name: "value", type: "int" }],
defaultParams: [0]
});
addFuncDef({
name: 'limit',
category: categories.Filter,
params: [{ name: "n", type: "int" }],
......
......@@ -9,7 +9,7 @@ function (angular, _, config, gfunc, Parser) {
'use strict';
var module = angular.module('grafana.controllers');
var targetLetters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'];
var targetLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
module.controller('GraphiteQueryCtrl', function($scope, $sce, templateSrv) {
......
......@@ -74,16 +74,19 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
};
InfluxDatasource.prototype.listColumns = function(seriesName) {
var interpolated = templateSrv.replace(seriesName);
if (interpolated[0] !== '/') {
interpolated = '/' + interpolated + '/';
seriesName = templateSrv.replace(seriesName);
if(!seriesName.match('^/.*/') && !seriesName.match(/^merge\(.*\)/)) {
seriesName = '"' + seriesName+ '"';
}
return this._seriesQuery('select * from ' + interpolated + ' limit 1').then(function(data) {
return this._seriesQuery('select * from ' + seriesName + ' limit 1').then(function(data) {
if (!data) {
return [];
}
return data[0].columns;
return data[0].columns.map(function(item) {
return /^\w+$/.test(item) ? item : ('"' + item + '"');
});
});
};
......@@ -97,17 +100,9 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
if (!data || data.length === 0) {
return [];
}
// influxdb >= 1.8
if (data[0].points.length > 0) {
return _.map(data[0].points, function(point) {
return point[1];
});
}
else { // influxdb <= 1.7
return _.map(data, function(series) {
return series.name; // influxdb < 1.7
});
}
return _.map(data[0].points, function(point) {
return point[1];
});
});
};
......
......@@ -88,7 +88,6 @@ function (angular, _) {
seriesList = [];
$scope.datasource.listSeries(query).then(function(series) {
seriesList = series;
console.log(series);
callback(seriesList);
});
}
......
......@@ -27,28 +27,27 @@ function (angular, _) {
this.list = [];
this.set = function(title,text,severity,timeout) {
var
_a = {
title: title || '',
text: $sce.trustAsHtml(text || ''),
severity: severity || 'info',
},
_ca = angular.toJson(_a),
_clist = _.map(self.list,function(alert) {return angular.toJson(alert);});
// If we already have this alert, remove it and add a new one
// Why do this instead of skipping the add because it resets the timer
if(_.contains(_clist,_ca)) {
_.remove(self.list,_.indexOf(_clist,_ca));
}
var newAlert = {
title: title || '',
text: $sce.trustAsHtml(text || ''),
severity: severity || 'info',
};
var newAlertJson = angular.toJson(newAlert);
self.list.push(_a);
// remove same alert if it already exists
_.remove(self.list, function(value) {
return angular.toJson(value) === newAlertJson;
});
self.list.push(newAlert);
if (timeout > 0) {
$timeout(function() {
self.list = _.without(self.list,_a);
self.list = _.without(self.list,newAlert);
}, timeout);
}
return(_a);
return(newAlert);
};
this.clear = function(alert) {
......
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