mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 18:25:40 +08:00
prevent explore from crashing when table is not present in response
This commit is contained in:
@ -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> {
|
|||||||
|
|
||||||
//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(
|
||||||
|
Reference in New Issue
Block a user