OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[Enhancement] combine list API call after workspace deleted

Open s-zx opened this issue 6 months ago • 3 comments
trafficstars

Description

What this PR does:

  1. Add a batchDelete method to delete multiple workspaces, avoiding unncessary workspaces/_list API call.
  2. Change workspace deletion from parallel to serial to avoid operation conflicts on the same data source, which could lead to deletion failures.
  3. Show notification after all deletion done. Change the notification when workspace deletion failed, showing how many deletions failed and succeeded.

Issues Resolved

N/A

Screenshot

N/A

Testing the changes

Delete multiple workspaces with the same data source.

Changelog

  • feat: Add batch delete method, fix deletion error

Check List

  • [ ] All tests pass
  • [ ] yarn test:jest
  • [ ] yarn test:jest_integration
  • [ ] New functionality includes testing.
  • [ ] New functionality has been documented.
  • [ ] Update CHANGELOG.md
  • [x] Commits are signed per the DCO using --signoff

s-zx avatar May 09 '25 08:05 s-zx

Codecov Report

:x: Patch coverage is 75.43860% with 14 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 62.06%. Comparing base (160d839) to head (ed1683b). :warning: Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
.../delete_workspace_modal/delete_workspace_modal.tsx 60.71% 7 Missing and 4 partials :warning:
src/plugins/workspace/public/workspace_client.ts 84.61% 2 Missing :warning:
...lete_workspace_modal/show_delete_details_modal.tsx 93.75% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9781   +/-   ##
=======================================
  Coverage   62.05%   62.06%           
=======================================
  Files        4288     4289    +1     
  Lines      109625   109668   +43     
  Branches    18032    18041    +9     
=======================================
+ Hits        68032    68066   +34     
- Misses      36968    36977    +9     
  Partials     4625     4625           
Flag Coverage Δ
Linux_1 27.64% <75.43%> (+0.02%) :arrow_up:
Linux_2 41.47% <ø> (ø)
Linux_3 39.46% <ø> (ø)
Linux_4 33.56% <ø> (ø)
Windows_1 27.66% <75.43%> (+0.02%) :arrow_up:
Windows_2 41.44% <ø> (ø)
Windows_3 39.47% <ø> (+<0.01%) :arrow_up:
Windows_4 33.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar May 09 '25 09:05 codecov[bot]

Hi @s-zx , thanks for raising PR to fix this issue. Could you fix these unit tests first? image

wanglam avatar May 14 '25 05:05 wanglam

Hi @s-zx , thanks for raise PR to fix this issue. Could you fix these unit tests first? image

Thanks for letting me know, I will fix these.

s-zx avatar May 14 '25 05:05 s-zx

We should add batchDelete function to IWorkspaceClient interface in src/core/public/workspace/types.ts

yubonluo avatar Sep 08 '25 07:09 yubonluo

We should add batchDelete function to IWorkspaceClient interface in src/core/public/workspace/types.ts

Got it. Thanks for your reminder!

s-zx avatar Sep 08 '25 08:09 s-zx

Could you please add a video for this enhancement?

yubonluo avatar Sep 08 '25 08:09 yubonluo

Could you please add a video for this enhancement?

Sure, I will add this later.

s-zx avatar Sep 08 '25 08:09 s-zx

I remember workspace detail page src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx also call the DeleteWorkspaceModal, could you check if it is compatible?

yubonluo avatar Sep 08 '25 08:09 yubonluo

I remember workspace detail page src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx also call the DeleteWorkspaceModal, could you check if it is compatible?

s-zx avatar Sep 08 '25 08:09 s-zx

I remember workspace detail page src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx also call the DeleteWorkspaceModal, could you check if it is compatible?

OK, I will check it.

s-zx avatar Sep 08 '25 08:09 s-zx

I remember workspace detail page src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx also call the DeleteWorkspaceModal, could you check if it is compatible?

I tested it and It works as expected.

s-zx avatar Sep 11 '25 08:09 s-zx

LGTM! Thanks for fixing this issue.

wanglam avatar Sep 12 '25 09:09 wanglam