diff --git a/changelogs/fragments/8322.yml b/changelogs/fragments/8322.yml new file mode 100644 index 000000000000..c44f12292b5f --- /dev/null +++ b/changelogs/fragments/8322.yml @@ -0,0 +1,2 @@ +fix: +- Keyboard shortcut for running queries ([#8322](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8322)) \ No newline at end of file diff --git a/src/plugins/data/public/ui/query_editor/query_editor.tsx b/src/plugins/data/public/ui/query_editor/query_editor.tsx index c2d79fb6d470..2ce9e9af484f 100644 --- a/src/plugins/data/public/ui/query_editor/query_editor.tsx +++ b/src/plugins/data/public/ui/query_editor/query_editor.tsx @@ -366,6 +366,14 @@ export default class QueryEditorUI extends Component { editor.setValue(`\n`.repeat(10)); this.setState({ lineCount: editor.getModel()?.getLineCount() }); this.inputRef = editor; + // eslint-disable-next-line no-bitwise + editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter, () => { + this.onSubmit(this.props.query); + }); + + return () => { + disposable.dispose(); + }; }, footerItems: { start: [