diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-09-13 23:05:12 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-09-13 23:05:12 +0200 |
commit | d2475e6a146534b5e7aaf2cc7b0b9a75e418415e (patch) | |
tree | 47f2ce48a1c03d8ca6414d92a78c764e25a16e3f /web/src/js/mitmproxy.react.js | |
parent | 9bacb6d426a54882235b8d745dbf123c7958c887 (diff) | |
download | mitmproxy-d2475e6a146534b5e7aaf2cc7b0b9a75e418415e.tar.gz mitmproxy-d2475e6a146534b5e7aaf2cc7b0b9a75e418415e.tar.bz2 mitmproxy-d2475e6a146534b5e7aaf2cc7b0b9a75e418415e.zip |
web: start gui
Diffstat (limited to 'web/src/js/mitmproxy.react.js')
-rw-r--r-- | web/src/js/mitmproxy.react.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/web/src/js/mitmproxy.react.js b/web/src/js/mitmproxy.react.js new file mode 100644 index 00000000..2a2ee910 --- /dev/null +++ b/web/src/js/mitmproxy.react.js @@ -0,0 +1,60 @@ +/** @jsx React.DOM */ + +var App = React.createClass({ + getInitialState: function () { + return { + settings: {} //TODO: How explicit should we get here? + //List all subattributes? + }; + }, + componentDidMount: function () { + //TODO: Replace DummyStore with real settings over WS (https://facebook.github.io/react/tips/initial-ajax.html) + //TODO: Is there a sensible place where we can store this? + var settings = new DummySettings({ + version: "0.12" + }); + settings.addChangeListener(this._onSettingsChange); + + //This would be async in some way or another. + this._onSettingsChange(null, settings); + }, + _onSettingsChange: function(event, settings){ + this.setState({settings: settings.getAll()}); + }, + render: function () { + return ( + <div id="container"> + <Header settings={this.state.settings}/> + <div id="main"> + <this.props.activeRouteHandler settings={this.state.settings}/> + </div> + <Footer/> + </div> + ); + } +}); + +var Traffic = React.createClass({ + render: function(){ + var json = JSON.stringify(this.props, null, 4); + var i = 5; + while(i--) json += json; + return (<pre>{json}</pre>); + } +}); + +var Reports = React.createClass({ + render: function(){ + return (<div>Report Editor</div>); + } +}); + +var routes = ( + <ReactRouter.Routes location="hash"> + <ReactRouter.Route name="app" path="/" handler={App}> + <ReactRouter.Route name="main" handler={Traffic}/> + <ReactRouter.Route name="reports" handler={Reports}/> + <ReactRouter.Redirect to="main"/> + </ReactRouter.Route> + </ReactRouter.Routes> +);
\ No newline at end of file |