aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/proxyapp.jsx.js
blob: ff6e8da1aeee37fe726b93266b835e7e67a1d681 (plain)
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
/** @jsx React.DOM */

//TODO: Move out of here, just a stub.
var Reports = React.createClass({
    render: function () {
        return <div>ReportEditor</div>;
    }
});


var ProxyAppMain = React.createClass({
    getInitialState: function () {
        return { settings: SettingsStore.getAll() };
    },
    componentDidMount: function () {
        SettingsStore.addListener("change", this.onSettingsChange);
    },
    componentWillUnmount: function () {
        SettingsStore.removeListener("change", this.onSettingsChange);
    },
    onSettingsChange: function () {
        this.setState({settings: SettingsStore.getAll()});
    },
    render: function () {
        return (
            <div id="container">
                <Header settings={this.state.settings}/>
                <this.props.activeRouteHandler settings={this.state.settings}/>
                {this.state.settings.showEventLog ? <Splitter axis="y"/> : null}
                {this.state.settings.showEventLog ? <EventLog/> : null}
                <Footer settings={this.state.settings}/>
            </div>
            );
    }
});


var Routes = ReactRouter.Routes;
var Route = ReactRouter.Route;
var Redirect = ReactRouter.Redirect;
var DefaultRoute = ReactRouter.DefaultRoute;
var NotFoundRoute = ReactRouter.NotFoundRoute;


var ProxyApp = (
    <Routes location="hash">
        <Route path="/" handler={ProxyAppMain}>
            <Route name="flows" path="flows" handler={MainView}/>
            <Route name="flow" path="flows/:flowId/:detailTab" handler={MainView}/>
            <Route name="reports" handler={Reports}/>
            <Redirect path="/" to="flows" />
        </Route>
    </Routes>
    );