Commit 18abd987 by Erik Sundell

prevent explore from crashing when table is not present in response

parent 4eebede9
...@@ -86,11 +86,10 @@ export function mergeTablesIntoModel(dst?: TableModel, ...tables: TableModel[]): ...@@ -86,11 +86,10 @@ export function mergeTablesIntoModel(dst?: TableModel, ...tables: TableModel[]):
if (arguments.length === 1) { if (arguments.length === 1) {
return model; return model;
} }
// Single query returns data columns and rows as is // Single query returns data columns and rows as is
if (arguments.length === 2) { if (arguments.length === 2) {
model.columns = [...tables[0].columns]; model.columns = tables[0].hasOwnProperty('columns') ? [...tables[0].columns] : [];
model.rows = [...tables[0].rows]; model.rows = tables[0].hasOwnProperty('rows') ? [...tables[0].rows] : [];
return model; return model;
} }
......
...@@ -784,14 +784,10 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> { ...@@ -784,14 +784,10 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
//Temp solution... How do detect if ds supports table format? //Temp solution... How do detect if ds supports table format?
let tableResult; let tableResult;
try { tableResult = mergeTablesIntoModel(
tableResult = mergeTablesIntoModel( new TableModel(),
new TableModel(), ...queryTransactions.filter(qt => qt.resultType === 'Table' && qt.done && qt.result).map(qt => qt.result)
...queryTransactions.filter(qt => qt.resultType === 'Table' && qt.done && qt.result).map(qt => qt.result) );
);
} catch (error) {
console.log(error);
}
const logsResult = const logsResult =
datasource && datasource.mergeStreams datasource && datasource.mergeStreams
? datasource.mergeStreams( ? datasource.mergeStreams(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment