web: squash bugs

This commit is contained in:
Maximilian Hils 2014-12-23 01:26:03 +01:00
parent b55d584309
commit 459772a8ef
4 changed files with 24 additions and 32 deletions

View File

@ -2293,7 +2293,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, {
},
recalculate: function (filt, sortfun) {
if (filt) {
this.filt = filt;
this.filt = filt.bind(this);
}
if (sortfun) {
this.sortfun = sortfun.bind(this);
@ -3138,7 +3138,12 @@ var FlowTable = React.createClass({displayName: 'FlowTable',
},
renderRow: function (flow) {
var selected = (flow === this.props.selected);
var highlighted = (this.props.view._highlight && this.props.view._highlight[flow.id].length > 0);
var highlighted =
(
this.props.view._highlight &&
this.props.view._highlight[flow.id]
);
return React.createElement(FlowRow, {key: flow.id,
ref: flow.id,
flow: flow,
@ -3538,27 +3543,18 @@ var MainView = React.createClass({displayName: 'MainView',
try {
var filt = Filt.parse(this.getQuery()[Query.FILTER] || "");
var highlightStr = this.getQuery()[Query.HIGHLIGHT];
var highlight = highlightStr ? [Filt.parse(highlightStr)] : [];
var highlight = highlightStr ? Filt.parse(highlightStr) : false;
} catch(e){
console.error("Error when processing filter: " + e);
}
var FadedHighlightColors = ["hsla(57, 100%, 50%, 0.33)"];
return function filter_and_highlight(flow) {
var view = this.state.view;
if(!view._highlight){
view._highlight = {};
}
view._highlight[flow.id] = [];
for (var i = 0; i < highlight.length; i++) {
if (highlight[i] && highlight[i](flow)) {
view._highlight[flow.id].push(FadedHighlightColors[i]);
}
if(!this._highlight){
this._highlight = {};
}
this._highlight[flow.id] = highlight && highlight(flow);
return filt(flow);
}.bind(this);
};
},
getViewSort: function () {
},

View File

@ -82,7 +82,12 @@ var FlowTable = React.createClass({
},
renderRow: function (flow) {
var selected = (flow === this.props.selected);
var highlighted = (this.props.view._highlight && this.props.view._highlight[flow.id].length > 0);
var highlighted =
(
this.props.view._highlight &&
this.props.view._highlight[flow.id]
);
return <FlowRow key={flow.id}
ref={flow.id}
flow={flow}

View File

@ -15,27 +15,18 @@ var MainView = React.createClass({
try {
var filt = Filt.parse(this.getQuery()[Query.FILTER] || "");
var highlightStr = this.getQuery()[Query.HIGHLIGHT];
var highlight = highlightStr ? [Filt.parse(highlightStr)] : [];
var highlight = highlightStr ? Filt.parse(highlightStr) : false;
} catch(e){
console.error("Error when processing filter: " + e);
}
var FadedHighlightColors = ["hsla(57, 100%, 50%, 0.33)"];
return function filter_and_highlight(flow) {
var view = this.state.view;
if(!view._highlight){
view._highlight = {};
}
view._highlight[flow.id] = [];
for (var i = 0; i < highlight.length; i++) {
if (highlight[i] && highlight[i](flow)) {
view._highlight[flow.id].push(FadedHighlightColors[i]);
}
if(!this._highlight){
this._highlight = {};
}
this._highlight[flow.id] = highlight && highlight(flow);
return filt(flow);
}.bind(this);
};
},
getViewSort: function () {
},

View File

@ -35,7 +35,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, {
},
recalculate: function (filt, sortfun) {
if (filt) {
this.filt = filt;
this.filt = filt.bind(this);
}
if (sortfun) {
this.sortfun = sortfun.bind(this);