forked from SpecterOps/BloodHound-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRawQuery.jsx
57 lines (50 loc) · 1.18 KB
/
RawQuery.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React, { Component } from 'react';
export default class RawQuery extends Component {
constructor(){
super();
this.state = {
val : "",
open: false
}
}
_onChange(event){
this.setState({
val:event.target.value
})
}
_onKeyUp(e){
var key = e.keyCode ? e.keyCode : e.which
if (key === 13){
emitter.emit('query', this.state.val)
}
}
componentDidMount() {
$(this.refs.input).slideToggle(0)
}
_toggle(){
$(this.refs.input).slideToggle()
this.setState({
open: !this.state.open
})
}
render() {
return (
<div className="bottomdiv">
<button onClick={this._toggle.bind(this)} className="slideupbutton">
<span className={this.state.open ? "glyphicon glyphicon-chevron-down" : "glyphicon glyphicon-chevron-up"} />
Raw Query
<span className={this.state.open ? "glyphicon glyphicon-chevron-down" : "glyphicon glyphicon-chevron-up"} />
</button>
<input
ref="input"
type="text"
onChange={this._onChange.bind(this)}
value={this.state.val}
onKeyUp={this._onKeyUp.bind(this)}
className="form-control queryInput"
autoComplete="off"
placeholder="Enter a raw query..." />
</div>
);
}
}