Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Keyboard shortcut for running queries #8322

Merged
merged 12 commits into from
Oct 4, 2024
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
Loading