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

[Workspace] Unassign data source before deleteByWorkspace #7279

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

raintygao
Copy link
Contributor

Description

In current implementation, we call deleteByWorkspace to delete related saved objects when deleting a workspace. This will cause selected data source deleted when it is only assigned to this workspace. So we will unassign this data source before calling deleteByWorkspace.

Testing the changes

  1. Use find API to find any data sources and what workspaces they belong to. http://localhost:6601/w/${OSD_ID}/api/saved_objects/_find?fields=id&fields=title&fields=workspaces&per_page=10000&type=data-source&workspaces=*
  2. Enter workspace list page to delete some workspace.
  3. Use find API then you could see that the data source is unassigned and still existed.

Changelog

  • fix: Unassign data source before deleteByWorkspace

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: tygao <tygao@amazon.com>
Copy link

codecov bot commented Jul 17, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 67.33%. Comparing base (d2e7b9d) to head (2fbb5c4).

Files Patch % Lines
src/plugins/workspace/server/workspace_client.ts 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7279      +/-   ##
==========================================
+ Coverage   67.30%   67.33%   +0.02%     
==========================================
  Files        3500     3500              
  Lines       69219    69225       +6     
  Branches    11275    11276       +1     
==========================================
+ Hits        46591    46613      +22     
+ Misses      19903    19885      -18     
- Partials     2725     2727       +2     
Flag Coverage Δ
Linux_1 33.25% <83.33%> (+0.01%) ⬆️
Linux_2 55.30% <ø> (ø)
Linux_3 45.27% <ø> (+0.01%) ⬆️
Windows_1 33.30% <83.33%> (+0.04%) ⬆️
Windows_2 55.25% <ø> (ø)
Windows_3 45.27% <ø> (ø)
Windows_4 34.70% <ø> (ø)

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
Contributor

@Hailong-am Hailong-am left a comment

Choose a reason for hiding this comment

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

thanks for fixing this 👍

@SuZhou-Joe SuZhou-Joe merged commit d67d6ba into opensearch-project:main Jul 17, 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-7279-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d67d6ba1c82153c4a1ea7874ac05f142f41f4eac
# Push it to GitHub
git push --set-upstream origin backport/backport-7279-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-7279-to-2.x.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 17, 2024
* unassign data source before deleteByWorkspace

Signed-off-by: tygao <tygao@amazon.com>

* Changeset file for PR #7279 created/updated

---------

Signed-off-by: tygao <tygao@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit d67d6ba)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Jul 18, 2024
)

* unassign data source before deleteByWorkspace



* Changeset file for PR #7279 created/updated

---------



(cherry picked from commit d67d6ba)

Signed-off-by: tygao <tygao@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>
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.

5 participants