Skip to content

Commit

Permalink
[Discover] Query Editor Shortcut Fires Incorrect Query (#9248) (#9310)
Browse files Browse the repository at this point in the history
* fix discover enter bug



* Changeset file for PR #9248 created/updated

---------



(cherry picked from commit 57c4424)

Signed-off-by: Sean Li <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 31, 2025
1 parent d8a49d4 commit 9ec202b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/9248.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix Discover query editor enter shortcuts reverting date range ([#9248](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9248))
7 changes: 4 additions & 3 deletions src/plugins/data/public/ui/query_editor/query_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const QueryEditorUI: React.FC<Props> = (props) => {
const editorQuery = props.query; // local query state managed by the editor. Not to be confused by the app query state.

const queryString = getQueryService().queryString;
const timefilter = getQueryService().timefilter.timefilter;
const languageManager = queryString.getLanguageService();
const extensionMap = languageManager.getQueryEditorExtensionMap();
const services = props.opensearchDashboards.services;
Expand Down Expand Up @@ -301,7 +302,7 @@ export const QueryEditorUI: React.FC<Props> = (props) => {
query: editor.getValue(),
};

onSubmit(newQuery);
onSubmit(newQuery, timefilter.getTime());
});

return () => {
Expand Down Expand Up @@ -358,11 +359,11 @@ export const QueryEditorUI: React.FC<Props> = (props) => {

editor.addCommand(monaco.KeyCode.Enter, () => {
const newQuery = {
...query,
...queryRef.current,
query: editor.getValue(),
};

onSubmit(newQuery);
onSubmit(newQuery, timefilter.getTime());
});
},
provideCompletionItems,
Expand Down

0 comments on commit 9ec202b

Please sign in to comment.