Diplay error msg when failed to fetch status from API (issue
@@ -71,15 +71,20 @@ class Search extends React.Component {
.then(function(response) {
return response.json();
}, function(error) {
- this.serverError = true;
- this.serverMessage = "Failed to get status from crawler server.";
+ return 'FETCH_ERROR';
})
.then(this.setupSearch.bind(this));
this.state = {message:"Loading...", searchEnabled: false};
}
setupSearch(status) {
- //status.searchEnabled = !status.searchEnabled;
+ if(status === 'FETCH_ERROR') {
+ this.setState({
+ message: "Failed to connect to ACHE API to get crawler status.",
+ searchEnabled: false
+ });
+ return;
+ }
if(!status.searchEnabled) {
this.setState({
message: "Search is not available for this crawl (it's only available when using ELASTICSEARCH data format).",
@@ -95,8 +100,6 @@ class Search extends React.Component {
render() {
-
-
const enabled = this.state.searchEnabled;
const message = this.state.message;
