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