williaster commented on a change in pull request #3581: Dashboard refactory
URL:
https://github.com/apache/incubator-superset/pull/3581#discussion_r149288912
##########
File path: superset/assets/javascripts/dashboard/components/SliceAdder.jsx
##########
@@ -65,14 +67,30 @@ class SliceAdder extends React.Component {
error: (error) => {
this.errored = true;
this.setState({
- errorMsg: this.props.dashboard.getAjaxErrorMsg(error),
+ errorMsg: t('Sorry, there was an error fetching slices to this
dashboard: ') +
+ this.getAjaxErrorMsg(error),
});
},
});
}
+ getAjaxErrorMsg(error) {
+ const respJSON = error.responseJSON;
+ return (respJSON && respJSON.message) ? respJSON.message :
+ error.responseText;
+ }
+
addSlices() {
-
this.props.dashboard.addSlicesToDashboard(Object.keys(this.state.selectionMap));
+ const adder = this;
+ this.props.addSlicesToDashboard(Object.keys(this.state.selectionMap))
+ // if successful, page will be reloaded.
+ .fail((error) => {
+ adder.errored = true;
+ adder.setState({
+ errorMsg: t('Sorry, there was an error adding slices to this
dashboard: ') +
Review comment:
nit this could be a template literal
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services