-
Notifications
You must be signed in to change notification settings - Fork 916
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] Fix: optimization on handling invalid workspace id in workspace_ui_settings wrapper #6669
[Workspace] Fix: optimization on handling invalid workspace id in workspace_ui_settings wrapper #6669
Conversation
Signed-off-by: SuZhou-Joe <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6669 +/- ##
=======================================
Coverage 67.79% 67.79%
=======================================
Files 3413 3413
Lines 66755 66760 +5
Branches 10861 10863 +2
=======================================
+ Hits 45254 45258 +4
Misses 18857 18857
- Partials 2644 2645 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/plugins/workspace/server/saved_objects/workspace_ui_settings_client_wrapper.ts
Outdated
Show resolved
Hide resolved
src/plugins/workspace/server/saved_objects/workspace_ui_settings_client_wrapper.ts
Show resolved
Hide resolved
…gs_client_wrapper.ts Co-authored-by: Yulong Ruan <[email protected]> Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
configObject.attributes = { | ||
...configObject.attributes, | ||
...(workspaceObject ? workspaceObject.attributes.uiSettings : {}), | ||
}; | ||
|
||
configObject.attributes = { |
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.
Seems the configObject.attributes
has already been set above. Why we need to assign it again?
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.
You are right, remove the useless assign.
Signed-off-by: SuZhou-Joe <[email protected]>
…kspace_ui_settings wrapper (#6669) * fix: invalid workspace id Signed-off-by: SuZhou-Joe <[email protected]> * Changeset file for PR #6669 created/updated * Update src/plugins/workspace/server/saved_objects/workspace_ui_settings_client_wrapper.ts Co-authored-by: Yulong Ruan <[email protected]> Signed-off-by: SuZhou-Joe <[email protected]> * feat: update error message Signed-off-by: SuZhou-Joe <[email protected]> * fix: type error Signed-off-by: SuZhou-Joe <[email protected]> * feat: remove useless code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[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 29a09b0) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…kspace_ui_settings wrapper (#6669) (#6672) * fix: invalid workspace id * Changeset file for PR #6669 created/updated * Update src/plugins/workspace/server/saved_objects/workspace_ui_settings_client_wrapper.ts * feat: update error message * fix: type error * feat: remove useless code --------- (cherry picked from commit 29a09b0) Signed-off-by: SuZhou-Joe <[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]>
…kspace_ui_settings wrapper (opensearch-project#6669) * fix: invalid workspace id Signed-off-by: SuZhou-Joe <[email protected]> * Changeset file for PR opensearch-project#6669 created/updated * Update src/plugins/workspace/server/saved_objects/workspace_ui_settings_client_wrapper.ts Co-authored-by: Yulong Ruan <[email protected]> Signed-off-by: SuZhou-Joe <[email protected]> * feat: update error message Signed-off-by: SuZhou-Joe <[email protected]> * fix: type error Signed-off-by: SuZhou-Joe <[email protected]> * feat: remove useless code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[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]>
Description
A new wrapper, workspace_ui_settings, has been introduced by workspace plugin. When a user attempts to access an invalid workspace, OSD will display plain JSON instead of a user-friendly web page. This PR primarily addresses the issue by adding a
try catch
wrapper to theclient.get
method.Issues Resolved
Screenshot
Before fix
After fix
As well as an error log in OSD:
Testing the changes
http://localhost:5601/w/123/app/workspace_overview
Saved object [workspace/123] not found
should be found.Changelog
Check List
yarn test:jest
yarn test:jest_integration