aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/flowtable-columns.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/flowtable-columns.js
parent4a92c425175a4e592c8760f028be683f53ab9b90 (diff)
downloadmitmproxy-40c242c3f6e9de093f68ad3e1f8887ae49a28b84.tar.gz
mitmproxy-40c242c3f6e9de093f68ad3e1f8887ae49a28b84.tar.bz2
mitmproxy-40c242c3f6e9de093f68ad3e1f8887ae49a28b84.zip
add table sort
Diffstat (limited to 'web/src/js/components/flowtable-columns.js')
-rw-r--r--web/src/js/components/flowtable-columns.js83
1 files changed, 60 insertions, 23 deletions
diff --git a/web/src/js/components/flowtable-columns.js b/web/src/js/components/flowtable-columns.js
index 39c4bd8d..a82c607a 100644
--- a/web/src/js/components/flowtable-columns.js
+++ b/web/src/js/components/flowtable-columns.js
@@ -1,11 +1,17 @@
var React = require("react");
-var flowutils = require("../flow/utils.js");
+var RequestUtils = require("../flow/utils.js").RequestUtils;
+var ResponseUtils = require("../flow/utils.js").ResponseUtils;
var utils = require("../utils.js");
var TLSColumn = React.createClass({
statics: {
- renderTitle: function () {
- return <th key="tls" className="col-tls"></th>;
+ Title: React.createClass({
+ render: function(){
+ return <th {...this.props} className={"col-tls " + (this.props.className || "") }></th>;
+ }
+ }),
+ sortKeyFun: function(flow){
+ return flow.request.scheme;
}
},
render: function () {
@@ -24,16 +30,18 @@ var TLSColumn = React.createClass({
var IconColumn = React.createClass({
statics: {
- renderTitle: function () {
- return <th key="icon" className="col-icon"></th>;
- }
+ Title: React.createClass({
+ render: function(){
+ return <th {...this.props} className={"col-icon " + (this.props.className || "") }></th>;
+ }
+ })
},
render: function () {
var flow = this.props.flow;
var icon;
if (flow.response) {
- var contentType = flowutils.ResponseUtils.getContentType(flow.response);
+ var contentType = ResponseUtils.getContentType(flow.response);
//TODO: We should assign a type to the flow somewhere else.
if (flow.response.code == 304) {
@@ -64,8 +72,13 @@ var IconColumn = React.createClass({
var PathColumn = React.createClass({
statics: {
- renderTitle: function () {
- return <th key="path" className="col-path">Path</th>;
+ Title: React.createClass({
+ render: function(){
+ return <th {...this.props} className={"col-path " + (this.props.className || "") }>Path</th>;
+ }
+ }),
+ sortKeyFun: function(flow){
+ return RequestUtils.pretty_url(flow.request);
}
},
render: function () {
@@ -73,7 +86,7 @@ var PathColumn = React.createClass({
return <td className="col-path">
{flow.request.is_replay ? <i className="fa fa-fw fa-repeat pull-right"></i> : null}
{flow.intercepted ? <i className="fa fa-fw fa-pause pull-right"></i> : null}
- {flow.request.scheme + "://" + flow.request.host + flow.request.path}
+ { RequestUtils.pretty_url(flow.request) }
</td>;
}
});
@@ -81,8 +94,13 @@ var PathColumn = React.createClass({
var MethodColumn = React.createClass({
statics: {
- renderTitle: function () {
- return <th key="method" className="col-method">Method</th>;
+ Title: React.createClass({
+ render: function(){
+ return <th {...this.props} className={"col-method " + (this.props.className || "") }>Method</th>;
+ }
+ }),
+ sortKeyFun: function(flow){
+ return flow.request.method;
}
},
render: function () {
@@ -94,8 +112,13 @@ var MethodColumn = React.createClass({
var StatusColumn = React.createClass({
statics: {
- renderTitle: function () {
- return <th key="status" className="col-status">Status</th>;
+ Title: React.createClass({
+ render: function(){
+ return <th {...this.props} className={"col-status " + (this.props.className || "") }>Status</th>;
+ }
+ }),
+ sortKeyFun: function(flow){
+ return flow.response ? flow.response.code : undefined;
}
},
render: function () {
@@ -113,8 +136,17 @@ var StatusColumn = React.createClass({
var SizeColumn = React.createClass({
statics: {
- renderTitle: function () {
- return <th key="size" className="col-size">Size</th>;
+ Title: React.createClass({
+ render: function(){
+ return <th {...this.props} className={"col-size " + (this.props.className || "") }>Size</th>;
+ }
+ }),
+ sortKeyFun: function(flow){
+ var total = flow.request.contentLength;
+ if (flow.response) {
+ total += flow.response.contentLength || 0;
+ }
+ return total;
}
},
render: function () {
@@ -132,8 +164,15 @@ var SizeColumn = React.createClass({
var TimeColumn = React.createClass({
statics: {
- renderTitle: function () {
- return <th key="time" className="col-time">Time</th>;
+ Title: React.createClass({
+ render: function(){
+ return <th {...this.props} className={"col-time " + (this.props.className || "") }>Time</th>;
+ }
+ }),
+ sortKeyFun: function(flow){
+ if(flow.response) {
+ return flow.response.timestamp_end - flow.request.timestamp_start;
+ }
}
},
render: function () {
@@ -156,9 +195,7 @@ var all_columns = [
MethodColumn,
StatusColumn,
SizeColumn,
- TimeColumn];
-
-
-module.exports = all_columns;
-
+ TimeColumn
+];
+module.exports = all_columns; \ No newline at end of file