From e44d049a8e01795b04c9a8cbd372f2d1ab168ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 12 Apr 2019 10:01:50 +0200 Subject: [PATCH] QueryInspector: Now shows error responses (#16514) While converting this to React we missed subscribing to errors Fixed #16512 --- .../dashboard/panel_editor/QueryInspector.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/panel_editor/QueryInspector.tsx b/public/app/features/dashboard/panel_editor/QueryInspector.tsx index 25c3c68e21e..a72fbdb7e8f 100644 --- a/public/app/features/dashboard/panel_editor/QueryInspector.tsx +++ b/public/app/features/dashboard/panel_editor/QueryInspector.tsx @@ -39,14 +39,20 @@ export class QueryInspector extends PureComponent { 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 { })); }; + onRequestError = (err: any) => { + this.onDataSourceResponse(err); + }; + onDataSourceResponse = (response: any = {}) => { if (this.state.isMocking) { this.handleMocking(response);