-
Notifications
You must be signed in to change notification settings - Fork 885
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 APIs to support plugin state in request #6303
[Workspace] Add APIs to support plugin state in request #6303
Conversation
…#312) * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6303 +/- ##
=======================================
Coverage 67.50% 67.51%
=======================================
Files 3376 3377 +1
Lines 65830 65836 +6
Branches 10648 10648
=======================================
+ Hits 44441 44449 +8
+ Misses 18803 18802 -1
+ Partials 2586 2585 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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 would you mind to update the PR description a bit to include how will |
Sure, updated. |
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
*/ | ||
export const updateWorkspaceState = ( | ||
request: OpenSearchDashboardsRequest, | ||
payload: Partial<WorkspaceState> |
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.
looks like workspacestate only has one field which is optional, is it necessary to specify partial?
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.
I think yes because actually the function just spread all the property into the request.app, which means user can pass in partial of the WorkspaceState
to update the state.
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
LGTM, looking forward to the actual consumption of the updated API |
…roject#6303) * feat: add APIs to support plugin state in request (opensearch-project#312) * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update CHANGELOG Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: use request app to store request workspace id Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: remove useless if Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
…roject#6303) * feat: add APIs to support plugin state in request (opensearch-project#312) * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update CHANGELOG Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: use request app to store request workspace id Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: remove useless if Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
…roject#6303) (#315) * feat: add APIs to support plugin state in request (#312) * feat: add APIs to support plugin state in request * feat: add APIs to support plugin state in request --------- * feat: update CHANGELOG * feat: update * feat: use request app to store request workspace id * feat: remove useless if --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
* feat: add APIs to support plugin state in request (#312) * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update CHANGELOG Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: use request app to store request workspace id Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: remove useless if Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> (cherry picked from commit fc3fef2) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* feat: add APIs to support plugin state in request (#312) * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: add APIs to support plugin state in request Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update CHANGELOG Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: update Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: use request app to store request workspace id Signed-off-by: SuZhou-Joe <suzhou@amazon.com> * feat: remove useless if Signed-off-by: SuZhou-Joe <suzhou@amazon.com> --------- Signed-off-by: SuZhou-Joe <suzhou@amazon.com> (cherry picked from commit fc3fef2) 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>
Description
Workspace need to store its workspace id throughout the whole request lifecycle but for now
OpensearchDashboardsRequest
only provides readonly interfaces. In order to add some states into the request without any impact on the response header or the connection between OSD and opensearch cluster, workspace will leverage theapp
interface in the raw request.How will the functions be used in workspace:
updateWorkspaceState
: https://github.com/ruanyl/OpenSearch-Dashboards/pull/293/files#diff-5462d700cd760de03fd73de704ceaf51a9f6a519df36429a3b384a21d4f9b68bR56 . workspace will parse the workspaceId from the real request and add the workspace id into workspaceState, which under the hood addrequestWorkspaceId
into rawRequest.app.getWorkspaceState
: https://github.com/ruanyl/OpenSearch-Dashboards/pull/293/files#diff-4ca4e52d5f1dbb92bcdb3694cd11e6f902fa3acadda1ab0f2e7045a0cd9e573dR25 In a wrapper of saved objects client, workspace will detect if there is requestWorkspaceId inside workspace state and try to append the workspace into the params accordingly.Issues Resolved
partial resolve #6130
Screenshot
Testing the changes
This PR only introduces a function to mutate the
request.app.requestWorkspaceId
field and has already been covered by unit test. Will have a following PR to consume such function and we can test in that PR.Check List
yarn test:jest
yarn test:jest_integration