diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-03-15 22:05:50 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-03-15 22:05:50 +0100 |
commit | 4a92c425175a4e592c8760f028be683f53ab9b90 (patch) | |
tree | cdbc7f43536fa8c97c9fbaaf995f4434be898e2a /web/src/js/components/mainview.js | |
parent | 3650d7366216e4cdde0fa369e58b681c9bc30236 (diff) | |
download | mitmproxy-4a92c425175a4e592c8760f028be683f53ab9b90.tar.gz mitmproxy-4a92c425175a4e592c8760f028be683f53ab9b90.tar.bz2 mitmproxy-4a92c425175a4e592c8760f028be683f53ab9b90.zip |
web: smaller changes
Diffstat (limited to 'web/src/js/components/mainview.js')
-rw-r--r-- | web/src/js/components/mainview.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/web/src/js/components/mainview.js b/web/src/js/components/mainview.js index 550a61da..18d7318f 100644 --- a/web/src/js/components/mainview.js +++ b/web/src/js/components/mainview.js @@ -2,6 +2,7 @@ var React = require("react"); var common = require("./common.js"); var actions = require("../actions.js"); +var Query = require("../actions.js").Query; var toputils = require("../utils.js"); var views = require("../store/view.js"); var Filt = require("../filt/filt.js"); @@ -12,12 +13,6 @@ var flowdetail = require("./flowdetail.js"); var MainView = React.createClass({ mixins: [common.Navigation, common.State], getInitialState: function () { - this.onQueryChange(Query.FILTER, function () { - this.state.view.recalculate(this.getViewFilt(), this.getViewSort()); - }.bind(this)); - this.onQueryChange(Query.HIGHLIGHT, function () { - this.state.view.recalculate(this.getViewFilt(), this.getViewSort()); - }.bind(this)); return { flows: [] }; @@ -46,6 +41,12 @@ var MainView = React.createClass({ this.closeView(); this.openView(nextProps.flowStore); } + + var filterChanged = (this.props.query[Query.FILTER] !== nextProps.query[Query.FILTER]); + var highlightChanged = (this.props.query[Query.HIGHLIGHT] !== nextProps.query[Query.HIGHLIGHT]); + if (filterChanged || highlightChanged) { + this.state.view.recalculate(this.getViewFilt(), this.getViewSort()); + } }, openView: function (store) { var view = new views.StoreView(store, this.getViewFilt(), this.getViewSort()); @@ -73,7 +74,7 @@ var MainView = React.createClass({ }, onRemove: function (flow_id, index) { if (flow_id === this.getParams().flowId) { - var flow_to_select = this.state.view.list[Math.min(index, this.state.view.list.length -1)]; + var flow_to_select = this.state.view.list[Math.min(index, this.state.view.list.length - 1)]; this.selectFlow(flow_to_select); } }, @@ -194,7 +195,7 @@ var MainView = React.createClass({ } break; case toputils.Key.V: - if(e.shiftKey && flow && flow.modified) { + if (e.shiftKey && flow && flow.modified) { actions.FlowActions.revert(flow); } break; |