You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2017/10/10 18:49:56 UTC
[incubator-superset] branch master updated: add explicit message
display for 'Fetching Annotation Layer' error (#3631)
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 bd45e3b add explicit message display for 'Fetching Annotation Layer' error (#3631)
bd45e3b is described below
commit bd45e3b19a4f8ed8fce054e07c4512a610bd002c
Author: Grace Guo <gr...@airbnb.com>
AuthorDate: Tue Oct 10 11:49:53 2017 -0700
add explicit message display for 'Fetching Annotation Layer' error (#3631)
---
.../assets/javascripts/components/AsyncSelect.jsx | 25 +++++++++++-----------
.../components/controls/SelectAsyncControl.jsx | 2 +-
superset/assets/visualizations/nvd3_vis.js | 2 +-
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/superset/assets/javascripts/components/AsyncSelect.jsx b/superset/assets/javascripts/components/AsyncSelect.jsx
index 69b4216..e81a123 100644
--- a/superset/assets/javascripts/components/AsyncSelect.jsx
+++ b/superset/assets/javascripts/components/AsyncSelect.jsx
@@ -42,19 +42,20 @@ class AsyncSelect extends React.PureComponent {
fetchOptions() {
this.setState({ isLoading: true });
const mutator = this.props.mutator;
- $.get(this.props.dataEndpoint, (data) => {
- this.setState({ options: mutator ? mutator(data) : data, isLoading: false });
+ $.get(this.props.dataEndpoint)
+ .done((data) => {
+ this.setState({ options: mutator ? mutator(data) : data, isLoading: false });
- if (!this.props.value && this.props.autoSelect && this.state.options.length) {
- this.onChange(this.state.options[0]);
- }
- })
- .fail(() => {
- this.props.onAsyncError();
- })
- .always(() => {
- this.setState({ isLoading: false });
- });
+ if (!this.props.value && this.props.autoSelect && this.state.options.length) {
+ this.onChange(this.state.options[0]);
+ }
+ })
+ .fail((xhr) => {
+ this.props.onAsyncError(xhr.responseText);
+ })
+ .always(() => {
+ this.setState({ isLoading: false });
+ });
}
render() {
return (
diff --git a/superset/assets/javascripts/explore/components/controls/SelectAsyncControl.jsx b/superset/assets/javascripts/explore/components/controls/SelectAsyncControl.jsx
index 173a275..e06778f 100644
--- a/superset/assets/javascripts/explore/components/controls/SelectAsyncControl.jsx
+++ b/superset/assets/javascripts/explore/components/controls/SelectAsyncControl.jsx
@@ -37,7 +37,7 @@ const SelectAsyncControl = ({ value, onChange, dataEndpoint,
<Select
dataEndpoint={dataEndpoint}
onChange={onSelectionChange}
- onAsyncError={() => notify.error(onAsyncErrorMessage)}
+ onAsyncError={errorMsg => notify.error(onAsyncErrorMessage + ': ' + errorMsg)}
mutator={mutator}
multi={multi}
value={value}
diff --git a/superset/assets/visualizations/nvd3_vis.js b/superset/assets/visualizations/nvd3_vis.js
index 681ceae..42fe9d2 100644
--- a/superset/assets/visualizations/nvd3_vis.js
+++ b/superset/assets/visualizations/nvd3_vis.js
@@ -512,7 +512,7 @@ function nvd3Vis(slice, payload) {
.call(chart);
// add annotation_layer
- if (isTimeSeries && payload.annotations.length) {
+ if (isTimeSeries && payload.annotations && payload.annotations.length) {
const tip = d3tip()
.attr('class', 'd3-tip')
.direction('n')
--
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].