diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-12-23 23:23:25 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-12-23 23:23:25 +0100 |
commit | b1311faa68947b982dbbe8b8f3e9d26b2356b1c2 (patch) | |
tree | 69e8b5b534c990d7cd8b937b7a5d7e39fbd97402 /web | |
parent | 4767b83726eb82d657825bcf8c00871667d73081 (diff) | |
download | mitmproxy-b1311faa68947b982dbbe8b8f3e9d26b2356b1c2.tar.gz mitmproxy-b1311faa68947b982dbbe8b8f3e9d26b2356b1c2.tar.bz2 mitmproxy-b1311faa68947b982dbbe8b8f3e9d26b2356b1c2.zip |
web: move eventlog state out of settings
Diffstat (limited to 'web')
-rw-r--r-- | web/src/css/flowtable.less | 4 | ||||
-rw-r--r-- | web/src/js/actions.js | 25 | ||||
-rw-r--r-- | web/src/js/components/eventlog.jsx.js | 6 | ||||
-rw-r--r-- | web/src/js/components/header.jsx.js | 19 | ||||
-rw-r--r-- | web/src/js/components/mainview.jsx.js | 4 | ||||
-rw-r--r-- | web/src/js/components/proxyapp.jsx.js | 4 |
6 files changed, 47 insertions, 15 deletions
diff --git a/web/src/css/flowtable.less b/web/src/css/flowtable.less index b18a71fa..38f5e0e8 100644 --- a/web/src/css/flowtable.less +++ b/web/src/css/flowtable.less @@ -27,10 +27,10 @@ background-color: hsla(209, 52%, 84%, 0.5) !important; } &.highlighted { - background-color: hsla(48, 100%, 50%, 0.4) !important; + background-color: hsla(48, 100%, 50%, 0.4); } &.highlighted:nth-child(even) { - background-color: hsla(48, 100%, 50%, 0.5) !important; + background-color: hsla(48, 100%, 50%, 0.5); } } diff --git a/web/src/js/actions.js b/web/src/js/actions.js index e7799118..091ae6c3 100644 --- a/web/src/js/actions.js +++ b/web/src/js/actions.js @@ -44,12 +44,14 @@ var SettingsActions = { data: settings }); + /* //Facebook Flux: We do an optimistic update on the client already. AppDispatcher.dispatchViewAction({ type: ActionTypes.SETTINGS_STORE, cmd: StoreCmds.UPDATE, data: settings }); + */ } }; @@ -68,7 +70,28 @@ var EventLogActions = { } }; +var FlowActions = { + accept: function (flow) { + jQuery.post("/flows/" + flow.id + "/accept"); + }, + accept_all: function(){ + jQuery.post("/flows/accept"); + }, + + update: function (flow) { + AppDispatcher.dispatchViewAction({ + type: ActionTypes.FLOW_STORE, + cmd: StoreCmds.UPDATE, + data: flow + }); + }, + clear: function(){ + jQuery.post("/clear"); + } +}; + Query = { FILTER: "f", - HIGHLIGHT: "h" + HIGHLIGHT: "h", + SHOW_EVENTLOG: "e" };
\ No newline at end of file diff --git a/web/src/js/components/eventlog.jsx.js b/web/src/js/components/eventlog.jsx.js index 9632eeec..e3b029ed 100644 --- a/web/src/js/components/eventlog.jsx.js +++ b/web/src/js/components/eventlog.jsx.js @@ -119,9 +119,9 @@ var EventLog = React.createClass({ }; }, close: function () { - SettingsActions.update({ - showEventLog: false - }); + var d = {}; + d[Query.SHOW_EVENTLOG] = undefined; + this.setQuery(d); }, toggleLevel: function (level) { var filter = _.extend({}, this.state.filter); diff --git a/web/src/js/components/header.jsx.js b/web/src/js/components/header.jsx.js index cb9cd149..9e6b8f2f 100644 --- a/web/src/js/components/header.jsx.js +++ b/web/src/js/components/header.jsx.js @@ -115,12 +115,18 @@ var MainMenu = React.createClass({ route: "flows" }, toggleEventLog: function () { - SettingsActions.update({ - showEventLog: !this.props.settings.showEventLog - }); + var d = {}; + + if(this.getQuery()[Query.SHOW_EVENTLOG]){ + d[Query.SHOW_EVENTLOG] = undefined; + } else { + d[Query.SHOW_EVENTLOG] = "t"; // any non-false value will do it, keep it short + } + + this.setQuery(d); }, clearFlows: function () { - jQuery.post("/clear"); + FlowActions.clear(); }, onFilterChange: function (val) { var d = {}; @@ -139,10 +145,13 @@ var MainMenu = React.createClass({ var filter = this.getQuery()[Query.FILTER] || ""; var highlight = this.getQuery()[Query.HIGHLIGHT] || ""; var intercept = this.props.settings.intercept || ""; + var showEventLog = this.getQuery()[Query.SHOW_EVENTLOG]; return ( <div> - <button className={"btn " + (this.props.settings.showEventLog ? "btn-primary" : "btn-default")} onClick={this.toggleEventLog}> + <button + className={"btn " + (showEventLog ? "btn-primary" : "btn-default")} + onClick={this.toggleEventLog}> <i className="fa fa-database"></i> Display Event Log </button> diff --git a/web/src/js/components/mainview.jsx.js b/web/src/js/components/mainview.jsx.js index 046d6af0..f0e50176 100644 --- a/web/src/js/components/mainview.jsx.js +++ b/web/src/js/components/mainview.jsx.js @@ -145,9 +145,9 @@ var MainView = React.createClass({ break; case Key.A: if (e.shiftKey) { - $.post("/flows/accept"); + FlowActions.accept_all(); } else if(this.getSelected()) { - $.post("/flows/" + this.getSelected().id + "/accept"); + FlowActions.accept(this.getSelected()); } break; default: diff --git a/web/src/js/components/proxyapp.jsx.js b/web/src/js/components/proxyapp.jsx.js index 91cd268f..92fc0e49 100644 --- a/web/src/js/components/proxyapp.jsx.js +++ b/web/src/js/components/proxyapp.jsx.js @@ -7,6 +7,7 @@ var Reports = React.createClass({ var ProxyAppMain = React.createClass({ + mixins: [State], getInitialState: function () { var eventStore = new EventLogStore(); var flowStore = new FlowStore(); @@ -14,7 +15,6 @@ var ProxyAppMain = React.createClass({ // Default Settings before fetch _.extend(settings.dict,{ - showEventLog: true }); return { settings: settings, @@ -37,7 +37,7 @@ var ProxyAppMain = React.createClass({ render: function () { var eventlog; - if (this.state.settings.dict.showEventLog) { + if (this.getQuery()[Query.SHOW_EVENTLOG]) { eventlog = [ <Splitter key="splitter" axis="y"/>, <EventLog key="eventlog" eventStore={this.state.eventStore}/> |