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

Only support copy for query templates #8899

Conversation

amsiglan
Copy link
Collaborator

Description

For query templates we don't want to run them when they load because they need user input to be valid. Currently Discover does not support a good way to avoid running the query on load.
To avoid this, this PR only lets the user copy the query, which can then be pastes into the Discover editor for modification before running them.

Screenshot

Screen.Recording.2024-11-19.at.7.38.51.PM.mov

Testing the changes

Tested changes locally

Changelog

  • fix: Only support copy action for query templates

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: Amardeepsingh Siglani <amardeep7194@gmail.com>
virajsanghvi
virajsanghvi previously approved these changes Nov 20, 2024
Copy link
Collaborator

@virajsanghvi virajsanghvi left a comment

Choose a reason for hiding this comment

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

code looks safe to me although I think it'll end up failing tests for the flyout (you may want to run locally to get ahead of it) - approving to unblock and assuming it passes ci

let's make sure we follow-up with testing if it does pass

…s not selected

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 18.75000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 60.86%. Comparing base (a8d383b) to head (9b563d9).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ui/saved_query_flyouts/open_saved_query_flyout.tsx 18.75% 10 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8899      +/-   ##
==========================================
- Coverage   60.86%   60.86%   -0.01%     
==========================================
  Files        3802     3802              
  Lines       91052    91059       +7     
  Branches    14370    14370              
==========================================
+ Hits        55421    55425       +4     
- Misses      32093    32095       +2     
- Partials     3538     3539       +1     
Flag Coverage Δ
Linux_1 29.01% <ø> (ø)
Linux_2 56.39% <ø> (ø)
Linux_3 37.88% <18.75%> (?)
Linux_4 29.00% <ø> (ø)
Windows_1 29.02% <ø> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.88% <18.75%> (-0.01%) ⬇️
Windows_4 29.00% <ø> (ø)

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.


🚨 Try these New Features:

@amsiglan amsiglan merged commit a107509 into opensearch-project:main Nov 20, 2024
70 of 71 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-8899-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a10750901857f838b1d92adfd27e4c46e6c7134b
# Push it to GitHub
git push --set-upstream origin backport/backport-8899-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-8899-to-2.x.

raintygao pushed a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Nov 20, 2024
* only support copy for query templates

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>

* Changeset file for PR opensearch-project#8899 created/updated

* clear selected query on tab change; keep button disabled when query is not selected

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>

---------

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.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