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

[discover] Query editor UI changes #7866

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

abbyhu2000
Copy link
Member

@abbyhu2000 abbyhu2000 commented Aug 27, 2024

Description

  • Move filter bar to a prepend filter button
  • Add a series of query control: language reference, saved query management button, for PPL and SQL, add one more query control of toggle
  • Build recent query pop over table, and able to run any recent query from history

Issues Resolved

Screenshot

filter button:

Screen.Recording.2024-08-27.at.12.26.54.PM.mov

query controls:
https://github.com/user-attachments/assets/18e1450f-4b3d-4dfb-9e8c-14495235cc6c

recent query:

Screen.Recording.2024-08-27.at.12.25.03.PM.mov

Testing the changes

Changelog

  • feat: Query editor UI changes

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

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
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

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 6.25000% with 15 lines in your changes missing coverage. Please review.

Project coverage is 64.16%. Comparing base (1976ecf) to head (5ad73e8).
Report is 146 commits behind head on main.

Files with missing lines Patch % Lines
...c/plugins/data/public/ui/search_bar/search_bar.tsx 12.50% 6 Missing and 1 partial ⚠️
...ugins/data/public/ui/filter_bar/filter_options.tsx 0.00% 1 Missing and 2 partials ⚠️
...c/ui/query_editor/editors/default_editor/index.tsx 0.00% 2 Missing ⚠️
.../query_string/language_service/language_service.ts 0.00% 1 Missing ⚠️
.../public/query/query_string/query_string_manager.ts 0.00% 1 Missing ⚠️
...ins/data/public/ui/query_editor/editors/shared.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7866      +/-   ##
==========================================
- Coverage   64.17%   64.16%   -0.01%     
==========================================
  Files        3659     3659              
  Lines       80796    80797       +1     
  Branches    12866    12869       +3     
==========================================
- Hits        51848    51843       -5     
- Misses      25769    25772       +3     
- Partials     3179     3182       +3     
Flag Coverage Δ
Linux_1 30.30% <0.00%> (-0.01%) ⬇️
Linux_2 55.89% <ø> (ø)
Linux_3 40.66% <6.25%> (-0.02%) ⬇️
Linux_4 31.46% <0.00%> (-0.01%) ⬇️
Windows_1 30.32% <0.00%> (-0.01%) ⬇️
Windows_2 55.85% <ø> (ø)
Windows_3 40.67% <6.25%> (+<0.01%) ⬆️
Windows_4 31.46% <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.

@kavilla kavilla changed the title Query editor UI changes [discover] Query editor UI changes Aug 27, 2024
return (
<div>
<EuiFlyout
className="observability-flyout"
Copy link
Member

Choose a reason for hiding this comment

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

?

@@ -0,0 +1,4 @@
.recentQuery__table {
padding: $euiSizeXS;
width: 1320px;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this fixed width? What if i look at it on a smaller screen?

return (
<div>
<EuiFlyout
className="observability-flyout"
Copy link
Member

Choose a reason for hiding this comment

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

nit: The class name should be updated

setIsLanguageReferenceOpen(false);
};

const osdDQLDocs = 'https://opensearch.org/docs/2.16/dashboards/dql)';
Copy link
Member

Choose a reason for hiding this comment

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

Can we get the version from package.json?

defaultMessage: `Language Reference`,
}),
run: async (anchorElement) => {
if (props.queryLanguage === 'PPL' || props.queryLanguage === 'SQL') {
Copy link
Member

Choose a reason for hiding this comment

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

To keep the code cleaner, cant we register these when we register the PPL and SQL language using the additional controls property?

Copy link
Member

Choose a reason for hiding this comment

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

I'd move all these langugae docs to the query enhancements plugin

@@ -112,9 +112,9 @@ export class QueryStringManager {
};

// Todo: update this function to use the Query object when it is udpated, Query object should include time range and dataset
Copy link
Member

Choose a reason for hiding this comment

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

Nit: We should remove this TODO

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

The styling and moving of the docs can be done in a fast follow. Approving the PR as is for now to unblock the rest of the work.

};

const queryControls =
props.queryLanguage === 'PPL' || props.queryLanguage === 'SQL'
Copy link
Member

Choose a reason for hiding this comment

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

Lets not check explicitly for the PPL/SQL stuff here. The expand should be associated with the editor itself. If its the DQL editor, it should have this but if its the Default editor, then it should have this control alongside the other controls

Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

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

Approving with agreement of fast follows.

Avoid hardcode ref to language in data plugin. Fast follow should consider modifying the contract of the language config to have more features. And if the language doesn't include it then dont render it. An example I would reference is Joshua's query editor extension. You can just render an array of actions.

For example you could pass in a button.

For the expand and collapsed I think it's weird the shifting of other buttons and that it's in the middle of the other actions even though it manipulates something not to the left of it. Like if I was tabbing through I could be typing and then I have to click tab twice otherwise the first button opens an overlay

Ive seen other applications include the expand and collapsed within the actual editor. Which makes sense for me because then I won't have to misclick on the wrong button potentially and open an overlay if I wanted to go from the query editor to expand it

@abbyhu2000 abbyhu2000 merged commit 333957b into opensearch-project:main Aug 28, 2024
72 of 73 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7866-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 333957b1ad7732774504dab53467e9e2d09c0c43
# Push it to GitHub
git push --set-upstream origin backport/backport-7866-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7866-to-2.x.

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