Commit 2c51f114 by Daniel Lee

singlestat: fix variable spelling

parent 97e2d75f
...@@ -192,10 +192,10 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -192,10 +192,10 @@ class SingleStatCtrl extends MetricsPanelCtrl {
if (this.panel.valueName === 'name') { if (this.panel.valueName === 'name') {
data.value = 0; data.value = 0;
data.valueRounded = 0; data.valueRounded = 0;
data.valueFormated = this.series[0].alias; data.valueFormatted = this.series[0].alias;
} else if (_.isString(lastValue)) { } else if (_.isString(lastValue)) {
data.value = 0; data.value = 0;
data.valueFormated = _.escape(lastValue); data.valueFormatted = _.escape(lastValue);
data.valueRounded = 0; data.valueRounded = 0;
} else { } else {
data.value = this.series[0].stats[this.panel.valueName]; data.value = this.series[0].stats[this.panel.valueName];
...@@ -203,7 +203,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -203,7 +203,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
var decimalInfo = this.getDecimalsForValue(data.value); var decimalInfo = this.getDecimalsForValue(data.value);
var formatFunc = kbn.valueFormats[this.panel.format]; var formatFunc = kbn.valueFormats[this.panel.format];
data.valueFormated = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals); data.valueFormatted = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals);
data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals); data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals);
} }
...@@ -219,7 +219,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -219,7 +219,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// special null case // special null case
if (map.value === 'null') { if (map.value === 'null') {
if (data.value === null || data.value === void 0) { if (data.value === null || data.value === void 0) {
data.valueFormated = map.text; data.valueFormatted = map.text;
return; return;
} }
continue; continue;
...@@ -228,7 +228,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -228,7 +228,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// value/number to text mapping // value/number to text mapping
var value = parseFloat(map.value); var value = parseFloat(map.value);
if (value === data.valueRounded) { if (value === data.valueRounded) {
data.valueFormated = map.text; data.valueFormatted = map.text;
return; return;
} }
} }
...@@ -238,7 +238,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -238,7 +238,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// special null case // special null case
if (map.from === 'null' && map.to === 'null') { if (map.from === 'null' && map.to === 'null') {
if (data.value === null || data.value === void 0) { if (data.value === null || data.value === void 0) {
data.valueFormated = map.text; data.valueFormatted = map.text;
return; return;
} }
continue; continue;
...@@ -248,14 +248,14 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -248,14 +248,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
var from = parseFloat(map.from); var from = parseFloat(map.from);
var to = parseFloat(map.to); var to = parseFloat(map.to);
if (to >= data.valueRounded && from <= data.valueRounded) { if (to >= data.valueRounded && from <= data.valueRounded) {
data.valueFormated = map.text; data.valueFormatted = map.text;
return; return;
} }
} }
} }
if (data.value === null || data.value === void 0) { if (data.value === null || data.value === void 0) {
data.valueFormated = "no value"; data.valueFormatted = "no value";
} }
} }
...@@ -317,7 +317,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -317,7 +317,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
if (panel.prefix) { body += getSpan('singlestat-panel-prefix', panel.prefixFontSize, panel.prefix); } if (panel.prefix) { body += getSpan('singlestat-panel-prefix', panel.prefixFontSize, panel.prefix); }
var value = applyColoringThresholds(data.value, data.valueFormated); 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) { body += getSpan('singlestat-panel-postfix', panel.postfixFontSize, panel.postfix); } if (panel.postfix) { body += getSpan('singlestat-panel-postfix', panel.postfixFontSize, panel.postfix); }
...@@ -329,7 +329,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -329,7 +329,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
function getValueText() { function getValueText() {
var result = panel.prefix ? panel.prefix : ''; var result = panel.prefix ? panel.prefix : '';
result += data.valueFormated; result += data.valueFormatted;
result += panel.postfix ? panel.postfix : ''; result += panel.postfix ? panel.postfix : '';
return result; return result;
......
...@@ -49,8 +49,8 @@ describe('SingleStatCtrl', function() { ...@@ -49,8 +49,8 @@ describe('SingleStatCtrl', function() {
expect(ctx.data.valueRounded).to.be(15); expect(ctx.data.valueRounded).to.be(15);
}); });
it('should set formated falue', function() { it('should set formatted falue', function() {
expect(ctx.data.valueFormated).to.be('15'); expect(ctx.data.valueFormatted).to.be('15');
}); });
}); });
...@@ -65,8 +65,8 @@ describe('SingleStatCtrl', function() { ...@@ -65,8 +65,8 @@ describe('SingleStatCtrl', function() {
expect(ctx.data.valueRounded).to.be(0); expect(ctx.data.valueRounded).to.be(0);
}); });
it('should set formated falue', function() { it('should set formatted falue', function() {
expect(ctx.data.valueFormated).to.be('test.cpu1'); expect(ctx.data.valueFormatted).to.be('test.cpu1');
}); });
}); });
...@@ -80,8 +80,8 @@ describe('SingleStatCtrl', function() { ...@@ -80,8 +80,8 @@ describe('SingleStatCtrl', function() {
expect(ctx.data.valueRounded).to.be(100); expect(ctx.data.valueRounded).to.be(100);
}); });
it('should set formated falue', function() { it('should set formatted falue', function() {
expect(ctx.data.valueFormated).to.be('100'); expect(ctx.data.valueFormatted).to.be('100');
}); });
}); });
...@@ -100,7 +100,7 @@ describe('SingleStatCtrl', function() { ...@@ -100,7 +100,7 @@ describe('SingleStatCtrl', function() {
}); });
it('Should replace value with text', function() { it('Should replace value with text', function() {
expect(ctx.data.valueFormated).to.be('OK'); expect(ctx.data.valueFormatted).to.be('OK');
}); });
}); });
...@@ -112,7 +112,7 @@ describe('SingleStatCtrl', function() { ...@@ -112,7 +112,7 @@ describe('SingleStatCtrl', function() {
}); });
it('Should replace value with text OK', function() { it('Should replace value with text OK', function() {
expect(ctx.data.valueFormated).to.be('OK'); expect(ctx.data.valueFormatted).to.be('OK');
}); });
}); });
...@@ -124,7 +124,7 @@ describe('SingleStatCtrl', function() { ...@@ -124,7 +124,7 @@ describe('SingleStatCtrl', function() {
}); });
it('Should replace value with text NOT OK', function() { it('Should replace value with text NOT OK', function() {
expect(ctx.data.valueFormated).to.be('NOT OK'); expect(ctx.data.valueFormatted).to.be('NOT OK');
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment