aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/flowtable-columns.js
diff options
context:
space:
mode:
authorJason <jason.daurus@gmail.com>2016-06-09 17:46:14 +0800
committerJason <jason.daurus@gmail.com>2016-06-09 17:52:30 +0800
commitf306cfa8b6445dd04c5f7188d1a5022bcb747a62 (patch)
tree8b229ee951b4e4756c3596b66cefee632bfb8870 /web/src/js/components/flowtable-columns.js
parent52754f40c29b95b8355627036660f7e182007e74 (diff)
downloadmitmproxy-f306cfa8b6445dd04c5f7188d1a5022bcb747a62.tar.gz
mitmproxy-f306cfa8b6445dd04c5f7188d1a5022bcb747a62.tar.bz2
mitmproxy-f306cfa8b6445dd04c5f7188d1a5022bcb747a62.zip
[web] separate flowtable to multiple files
Diffstat (limited to 'web/src/js/components/flowtable-columns.js')
-rw-r--r--web/src/js/components/flowtable-columns.js131
1 files changed, 0 insertions, 131 deletions
diff --git a/web/src/js/components/flowtable-columns.js b/web/src/js/components/flowtable-columns.js
deleted file mode 100644
index 799b3f9f..00000000
--- a/web/src/js/components/flowtable-columns.js
+++ /dev/null
@@ -1,131 +0,0 @@
-import React from "react"
-import {RequestUtils, ResponseUtils} from "../flow/utils.js"
-import {formatSize, formatTimeDelta} from "../utils.js"
-
-
-export function TLSColumn({flow}) {
- let ssl = (flow.request.scheme === "https")
- let classes
- if (ssl) {
- classes = "col-tls col-tls-https"
- } else {
- classes = "col-tls col-tls-http"
- }
- return <td className={classes}></td>
-}
-TLSColumn.Title = ({className = "", ...props}) => <th {...props} className={"col-tls " + className }></th>
-TLSColumn.sortKeyFun = flow => flow.request.scheme
-
-
-export function IconColumn({flow}) {
- let icon
- if (flow.response) {
- var contentType = ResponseUtils.getContentType(flow.response)
-
- //TODO: We should assign a type to the flow somewhere else.
- if (flow.response.status_code === 304) {
- icon = "resource-icon-not-modified"
- } else if (300 <= flow.response.status_code && flow.response.status_code < 400) {
- icon = "resource-icon-redirect"
- } else if (contentType && contentType.indexOf("image") >= 0) {
- icon = "resource-icon-image"
- } else if (contentType && contentType.indexOf("javascript") >= 0) {
- icon = "resource-icon-js"
- } else if (contentType && contentType.indexOf("css") >= 0) {
- icon = "resource-icon-css"
- } else if (contentType && contentType.indexOf("html") >= 0) {
- icon = "resource-icon-document"
- }
- }
- if (!icon) {
- icon = "resource-icon-plain"
- }
-
- icon += " resource-icon"
- return <td className="col-icon">
- <div className={icon}></div>
- </td>
-}
-IconColumn.Title = ({className = "", ...props}) => <th {...props} className={"col-icon " + className }></th>
-
-
-export function PathColumn({flow}) {
- 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}
- { RequestUtils.pretty_url(flow.request) }
- </td>
-}
-PathColumn.Title = ({className = "", ...props}) =>
- <th {...props} className={"col-path " + className }>Path</th>
-PathColumn.sortKeyFun = flow => RequestUtils.pretty_url(flow.request)
-
-
-export function MethodColumn({flow}) {
- return <td className="col-method">{flow.request.method}</td>
-}
-MethodColumn.Title = ({className = "", ...props}) =>
- <th {...props} className={"col-method " + className }>Method</th>
-MethodColumn.sortKeyFun = flow => flow.request.method
-
-
-export function StatusColumn({flow}) {
- let status
- if (flow.response) {
- status = flow.response.status_code
- } else {
- status = null
- }
- return <td className="col-status">{status}</td>
-
-}
-StatusColumn.Title = ({className = "", ...props}) =>
- <th {...props} className={"col-status " + className }>Status</th>
-StatusColumn.sortKeyFun = flow => flow.response ? flow.response.status_code : undefined
-
-
-export function SizeColumn({flow}) {
- let total = flow.request.contentLength
- if (flow.response) {
- total += flow.response.contentLength || 0
- }
- let size = formatSize(total)
- return <td className="col-size">{size}</td>
-
-}
-SizeColumn.Title = ({className = "", ...props}) =>
- <th {...props} className={"col-size " + className }>Size</th>
-SizeColumn.sortKeyFun = flow => {
- let total = flow.request.contentLength
- if (flow.response) {
- total += flow.response.contentLength || 0
- }
- return total
-}
-
-
-export function TimeColumn({flow}) {
- let time
- if (flow.response) {
- time = formatTimeDelta(1000 * (flow.response.timestamp_end - flow.request.timestamp_start))
- } else {
- time = "..."
- }
- return <td className="col-time">{time}</td>
-}
-TimeColumn.Title = ({className = "", ...props}) =>
- <th {...props} className={"col-time " + className }>Time</th>
-TimeColumn.sortKeyFun = flow => flow.response.timestamp_end - flow.request.timestamp_start
-
-
-var all_columns = [
- TLSColumn,
- IconColumn,
- PathColumn,
- MethodColumn,
- StatusColumn,
- SizeColumn,
- TimeColumn
-]
-
-export default all_columns