Skip to content

Commit

Permalink
add explicit message display for 'Fetching Annotation Layer' error (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo authored and mistercrunch committed Oct 10, 2017
1 parent b866b33 commit bd45e3b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
25 changes: 13 additions & 12 deletions superset/assets/javascripts/components/AsyncSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit bd45e3b

Please sign in to comment.