aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-12-26 03:10:24 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-12-26 03:10:24 +0100
commit3e63107e9473e3ec6676c047171a5d23c79b7dcd (patch)
tree547f90a865ec102ae5f7f90b07e535b6a7b0d6ac /web/src/js
parent1f454b577f7db434d79388eb101006b065f62a2b (diff)
downloadmitmproxy-3e63107e9473e3ec6676c047171a5d23c79b7dcd.tar.gz
mitmproxy-3e63107e9473e3ec6676c047171a5d23c79b7dcd.tar.bz2
mitmproxy-3e63107e9473e3ec6676c047171a5d23c79b7dcd.zip
web: integrate filter docs
Diffstat (limited to 'web/src/js')
-rw-r--r--web/src/js/components/header.jsx.js54
1 files changed, 46 insertions, 8 deletions
diff --git a/web/src/js/components/header.jsx.js b/web/src/js/components/header.jsx.js
index ba63f12e..6470aec5 100644
--- a/web/src/js/components/header.jsx.js
+++ b/web/src/js/components/header.jsx.js
@@ -1,3 +1,45 @@
+var FilterDocs = React.createClass({
+ statics: {
+ xhr: false,
+ doc: false
+ },
+ componentWillMount: function () {
+ if (!FilterDocs.doc) {
+ FilterDocs.xhr = $.getJSON("/filter-help").done(function (doc) {
+ FilterDocs.doc = doc;
+ FilterDocs.xhr = false;
+ });
+ }
+ if (FilterDocs.xhr) {
+ FilterDocs.xhr.done(function () {
+ this.forceUpdate();
+ }.bind(this));
+ }
+ },
+ render: function () {
+ if (!FilterDocs.doc) {
+ return <i className="fa fa-spinner fa-spin"></i>;
+ } else {
+ var commands = FilterDocs.doc.commands.map(function (c) {
+ return <tr>
+ <td>{c[0].replace(" ", '\u00a0')}</td>
+ <td>{c[1]}</td>
+ </tr>;
+ });
+ commands.push(<tr>
+ <td colSpan="2">
+ <a href="https://mitmproxy.org/doc/features/filters.html"
+ target="_blank">
+ <i className="fa fa-external-link"></i>
+ &nbsp; mitmproxy docs</a>
+ </td>
+ </tr>);
+ return <table className="table table-condensed">
+ <tbody>{commands}</tbody>
+ </table>;
+ }
+ }
+});
var FilterInput = React.createClass({
getInitialState: function () {
// Consider both focus and mouseover for showing/hiding the tooltip,
@@ -41,10 +83,7 @@ var FilterInput = React.createClass({
return desc;
} else {
return (
- <a href="https://mitmproxy.org/doc/features/filters.html" target="_blank">
- <i className="fa fa-external-link"></i>
- Filter Documentation
- </a>
+ <FilterDocs/>
);
}
},
@@ -134,28 +173,27 @@ var MainMenu = React.createClass({
return (
<div>
- <form className="form-inline" style={{display: "inline"}}>
+ <div className="menu-row">
<FilterInput
placeholder="Filter"
type="filter"
color="black"
value={filter}
onChange={this.onFilterChange} />
- <span> </span>
<FilterInput
placeholder="Highlight"
type="tag"
color="hsl(48, 100%, 50%)"
value={highlight}
onChange={this.onHighlightChange}/>
- <span> </span>
<FilterInput
placeholder="Intercept"
type="pause"
color="hsl(208, 56%, 53%)"
value={intercept}
onChange={this.onInterceptChange}/>
- </form>
+ </div>
+ <div className="clearfix"></div>
</div>
);
}