mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
SingleStatPanel: fix for color thresholds and value to text mapping combo, Fixes #2044
This commit is contained in:
parent
58f743f87d
commit
0047ce067d
@ -190,7 +190,12 @@ function (angular, app, _, TimeSeries, kbn, PanelMeta) {
|
|||||||
data.flotpairs = $scope.series[0].flotpairs;
|
data.flotpairs = $scope.series[0].flotpairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first check value to text mappings
|
var decimalInfo = $scope.getDecimalsForValue(data.value);
|
||||||
|
var formatFunc = kbn.valueFormats[$scope.panel.format];
|
||||||
|
data.valueFormated = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals);
|
||||||
|
data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals);
|
||||||
|
|
||||||
|
// check value to text mappings
|
||||||
for(var i = 0; i < $scope.panel.valueMaps.length; i++) {
|
for(var i = 0; i < $scope.panel.valueMaps.length; i++) {
|
||||||
var map = $scope.panel.valueMaps[i];
|
var map = $scope.panel.valueMaps[i];
|
||||||
// special null case
|
// special null case
|
||||||
@ -201,6 +206,7 @@ function (angular, app, _, TimeSeries, kbn, PanelMeta) {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// value/number to text mapping
|
// value/number to text mapping
|
||||||
var value = parseFloat(map.value);
|
var value = parseFloat(map.value);
|
||||||
if (value === data.value) {
|
if (value === data.value) {
|
||||||
@ -212,11 +218,6 @@ function (angular, app, _, TimeSeries, kbn, PanelMeta) {
|
|||||||
if (data.value === null || data.value === void 0) {
|
if (data.value === null || data.value === void 0) {
|
||||||
data.valueFormated = "no value";
|
data.valueFormated = "no value";
|
||||||
}
|
}
|
||||||
|
|
||||||
var decimalInfo = $scope.getDecimalsForValue(data.value);
|
|
||||||
var formatFunc = kbn.valueFormats[$scope.panel.format];
|
|
||||||
data.valueFormated = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals);
|
|
||||||
data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.removeValueMap = function(map) {
|
$scope.removeValueMap = function(map) {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<form name="loginForm" class="login-form">
|
<form name="loginForm" class="login-form">
|
||||||
<div class="tight-form" ng-if="loginMode">
|
<div class="tight-form" ng-if="loginMode">
|
||||||
<ul class="tight-form-list">
|
<ul class="tight-form-list">
|
||||||
<li class="tight-form-item" style="width: 80px">
|
<li class="tight-form-item" style="width: 78px">
|
||||||
<strong>User</strong>
|
<strong>User</strong>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="tight-form" ng-if="loginMode">
|
<div class="tight-form" ng-if="loginMode">
|
||||||
<ul class="tight-form-list">
|
<ul class="tight-form-list">
|
||||||
<li class="tight-form-item" style="width: 80px">
|
<li class="tight-form-item" style="width: 78px">
|
||||||
<strong>Password</strong>
|
<strong>Password</strong>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
Loading…
Reference in New Issue
Block a user