Commit 675a031b by Tobias Skarhed

All except one passing

parent fc06f8bf
...@@ -310,11 +310,14 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -310,11 +310,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
data.valueRounded = data.value; data.valueRounded = data.value;
data.valueFormatted = formatFunc(data.value, this.dashboard.isTimezoneUtc()); data.valueFormatted = formatFunc(data.value, this.dashboard.isTimezoneUtc());
} else { } else {
console.log(lastPoint, lastValue); // console.log(lastPoint, lastValue);
// console.log(this.panel.valueName);
// console.log(this.panel);
data.value = this.series[0].stats[this.panel.valueName]; data.value = this.series[0].stats[this.panel.valueName];
data.flotpairs = this.series[0].flotpairs; data.flotpairs = this.series[0].flotpairs;
let decimalInfo = this.getDecimalsForValue(data.value); let decimalInfo = this.getDecimalsForValue(data.value);
console.log(decimalInfo);
let formatFunc = kbn.valueFormats[this.panel.format]; let formatFunc = kbn.valueFormats[this.panel.format];
data.valueFormatted = 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);
......
...@@ -192,6 +192,8 @@ describe('SingleStatCtrl', function() { ...@@ -192,6 +192,8 @@ describe('SingleStatCtrl', function() {
) { ) {
ctx.setup(function() { ctx.setup(function() {
ctx.data = [{ target: 'test.cpu1', datapoints: [[99.999, 1], [99.99999, 2]] }]; ctx.data = [{ target: 'test.cpu1', datapoints: [[99.999, 1], [99.99999, 2]] }];
ctx.ctrl.panel.valueName = 'avg';
ctx.ctrl.panel.format = 'none';
}); });
it('Should be rounded', function() { it('Should be rounded', function() {
...@@ -259,7 +261,9 @@ describe('SingleStatCtrl', function() { ...@@ -259,7 +261,9 @@ describe('SingleStatCtrl', function() {
singleStatScenario('with default values', function(ctx) { singleStatScenario('with default values', function(ctx) {
ctx.setup(function() { ctx.setup(function() {
ctx.data = tableData; ctx.data = tableData;
ctx.ctrl.panel = {};
ctx.ctrl.panel.tableColumn = 'mean'; ctx.ctrl.panel.tableColumn = 'mean';
ctx.ctrl.panel.format = 'none';
}); });
it('Should use first rows value as default main value', function() { it('Should use first rows value as default main value', function() {
......
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