From 1d9b1f79a11feb57043be1d9d656f4c1638d3357 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 15 Sep 2014 18:39:25 +0200 Subject: web: eventlog ui --- libmproxy/web/static/css/app.css | 12 +++++++++++- libmproxy/web/static/js/app.js | 13 +++++++++---- libmproxy/web/templates/index.html | 8 ++++---- web/gulpfile.js | 2 +- web/src/css/eventlog.less | 11 +++++++++++ web/src/css/header.less | 2 +- web/src/index.html | 8 ++++---- web/src/js/components/EventLog.react.js | 6 ++++++ web/src/js/components/Header.react.js | 9 ++++----- 9 files changed, 51 insertions(+), 20 deletions(-) diff --git a/libmproxy/web/static/css/app.css b/libmproxy/web/static/css/app.css index fe8fd79a..e5b9d134 100644 --- a/libmproxy/web/static/css/app.css +++ b/libmproxy/web/static/css/app.css @@ -64,7 +64,7 @@ header nav a.special:hover { background-color: #5386c6; } header .menu { - height: 100px; + padding: 10px; border-bottom: solid #a6a6a6 1px; } .eventlog { @@ -76,6 +76,16 @@ header .menu { height: 200px; overflow: auto; } +.eventlog .close-button { + float: right; + margin: -9px; + padding: 4px; + cursor: pointer; + color: grey; +} +.eventlog .close-button:hover { + color: black; +} footer { box-shadow: 0 -1px 3px #d3d3d3; padding: 0px 10px 3px; diff --git a/libmproxy/web/static/js/app.js b/libmproxy/web/static/js/app.js index 7873046a..72bb5ff8 100644 --- a/libmproxy/web/static/js/app.js +++ b/libmproxy/web/static/js/app.js @@ -232,14 +232,13 @@ var MainMenu = React.createClass({displayName: 'MainMenu', mixins: [SettingsMixin], handleSettingsChange:function() { SettingsActions.update({ - showEventLog: this.refs.showEventLogInput.getDOMNode().checked + showEventLog: !this.state.settings.showEventLog }); }, render:function(){ return React.DOM.div(null, - React.DOM.label(null, - React.DOM.input({type: "checkbox", ref: "showEventLogInput", checked: this.state.settings.showEventLog, onChange: this.handleSettingsChange}), - "Show Event Log" + React.DOM.button({className: "btn " + (this.state.settings.showEventLog ? "btn-primary" : "btn-default"), onClick: this.handleSettingsChange}, + React.DOM.i({className: "fa fa-database"}), " Display Event Log" ) ); } @@ -355,10 +354,16 @@ var TrafficTable = React.createClass({displayName: 'TrafficTable', /** @jsx React.DOM */ var EventLog = React.createClass({displayName: 'EventLog', + close:function(){ + SettingsActions.update({ + showEventLog: false + }); + }, render:function(){ return ( React.DOM.div({className: "eventlog"}, React.DOM.pre(null, + React.DOM.i({className: "fa fa-close close-button", onClick: this.close}), "much log." ) ) diff --git a/libmproxy/web/templates/index.html b/libmproxy/web/templates/index.html index 6cef0d25..4db2ed51 100644 --- a/libmproxy/web/templates/index.html +++ b/libmproxy/web/templates/index.html @@ -4,10 +4,10 @@ mitmproxy - - - - + + + +
diff --git a/web/gulpfile.js b/web/gulpfile.js index 68a5e479..939f4fcc 100644 --- a/web/gulpfile.js +++ b/web/gulpfile.js @@ -106,7 +106,7 @@ gulp.task("jshint", function () { gulp.task("html", function () { return gulp.src(path.html) - .pipe(gulp.dest(path.dist + "static")) + .pipe(gulp.dest(path.dist + "templates")) .pipe(livereload({ auto: false })); }); diff --git a/web/src/css/eventlog.less b/web/src/css/eventlog.less index 0e97832b..8ad304aa 100644 --- a/web/src/css/eventlog.less +++ b/web/src/css/eventlog.less @@ -8,4 +8,15 @@ height: 200px; overflow: auto; } + + .close-button { + float: right; + margin: -9px; + padding: 4px; + cursor: pointer; + color: grey; + &:hover { + color: black; + } + } } \ No newline at end of file diff --git a/web/src/css/header.less b/web/src/css/header.less index 69a947c5..2a3c9765 100644 --- a/web/src/css/header.less +++ b/web/src/css/header.less @@ -45,7 +45,7 @@ header { } .menu { - height: 100px; + padding: 10px; border-bottom: solid @separator-color 1px; } } \ No newline at end of file diff --git a/web/src/index.html b/web/src/index.html index 6cef0d25..4db2ed51 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -4,10 +4,10 @@ mitmproxy - - - - + + + +
diff --git a/web/src/js/components/EventLog.react.js b/web/src/js/components/EventLog.react.js index e710d30c..0ecf40b1 100644 --- a/web/src/js/components/EventLog.react.js +++ b/web/src/js/components/EventLog.react.js @@ -1,10 +1,16 @@ /** @jsx React.DOM */ var EventLog = React.createClass({ + close(){ + SettingsActions.update({ + showEventLog: false + }); + }, render(){ return (
+            
             much log.
             
diff --git a/web/src/js/components/Header.react.js b/web/src/js/components/Header.react.js index dc304d81..d1f18a82 100644 --- a/web/src/js/components/Header.react.js +++ b/web/src/js/components/Header.react.js @@ -4,15 +4,14 @@ var MainMenu = React.createClass({ mixins: [SettingsMixin], handleSettingsChange() { SettingsActions.update({ - showEventLog: this.refs.showEventLogInput.getDOMNode().checked + showEventLog: !this.state.settings.showEventLog }); }, render(){ return
- +
; } }); -- cgit v1.2.3