Commit e44d049a by Torkel Ödegaard Committed by GitHub

QueryInspector: Now shows error responses (#16514)

While converting this to React we missed subscribing to errors

Fixed #16512
parent 44b36502
......@@ -39,14 +39,20 @@ export class QueryInspector extends PureComponent<Props, State> {
componentDidMount() {
const { panel } = this.props;
panel.events.on('refresh', this.onPanelRefresh);
appEvents.on('ds-request-response', this.onDataSourceResponse);
appEvents.on('ds-request-error', this.onRequestError);
panel.events.on('refresh', this.onPanelRefresh);
panel.refresh();
}
componentWillUnmount() {
const { panel } = this.props;
appEvents.off('ds-request-response', this.onDataSourceResponse);
appEvents.on('ds-request-error', this.onRequestError);
panel.events.off('refresh', this.onPanelRefresh);
}
......@@ -73,6 +79,10 @@ export class QueryInspector extends PureComponent<Props, State> {
}));
};
onRequestError = (err: any) => {
this.onDataSourceResponse(err);
};
onDataSourceResponse = (response: any = {}) => {
if (this.state.isMocking) {
this.handleMocking(response);
......
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