-
Notifications
You must be signed in to change notification settings - Fork 898
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] Validate if workspace exists when setup inside a workspace #6154
[Workspace] Validate if workspace exists when setup inside a workspace #6154
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6154 +/- ##
=======================================
Coverage 67.31% 67.31%
=======================================
Files 3348 3350 +2
Lines 64966 64993 +27
Branches 10465 10468 +3
=======================================
+ Hits 43729 43752 +23
- Misses 18690 18694 +4
Partials 2547 2547
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
fbde44f
to
d54dfa2
Compare
52672e1
to
9a9c39c
Compare
application.navigateToApp(WORKSPACE_FATAL_ERROR_APP_ID, { | ||
replace: true, | ||
state: { | ||
error: result.error, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we consider to to check result.error exists before access it. like as const error = result.error || "Unknown error";
so ensures that error
always have value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the error is empty or null, we will hide the callout component to not display the detailed error message, but update to result?.error
to protect the code.
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>
cf4c84c
to
8350bef
Compare
src/plugins/workspace/public/components/workspace_fatal_error/workspace_fatal_error.tsx
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_fatal_error/workspace_fatal_error.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_fatal_error/workspace_fatal_error.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
The backport to
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-6154-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0cc91ab3ed89ed72552a29e503cab2dab324a073
# Push it to GitHub
git push --set-upstream origin backport/backport-6154-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 |
opensearch-project#6154) * feat: validate if workspace exists when setup inside a workspace Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * fix: unit test Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: optimize import order Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add protection Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * Apply suggestions from code review Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: jump to landing page Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> (cherry picked from commit 0cc91ab)
#6154) (#6444) * feat: validate if workspace exists when setup inside a workspace Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * fix: unit test Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: optimize import order Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add protection Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * Apply suggestions from code review Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: jump to landing page Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> (cherry picked from commit 0cc91ab)
Description
When user enters a url with workspaceId pattern inside url, workspace plugin should validate if the id exists, or should show an friendly error page to ask user to go back to home page without a pattern in url.
Issues Resolved
closes #6155
Screenshot
Testing the changes
workspace.enabled: true
yarn start --no-base-path
to make sure no random base path will be appendedhttp://localhost:5601/w/foo/app/dev_tools
, the page should render successfully.http://localhost:5601/w/not_existing/app/dev_tools
, should see a page with error just like the screenshot above.http://localhost:5601/w/foo/app/workspace_fatal_error
, user should be redirect tohttp://localhost:5601/w/foo/app/workspace_overview
page, though the page has not been implement yet.Check List
yarn test:jest
yarn test:jest_integration