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]Add workspace id in basePath #212

Merged

Conversation

SuZhou-Joe
Copy link
Collaborator

@SuZhou-Joe SuZhou-Joe commented Oct 9, 2023

Description

Issues Resolved

Screenshot

Testing the changes

Check List

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

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2023

Codecov Report

Merging #212 (2c79849) into workspace-pr-integr (903e594) will decrease coverage by 4.44%.
Report is 1 commits behind head on workspace-pr-integr.
The diff coverage is 82.96%.

@@                   Coverage Diff                   @@
##           workspace-pr-integr     #212      +/-   ##
=======================================================
- Coverage                66.06%   61.62%   -4.44%     
=======================================================
  Files                     3386     2981     -405     
  Lines                    64872    57676    -7196     
  Branches                 10455     9314    -1141     
=======================================================
- Hits                     42858    35545    -7313     
- Misses                   19446    20039     +593     
+ Partials                  2568     2092     -476     
Flag Coverage Δ
Linux_ ?
_1 34.95% <71.11%> (?)
_2 55.51% <97.61%> (+0.05%) ⬆️
_3 44.50% <40.47%> (?)

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

Files Coverage Δ
src/core/public/http/http_service.mock.ts 100.00% <100.00%> (ø)
src/core/public/http/http_service.ts 88.23% <100.00%> (+3.61%) ⬆️
src/core/utils/constants.ts 100.00% <100.00%> (ø)
src/core/utils/workspace.ts 100.00% <100.00%> (ø)
src/plugins/workspace/common/constants.ts 100.00% <100.00%> (ø)
...ts/workspace_fatal_error/workspace_fatal_error.tsx 100.00% <100.00%> (ø)
.../plugins/workspace/public/workspace_client.mock.ts 100.00% <100.00%> (ø)
src/core/public/http/base_path.ts 95.83% <93.75%> (+7.59%) ⬆️
src/plugins/workspace/public/plugin.ts 73.07% <75.00%> (ø)
src/plugins/workspace/public/workspace_client.ts 71.92% <71.92%> (ø)

... and 757 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
src/core/public/utils/workspace.ts Outdated Show resolved Hide resolved
src/core/public/utils/workspace.ts Outdated Show resolved Hide resolved
src/plugins/workspace/public/plugin.test.ts Outdated Show resolved Hide resolved
src/plugins/workspace/public/plugin.test.ts Outdated Show resolved Hide resolved
src/plugins/workspace/public/plugin.test.ts Outdated Show resolved Hide resolved
src/plugins/workspace/server/plugin.ts Show resolved Hide resolved
src/plugins/workspace/public/workspace_client.ts Outdated Show resolved Hide resolved
src/plugins/workspace/public/workspace_client.ts Outdated Show resolved Hide resolved
src/plugins/workspace/public/workspace_client.ts Outdated Show resolved Hide resolved
src/plugins/workspace/public/workspace_client.ts Outdated Show resolved Hide resolved
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
services: { application, http },
} = useOpenSearchDashboards();
const goBackToHome = () => {
window.location.href = formatUrlWithWorkspaceId(
Copy link
Owner

Choose a reason for hiding this comment

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

Nit, just another thought, instead of calling formatUrlWithWorkspaceId, perhaps we can refactor getUrlForApp like this:

getUrlForApp: (appId, {path, absolute = false, withoutWorkspace = false}) => ...

Copy link
Collaborator Author

@SuZhou-Joe SuZhou-Joe Oct 12, 2023

Choose a reason for hiding this comment

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

Actually I do not know if we should do that as I think getUrlForApp is a method to handle path without knowing basePath, though under the hood it uses bathPath.prepend to format url.

Copy link
Owner

Choose a reason for hiding this comment

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

I see, that makes sense

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
@SuZhou-Joe SuZhou-Joe merged commit 43e91fa into ruanyl:workspace-pr-integr Oct 12, 2023
34 checks passed
@opensearch-workspace-development

The backport to workspace 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-workspace workspace
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-workspace
# Create a new branch
git switch --create backport/backport-212-to-workspace
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 43e91faec7ab11131207f598668b073f727ef073
# Push it to GitHub
git push --set-upstream origin backport/backport-212-to-workspace
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-workspace

Then, create a pull request where the base branch is workspace and the compare/head branch is backport/backport-212-to-workspace.

SuZhou-Joe added a commit that referenced this pull request Oct 16, 2023
)

* [Workspace]Add workspace id in basePath (#212)

* feat: enable workspace id in basePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless test object id

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update snapshot

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move formatUrlWithWorkspaceId to core/public/utils

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update comment

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add space under license

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
(cherry picked from commit 43e91fa)

* feat: some sync

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: modify import path

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
wanglam pushed a commit that referenced this pull request Feb 26, 2024
* feat: enable workspace id in basePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless test object id

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update snapshot

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move formatUrlWithWorkspaceId to core/public/utils

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update comment

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add space under license

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
ruanyl pushed a commit that referenced this pull request Mar 15, 2024
* [Workspace]Add workspace id in basePath (#212)

* feat: enable workspace id in basePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless test object id

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update snapshot

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move formatUrlWithWorkspaceId to core/public/utils

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update comment

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add space under license

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add CHANGELOG

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add feature flag check

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: make the pr smaller

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize with a more strict check

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test error

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add a unit test case

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: better merge

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: rename the workspaceBasePath to clientBasePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: snapshot

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: rename withoutWorkspace to withoutClientBasePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* Revert "feat: add feature flag check"

This reverts commit 64b3645.

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* Revert "fix: unit test error"

This reverts commit 80bed72.

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize comment and test cases description

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize comment

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
SuZhou-Joe added a commit that referenced this pull request Mar 18, 2024
* feat: enable workspace id in basePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless test object id

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update snapshot

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move formatUrlWithWorkspaceId to core/public/utils

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update comment

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add space under license

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
ruanyl pushed a commit that referenced this pull request Apr 16, 2024
…pensearch-project#6422)

* [Workspace]Add workspace id in basePath (#212)

* feat: enable workspace id in basePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless test object id

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update snapshot

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move formatUrlWithWorkspaceId to core/public/utils

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless variable

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: move workspace/utils to core

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update comment

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: update unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimization

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add space under license

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add CHANGELOG

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add feature flag check

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: make the pr smaller

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize with a more strict check

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: unit test error

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: remove useless code

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: add a unit test case

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: better merge

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: rename the workspaceBasePath to clientBasePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* fix: snapshot

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: rename withoutWorkspace to withoutClientBasePath

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* Revert "feat: add feature flag check"

This reverts commit 64b3645.

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* Revert "fix: unit test error"

This reverts commit 80bed72.

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize comment and test cases description

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize comment

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
(cherry picked from commit 3073926)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[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