mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
SingleStatPanel: various fixes
This commit is contained in:
parent
37176fa42d
commit
fa813024ca
@ -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];
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user