mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
add explicit message display for 'Fetching Annotation Layer' error (#3631)
This commit is contained in:
committed by
Maxime Beauchemin
parent
b866b33dee
commit
bd45e3b19a
@@ -42,19 +42,20 @@ class AsyncSelect extends React.PureComponent {
|
|||||||
fetchOptions() {
|
fetchOptions() {
|
||||||
this.setState({ isLoading: true });
|
this.setState({ isLoading: true });
|
||||||
const mutator = this.props.mutator;
|
const mutator = this.props.mutator;
|
||||||
$.get(this.props.dataEndpoint, (data) => {
|
$.get(this.props.dataEndpoint)
|
||||||
this.setState({ options: mutator ? mutator(data) : data, isLoading: false });
|
.done((data) => {
|
||||||
|
this.setState({ options: mutator ? mutator(data) : data, isLoading: false });
|
||||||
|
|
||||||
if (!this.props.value && this.props.autoSelect && this.state.options.length) {
|
if (!this.props.value && this.props.autoSelect && this.state.options.length) {
|
||||||
this.onChange(this.state.options[0]);
|
this.onChange(this.state.options[0]);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail(() => {
|
.fail((xhr) => {
|
||||||
this.props.onAsyncError();
|
this.props.onAsyncError(xhr.responseText);
|
||||||
})
|
})
|
||||||
.always(() => {
|
.always(() => {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const SelectAsyncControl = ({ value, onChange, dataEndpoint,
|
|||||||
<Select
|
<Select
|
||||||
dataEndpoint={dataEndpoint}
|
dataEndpoint={dataEndpoint}
|
||||||
onChange={onSelectionChange}
|
onChange={onSelectionChange}
|
||||||
onAsyncError={() => notify.error(onAsyncErrorMessage)}
|
onAsyncError={errorMsg => notify.error(onAsyncErrorMessage + ': ' + errorMsg)}
|
||||||
mutator={mutator}
|
mutator={mutator}
|
||||||
multi={multi}
|
multi={multi}
|
||||||
value={value}
|
value={value}
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ function nvd3Vis(slice, payload) {
|
|||||||
.call(chart);
|
.call(chart);
|
||||||
|
|
||||||
// add annotation_layer
|
// add annotation_layer
|
||||||
if (isTimeSeries && payload.annotations.length) {
|
if (isTimeSeries && payload.annotations && payload.annotations.length) {
|
||||||
const tip = d3tip()
|
const tip = d3tip()
|
||||||
.attr('class', 'd3-tip')
|
.attr('class', 'd3-tip')
|
||||||
.direction('n')
|
.direction('n')
|
||||||
|
|||||||
Reference in New Issue
Block a user