Commit f43735ac by David Committed by GitHub

Merge pull request #12813 from grafana/davkal/explore-empty-results

Explore: show message if queries did not return data
parents 0f94d2f5 f1c1633d
......@@ -513,21 +513,22 @@ export class Explore extends React.Component<any, IExploreState> {
onExecuteQuery={this.handleSubmit}
onRemoveQueryRow={this.handleRemoveQueryRow}
/>
{queryError ? <div className="text-warning m-a-2">{queryError}</div> : null}
{queryError && !loading ? <div className="text-warning m-a-2">{queryError}</div> : null}
<main className="m-t-2">
{supportsGraph && showingGraph ? (
<Graph
data={graphResult}
height={graphHeight}
loading={loading}
id={`explore-graph-${position}`}
options={requestOptions}
height={graphHeight}
split={split}
/>
) : null}
{supportsTable && showingTable ? (
<Table data={tableResult} onClickCell={this.onClickTableCell} className="m-t-3" />
<Table className="m-t-3" data={tableResult} loading={loading} onClickCell={this.onClickTableCell} />
) : null}
{supportsLogs && showingLogs ? <Logs data={logsResult} /> : null}
{supportsLogs && showingLogs ? <Logs data={logsResult} loading={loading} /> : null}
</main>
</div>
) : null}
......
......@@ -123,7 +123,14 @@ class Graph extends Component<any, any> {
}
render() {
const { data, height } = this.props;
const { data, height, loading } = this.props;
if (!loading && data && data.length === 0) {
return (
<div className="panel-container">
<div className="muted m-a-1">The queries returned no time series to graph.</div>
</div>
);
}
return (
<div className="panel-container">
<div id={this.props.id} className="explore-graph" style={{ height }} />
......
......@@ -5,6 +5,7 @@ import { LogsModel, LogRow } from 'app/core/logs_model';
interface LogsProps {
className?: string;
data: LogsModel;
loading: boolean;
}
const EXAMPLE_QUERY = '{job="default/prometheus"}';
......
......@@ -6,6 +6,7 @@ const EMPTY_TABLE = new TableModel();
interface TableProps {
className?: string;
data: TableModel;
loading: boolean;
onClickCell?: (columnKey: string, rowValue: string) => void;
}
......@@ -38,8 +39,24 @@ function Cell(props: SFCCellProps) {
export default class Table extends PureComponent<TableProps, {}> {
render() {
const { className = '', data, onClickCell } = this.props;
const tableModel = data || EMPTY_TABLE;
const { className = '', data, loading, onClickCell } = this.props;
let tableModel = data || EMPTY_TABLE;
if (!loading && data && data.rows.length === 0) {
return (
<table className={`${className} filter-table`}>
<thead>
<tr>
<th>Table</th>
</tr>
</thead>
<tbody>
<tr>
<td className="muted">The queries returned no data for a table.</td>
</tr>
</tbody>
</table>
);
}
return (
<table className={`${className} filter-table`}>
<thead>
......
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