web: filtering
This commit is contained in:
parent
5ccae48b92
commit
588d6dbe22
|
@ -1 +1,2 @@
|
|||
libmproxy/web/static/**/* -diff
|
||||
libmproxy/web/static/**/* -diff
|
||||
web/src/js/filt/filt.js -diff
|
File diff suppressed because it is too large
Load Diff
|
@ -57,7 +57,7 @@ var EventLogContents = React.createClass({
|
|||
componentWillReceiveProps: function (nextProps) {
|
||||
if (nextProps.filter !== this.props.filter) {
|
||||
this.props.filter = nextProps.filter; // Dirty: Make sure that view filter sees the update.
|
||||
this.state.view.recalculate(this.props.eventStore.list);
|
||||
this.state.view.recalculate();
|
||||
}
|
||||
if (nextProps.eventStore !== this.props.eventStore) {
|
||||
this.closeView();
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
var MainView = React.createClass({
|
||||
mixins: [Navigation, State],
|
||||
getInitialState: function () {
|
||||
this.onQueryChange(Query.FILTER, function(){
|
||||
this.state.view.recalculate(this.getViewFilt(), this.getViewSort());
|
||||
}.bind(this));
|
||||
return {
|
||||
flows: []
|
||||
};
|
||||
},
|
||||
getViewFilt: function(){
|
||||
return Filt.parse(this.getQuery()[Query.FILTER]);
|
||||
},
|
||||
getViewSort: function(){
|
||||
},
|
||||
componentWillReceiveProps: function (nextProps) {
|
||||
if (nextProps.flowStore !== this.props.flowStore) {
|
||||
this.closeView();
|
||||
|
@ -12,7 +20,7 @@ var MainView = React.createClass({
|
|||
}
|
||||
},
|
||||
openView: function (store) {
|
||||
var view = new StoreView(store);
|
||||
var view = new StoreView(store, this.getViewFilt(), this.getViewSort());
|
||||
this.setState({
|
||||
view: view
|
||||
});
|
||||
|
|
Binary file not shown.
|
@ -130,6 +130,7 @@ function url(regex){
|
|||
|
||||
start "filter expression"
|
||||
= __ orExpr:OrExpr __ { return orExpr; }
|
||||
/ {return trueFilter; }
|
||||
|
||||
ws "whitespace" = [ \t\n\r]
|
||||
cc "control character" = [|&!()~"]
|
||||
|
|
|
@ -29,7 +29,7 @@ _.extend(ListStore.prototype, EventEmitter.prototype, {
|
|||
reset: function (elems) {
|
||||
this.list = elems || [];
|
||||
this._build_map();
|
||||
this.emit("recalculate", this.list);
|
||||
this.emit("recalculate");
|
||||
},
|
||||
_build_map: function () {
|
||||
this._pos_map = {};
|
||||
|
@ -54,11 +54,11 @@ function DictStore() {
|
|||
_.extend(DictStore.prototype, EventEmitter.prototype, {
|
||||
update: function (dict) {
|
||||
_.merge(this.dict, dict);
|
||||
this.emit("recalculate", this.dict);
|
||||
this.emit("recalculate");
|
||||
},
|
||||
reset: function (dict) {
|
||||
this.dict = dict || {};
|
||||
this.emit("recalculate", this.dict);
|
||||
this.emit("recalculate");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ function StoreView(store, filt, sortfun) {
|
|||
this.store.addListener("remove", this.remove);
|
||||
this.store.addListener("recalculate", this.recalculate);
|
||||
|
||||
this.recalculate(this.store.list, filt, sortfun);
|
||||
this.recalculate(filt, sortfun);
|
||||
}
|
||||
|
||||
_.extend(StoreView.prototype, EventEmitter.prototype, {
|
||||
|
@ -33,7 +33,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, {
|
|||
this.store.removeListener("remove", this.remove);
|
||||
this.store.removeListener("recalculate", this.recalculate);
|
||||
},
|
||||
recalculate: function (elems, filt, sortfun) {
|
||||
recalculate: function (filt, sortfun) {
|
||||
if (filt) {
|
||||
this.filt = filt;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, {
|
|||
this.sortfun = sortfun.bind(this);
|
||||
}
|
||||
|
||||
this.list = elems.filter(this.filt);
|
||||
this.list = this.store.list.filter(this.filt);
|
||||
this.list.sort(function (a, b) {
|
||||
return this.sortfun(a) - this.sortfun(b);
|
||||
}.bind(this));
|
||||
|
|
Loading…
Reference in New Issue