mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(table): renderes empty date column as '-' (#6736)
* fix(table): renderes empty date column as '-' closes #6728 * docs(changelog): add note about closing 6728
This commit is contained in:
committed by
Torkel Ödegaard
parent
2bdeb78885
commit
2bdb2f79ec
@@ -47,6 +47,10 @@ export class TableRenderer {
|
||||
|
||||
if (style.type === 'date') {
|
||||
return v => {
|
||||
if (v === undefined || v === null) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
if (_.isArray(v)) { v = v[0]; }
|
||||
var date = moment(v);
|
||||
if (this.isUtc) {
|
||||
|
||||
@@ -68,6 +68,16 @@ describe('when rendering table', () => {
|
||||
expect(html).to.be('<td>2014-01-01T06:06:06Z</td>');
|
||||
});
|
||||
|
||||
it('undefined time column should be rendered as -', () => {
|
||||
var html = renderer.renderCell(0, undefined);
|
||||
expect(html).to.be('<td>-</td>');
|
||||
});
|
||||
|
||||
it('null time column should be rendered as -', () => {
|
||||
var html = renderer.renderCell(0, null);
|
||||
expect(html).to.be('<td>-</td>');
|
||||
});
|
||||
|
||||
it('number column with unit specified should ignore style unit', () => {
|
||||
var html = renderer.renderCell(5, 1230);
|
||||
expect(html).to.be('<td>1.23 kbps</td>');
|
||||
|
||||
Reference in New Issue
Block a user