Web-console: Add run keyboard short cut to sql-control (#7787)

* add run keyboard shortcut

* add allow input
This commit is contained in:
mcbrewster 2019-05-29 16:11:59 -07:00 committed by Clint Wylie
parent 782863ed0f
commit 245eded350
3 changed files with 16 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import {
Popover,
Position, ResizeSensor
} from '@blueprintjs/core';
import { Hotkey, Hotkeys, HotkeysTarget } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import axios from 'axios';
import * as ace from 'brace';
@ -77,6 +78,7 @@ export interface SqlControlState {
editorHeight: number;
}
@HotkeysTarget
export class SqlControl extends React.Component<SqlControlProps, SqlControlState> {
constructor(props: SqlControlProps, context: any) {
super(props, context);
@ -303,6 +305,18 @@ export class SqlControl extends React.Component<SqlControlProps, SqlControlState
</Menu>;
}
public renderHotkeys() {
return <Hotkeys>
<Hotkey
allowInInput
global
combo="ctrl + enter"
label="run on click"
onKeyDown={this.onRunClick}
/>
</Hotkeys>;
}
render() {
const { queryElapsed } = this.props;
const { query, autoComplete, wrapQuery, editorHeight } = this.state;

View File

@ -16,7 +16,7 @@ exports[`describe sql view sql view snapshot 1`] = `
<div
className="top-pane"
>
<SqlControl
<HotkeysTarget(SqlControl)
initSql="test"
onExplain={[Function]}
onRun={[Function]}

View File

@ -1,5 +1,6 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"noImplicitAny": true,
"noEmitOnError": true,
"declaration": false,