mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-21 19:04:23 +00:00
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
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 (
|
|
<div>
|
|
<h4 className="subTitle">Log Filter</h4>
|
|
<div className="filterSection">
|
|
<form className="uk-form">
|
|
<input className="uk-form-large" ref="keywordInput" onChange={self.dealChange} type="text" placeholder="keywords or /^regExp$/" width="300"/>
|
|
</form>
|
|
</div>
|
|
<p>
|
|
<i className="uk-icon-magic"></i> type <strong>/id=\d{3}/</strong> will give you all the logs containing <strong>id=123</strong>
|
|
</p>
|
|
</div>
|
|
);
|
|
},
|
|
componentDidMount:function(){
|
|
this.setFocus();
|
|
}
|
|
});
|
|
|
|
return Filter;
|
|
}
|
|
|
|
module.exports.init = init; |