Skip to content

Commit

Permalink
[Enhancement] Keyboard shortcut for running queries (#8322)
Browse files Browse the repository at this point in the history
* added keyboard listener

Signed-off-by: sumukhswamy <[email protected]>

* changed implementation to monaco action button

Signed-off-by: sumukhswamy <[email protected]>

* changed implementation to monaco action button

Signed-off-by: sumukhswamy <[email protected]>

* added space

Signed-off-by: sumukhswamy <[email protected]>

* Update src/plugins/data/public/ui/query_editor/query_editor.tsx

Co-authored-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Sumukh Swamy <[email protected]>

* updated linter, added changesheet

Signed-off-by: sumukhswamy <[email protected]>

---------

Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: Sumukh Swamy <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
  • Loading branch information
sumukhswamy and ashwin-pc authored Oct 4, 2024
1 parent 858b70f commit 57eea79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8322.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Keyboard shortcut for running queries ([#8322](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8322))
8 changes: 8 additions & 0 deletions src/plugins/data/public/ui/query_editor/query_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,14 @@ export default class QueryEditorUI extends Component<Props, State> {
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: [
Expand Down

0 comments on commit 57eea79

Please sign in to comment.