diff --git a/public/app/plugins/panel/table/renderer.ts b/public/app/plugins/panel/table/renderer.ts index b2c1907058e..88cef17bc76 100644 --- a/public/app/plugins/panel/table/renderer.ts +++ b/public/app/plugins/panel/table/renderer.ts @@ -104,7 +104,7 @@ export class TableRenderer { return '-'; } - if (_.isString(v)) { + if (_.isString(v) || _.isArray(v)) { return this.defaultCellFormatter(v, column.style); } diff --git a/public/app/plugins/panel/table/specs/renderer.jest.ts b/public/app/plugins/panel/table/specs/renderer.jest.ts index 61ecbeca30f..48e4caaadfb 100644 --- a/public/app/plugins/panel/table/specs/renderer.jest.ts +++ b/public/app/plugins/panel/table/specs/renderer.jest.ts @@ -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('value1, value2'); + }); }); }); diff --git a/public/app/plugins/panel/table/specs/transformers.jest.ts b/public/app/plugins/panel/table/specs/transformers.jest.ts index 68af0ca7319..5f86266701e 100644 --- a/public/app/plugins/panel/table/specs/transformers.jest.ts +++ b/public/app/plugins/panel/table/specs/transformers.jest.ts @@ -154,7 +154,7 @@ describe('when transforming time series table', () => { var rawData = { annotations: [ { - min: 1000, + time: 1000, text: 'hej', tags: ['tags', 'asd'], title: 'title', diff --git a/public/app/plugins/panel/table/transformers.ts b/public/app/plugins/panel/table/transformers.ts index e23adb43f19..9a94f191646 100644 --- a/public/app/plugins/panel/table/transformers.ts +++ b/public/app/plugins/panel/table/transformers.ts @@ -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]); } } };