close writedataform on escape

pull/10616/head
Jade McGough 2017-05-25 17:30:32 -07:00
parent 8e0bd25f49
commit 62ce1d3b7a
1 changed files with 11 additions and 0 deletions

View File

@ -13,6 +13,7 @@ class WriteDataForm extends Component {
this.handleSelectDatabase = ::this.handleSelectDatabase
this.handleWrite = ::this.handleWrite
this.handleClickOutside = ::this.handleClickOutside
this.handleKeyUp = ::this.handleKeyUp
}
handleSelectDatabase(item) {
@ -24,6 +25,14 @@ class WriteDataForm extends Component {
onClose()
}
handleKeyUp(e) {
const escapeKeyCode = 27
if (e.which === escapeKeyCode) {
const {onClose} = this.props
onClose()
}
}
handleWrite() {
const {onClose, source, writeData} = this.props
const {selectedDatabase} = this.state
@ -56,6 +65,8 @@ class WriteDataForm extends Component {
spellCheck="false"
placeholder="<measurement>,<tag_key>=<tag_value> <field_key>=<field_value>"
ref={editor => this.editor = editor}
onKeyUp={this.handleKeyUp}
autoFocus={true}
/>
<span>
Uses InfluxDB Line Protocol -&nbsp;