SingleStatPanel: various fixes

This commit is contained in:
Torkel Ödegaard 2014-11-06 12:30:42 +01:00
parent 37176fa42d
commit fa813024ca
4 changed files with 14 additions and 11 deletions

View File

@ -169,7 +169,9 @@ function (angular, app, _, TimeSeries, kbn) {
var data = {}; var data = {};
if (!$scope.series || $scope.series.length === 0) { if (!$scope.series || $scope.series.length === 0) {
data.series = { mainValue: null, datapoints: [] }; data.flotpairs = [];
data.mainValue = Number.NaN;
data.mainValueFormated = 'NaN';
} }
else { else {
var series = $scope.series[0]; var series = $scope.series[0];

View File

@ -21,14 +21,6 @@ function (angular, app, _, kbn, $) {
var $panelContainer = elem.parents('.panel-container'); var $panelContainer = elem.parents('.panel-container');
scope.$on('render', function() { scope.$on('render', function() {
data = scope.data;
panel = scope.panel;
if (!data || data.flotpairs.length === 0) {
elem.html('no data');
return;
}
render(); render();
}); });
@ -148,9 +140,11 @@ function (angular, app, _, kbn, $) {
} }
function render() { function render() {
data = scope.data;
panel = scope.panel;
setElementHeight(); setElementHeight();
var panel = scope.panel;
var body = getBigValueHtml(); var body = getBigValueHtml();
if (panel.colorBackground && data.mainValue) { if (panel.colorBackground && data.mainValue) {

View File

@ -99,10 +99,15 @@ function (angular, $, kbn, _, moment) {
result.panel = panel; result.panel = panel;
result.row = row; result.row = row;
result.index = index; result.index = index;
return;
} }
}); });
}); });
if (!result.panel) {
return null;
}
return result; return result;
}; };

View File

@ -39,7 +39,9 @@ function (angular, _, $) {
if (!this.state.panelId) { return; } if (!this.state.panelId) { return; }
var panelInfo = this.$scope.dashboard.getPanelInfoById(this.state.panelId); var panelInfo = this.$scope.dashboard.getPanelInfoById(this.state.panelId);
if (panelInfo) {
panelInfo.row.collapse = false; panelInfo.row.collapse = false;
}
}; };
DashboardViewState.prototype.needsSync = function(urlState) { DashboardViewState.prototype.needsSync = function(urlState) {