From b695dcd0eb276c0e235b321e2fe66d475ee2e085 Mon Sep 17 00:00:00 2001 From: Shavonn Brown Date: Tue, 21 May 2019 02:56:34 -0400 Subject: [PATCH] TablePanel: Check for table using keys (#17185) * Fix: the type is not set so can check for columns and rows to validate is table (#16996) * Fix: the type is not set so can check for columns and rows to validate is table (#16996) * Fix: fix no table check and tests (#16996) --- public/app/plugins/panel/table/specs/transformers.test.ts | 1 - public/app/plugins/panel/table/transformers.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/panel/table/specs/transformers.test.ts b/public/app/plugins/panel/table/specs/transformers.test.ts index 49926aa00a8..c82c9dd6cd0 100644 --- a/public/app/plugins/panel/table/specs/transformers.test.ts +++ b/public/app/plugins/panel/table/specs/transformers.test.ts @@ -108,7 +108,6 @@ describe('when transforming time series table', () => { { type: 'foo', columns: [{ text: 'Time' }, { text: 'Label Key 1' }, { text: 'Value' }], - rows: [[time, 'Label Value 1', 42]], }, ]; diff --git a/public/app/plugins/panel/table/transformers.ts b/public/app/plugins/panel/table/transformers.ts index dac63a935a0..ab3daf6c7be 100644 --- a/public/app/plugins/panel/table/transformers.ts +++ b/public/app/plugins/panel/table/transformers.ts @@ -158,9 +158,8 @@ transformers['table'] = { if (!data || data.length === 0) { return; } - - const noTableIndex = _.findIndex(data, d => d.type !== 'table'); - if (noTableIndex > -1) { + const noTableIndex = _.findIndex(data, d => 'columns' in d && 'rows' in d); + if (noTableIndex < 0) { throw { message: `Result of query #${String.fromCharCode( 65 + noTableIndex