diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-09-18 00:01:45 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-09-18 00:01:45 +0200 |
commit | 6a161be6b4c526fcc5f6581c7faff00a2c976f37 (patch) | |
tree | 6b99c30538a57e096c4fd01a923fc8542e90e6e4 /web/src/js/components/eventlog.jsx.js | |
parent | b99de36b24e4687e35069fbfa18727519f23ea35 (diff) | |
download | mitmproxy-6a161be6b4c526fcc5f6581c7faff00a2c976f37.tar.gz mitmproxy-6a161be6b4c526fcc5f6581c7faff00a2c976f37.tar.bz2 mitmproxy-6a161be6b4c526fcc5f6581c7faff00a2c976f37.zip |
.jsx -> .jsx.js
Rename jsx files to be compatible with Chrome Dev Tools and
Workspace Mapping.
Diffstat (limited to 'web/src/js/components/eventlog.jsx.js')
-rw-r--r-- | web/src/js/components/eventlog.jsx.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/web/src/js/components/eventlog.jsx.js b/web/src/js/components/eventlog.jsx.js new file mode 100644 index 00000000..df212177 --- /dev/null +++ b/web/src/js/components/eventlog.jsx.js @@ -0,0 +1,41 @@ +/** @jsx React.DOM */ + +var EventLog = React.createClass({ + mixins:[AutoScrollMixin], + getInitialState: function () { + return { + log: [] + }; + }, + componentDidMount: function () { + this.log = EventLogStore.getView(); + this.log.addListener("change", this.onEventLogChange); + }, + componentWillUnmount: function () { + this.log.removeListener("change", this.onEventLogChange); + this.log.close(); + }, + onEventLogChange: function () { + this.setState({ + log: this.log.getAll() + }); + }, + close: function () { + SettingsActions.update({ + showEventLog: false + }); + }, + render: function () { + var messages = this.state.log.map(function(row) { + var indicator = null; + if(row.source === "ui"){ + indicator = <i className="fa fa-html5"></i>; + } + return ( + <div key={row.id}> + { indicator } {row.message} + </div>); + }); + return <pre className="eventlog">{messages}</pre>; + } +});
\ No newline at end of file |