aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/mainview.js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-03-17 03:05:59 +0100
committerMaximilian Hils <git@maximilianhils.com>2015-03-17 03:05:59 +0100
commit40c242c3f6e9de093f68ad3e1f8887ae49a28b84 (patch)
tree5094f259893167b6425a88c6709ed6135d573eaa /web/src/js/components/mainview.js
parent4a92c425175a4e592c8760f028be683f53ab9b90 (diff)
downloadmitmproxy-40c242c3f6e9de093f68ad3e1f8887ae49a28b84.tar.gz
mitmproxy-40c242c3f6e9de093f68ad3e1f8887ae49a28b84.tar.bz2
mitmproxy-40c242c3f6e9de093f68ad3e1f8887ae49a28b84.zip
add table sort
Diffstat (limited to 'web/src/js/components/mainview.js')
-rw-r--r--web/src/js/components/mainview.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/web/src/js/components/mainview.js b/web/src/js/components/mainview.js
index 18d7318f..184ef49f 100644
--- a/web/src/js/components/mainview.js
+++ b/web/src/js/components/mainview.js
@@ -9,12 +9,12 @@ var Filt = require("../filt/filt.js");
FlowTable = require("./flowtable.js");
var flowdetail = require("./flowdetail.js");
-
var MainView = React.createClass({
mixins: [common.Navigation, common.State],
getInitialState: function () {
return {
- flows: []
+ flows: [],
+ sortKeyFun: false
};
},
getViewFilt: function () {
@@ -34,8 +34,6 @@ var MainView = React.createClass({
return filt(flow);
};
},
- getViewSort: function () {
- },
componentWillReceiveProps: function (nextProps) {
if (nextProps.flowStore !== this.props.flowStore) {
this.closeView();
@@ -45,11 +43,11 @@ var MainView = React.createClass({
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());
+ this.state.view.recalculate(this.getViewFilt(), this.state.sortKeyFun);
}
},
openView: function (store) {
- var view = new views.StoreView(store, this.getViewFilt(), this.getViewSort());
+ var view = new views.StoreView(store, this.getViewFilt(), this.state.sortKeyFun);
this.setState({
view: view
});
@@ -87,6 +85,12 @@ var MainView = React.createClass({
componentWillUnmount: function () {
this.closeView();
},
+ setSortKeyFun: function(sortKeyFun){
+ this.setState({
+ sortKeyFun: sortKeyFun
+ });
+ this.state.view.recalculate(this.getViewFilt(), sortKeyFun);
+ },
selectFlow: function (flow) {
if (flow) {
this.replaceWith(
@@ -226,6 +230,7 @@ var MainView = React.createClass({
<FlowTable ref="flowTable"
view={this.state.view}
selectFlow={this.selectFlow}
+ setSortKeyFun={this.setSortKeyFun}
selected={selected} />
{details}
</div>