aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/proxyapp.js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-02-28 22:35:08 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-02-28 22:35:08 +0100
commitcbb068edaaa4a91297cc8c6416dcbc274b3e1317 (patch)
tree74a21b74a402295c3e5f687babda30b4682e37de /web/src/js/components/proxyapp.js
parentade5078ebde142a83692bd5e940f6463e6ee52c7 (diff)
downloadmitmproxy-cbb068edaaa4a91297cc8c6416dcbc274b3e1317.tar.gz
mitmproxy-cbb068edaaa4a91297cc8c6416dcbc274b3e1317.tar.bz2
mitmproxy-cbb068edaaa4a91297cc8c6416dcbc274b3e1317.zip
fix up web stuff
Diffstat (limited to 'web/src/js/components/proxyapp.js')
-rw-r--r--web/src/js/components/proxyapp.js45
1 files changed, 24 insertions, 21 deletions
diff --git a/web/src/js/components/proxyapp.js b/web/src/js/components/proxyapp.js
index e766d6e6..9c2d8714 100644
--- a/web/src/js/components/proxyapp.js
+++ b/web/src/js/components/proxyapp.js
@@ -1,4 +1,5 @@
var React = require("react");
+var ReactDOM = require("react-dom");
var ReactRouter = require("react-router");
var _ = require("lodash");
@@ -27,6 +28,7 @@ var ProxyAppMain = React.createClass({
flowStore: React.PropTypes.object.isRequired,
eventStore: React.PropTypes.object.isRequired,
returnFocus: React.PropTypes.func.isRequired,
+ routerFoo: React.PropTypes.object,
},
componentDidMount: function () {
this.focus();
@@ -37,6 +39,10 @@ var ProxyAppMain = React.createClass({
flowStore: this.state.flowStore,
eventStore: this.state.eventStore,
returnFocus: this.focus,
+ routerFoo: {
+ location: this.props.location,
+ params: this.props.params
+ }
};
},
getInitialState: function () {
@@ -53,10 +59,10 @@ var ProxyAppMain = React.createClass({
};
},
focus: function () {
- React.findDOMNode(this).focus();
+ ReactDOM.findDOMNode(this).focus();
},
getMainComponent: function () {
- return this.refs.view.refs.__routeHandler__;
+ return this.refs.view;
},
onKeydown: function (e) {
@@ -88,7 +94,7 @@ var ProxyAppMain = React.createClass({
},
render: function () {
var eventlog;
- if (this.getQuery()[Query.SHOW_EVENTLOG]) {
+ if (this.props.location.query[Query.SHOW_EVENTLOG]) {
eventlog = [
<common.Splitter key="splitter" axis="y"/>,
<EventLog key="eventlog"/>
@@ -96,10 +102,14 @@ var ProxyAppMain = React.createClass({
} else {
eventlog = null;
}
+ var children = React.cloneElement(
+ this.props.children,
+ { ref: "view", query: this.props.location.query }
+ );
return (
<div id="container" tabIndex="0" onKeyDown={this.onKeydown}>
<header.Header ref="header"/>
- <RouteHandler ref="view" query={this.getQuery()}/>
+ {children}
{eventlog}
<Footer/>
</div>
@@ -108,22 +118,15 @@ var ProxyAppMain = React.createClass({
});
-var Route = ReactRouter.Route;
-var RouteHandler = ReactRouter.RouteHandler;
-var Redirect = ReactRouter.Redirect;
-var DefaultRoute = ReactRouter.DefaultRoute;
-var NotFoundRoute = ReactRouter.NotFoundRoute;
-
+import { Route, Router, hashHistory, Redirect} from "react-router";
-var routes = (
- <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" />
+export var app = (
+<Router history={hashHistory}>
+ <Redirect from="/" to="/flows" />
+ <Route path="/" component={ProxyAppMain}>
+ <Route path="flows" component={MainView}/>
+ <Route path="flows/:flowId/:detailTab" component={MainView}/>
+ <Route path="reports" component={Reports}/>
</Route>
-);
-
-module.exports = {
- routes: routes
-}; \ No newline at end of file
+</Router>
+); \ No newline at end of file