blob: 8bd5e46a0153c7e225b947015b8f2e20156a33d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
import React, {Component} from 'react';
import Header from "./Header";
import MainPane from "./MainPane";
import Footer from "./Footer";
import {BrowserRouter as Router} from "react-router-dom";
import Services from "./Services";
import Filters from "./Filters";
import Config from "./Config";
class App extends Component {
constructor(props) {
super(props);
this.state = {
servicesWindowOpen: false,
filterWindowOpen: false,
configWindowOpen: false,
configDone: false
};
fetch('/api/services')
.then(response => {
if( response.status === 503){
this.setState({configWindowOpen: true});
} else if (response.status === 200){
this.setState({configDone: true});
}
});
}
render() {
let modal;
if (this.state.servicesWindowOpen) {
modal = <Services onHide={() => this.setState({servicesWindowOpen: false})}/>;
}
if (this.state.filterWindowOpen) {
modal = <Filters onHide={() => this.setState({filterWindowOpen: false})}/>;
}
if (this.state.configWindowOpen) {
modal = <Config onHide={() => this.setState({configWindowOpen: false})}
onDone={() => this.setState({configDone: true})}/>;
}
return (
<div className="app">
<Router>
<Header onOpenServices={() => this.setState({servicesWindowOpen: true})}
onOpenFilters={() => this.setState({filterWindowOpen: true})}
onOpenConfig={() => this.setState({configWindowOpen: true})}
onOpenUpload={() => this.setState({uploadWindowOpen: true})}
onConfigDone={this.state.configDone}
/>
<MainPane />
{modal}
<Footer/>
</Router>
</div>
);
}
}
export default App;
|