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

feat: added a new API to allow adding additional editor controls #7936

Closed

Conversation

ruanyl
Copy link
Member

@ruanyl ruanyl commented Aug 30, 2024

Description

Allow externals to add additional query editor controls

Issues Resolved

Screenshot

image

Testing the changes

Changelog

  • feat: added a new API to allow externals to add additional controls to query editor

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.

@ruanyl
Copy link
Member Author

ruanyl commented Aug 30, 2024

@kavilla @ashwin-pc @abbyhu2000 Would love to see your comments :)

opensearch-changeset-bot bot added a commit to ruanyl/OpenSearch-Dashboards that referenced this pull request Aug 30, 2024
Copy link

codecov bot commented Aug 30, 2024

Codecov Report

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

Project coverage is 61.01%. Comparing base (cbe74d8) to head (a416e6c).
Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/data/public/ui/ui_service.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7936      +/-   ##
==========================================
- Coverage   61.02%   61.01%   -0.01%     
==========================================
  Files        3688     3688              
  Lines       87223    87226       +3     
  Branches    13422    13422              
==========================================
- Hits        53224    53222       -2     
- Misses      30772    30776       +4     
- Partials     3227     3228       +1     
Flag Coverage Δ
Linux_1 29.34% <0.00%> (-0.01%) ⬇️
Linux_2 56.25% <ø> (ø)
Linux_3 37.78% <0.00%> (-0.02%) ⬇️
Linux_4 29.60% <0.00%> (-0.01%) ⬇️
Windows_1 29.36% <0.00%> (-0.01%) ⬇️
Windows_2 56.20% <ø> (ø)
Windows_3 37.79% <0.00%> (-0.01%) ⬇️
Windows_4 29.60% <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.

@@ -60,6 +62,7 @@ export interface QueryEditorProps {
filterBar?: any;
prepend?: React.ComponentProps<typeof EuiCompressedFieldText>['prepend'];
savedQueryManagement?: any;
additionalControls$?: BehaviorSubject<SearchBarControl[]>;
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 to be an observable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Might not be a hard requirement now, but I was thinking, it might make sense to make it an observable so that the controls can be added on the fly, similar to dynamic action triggers.

Copy link
Member

Choose a reason for hiding this comment

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

There are 2 problems I see with this approach.

  1. Whats the usecase for such dynamic controls? Without a use I don't want to add more complexity to the query bar. It think it's more useful to pass the current app state to determine if the controls are needed rather than having an observable.
  2. Right now you can only add controls but not remove them. But this is an easy fix compared to the first one though

SuZhou-Joe
SuZhou-Joe previously approved these changes Sep 2, 2024
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