Commit f95359fb by Johannes Schill

Notify user on query error

parent 12603010
// Library
import React, { Component } from 'react';
import Tooltip from 'app/core/components/Tooltip/Tooltip';
// Services
import { getDatasourceSrv, DatasourceSrv } from 'app/features/plugins/datasource_srv';
......@@ -138,7 +139,7 @@ export class DataPanel extends Component<Props, State> {
const timeSeries = response.data;
if (isFirstLoad && loading === LoadingState.Loading) {
return this.renderLoadingSpinner();
return this.renderLoadingState();
}
if (!queries.length) {
......@@ -151,7 +152,7 @@ export class DataPanel extends Component<Props, State> {
return (
<>
{this.renderLoadingSpinner()}
{this.renderLoadingState()}
{this.props.children({
timeSeries,
loading,
......@@ -160,15 +161,26 @@ export class DataPanel extends Component<Props, State> {
);
}
private renderLoadingSpinner(): JSX.Element {
private renderLoadingState(): JSX.Element {
const { loading } = this.state;
if (loading === LoadingState.Loading) {
return (
<div className="panel-loading">
<i className="fa fa-spinner fa-spin" />
</div>
);
} else if (loading === LoadingState.Error) {
return (
<Tooltip
content="Request Error"
className="popper__manager--block"
refClassName={`panel-info-corner panel-info-corner--error`}
placement="bottom-start"
>
<i className="fa" />
<span className="panel-info-corner-inner" />
</Tooltip>
);
}
return null;
......
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