mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
using error callback from datapanel instead
This commit is contained in:
parent
56f7cd9602
commit
aad558ce9c
@ -35,8 +35,16 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|||||||
|
|
||||||
class Popper extends PureComponent<Props> {
|
class Popper extends PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { show, placement, onMouseEnter, onMouseLeave, className, wrapperClassName, renderArrow } = this.props;
|
const {
|
||||||
const { content } = this.props;
|
content,
|
||||||
|
show,
|
||||||
|
placement,
|
||||||
|
onMouseEnter,
|
||||||
|
onMouseLeave,
|
||||||
|
className,
|
||||||
|
wrapperClassName,
|
||||||
|
renderArrow,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Manager>
|
<Manager>
|
||||||
|
@ -34,6 +34,7 @@ export interface Props {
|
|||||||
maxDataPoints?: number;
|
maxDataPoints?: number;
|
||||||
children: (r: RenderProps) => JSX.Element;
|
children: (r: RenderProps) => JSX.Element;
|
||||||
onDataResponse?: (data: DataQueryResponse) => void;
|
onDataResponse?: (data: DataQueryResponse) => void;
|
||||||
|
onError: (errorMessage: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
@ -94,6 +95,7 @@ export class DataPanel extends Component<Props, State> {
|
|||||||
widthPixels,
|
widthPixels,
|
||||||
maxDataPoints,
|
maxDataPoints,
|
||||||
onDataResponse,
|
onDataResponse,
|
||||||
|
onError,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!isVisible) {
|
if (!isVisible) {
|
||||||
@ -146,7 +148,9 @@ export class DataPanel extends Component<Props, State> {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Loading error', err);
|
console.log('Loading error', err);
|
||||||
this.setState({ isFirstLoad: false });
|
this.setState({ isFirstLoad: false });
|
||||||
throw new Error('Request Error');
|
onError(`Query error
|
||||||
|
status: ${err.status}
|
||||||
|
message: ${err.statusText}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -169,7 +173,6 @@ export class DataPanel extends Component<Props, State> {
|
|||||||
render() {
|
render() {
|
||||||
const { queries } = this.props;
|
const { queries } = this.props;
|
||||||
const { loading, isFirstLoad } = this.state;
|
const { loading, isFirstLoad } = this.state;
|
||||||
|
|
||||||
const panelData = this.getPanelData();
|
const panelData = this.getPanelData();
|
||||||
|
|
||||||
if (isFirstLoad && loading === LoadingState.Loading) {
|
if (isFirstLoad && loading === LoadingState.Loading) {
|
||||||
|
@ -171,6 +171,7 @@ export class PanelChrome extends PureComponent<Props, State> {
|
|||||||
widthPixels={width}
|
widthPixels={width}
|
||||||
refreshCounter={refreshCounter}
|
refreshCounter={refreshCounter}
|
||||||
onDataResponse={this.onDataResponse}
|
onDataResponse={this.onDataResponse}
|
||||||
|
onError={this.onError}
|
||||||
>
|
>
|
||||||
{({ loading, panelData }) => {
|
{({ loading, panelData }) => {
|
||||||
return this.renderPanelPlugin(loading, panelData, width, height);
|
return this.renderPanelPlugin(loading, panelData, width, height);
|
||||||
@ -185,7 +186,7 @@ export class PanelChrome extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { dashboard, panel } = this.props;
|
const { dashboard, panel } = this.props;
|
||||||
const { timeInfo } = this.state;
|
const { errorMessage, timeInfo } = this.state;
|
||||||
const { transparent } = panel;
|
const { transparent } = panel;
|
||||||
|
|
||||||
const containerClassNames = `panel-container panel-container--absolute ${transparent ? 'panel-transparent' : ''}`;
|
const containerClassNames = `panel-container panel-container--absolute ${transparent ? 'panel-transparent' : ''}`;
|
||||||
@ -206,7 +207,7 @@ export class PanelChrome extends PureComponent<Props, State> {
|
|||||||
description={panel.description}
|
description={panel.description}
|
||||||
scopedVars={panel.scopedVars}
|
scopedVars={panel.scopedVars}
|
||||||
links={panel.links}
|
links={panel.links}
|
||||||
error={this.state.errorMessage}
|
error={errorMessage}
|
||||||
/>
|
/>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
{({ error, errorInfo }) => {
|
{({ error, errorInfo }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user