aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-09-16 00:56:43 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-09-16 00:56:43 +0200
commit674bc4273e9a2f1a2e41ef977a80219423c7cb51 (patch)
treeb343902da8a0de10f075c46c75f8ad135bc23192 /web/src/js/components
parentacdd182754625fabcfc2c6ed4bdad8a63bce8ad6 (diff)
downloadmitmproxy-674bc4273e9a2f1a2e41ef977a80219423c7cb51.tar.gz
mitmproxy-674bc4273e9a2f1a2e41ef977a80219423c7cb51.tar.bz2
mitmproxy-674bc4273e9a2f1a2e41ef977a80219423c7cb51.zip
format javascript
Diffstat (limited to 'web/src/js/components')
-rw-r--r--web/src/js/components/EventLog.react.js58
-rw-r--r--web/src/js/components/Header.react.js18
-rw-r--r--web/src/js/components/ProxyApp.react.js46
-rw-r--r--web/src/js/components/TrafficTable.react.js29
4 files changed, 78 insertions, 73 deletions
diff --git a/web/src/js/components/EventLog.react.js b/web/src/js/components/EventLog.react.js
index 3a7dedc8..6c7a7c58 100644
--- a/web/src/js/components/EventLog.react.js
+++ b/web/src/js/components/EventLog.react.js
@@ -1,37 +1,37 @@
/** @jsx React.DOM */
var EventLog = React.createClass({
- getInitialState(){
- return {
- log: []
- };
- },
- componentDidMount(){
- this.log = EventLogStore.getView();
- this.log.addListener("change",this.onEventLogChange);
- },
- componentWillUnmount(){
- this.log.removeListener("change",this.onEventLogChange);
- this.log.close();
- },
- onEventLogChange(){
- this.setState({
- log: this.log.getAll()
- });
- },
- close(){
- SettingsActions.update({
- showEventLog: false
- });
- },
- render(){
- var messages = this.state.log.map(row => <div key={row.id}>{row.message}</div>);
+ getInitialState() {
+ return {
+ log: []
+ };
+ },
+ componentDidMount() {
+ this.log = EventLogStore.getView();
+ this.log.addListener("change", this.onEventLogChange);
+ },
+ componentWillUnmount() {
+ this.log.removeListener("change", this.onEventLogChange);
+ this.log.close();
+ },
+ onEventLogChange() {
+ this.setState({
+ log: this.log.getAll()
+ });
+ },
+ close() {
+ SettingsActions.update({
+ showEventLog: false
+ });
+ },
+ render() {
+ var messages = this.state.log.map(row => (<div key={row.id}>{row.message}</div>));
return (
<div className="eventlog">
- <pre>
- <i className="fa fa-close close-button" onClick={this.close}></i>
- {messages}
- </pre>
+ <pre>
+ <i className="fa fa-close close-button" onClick={this.close}></i>
+ {messages}
+ </pre>
</div>
);
}
diff --git a/web/src/js/components/Header.react.js b/web/src/js/components/Header.react.js
index 41202463..0131d350 100644
--- a/web/src/js/components/Header.react.js
+++ b/web/src/js/components/Header.react.js
@@ -7,21 +7,23 @@ var MainMenu = React.createClass({
});
},
render(){
- return <div>
- <button className={"btn " + (this.props.settings.showEventLog ? "btn-primary" : "btn-default")} onClick={this.toggleEventLog}>
+ return (
+ <div>
+ <button className={"btn " + (this.props.settings.showEventLog ? "btn-primary" : "btn-default")} onClick={this.toggleEventLog}>
<i className="fa fa-database"></i> Display Event Log
- </button>
- </div>;
+ </button>
+ </div>
+ );
}
});
var ToolsMenu = React.createClass({
render(){
- return (<div>Tools Menu</div>);
+ return <div>Tools Menu</div>;
}
});
var ReportsMenu = React.createClass({
render(){
- return (<div>Reports Menu</div>);
+ return <div>Reports Menu</div>;
}
});
@@ -58,7 +60,6 @@ var Header = React.createClass({
handleFileClick(){
console.log("File click");
},
-
render(){
var header = [];
for(var item in _Header_Entries){
@@ -82,6 +83,7 @@ var Header = React.createClass({
<div className="menu">
{ menu }
</div>
- </header>);
+ </header>
+ );
}
}); \ No newline at end of file
diff --git a/web/src/js/components/ProxyApp.react.js b/web/src/js/components/ProxyApp.react.js
index fc21ecd8..01adb089 100644
--- a/web/src/js/components/ProxyApp.react.js
+++ b/web/src/js/components/ProxyApp.react.js
@@ -2,46 +2,46 @@
//TODO: Move out of here, just a stub.
var Reports = React.createClass({
- render(){
- return (<div>Report Editor</div>);
- }
+ render(){
+ return <div>Report Editor</div>;
+ }
});
var ProxyAppMain = React.createClass({
getInitialState(){
- return { settings: SettingsStore.getAll() };
+ return { settings: SettingsStore.getAll() };
},
componentDidMount(){
- SettingsStore.addListener("change", this.onSettingsChange);
+ SettingsStore.addListener("change", this.onSettingsChange);
},
componentWillUnmount(){
- SettingsStore.removeListener("change", this.onSettingsChange);
+ SettingsStore.removeListener("change", this.onSettingsChange);
},
onSettingsChange(){
- console.log("onSettingsChange");
- this.setState({settings: SettingsStore.getAll()});
+ console.log("onSettingsChange");
+ this.setState({settings: SettingsStore.getAll()});
},
render() {
- return (
- <div id="container">
- <Header settings={this.state.settings}/>
- <div id="main"><this.props.activeRouteHandler/></div>
- {this.state.settings.showEventLog ? <EventLog/> : null}
- <Footer/>
- </div>
- );
+ return (
+ <div id="container">
+ <Header settings={this.state.settings}/>
+ <div id="main"><this.props.activeRouteHandler/></div>
+ {this.state.settings.showEventLog ? <EventLog/> : null}
+ <Footer/>
+ </div>
+ );
}
});
var ProxyApp = (
- <ReactRouter.Routes location="hash">
- <ReactRouter.Route name="app" path="/" handler={ProxyAppMain}>
- <ReactRouter.Route name="main" handler={TrafficTable}/>
- <ReactRouter.Route name="reports" handler={Reports}/>
- <ReactRouter.Redirect to="main"/>
- </ReactRouter.Route>
- </ReactRouter.Routes>
+ <ReactRouter.Routes location="hash">
+ <ReactRouter.Route name="app" path="/" handler={ProxyAppMain}>
+ <ReactRouter.Route name="main" handler={TrafficTable}/>
+ <ReactRouter.Route name="reports" handler={Reports}/>
+ <ReactRouter.Redirect to="main"/>
+ </ReactRouter.Route>
+ </ReactRouter.Routes>
);
diff --git a/web/src/js/components/TrafficTable.react.js b/web/src/js/components/TrafficTable.react.js
index d6a4f200..7e9e26e3 100644
--- a/web/src/js/components/TrafficTable.react.js
+++ b/web/src/js/components/TrafficTable.react.js
@@ -1,31 +1,34 @@
/** @jsx React.DOM */
var TrafficTable = React.createClass({
- getInitialState: function(){
+ getInitialState() {
return {
flows: []
};
},
- componentDidMount(){
+ componentDidMount() {
//this.flowStore = FlowStore.getView();
//this.flowStore.addListener("change",this.onFlowChange);
},
- componentWillUnmount(){
+ componentWillUnmount() {
//this.flowStore.removeListener("change",this.onFlowChange);
//this.flowStore.close();
},
- onFlowChange(){
+ onFlowChange() {
this.setState({
//flows: this.flowStore.getAll()
});
},
- render: function () {
- /*var flows = this.state.flows.map(function(flow){
- return <div>{flow.request.method} {flow.request.scheme}://{flow.request.host}{flow.request.path}</div>;
- }); *//**/
- x = "Flow";
- i = 12;
- while(i--) x += x;
- return <div><pre>{x}</pre></div>;
- }
+ render() {
+ /*var flows = this.state.flows.map(function(flow){
+ return <div>{flow.request.method} {flow.request.scheme}://{flow.request.host}{flow.request.path}</div>;
+ }); */
+ //Dummy Text for layout testing
+ x = "Flow";
+ i = 12;
+ while (i--) x += x;
+ return (
+ <div><pre> { x } </pre></div>
+ );
+ }
}); \ No newline at end of file