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

Filter Saved Query by supported language #8325

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

LDrago27
Copy link
Collaborator

@LDrago27 LDrago27 commented Sep 24, 2024

Description

This PR aims at filtering Saved Queries on the basis of language.

Issues Resolved

Screenshot

In Discover that supports additional SQL and PPL languages
image

In Visualize page where we only support DQL, other language Saved Queries are filtered

image

Testing the changes

Changelog

  • skip

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

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

@github-actions github-actions bot added failed changeset Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry and removed failed changeset labels Sep 24, 2024
Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
Copy link

codecov bot commented Sep 24, 2024

Codecov Report

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

Project coverage is 64.14%. Comparing base (9a88bf5) to head (728fde5).
Report is 177 commits behind head on main.

Files with missing lines Patch % Lines
...ta/public/query/saved_query/saved_query_service.ts 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8325      +/-   ##
==========================================
- Coverage   64.14%   64.14%   -0.01%     
==========================================
  Files        3743     3743              
  Lines       88843    88851       +8     
  Branches    13855    13858       +3     
==========================================
+ Hits        56987    56991       +4     
- Misses      31241    31245       +4     
  Partials      615      615              
Flag Coverage Δ
Linux_1 30.06% <0.00%> (-0.01%) ⬇️
Linux_2 58.86% <ø> (ø)
Linux_3 40.35% <55.55%> (+<0.01%) ⬆️
Linux_4 31.57% <0.00%> (-0.01%) ⬇️
Windows_1 30.07% <0.00%> (-0.01%) ⬇️
Windows_2 58.81% <ø> (ø)
Windows_3 40.35% <55.55%> (+<0.01%) ⬆️
Windows_4 31.57% <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.

Copy link
Member

@sejli sejli left a comment

Choose a reason for hiding this comment

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

Nice changes! Just some non-blocking comments, otherwise LGTM

Comment on lines +137 to +140
return (
languageService?.getLanguage(languageId)?.supportedAppNames?.includes(currentAppId) ??
true
);
Copy link
Member

Choose a reason for hiding this comment

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

nit: Do we just need the parenthesis here? Or could it just be

return languageService?.getLanguage(languageId)?.supportedAppNames?.includes(currentAppId) ?? true;

(await application?.currentAppId$?.pipe(first()).toPromise()) ?? Promise.resolve(undefined);
const languageService = queryStringManager?.getLanguageService();

// Filtering saved queries based on language supported by cirrent application
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
// Filtering saved queries based on language supported by cirrent application
// Filtering saved queries based on language supported by current application

queries = queries.filter((query) => {
const languageId = query.attributes.query.language;
return (
languageService?.getLanguage(languageId)?.supportedAppNames?.includes(currentAppId) ??
Copy link
Member

Choose a reason for hiding this comment

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

nit: Will languageService ever not have getLanguage()?

@@ -41,7 +43,9 @@ type SerializedSavedQueryAttributes = SavedObjectAttributes &
};

export const createSavedQueryService = (
Copy link
Member

Choose a reason for hiding this comment

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

we should add a back log item to extend this service. i think at one point we were going to have a toggle to save the query with or without the dataset. which id imagine that is something we would want since in the past the saved query wouldn't replace the selected dataset (index pattern) it would just replace the current query

@kavilla
Copy link
Member

kavilla commented Sep 26, 2024

lgtm its for 2.18 correct?

@LDrago27 LDrago27 merged commit 33f4f64 into opensearch-project:main Sep 26, 2024
73 of 75 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 26, 2024
Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
(cherry picked from commit 33f4f64)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
LDrago27 pushed a commit that referenced this pull request Sep 26, 2024
(cherry picked from commit 33f4f64)

Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
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>
SuZhou-Joe pushed a commit to SuZhou-Joe/OpenSearch-Dashboards that referenced this pull request Oct 3, 2024
…pensearch-project#8356)

(cherry picked from commit 33f4f64)

Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
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>
sejli added a commit to sejli/OpenSearch-Dashboards that referenced this pull request Oct 4, 2024
sejli added a commit to sejli/OpenSearch-Dashboards that referenced this pull request Oct 8, 2024
sejli added a commit that referenced this pull request Oct 11, 2024
* Adding recent datasets to dataset selector

Signed-off-by: Sean Li <lnse@amazon.com>

* addressing comments, adding tests

Signed-off-by: Sean Li <lnse@amazon.com>

* moving recent datasets to fetched datasets

Signed-off-by: Sean Li <lnse@amazon.com>

* mocking UI settings for test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing connect_to_query_state.test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing sync_state_with_url test

Signed-off-by: Sean Li <lnse@amazon.com>

* adding recent datasets to session storage

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing cache bug, improving code structure

Signed-off-by: Sean Li <lnse@amazon.com>

* adding i18n translation for group labels

Signed-off-by: Sean Li <lnse@amazon.com>

* updating mock

Signed-off-by: Sean Li <lnse@amazon.com>

* updating state sync tests and fixing typos in #8325

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing dataset selector test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing index test

Signed-off-by: Sean Li <lnse@amazon.com>

---------

Signed-off-by: Sean Li <lnse@amazon.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 11, 2024
* Adding recent datasets to dataset selector

Signed-off-by: Sean Li <lnse@amazon.com>

* addressing comments, adding tests

Signed-off-by: Sean Li <lnse@amazon.com>

* moving recent datasets to fetched datasets

Signed-off-by: Sean Li <lnse@amazon.com>

* mocking UI settings for test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing connect_to_query_state.test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing sync_state_with_url test

Signed-off-by: Sean Li <lnse@amazon.com>

* adding recent datasets to session storage

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing cache bug, improving code structure

Signed-off-by: Sean Li <lnse@amazon.com>

* adding i18n translation for group labels

Signed-off-by: Sean Li <lnse@amazon.com>

* updating mock

Signed-off-by: Sean Li <lnse@amazon.com>

* updating state sync tests and fixing typos in #8325

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing dataset selector test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing index test

Signed-off-by: Sean Li <lnse@amazon.com>

---------

Signed-off-by: Sean Li <lnse@amazon.com>
(cherry picked from commit 464ef56)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
sejli added a commit to sejli/OpenSearch-Dashboards that referenced this pull request Oct 21, 2024
* Adding recent datasets to dataset selector

Signed-off-by: Sean Li <lnse@amazon.com>

* addressing comments, adding tests

Signed-off-by: Sean Li <lnse@amazon.com>

* moving recent datasets to fetched datasets

Signed-off-by: Sean Li <lnse@amazon.com>

* mocking UI settings for test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing connect_to_query_state.test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing sync_state_with_url test

Signed-off-by: Sean Li <lnse@amazon.com>

* adding recent datasets to session storage

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing cache bug, improving code structure

Signed-off-by: Sean Li <lnse@amazon.com>

* adding i18n translation for group labels

Signed-off-by: Sean Li <lnse@amazon.com>

* updating mock

Signed-off-by: Sean Li <lnse@amazon.com>

* updating state sync tests and fixing typos in opensearch-project#8325

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing dataset selector test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing index test

Signed-off-by: Sean Li <lnse@amazon.com>

---------

Signed-off-by: Sean Li <lnse@amazon.com>
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
* Adding recent datasets to dataset selector

Signed-off-by: Sean Li <lnse@amazon.com>

* addressing comments, adding tests

Signed-off-by: Sean Li <lnse@amazon.com>

* moving recent datasets to fetched datasets

Signed-off-by: Sean Li <lnse@amazon.com>

* mocking UI settings for test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing connect_to_query_state.test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing sync_state_with_url test

Signed-off-by: Sean Li <lnse@amazon.com>

* adding recent datasets to session storage

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing cache bug, improving code structure

Signed-off-by: Sean Li <lnse@amazon.com>

* adding i18n translation for group labels

Signed-off-by: Sean Li <lnse@amazon.com>

* updating mock

Signed-off-by: Sean Li <lnse@amazon.com>

* updating state sync tests and fixing typos in opensearch-project#8325

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing dataset selector test

Signed-off-by: Sean Li <lnse@amazon.com>

* fixing index test

Signed-off-by: Sean Li <lnse@amazon.com>

---------

Signed-off-by: Sean Li <lnse@amazon.com>
@ananzh ananzh added the v2.18.0 label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all-star-contributor backport 2.x discover for discover reinvent discover-next in-next Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v2.18.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants