Browse Source

Handle undefined graph and table results

Dominik Prokop 7 years ago
parent
commit
957c659291

+ 5 - 0
public/app/features/explore/GraphContainer.tsx

@@ -30,6 +30,11 @@ export class GraphContainer extends PureComponent<GraphContainerProps> {
   render() {
   render() {
     const { exploreId, graphResult, loading, onChangeTime, showingGraph, showingTable, range, split } = this.props;
     const { exploreId, graphResult, loading, onChangeTime, showingGraph, showingTable, range, split } = this.props;
     const graphHeight = showingGraph && showingTable ? '200px' : '400px';
     const graphHeight = showingGraph && showingTable ? '200px' : '400px';
+
+    if (!graphResult) {
+      return null;
+    }
+
     return (
     return (
       <Panel label="Graph" isOpen={showingGraph} loading={loading} onToggle={this.onClickGraphButton}>
       <Panel label="Graph" isOpen={showingGraph} loading={loading} onToggle={this.onClickGraphButton}>
         <Graph
         <Graph

+ 5 - 0
public/app/features/explore/TableContainer.tsx

@@ -26,6 +26,11 @@ export class TableContainer extends PureComponent<TableContainerProps> {
 
 
   render() {
   render() {
     const { loading, onClickCell, showingTable, tableResult } = this.props;
     const { loading, onClickCell, showingTable, tableResult } = this.props;
+
+    if (!tableResult) {
+      return null;
+    }
+
     return (
     return (
       <Panel label="Table" loading={loading} isOpen={showingTable} onToggle={this.onClickTableButton}>
       <Panel label="Table" loading={loading} isOpen={showingTable} onToggle={this.onClickTableButton}>
         <Table data={tableResult} loading={loading} onClickCell={onClickCell} />
         <Table data={tableResult} loading={loading} onClickCell={onClickCell} />