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) # 1.9.1 (2014-12-29)
**Enhancements** **Enhancements**
......
...@@ -14,10 +14,6 @@ function () { ...@@ -14,10 +14,6 @@ function () {
array.splice(toIndex, 0, array.splice(fromIndex, 1)[0]); array.splice(toIndex, 0, array.splice(fromIndex, 1)[0]);
return array; 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; // If variable is value, then return alt. If variable is anything else, return value;
toggle: function (variable, value, alt) { toggle: function (variable, value, alt) {
return variable === value ? alt : value; return variable === value ? alt : value;
......
...@@ -232,7 +232,10 @@ function (angular, _, $, config, kbn, moment) { ...@@ -232,7 +232,10 @@ function (angular, _, $, config, kbn, moment) {
'#A', '#B', '#C', '#D', '#A', '#B', '#C', '#D',
'#E', '#F', '#G', '#H', '#E', '#F', '#G', '#H',
'#I', '#J', '#K', '#L', '#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) { GraphiteDatasource.prototype.buildGraphiteParams = function(options) {
......
...@@ -224,6 +224,13 @@ function (_, $) { ...@@ -224,6 +224,13 @@ function (_, $) {
}); });
addFuncDef({ addFuncDef({
name: "cumulative",
category: categories.Special,
params: [],
defaultParams: []
});
addFuncDef({
name: "groupByNode", name: "groupByNode",
category: categories.Special, category: categories.Special,
params: [ params: [
...@@ -468,6 +475,13 @@ function (_, $) { ...@@ -468,6 +475,13 @@ function (_, $) {
}); });
addFuncDef({ addFuncDef({
name: 'minimumBelow',
category: categories.Filter,
params: [{ name: "value", type: "int" }],
defaultParams: [0]
});
addFuncDef({
name: 'limit', name: 'limit',
category: categories.Filter, category: categories.Filter,
params: [{ name: "n", type: "int" }], params: [{ name: "n", type: "int" }],
......
...@@ -9,7 +9,7 @@ function (angular, _, config, gfunc, Parser) { ...@@ -9,7 +9,7 @@ function (angular, _, config, gfunc, Parser) {
'use strict'; 'use strict';
var module = angular.module('grafana.controllers'); 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) { module.controller('GraphiteQueryCtrl', function($scope, $sce, templateSrv) {
......
...@@ -74,16 +74,19 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) { ...@@ -74,16 +74,19 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
}; };
InfluxDatasource.prototype.listColumns = function(seriesName) { InfluxDatasource.prototype.listColumns = function(seriesName) {
var interpolated = templateSrv.replace(seriesName); seriesName = templateSrv.replace(seriesName);
if (interpolated[0] !== '/') {
interpolated = '/' + interpolated + '/'; 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) { if (!data) {
return []; 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) { ...@@ -97,17 +100,9 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
if (!data || data.length === 0) { if (!data || data.length === 0) {
return []; return [];
} }
// influxdb >= 1.8 return _.map(data[0].points, function(point) {
if (data[0].points.length > 0) { return point[1];
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
});
}
}); });
}; };
......
...@@ -88,7 +88,6 @@ function (angular, _) { ...@@ -88,7 +88,6 @@ function (angular, _) {
seriesList = []; seriesList = [];
$scope.datasource.listSeries(query).then(function(series) { $scope.datasource.listSeries(query).then(function(series) {
seriesList = series; seriesList = series;
console.log(series);
callback(seriesList); callback(seriesList);
}); });
} }
......
...@@ -27,28 +27,27 @@ function (angular, _) { ...@@ -27,28 +27,27 @@ function (angular, _) {
this.list = []; this.list = [];
this.set = function(title,text,severity,timeout) { this.set = function(title,text,severity,timeout) {
var var newAlert = {
_a = { title: title || '',
title: title || '', text: $sce.trustAsHtml(text || ''),
text: $sce.trustAsHtml(text || ''), severity: severity || 'info',
severity: severity || 'info', };
},
_ca = angular.toJson(_a), var newAlertJson = angular.toJson(newAlert);
_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));
}
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) { if (timeout > 0) {
$timeout(function() { $timeout(function() {
self.list = _.without(self.list,_a); self.list = _.without(self.list,newAlert);
}, timeout); }, timeout);
} }
return(_a);
return(newAlert);
}; };
this.clear = function(alert) { 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