diff options
author | Jason <jason.daurus@gmail.com> | 2016-06-18 14:18:24 +0800 |
---|---|---|
committer | Jason <jason.daurus@gmail.com> | 2016-06-18 14:18:24 +0800 |
commit | 9cb5b0af9db83d84af0bdb45d56a9755b400c212 (patch) | |
tree | a2f2c6985f8a2230be3b8796567e678733e03b7f /web/src/js/components | |
parent | 6c0511b06fdc359ec4c48879f803c80d7fbeb34c (diff) | |
parent | 23b976a999f41439e83c1010474ec9dc680b8486 (diff) | |
download | mitmproxy-9cb5b0af9db83d84af0bdb45d56a9755b400c212.tar.gz mitmproxy-9cb5b0af9db83d84af0bdb45d56a9755b400c212.tar.bz2 mitmproxy-9cb5b0af9db83d84af0bdb45d56a9755b400c212.zip |
Merge branch 'master' of github.com:mitmproxy/mitmproxy into websocket
Conflicts:
mitmproxy/web/static/app.js
web/src/js/components/ProxyApp.jsx
web/src/js/connection.js
Diffstat (limited to 'web/src/js/components')
-rw-r--r-- | web/src/js/components/Header/MainMenu.jsx | 11 | ||||
-rw-r--r-- | web/src/js/components/ProxyApp.jsx | 77 |
2 files changed, 34 insertions, 54 deletions
diff --git a/web/src/js/components/Header/MainMenu.jsx b/web/src/js/components/Header/MainMenu.jsx index 86bf961a..7b0b542c 100644 --- a/web/src/js/components/Header/MainMenu.jsx +++ b/web/src/js/components/Header/MainMenu.jsx @@ -1,9 +1,10 @@ import React, { Component, PropTypes } from 'react' -import { SettingsActions } from "../../actions.js" import FilterInput from './FilterInput' import { Query } from '../../actions.js' +import {setInterceptPattern} from "../../ducks/settings" +import { connect } from 'react-redux' -export default class MainMenu extends Component { +class MainMenu extends Component { static title = 'Start' static route = 'flows' @@ -28,7 +29,7 @@ export default class MainMenu extends Component { } onInterceptChange(val) { - SettingsActions.update({ intercept: val }) + this.props.setInterceptPattern(val); } render() { @@ -71,3 +72,7 @@ export default class MainMenu extends Component { ) } } + +export default connect(undefined, { + setInterceptPattern +})(MainMenu); diff --git a/web/src/js/components/ProxyApp.jsx b/web/src/js/components/ProxyApp.jsx index 11c321e7..89bd95fd 100644 --- a/web/src/js/components/ProxyApp.jsx +++ b/web/src/js/components/ProxyApp.jsx @@ -7,7 +7,6 @@ import { init as appInit, destruct as appDestruct } from '../ducks/app' import Header from './Header' import EventLog from './EventLog' import Footer from './Footer' -import { SettingsStore } from '../store/store.js' import { Key } from '../utils.js' class ProxyAppMain extends Component { @@ -23,17 +22,9 @@ class ProxyAppMain extends Component { constructor(props, context) { super(props, context) - this.settingsStore = new SettingsStore() - - // Default Settings before fetch - _.extend(this.settingsStore.dict, {}) - - this.state = { settings: this.settingsStore.dict } - this.focus = this.focus.bind(this) this.onKeyDown = this.onKeyDown.bind(this) this.updateLocation = this.updateLocation.bind(this) - this.onSettingsChange = this.onSettingsChange.bind(this) } componentWillMount() { @@ -41,53 +32,14 @@ class ProxyAppMain extends Component { } /** - * @todo move to actions - */ - updateLocation(pathname, queryUpdate) { - if (pathname === undefined) { - pathname = this.props.location.pathname - } - const query = this.props.location.query - for (const key of Object.keys(queryUpdate || {})) { - query[key] = queryUpdate[key] || undefined - } - this.context.router.replace({ pathname, query }) - } - - /** - * @todo pass in with props - */ - getQuery() { - // For whatever reason, react-router always returns the same object, which makes comparing - // the current props with nextProps impossible. As a workaround, we just clone the query object. - return _.clone(this.props.location.query) - } - - /** - * @todo remove settings store - * @todo connect websocket here * @todo listen to window's key events */ componentDidMount() { this.focus() - this.settingsStore.addListener('recalculate', this.onSettingsChange) } - /** - * @todo remove settings store - * @todo disconnect websocket here - * @todo stop listening to window's key events - */ componentWillUnmount() { this.props.appDestruct() - this.settingsStore.removeListener('recalculate', this.onSettingsChange) - } - - /** - * @todo move to actions - */ - onSettingsChange() { - this.setState({ settings: this.settingsStore.dict }) } /** @@ -144,9 +96,31 @@ class ProxyAppMain extends Component { e.preventDefault() } + /** + * @todo move to actions + */ + updateLocation(pathname, queryUpdate) { + if (pathname === undefined) { + pathname = this.props.location.pathname + } + const query = this.props.location.query + for (const key of Object.keys(queryUpdate || {})) { + query[key] = queryUpdate[key] || undefined + } + this.context.router.replace({ pathname, query }) + } + + /** + * @todo pass in with props + */ + getQuery() { + // For whatever reason, react-router always returns the same object, which makes comparing + // the current props with nextProps impossible. As a workaround, we just clone the query object. + return _.clone(this.props.location.query) + } + render() { - const { showEventLog, location, children } = this.props - const { settings } = this.state + const { showEventLog, location, children, settings } = this.props const query = this.getQuery() return ( <div id="container" tabIndex="0" onKeyDown={this.onKeyDown}> @@ -166,7 +140,8 @@ class ProxyAppMain extends Component { export default connect( state => ({ - showEventLog: state.eventLog.visible + showEventLog: state.eventLog.visible, + settings: state.settings.settings, }), { appInit, |