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] Support getting workspace client from coreStart #7501

Merged

Conversation

yubonluo
Copy link
Contributor

@yubonluo yubonluo commented Jul 26, 2024

Description

Support getting workspace client from coreStart.
Expose a workspace client interface, which can be implemented by the workspace client:

export interface IWorkspaceClient {
  copy(objects: any[], targetWorkspace: string, includeReferencesDeep?: boolean): Promise<any>;
}

Other plugins can get workspace client from coreStart:

const workspaceClient = coreStart.workspaces.client$.getValue();

Currently, this interface exposes a copy method, which can be used by other plugin:

workspaceClient.copy(xxx, xxx, xxx);

Issues Resolved

Screenshot

Testing the changes

Changelog

  • refactor: [Workspace] Support getting workspaces client from coreStart

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

@yubonluo yubonluo force-pushed the 2.17-optimize-workspace-client branch from 862494c to df7f4e9 Compare July 26, 2024 02:14
Copy link

codecov bot commented Jul 26, 2024

Codecov Report

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

Project coverage is 63.81%. Comparing base (4cdfcf4) to head (dd7b403).
Report is 190 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/workspace/public/workspace_client.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7501   +/-   ##
=======================================
  Coverage   63.81%   63.81%           
=======================================
  Files        3651     3650    -1     
  Lines       80954    80966   +12     
  Branches    12893    12894    +1     
=======================================
+ Hits        51662    51671    +9     
- Misses      26126    26127    +1     
- Partials     3166     3168    +2     
Flag Coverage Δ
Linux_1 30.04% <31.57%> (+<0.01%) ⬆️
Linux_2 55.85% <100.00%> (+0.01%) ⬆️
Linux_3 40.41% <7.69%> (-0.01%) ⬇️
Linux_4 31.28% <76.92%> (+<0.01%) ⬆️
Windows_1 30.05% <31.57%> (+<0.01%) ⬆️
Windows_2 55.81% <100.00%> (+0.01%) ⬆️
Windows_3 40.41% <7.69%> (-0.01%) ⬇️
Windows_4 31.28% <76.92%> (+<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.

Signed-off-by: yubonluo <[email protected]>
…OpenSearch-Dashboards into 2.17/optimize-workspace-client
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
SuZhou-Joe
SuZhou-Joe previously approved these changes Aug 15, 2024
Signed-off-by: yubonluo <[email protected]>
@ruanyl ruanyl merged commit ae7cfa6 into opensearch-project:main Aug 16, 2024
67 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-7501-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ae7cfa6072957ac2068807618a02804321731c2f
# Push it to GitHub
git push --set-upstream origin backport/backport-7501-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-7501-to-2.x.

Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
…ch-project#7501)

* Support to get workspace client from coreStart

Signed-off-by: yubonluo <[email protected]>

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

* Support to get workspace client from coreStart

Signed-off-by: yubonluo <[email protected]>

* fix test error

Signed-off-by: yubonluo <[email protected]>

* delete irrelevant modification

Signed-off-by: yubonluo <[email protected]>

* optimize the code

Signed-off-by: yubonluo <[email protected]>

* optimize the code

Signed-off-by: yubonluo <[email protected]>

* optimize the code

Signed-off-by: yubonluo <[email protected]>

---------

Signed-off-by: yubonluo <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Yulong Ruan <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 22, 2024
* Support to get workspace client from coreStart

Signed-off-by: yubonluo <[email protected]>

* Changeset file for PR #7501 created/updated

* Support to get workspace client from coreStart

Signed-off-by: yubonluo <[email protected]>

* fix test error

Signed-off-by: yubonluo <[email protected]>

* delete irrelevant modification

Signed-off-by: yubonluo <[email protected]>

* optimize the code

Signed-off-by: yubonluo <[email protected]>

* optimize the code

Signed-off-by: yubonluo <[email protected]>

* optimize the code

Signed-off-by: yubonluo <[email protected]>

---------

Signed-off-by: yubonluo <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Yulong Ruan <[email protected]>
(cherry picked from commit ae7cfa6)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Aug 22, 2024
…7797)

* Support to get workspace client from coreStart



* Changeset file for PR #7501 created/updated

* Support to get workspace client from coreStart



* fix test error



* delete irrelevant modification



* optimize the code



* optimize the code



* optimize the code



---------




(cherry picked from commit ae7cfa6)

Signed-off-by: yubonluo <[email protected]>
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>
Co-authored-by: Yulong Ruan <[email protected]>
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