start with sort, continue tomorrow

This commit is contained in:
Clemens 2016-06-07 00:17:09 +02:00
parent ac2d8549e5
commit ff2129773f
3 changed files with 14 additions and 36 deletions

View File

@ -1536,28 +1536,13 @@ function FlowTableHead(_ref2) {
var sort = _ref2.sort; var sort = _ref2.sort;
//const hasSort = Column.sortKeyFun; /* function () {
const k = Column.sortKeyFun.apply(this, arguments);
// let sortDesc = this.props.sort.sortDesc; if (_.isString(k)) {
// return reverseString("" + k);
// if (Column === this.props.sort.sortColumn) { }
// sortDesc = !sortDesc; return -k;
// this.props.setSort(sortColumn, sortDesc); };*/
// } else {
// this.props.setSort({sortColumn: hasSort && Column, sortDesc: false});
// }
//
// let sortKeyFun = Column.sortKeyFun;
// if (sortDesc) {
// sortKeyFun = hasSort && function () {
// const k = Column.sortKeyFun.apply(this, arguments);
// if (_.isString(k)) {
// return reverseString("" + k);
// }
// return -k;
// };
// }
//this.props.setSortKeyFun(sortKeyFun);
var sortColumn = sort.sortColumn; var sortColumn = sort.sortColumn;
var sortType = sort.sortDesc ? "sort-desc" : "sort-asc"; var sortType = sort.sortDesc ? "sort-desc" : "sort-asc";
@ -1583,7 +1568,7 @@ FlowTableHead.propTypes = {
columns: _react2.default.PropTypes.array.isRequired columns: _react2.default.PropTypes.array.isRequired
}; };
var FlowTableHeadContainer = (0, _reactRedux.connect)(function (state, ownProps) { var FlowTableHeadContainer = (0, _reactRedux.connect)(function (state) {
return { return {
sort: state.flows.sort sort: state.flows.sort
}; };
@ -1730,7 +1715,9 @@ var parseFilter = _lodash2.default.memoize(_filt2.default.parse);
var FlowTableContainer = (0, _reactRedux.connect)(function (state) { var FlowTableContainer = (0, _reactRedux.connect)(function (state) {
return { return {
flows: state.flows.view flows: state.flows.view.sort(function (a, b) {
return state.flows.sort.sortColumn ? a.response.status_code > b.response.status_code : 0;
})
}; };
})(FlowTable); })(FlowTable);
@ -3801,9 +3788,6 @@ var MainView = _react2.default.createClass({
this.props.setHighlight(nextProps.location.query[_actions.Query.HIGHLIGHT], false); this.props.setHighlight(nextProps.location.query[_actions.Query.HIGHLIGHT], false);
} }
}, },
setSortKeyFun: function setSortKeyFun(sortKeyFun) {
// FIXME: Move to redux. This requires that sortKeyFun is not a function anymore.
},
selectFlow: function selectFlow(flow) { selectFlow: function selectFlow(flow) {
// TODO: This belongs into redux // TODO: This belongs into redux
if (flow) { if (flow) {
@ -3934,9 +3918,6 @@ var MainView = _react2.default.createClass({
{ className: "main-view" }, { className: "main-view" },
_react2.default.createElement(_flowtable2.default, { ref: "flowTable", _react2.default.createElement(_flowtable2.default, { ref: "flowTable",
selectFlow: this.selectFlow, selectFlow: this.selectFlow,
setSortKeyFun: function setSortKeyFun(f) {
return console.log("asdf");
},
setSort: this.props.setSort, setSort: this.props.setSort,
selected: this.props.selectedFlow }), selected: this.props.selectedFlow }),
details details

View File

@ -94,7 +94,7 @@ FlowTableHead.propTypes = {
}; };
const FlowTableHeadContainer = connect( const FlowTableHeadContainer = connect(
(state, ownProps) => ({ (state) => ({
sort: state.flows.sort sort: state.flows.sort
}) })
)(FlowTableHead) )(FlowTableHead)
@ -215,7 +215,8 @@ const parseFilter = _.memoize(Filt.parse)
const FlowTableContainer = connect( const FlowTableContainer = connect(
state => ({ state => ({
flows: state.flows.view, // first idea to sort here, but i think thats not good enough ( and not working yet)...
flows: state.flows.view.sort((a,b) => state.flows.sort.sortColumn ? a.response.status_code > b.response.status_code : 0),
}) })
)(FlowTable) )(FlowTable)

View File

@ -23,9 +23,6 @@ var MainView = React.createClass({
this.props.setHighlight(nextProps.location.query[Query.HIGHLIGHT], false) this.props.setHighlight(nextProps.location.query[Query.HIGHLIGHT], false)
} }
}, },
setSortKeyFun: function (sortKeyFun) {
// FIXME: Move to redux. This requires that sortKeyFun is not a function anymore.
},
selectFlow: function (flow) { selectFlow: function (flow) {
// TODO: This belongs into redux // TODO: This belongs into redux
if (flow) { if (flow) {
@ -161,7 +158,6 @@ var MainView = React.createClass({
<div className="main-view"> <div className="main-view">
<FlowTable ref="flowTable" <FlowTable ref="flowTable"
selectFlow={this.selectFlow} selectFlow={this.selectFlow}
setSortKeyFun={(f) => console.log("asdf")}
setSort={this.props.setSort} setSort={this.props.setSort}
selected={this.props.selectedFlow} /> selected={this.props.selectedFlow} />
{details} {details}