Merge branch 'master' into panel_repeat

Conflicts:
	public/app/features/templating/templateValuesSrv.js
This commit is contained in:
Torkel Ödegaard
2015-04-29 13:59:15 +02:00
16 changed files with 144 additions and 48 deletions

View File

@@ -376,6 +376,7 @@ function($, _, moment) {
kbn.valueFormats.bytes = kbn.formatFuncCreator(1024, [' B', ' KiB', ' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']);
kbn.valueFormats.kbytes = kbn.formatFuncCreator(1024, [' KiB', ' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']);
kbn.valueFormats.mbytes = kbn.formatFuncCreator(1024, [' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']);
kbn.valueFormats.gbytes = kbn.formatFuncCreator(1024, [' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']);
kbn.valueFormats.bps = kbn.formatFuncCreator(1000, [' bps', ' Kbps', ' Mbps', ' Gbps', ' Tbps', ' Pbps', ' Ebps', ' Zbps', ' Ybps']);
kbn.valueFormats.Bps = kbn.formatFuncCreator(1000, [' Bps', ' KBps', ' MBps', ' GBps', ' TBps', ' PBps', ' EBps', ' ZBps', ' YBps']);
kbn.valueFormats.short = kbn.formatFuncCreator(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Qaudr', ' Quint', ' Sext', ' Sept']);
@@ -547,6 +548,7 @@ function($, _, moment) {
{text: 'bytes', value: 'bytes'},
{text: 'kilobytes', value: 'kbytes'},
{text: 'megabytes', value: 'mbytes'},
{text: 'gigabytes', value: 'gbytes'},
]
},
{

View File

@@ -7,7 +7,7 @@ function (angular, config) {
var module = angular.module('grafana.controllers');
module.controller('LoginCtrl', function($scope, backendSrv, contextSrv) {
module.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) {
$scope.formModel = {
user: '',
email: '',
@@ -28,6 +28,13 @@ function (angular, config) {
$scope.init = function() {
$scope.$watch("loginMode", $scope.loginModeChanged);
$scope.passwordChanged();
var params = $location.search();
if (params.failedMsg) {
$scope.appEvent('alert-warning', ['Login Failed', params.failedMsg]);
delete params.failedMsg;
$location.search(params);
}
};
// build info view model

View File

@@ -29,13 +29,7 @@ function (angular, _, kbn) {
var variable = this.variables[i];
var urlValue = queryParams['var-' + variable.name];
if (urlValue !== void 0) {
var option = _.findWhere(variable.options, { text: urlValue });
option = option || { text: urlValue, value: urlValue };
var promise = this.setVariableValue(variable, option);
this.updateAutoInterval(variable);
promises.push(promise);
promises.push(this.setVariableFromUrl(variable, urlValue));
}
else if (variable.refresh) {
promises.push(this.updateOptions(variable));
@@ -48,6 +42,25 @@ function (angular, _, kbn) {
return $q.all(promises);
};
this.setVariableFromUrl = function(variable, urlValue) {
if (variable.refresh) {
var self = this;
//refresh the list of options before setting the value
return this.updateOptions(variable).then(function() {
var option = _.findWhere(variable.options, { text: urlValue });
option = option || { text: urlValue, value: urlValue };
self.updateAutoInterval(variable);
return self.setVariableValue(variable, option);
});
}
var option = _.findWhere(variable.options, { text: urlValue });
option = option || { text: urlValue, value: urlValue };
this.updateAutoInterval(variable);
return this.setVariableValue(variable, option);
};
this.updateAutoInterval = function(variable) {
if (!variable.auto) { return; }

View File

@@ -5,7 +5,8 @@ function (_) {
'use strict';
function InfluxSeries(options) {
this.seriesList = options.seriesList;
this.seriesList = options.seriesList && options.seriesList.results && options.seriesList.results.length > 0
? options.seriesList.results[0].series || [] : [];
this.alias = options.alias;
this.annotation = options.annotation;
}
@@ -17,12 +18,10 @@ function (_) {
var self = this;
console.log(self.seriesList);
if (!self.seriesList || !self.seriesList.results || !self.seriesList.results[0]) {
if (self.seriesList.length === 0) {
return output;
}
this.seriesList = self.seriesList.results[0].series;
_.each(self.seriesList, function(series) {
var datapoints = [];
for (var i = 0; i < series.values.length; i++) {
@@ -63,19 +62,15 @@ function (_) {
if (column === self.annotation.textColumn) { textCol = index; return; }
});
_.each(series.points, function (point) {
_.each(series.values, function (value) {
var data = {
annotation: self.annotation,
time: point[timeCol],
title: point[titleCol],
tags: point[tagsCol],
text: point[textCol]
time: + new Date(value[timeCol]),
title: value[titleCol],
tags: value[tagsCol],
text: value[textCol]
};
if (tagsCol) {
data.tags = point[tagsCol];
}
list.push(data);
});
});

View File

@@ -13,5 +13,6 @@
"annotations": "app/plugins/datasource/influxdb/partials/annotations.editor.html"
},
"metrics": true
"metrics": true,
"annotations": true
}