Merge pull request #11143 from ApsOps/colorize-singlestat-prefix-postfix

Add color to prefix and postfix in singlestat panel
This commit is contained in:
Carl Bergquist 2018-03-13 10:41:40 +01:00 committed by GitHub
commit 6df13252bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -426,14 +426,16 @@ class SingleStatCtrl extends MetricsPanelCtrl {
var body = '<div class="singlestat-panel-value-container">'; var body = '<div class="singlestat-panel-value-container">';
if (panel.prefix) { if (panel.prefix) {
body += getSpan('singlestat-panel-prefix', panel.prefixFontSize, panel.prefix); var prefix = applyColoringThresholds(data.value, panel.prefix);
body += getSpan('singlestat-panel-prefix', panel.prefixFontSize, prefix);
} }
var value = applyColoringThresholds(data.value, data.valueFormatted); var value = applyColoringThresholds(data.value, data.valueFormatted);
body += getSpan('singlestat-panel-value', panel.valueFontSize, value); body += getSpan('singlestat-panel-value', panel.valueFontSize, value);
if (panel.postfix) { if (panel.postfix) {
body += getSpan('singlestat-panel-postfix', panel.postfixFontSize, panel.postfix); var postfix = applyColoringThresholds(data.value, panel.postfix);
body += getSpan('singlestat-panel-postfix', panel.postfixFontSize, postfix);
} }
body += '</div>'; body += '</div>';