diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-03-07 17:58:27 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-03-07 17:58:27 +0100 |
commit | ea3742c3938248c273be159d15ac49b4d2884ed8 (patch) | |
tree | d128af8eb295ed29f76793514624078f7c0d0b46 /web/src/js/components/proxyapp.js | |
parent | 34d19cf12e72a50b1d2e6fd1977c559ed9a80068 (diff) | |
parent | ca9a493a1c20651d111ab06f43437d97b7104705 (diff) | |
download | mitmproxy-ea3742c3938248c273be159d15ac49b4d2884ed8.tar.gz mitmproxy-ea3742c3938248c273be159d15ac49b4d2884ed8.tar.bz2 mitmproxy-ea3742c3938248c273be159d15ac49b4d2884ed8.zip |
Merge pull request #1009 from gzzhanghao/settings
[web] eliminate SettingsState
Diffstat (limited to 'web/src/js/components/proxyapp.js')
-rw-r--r-- | web/src/js/components/proxyapp.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/web/src/js/components/proxyapp.js b/web/src/js/components/proxyapp.js index 97acfbde..d17a1522 100644 --- a/web/src/js/components/proxyapp.js +++ b/web/src/js/components/proxyapp.js @@ -23,7 +23,6 @@ var Reports = React.createClass({ var ProxyAppMain = React.createClass({ mixins: [Router], childContextTypes: { - settingsStore: React.PropTypes.object.isRequired, flowStore: React.PropTypes.object.isRequired, eventStore: React.PropTypes.object.isRequired, returnFocus: React.PropTypes.func.isRequired, @@ -31,10 +30,16 @@ var ProxyAppMain = React.createClass({ }, componentDidMount: function () { this.focus(); + this.settingsStore.addListener("recalculate", this.onSettingsChange); + }, + componentWillUnmount: function () { + this.settingsStore.removeListener("recalculate", this.onSettingsChange); + }, + onSettingsChange: function () { + this.setState({ settings: this.settingsStore.dict }); }, getChildContext: function () { return { - settingsStore: this.state.settingsStore, flowStore: this.state.flowStore, eventStore: this.state.eventStore, returnFocus: this.focus, @@ -46,10 +51,11 @@ var ProxyAppMain = React.createClass({ var flowStore = new FlowStore(); var settingsStore = new SettingsStore(); + this.settingsStore = settingsStore; // Default Settings before fetch _.extend(settingsStore.dict, {}); return { - settingsStore: settingsStore, + settings: settingsStore.dict, flowStore: flowStore, eventStore: eventStore }; @@ -106,10 +112,10 @@ var ProxyAppMain = React.createClass({ ); return ( <div id="container" tabIndex="0" onKeyDown={this.onKeydown}> - <Header ref="header"/> + <Header ref="header" settings={this.state.settings}/> {children} {eventlog} - <Footer/> + <Footer settings={this.state.settings}/> </div> ); } |