diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2014-12-30 22:12:26 +1300 | 
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2014-12-30 22:12:26 +1300 | 
| commit | 2152d4dd92f0576aa6e85833cc49607d3027e40e (patch) | |
| tree | ddb62abe4cd177884446523096aa94a1c8d91163 /web/src/js | |
| parent | b847faf37f53111ca6bd435e4374b3bbbe4a8c28 (diff) | |
| download | mitmproxy-2152d4dd92f0576aa6e85833cc49607d3027e40e.tar.gz mitmproxy-2152d4dd92f0576aa6e85833cc49607d3027e40e.tar.bz2 mitmproxy-2152d4dd92f0576aa6e85833cc49607d3027e40e.zip  | |
More conversions to browserify
Diffstat (limited to 'web/src/js')
| -rw-r--r-- | web/src/js/actions.js | 5 | ||||
| -rw-r--r-- | web/src/js/components/flowdetail.jsx.js | 38 | ||||
| -rw-r--r-- | web/src/js/components/mainview.jsx.js | 5 | ||||
| -rw-r--r-- | web/src/js/flow/utils.js | 4 | ||||
| -rw-r--r-- | web/src/js/store/store.js | 2 | 
5 files changed, 36 insertions, 18 deletions
diff --git a/web/src/js/actions.js b/web/src/js/actions.js index 6dc11825..4c62e9e2 100644 --- a/web/src/js/actions.js +++ b/web/src/js/actions.js @@ -112,6 +112,9 @@ Query = {  module.exports = {      ActionTypes: ActionTypes, -    ConnectionActions: ConnectionActions +    ConnectionActions: ConnectionActions, +    FlowActions: FlowActions, +    StoreCmds: StoreCmds +  };
\ No newline at end of file diff --git a/web/src/js/components/flowdetail.jsx.js b/web/src/js/components/flowdetail.jsx.js index 0f91bde1..9e88a6e6 100644 --- a/web/src/js/components/flowdetail.jsx.js +++ b/web/src/js/components/flowdetail.jsx.js @@ -1,3 +1,11 @@ +var React = require("react"); +var _ = require("lodash"); + +var utils = require("./utils.jsx.js"); +var actions = require("../actions.js"); +var flowutils = require("../flow/utils.js"); +var toputils = require("../utils.js"); +  var NavAction = React.createClass({      onClick: function (e) {          e.preventDefault(); @@ -34,19 +42,19 @@ var FlowDetailNav = React.createClass({          var acceptButton = null;          if(flow.intercepted){ -            acceptButton = <NavAction title="[a]ccept intercepted flow" icon="fa-play" onClick={FlowActions.accept.bind(null, flow)} />; +            acceptButton = <NavAction title="[a]ccept intercepted flow" icon="fa-play" onClick={actions.FlowActions.accept.bind(null, flow)} />;          }          var revertButton = null;          if(flow.modified){ -            revertButton = <NavAction title="revert changes to flow [V]" icon="fa-history" onClick={FlowActions.revert.bind(null, flow)} />; +            revertButton = <NavAction title="revert changes to flow [V]" icon="fa-history" onClick={actions.FlowActions.revert.bind(null, flow)} />;          }          return (              <nav ref="head" className="nav-tabs nav-tabs-sm">                  {tabs} -                <NavAction title="[d]elete flow" icon="fa-trash" onClick={FlowActions.delete.bind(null, flow)} /> -                <NavAction title="[D]uplicate flow" icon="fa-copy" onClick={FlowActions.duplicate.bind(null, flow)} /> -                <NavAction disabled title="[r]eplay flow" icon="fa-repeat" onClick={FlowActions.replay.bind(null, flow)} /> +                <NavAction title="[d]elete flow" icon="fa-trash" onClick={actions.FlowActions.delete.bind(null, flow)} /> +                <NavAction title="[D]uplicate flow" icon="fa-copy" onClick={actions.FlowActions.duplicate.bind(null, flow)} /> +                <NavAction disabled title="[r]eplay flow" icon="fa-repeat" onClick={actions.FlowActions.replay.bind(null, flow)} />                  {acceptButton}                  {revertButton}              </nav> @@ -79,12 +87,12 @@ var FlowDetailRequest = React.createClass({          var flow = this.props.flow;          var first_line = [              flow.request.method, -            RequestUtils.pretty_url(flow.request), +            flowutils.RequestUtils.pretty_url(flow.request),              "HTTP/" + flow.request.httpversion.join(".")          ].join(" ");          var content = null;          if (flow.request.contentLength > 0) { -            content = "Request Content Size: " + formatSize(flow.request.contentLength); +            content = "Request Content Size: " + toputils.formatSize(flow.request.contentLength);          } else {              content = <div className="alert alert-info">No Content</div>;          } @@ -112,7 +120,7 @@ var FlowDetailResponse = React.createClass({          ].join(" ");          var content = null;          if (flow.response.contentLength > 0) { -            content = "Response Content Size: " + formatSize(flow.response.contentLength); +            content = "Response Content Size: " + toputils.formatSize(flow.response.contentLength);          } else {              content = <div className="alert alert-info">No Content</div>;          } @@ -138,7 +146,7 @@ var FlowDetailError = React.createClass({                  <div className="alert alert-warning">                  {flow.error.msg}                      <div> -                        <small>{ formatTimeStamp(flow.error.timestamp) }</small> +                        <small>{ toputils.formatTimeStamp(flow.error.timestamp) }</small>                      </div>                  </div>              </section> @@ -154,11 +162,11 @@ var TimeStamp = React.createClass({              return <tr></tr>;          } -        var ts = formatTimeStamp(this.props.t); +        var ts = toputils.formatTimeStamp(this.props.t);          var delta;          if (this.props.deltaTo) { -            delta = formatTimeDelta(1000 * (this.props.t - this.props.deltaTo)); +            delta = toputils.formatTimeDelta(1000 * (this.props.t - this.props.deltaTo));              delta = <span className="text-muted">{"(" + delta + ")"}</span>;          } else {              delta = null; @@ -329,7 +337,7 @@ var allTabs = {  };  var FlowDetail = React.createClass({ -    mixins: [StickyHeadMixin, Navigation, State], +    mixins: [utils.StickyHeadMixin, utils.Navigation, utils.State],      getTabs: function (flow) {          var tabs = [];          ["request", "response", "error"].forEach(function (e) { @@ -384,4 +392,8 @@ var FlowDetail = React.createClass({              </div>          );      } -});
\ No newline at end of file +}); + +module.exports = { +    FlowDetail: FlowDetail +};
\ No newline at end of file diff --git a/web/src/js/components/mainview.jsx.js b/web/src/js/components/mainview.jsx.js index 85ca36bb..5661ab1d 100644 --- a/web/src/js/components/mainview.jsx.js +++ b/web/src/js/components/mainview.jsx.js @@ -4,6 +4,7 @@ var utils = require("./utils.jsx.js");  var views = require("../store/view.js");  var Filt = require("../filt/filt.js");  FlowTable = require("./flowtable.jsx.js"); +var flowdetail = require("./flowdetail.jsx.js");  var MainView = React.createClass({ @@ -208,8 +209,8 @@ var MainView = React.createClass({          var details;          if (selected) {              details = [ -                <Splitter key="splitter"/>, -                <FlowDetail key="flowDetails" ref="flowDetails" flow={selected}/> +                <utils.Splitter key="splitter"/>, +                <flowdetail.FlowDetail key="flowDetails" ref="flowDetails" flow={selected}/>              ];          } else {              details = null; diff --git a/web/src/js/flow/utils.js b/web/src/js/flow/utils.js index 50305482..a95d4ffe 100644 --- a/web/src/js/flow/utils.js +++ b/web/src/js/flow/utils.js @@ -60,5 +60,7 @@ var ResponseUtils = _.extend(_MessageUtils, {});  module.exports = { -    ResponseUtils: ResponseUtils +    ResponseUtils: ResponseUtils, +    RequestUtils: RequestUtils +  }
\ No newline at end of file diff --git a/web/src/js/store/store.js b/web/src/js/store/store.js index 60913ca6..3def7723 100644 --- a/web/src/js/store/store.js +++ b/web/src/js/store/store.js @@ -91,7 +91,7 @@ _.extend(LiveStoreMixin.prototype, {              return this.fetch();          }          if (event.type === this.type) { -            if (event.cmd === StoreCmds.RESET) { +            if (event.cmd === actions.StoreCmds.RESET) {                  this.fetch(event.data);              } else if (this._updates_before_fetch) {                  console.log("defer update", event);  | 
