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

Fix running recent query button #8252

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

abbyhu2000
Copy link
Member

Description

Fix the bug of running recent query jump to another language.

Issues Resolved

Screenshot

Testing the changes

Changelog

  • fix: Run recent query button work properly

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

ashwin-pc
ashwin-pc previously approved these changes Sep 19, 2024
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 64.11%. Comparing base (27ba36c) to head (e21530a).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...query_string/language_service/lib/recent_query.tsx 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8252   +/-   ##
=======================================
  Coverage   64.11%   64.11%           
=======================================
  Files        3744     3744           
  Lines       88862    88864    +2     
  Branches    13852    13852           
=======================================
+ Hits        56975    56978    +3     
+ Misses      31273    31272    -1     
  Partials      614      614           
Flag Coverage Δ
Linux_1 30.06% <0.00%> (-0.01%) ⬇️
Linux_2 58.85% <ø> (ø)
Linux_3 40.35% <0.00%> (-0.01%) ⬇️
Linux_4 31.56% <0.00%> (?)
Windows_1 30.08% <0.00%> (-0.01%) ⬇️
Windows_2 58.80% <ø> (ø)
Windows_3 40.36% <0.00%> (-0.01%) ⬇️
Windows_4 31.56% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -51,7 +51,10 @@ export function RecentQueriesTable({
icon: 'play',
type: 'icon',
onClick: (item: RecentQueryTableItem) => {
onClickRecentQuery(recentQueries[item.id].query, recentQueries[item.id].timeRange);
onClickRecentQuery(
Copy link
Member

@kavilla kavilla Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to mind explaining this part a little bit? like how this fixes the problem?

without knowing too much about the implementation, for me this basically looks for the query and assumes its the same query which might not be accurate still i think.

i dont think we show this feature for DQL but in the case of DQL the query could actually just be
"" for multiple queries for different index patterns. And this logic to me would find the first query that is "" and assume that is the recent query.

in SQL and PPL we dont limit what they type so technically they could select data_logs

and in SQL it would be SELECT * FROM data_logs
and then they type it SELECT * FROM eccomerce and then select the eccommerce sample data. so then the query editor says SELECT * FROM eccomerce which query is the right query here.

i think the solution here should be assigning a GUID or using the timestamp of execution as the identifier. then the RecentQueryTableItem.id should be just the id of that GUID or timestamp

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense. i revised it to use uuid

@@ -13,6 +13,7 @@ import {
import { EditorInstance } from '../../../ui/query_editor/editors';

export interface RecentQueryItem {
id: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think it's a string now right ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix in later PR

@abbyhu2000 abbyhu2000 merged commit 2f36eaf into opensearch-project:main Sep 20, 2024
66 of 67 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 20, 2024
* Fix click on recent query switching language

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

* change to use uuid as identifier

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

* Changeset file for PR #8252 created/updated

---------

Signed-off-by: abbyhu2000 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 2f36eaf)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 20, 2024
* Fix click on recent query switching language

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

* change to use uuid as identifier

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

* Changeset file for PR #8252 created/updated

---------

Signed-off-by: abbyhu2000 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 2f36eaf)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kavilla pushed a commit that referenced this pull request Sep 23, 2024
* Fix click on recent query switching language



* change to use uuid as identifier



* Changeset file for PR #8252 created/updated

---------



(cherry picked from commit 2f36eaf)

Signed-off-by: abbyhu2000 <[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>
kavilla pushed a commit that referenced this pull request Sep 23, 2024
* Fix click on recent query switching language



* change to use uuid as identifier



* Changeset file for PR #8252 created/updated

---------



(cherry picked from commit 2f36eaf)

Signed-off-by: abbyhu2000 <[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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants