Commit ecbe7d06 by Marcus Efraimsson Committed by Torkel Ödegaard

fix: Table panel now renders annotations correctly. Fixes #9842 (#9868)

parent ac8b20a6
......@@ -104,7 +104,7 @@ export class TableRenderer {
return '-';
}
if (_.isString(v)) {
if (_.isString(v) || _.isArray(v)) {
return this.defaultCellFormatter(v, column.style);
}
......
......@@ -14,9 +14,10 @@ describe('when rendering table', () => {
{text: 'United', unit: 'bps'},
{text: 'Sanitized'},
{text: 'Link'},
{text: 'Array'},
];
table.rows = [
[1388556366666, 1230, 40, undefined, "", "", "my.host.com", "host1"]
[1388556366666, 1230, 40, undefined, "", "", "my.host.com", "host1", ["value1", "value2"]]
];
var panel = {
......@@ -66,6 +67,12 @@ describe('when rendering table', () => {
linkUrl: "/dashboard?param=$__cell&param_1=$__cell_1&param_2=$__cell_2",
linkTooltip: "$__cell $__cell_1 $__cell_6",
linkTargetBlank: true
},
{
pattern: 'Array',
type: 'number',
unit: 'ms',
decimals: 3
}
]
};
......@@ -182,6 +189,11 @@ describe('when rendering table', () => {
`;
expect(normalize(html)).toBe(normalize(expectedHtml));
});
it('Array column should not use number as formatter', () => {
var html = renderer.renderCell(8, 0, ['value1', 'value2']);
expect(html).toBe('<td>value1, value2</td>');
});
});
});
......
......@@ -154,7 +154,7 @@ describe('when transforming time series table', () => {
var rawData = {
annotations: [
{
min: 1000,
time: 1000,
text: 'hej',
tags: ['tags', 'asd'],
title: 'title',
......
......@@ -124,7 +124,7 @@ transformers['annotations'] = {
for (var i = 0; i < data.annotations.length; i++) {
var evt = data.annotations[i];
model.rows.push([evt.min, evt.title, evt.text, evt.tags]);
model.rows.push([evt.time, evt.title, evt.text, evt.tags]);
}
}
};
......
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