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

[data] reset query when disabling query enhancements if type is not supported #8772

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kavilla
Copy link
Member

@kavilla kavilla commented Oct 31, 2024

Description

Reset the query to DQL and an empty string and update to use a default index pattern when query enhancements went from enabled to disabled.

For example if the user selects SQL, then disables query enhancements we will default it back to DQL. This is to avoid bad state or failures.

Another example would be having an S3 data type which is not supported by default.

Issues Resolved

n/a

Screenshot

Testing the changes

Changelog

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

… type

For example if the user selects SQL, then disables query enhancements
we will default it back to DQL. This is to avoid bad state or failures.

Issue:
n/a

Signed-off-by: Kawika Avilla <[email protected]>
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.

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.

@@ -57,6 +57,28 @@ export class QueryStringManager {
this.queryHistory = createHistory({ storage: this.sessionStorage });
this.datasetService = new DatasetService(uiSettings, this.sessionStorage);
this.languageService = new LanguageService(this.defaultSearchInterceptor, this.storage);

this.uiSettings.get$(UI_SETTINGS.QUERY_ENHANCEMENTS_ENABLED).subscribe((isEnabled) => {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't safe enough. It should be something on page load ideally that checks for the flag and does any cleanup actions. Since we require a page reload for the flag, that should take care of the change listener missing the change and letting the bad state persist

Copy link
Member

Choose a reason for hiding this comment

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

Is it possible that the setting changes before subscription set up or already in a bad state (ex. SQL) when the subscription is established?

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 60.75%. Comparing base (c9941f7) to head (0a745c8).

Files with missing lines Patch % Lines
.../public/query/query_string/query_string_manager.ts 12.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8772      +/-   ##
==========================================
- Coverage   60.75%   60.75%   -0.01%     
==========================================
  Files        3798     3798              
  Lines       90688    90696       +8     
  Branches    14275    14278       +3     
==========================================
+ Hits        55100    55101       +1     
- Misses      32089    32096       +7     
  Partials     3499     3499              
Flag Coverage Δ
Linux_1 29.05% <0.00%> (-0.01%) ⬇️
Linux_2 56.39% <ø> (ø)
Linux_3 37.60% <12.50%> (-0.01%) ⬇️
Linux_4 29.82% <0.00%> (-0.01%) ⬇️
Windows_1 29.06% <0.00%> (-0.01%) ⬇️
Windows_2 56.34% <ø> (ø)
Windows_3 37.60% <12.50%> (-0.01%) ⬇️
Windows_4 29.82% <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.

@ananzh
Copy link
Member

ananzh commented Oct 31, 2024

@kavilla is this for 2.18 or 2.19?

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.

3 participants