mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
This commit is contained in:
parent
ac8b20a60c
commit
ecbe7d06a6
@ -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¶m_1=$__cell_1¶m_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]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user