Table: Add space between values for the DefaultCell (#42246) (#42276)

fixes #42024

(cherry picked from commit 86a22a914d)

Co-authored-by: Derik Evangelista <derik.evangelista@grafana.com>
This commit is contained in:
Grot (@grafanabot) 2021-11-25 04:27:50 -05:00 committed by GitHub
parent 4f45b44a71
commit 53140c5b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -70,11 +70,11 @@ describe('Process simple display values', () => {
});
it('array of text', () => {
assertSame(['a', 'b', 'c'], processors, { text: 'a,b,c', numeric: NaN });
assertSame(['a', 'b', 'c'], processors, { text: 'a, b, c', numeric: NaN });
});
it('array of numbers', () => {
assertSame([1, 2, 3], processors, { text: '1,2,3', numeric: NaN });
assertSame([1, 2, 3], processors, { text: '1, 2, 3', numeric: NaN });
});
it('empty object', () => {

View File

@ -1,5 +1,5 @@
// Libraries
import { toString, toNumber as _toNumber, isEmpty, isBoolean } from 'lodash';
import { toString, toNumber as _toNumber, isEmpty, isBoolean, isArray, join } from 'lodash';
// Types
import { Field, FieldType } from '../types/dataFrame';
@ -116,6 +116,10 @@ export function getDisplayProcessor(options?: DisplayProcessorOptions): DisplayP
}
}
if (text == null && isArray(value)) {
text = join(value, ', ');
}
if (text == null) {
text = toString(value);
if (!text) {