diff --git a/ache-dashboard/src/StartCrawl.js b/ache-dashboard/src/StartCrawl.js index 2b245f8fb..4b039b6ed 100644 --- a/ache-dashboard/src/StartCrawl.js +++ b/ache-dashboard/src/StartCrawl.js @@ -33,6 +33,7 @@ class StartCrawl extends React.Component { if(response.crawlerRunning === true) { this.setState({ crawlerRunning: true, + crawlerState: response.crawlerState, serverMessage: "Crawler is running. Open \"Monitoring\" tab for crawl details." }); } else { @@ -71,6 +72,14 @@ class StartCrawl extends React.Component { api.post("/startCrawl", config).then(this.updateResponse.bind(this)); } + stopCrawl(event) { + //this.setState({starting: true}); + var config = { + mode: 'cors' + }; + api.get("/stopCrawl", config).then(this.updateResponse.bind(this)); + } + updateResponse(response) { if('FETCH_ERROR' === response) { this.setState({ @@ -78,7 +87,12 @@ class StartCrawl extends React.Component { serverMessage: "Failed to connect to server to start the crawler." }); } else { - if(response.crawlerStarted === false) { + if(response.shutdownInitiated === true) { + this.setState({ + stopping: true, + serverMessage: response.message + }); + } else if(response.crawlerStarted === false) { this.setState({ starting: false, serverError: true, @@ -145,11 +159,20 @@ class StartCrawl extends React.Component { ); } - // render crawker running message + // render crawler running message if (this.state.crawlerRunning === true) { return ( -
-  {this.state.serverMessage} +
+
+
+  {this.state.serverMessage} +
+
+
+
+ +
+
); }