This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new ac19875 Erase previously shown chart on error (#6905)
ac19875 is described below
commit ac198754f211c2b491661ad7d2d03e2032b676b8
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Tue Feb 26 15:15:44 2019 -0800
Erase previously shown chart on error (#6905)
* Erase previously shown chart on error
* Addressing comments
* lint
---
superset/assets/src/chart/Chart.jsx | 23 +++++++++++++----------
superset/assets/src/chart/chartReducer.js | 1 +
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/superset/assets/src/chart/Chart.jsx
b/superset/assets/src/chart/Chart.jsx
index 3ef2c8b..d264022 100644
--- a/superset/assets/src/chart/Chart.jsx
+++ b/superset/assets/src/chart/Chart.jsx
@@ -88,16 +88,24 @@ class Chart extends React.PureComponent {
});
}
+ renderStackTraceMessage() {
+ const { chartAlert, chartStackTrace, queryResponse } = this.props;
+ return (
+ <StackTraceMessage
+ message={chartAlert}
+ link={queryResponse ? queryResponse.link : null}
+ stackTrace={chartStackTrace}
+ />);
+ }
+
render() {
const {
width,
height,
chartAlert,
- chartStackTrace,
chartStatus,
errorMessage,
onQuery,
- queryResponse,
refreshOverlayVisible,
} = this.props;
@@ -107,6 +115,9 @@ class Chart extends React.PureComponent {
const containerStyles = isLoading ? { height, width } : null;
const isFaded = refreshOverlayVisible && !errorMessage;
this.renderContainerStartTime = Logger.getTimestamp();
+ if (chartStatus === 'failed') {
+ return this.renderStackTraceMessage();
+ }
return (
<ErrorBoundary onError={this.handleRenderContainerFailure}
showMessage={false}>
@@ -117,14 +128,6 @@ class Chart extends React.PureComponent {
{isLoading && <Loading size={50} />}
- {chartAlert && (
- <StackTraceMessage
- message={chartAlert}
- link={queryResponse ? queryResponse.link : null}
- stackTrace={chartStackTrace}
- />
- )}
-
{!isLoading && !chartAlert && isFaded && (
<RefreshChartOverlay
width={width}
diff --git a/superset/assets/src/chart/chartReducer.js
b/superset/assets/src/chart/chartReducer.js
index 762a765..f626be7 100644
--- a/superset/assets/src/chart/chartReducer.js
+++ b/superset/assets/src/chart/chartReducer.js
@@ -48,6 +48,7 @@ export default function chartReducer(charts = {}, action) {
chartStatus: 'success',
queryResponse: action.queryResponse,
chartUpdateEndTime: now(),
+ chartAlert: null,
};
},
[actions.CHART_UPDATE_STARTED](state) {