anyproxy/web/src/filter.js

43 lines
1.0 KiB
JavaScript
Raw Normal View History

2015-07-07 17:31:56 +08:00
function init(React){
var Filter = React.createClass({
dealChange:function(){
var self = this,
userInput = React.findDOMNode(self.refs.keywordInput).value;
self.props.onChangeKeyword && self.props.onChangeKeyword.call(null,userInput);
},
setFocus:function(){
var self = this;
React.findDOMNode(self.refs.keywordInput).focus();
},
componentDidUpdate:function(){
this.setFocus();
},
render:function(){
var self = this;
return (
2015-07-08 11:55:13 +08:00
<div>
2015-07-07 17:31:56 +08:00
<h4 className="subTitle">Log Filter</h4>
2015-07-08 11:55:13 +08:00
<div className="filterSection">
2015-07-31 14:00:34 +08:00
<div className="uk-form">
2015-07-08 11:55:13 +08:00
<input className="uk-form-large" ref="keywordInput" onChange={self.dealChange} type="text" placeholder="keywords or /^regExp$/" width="300"/>
2015-07-31 14:00:34 +08:00
</div>
2015-07-08 11:55:13 +08:00
</div>
2015-07-12 21:19:49 +08:00
<p>
2015-07-20 08:58:57 +08:00
<i className="uk-icon-magic"></i>&nbsp;&nbsp;type <strong>/id=\d{3}/</strong> will give you all the logs containing <strong>id=123</strong>
2015-07-12 21:19:49 +08:00
</p>
2015-07-07 17:31:56 +08:00
</div>
);
},
componentDidMount:function(){
this.setFocus();
}
});
return Filter;
}
module.exports.init = init;