-
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] Add duplicate saved objects API #6288
Conversation
Signed-off-by: gaobinlong <[email protected]>
Signed-off-by: gaobinlong <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6288 +/- ##
==========================================
+ Coverage 55.58% 55.62% +0.03%
==========================================
Files 1199 1199
Lines 24259 24259
Branches 4087 4087
==========================================
+ Hits 13485 13493 +8
+ Misses 10133 10124 -9
- Partials 641 642 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Can we add docs for the new API changes? Als can we document the existing API as a part of this change?
I'm glad to do that, and how could we add documents for the server apis? |
Here are all the Readme's in the repo that document various features. https://opensearch-project.github.io/OpenSearch-Dashboards/docs/index.html#/. I think adding it to the main saved object plugin readme should be good enough. https://opensearch-project.github.io/OpenSearch-Dashboards/docs/index.html#/../src/plugins/saved_objects/README |
Signed-off-by: gaobinlong <[email protected]>
I've added the documentation for all saved objects API, the format refers to OpenSearch API's document, please help to take a look, thanks! |
Signed-off-by: gaobinlong <[email protected]>
Thanks @bandinib-amzn , I think all of your comments above have been addressed yet, please take a look at the latest change, thank you! For why we add this new API, firstly, the loaded data on the page are not complete, we need to fetch all the details of the references before creating them in the target workspace, secondly, instead of call export API and then import API, this new API makes it easier for users to duplicate saved objects when they just call the server APIs to complete their work, I saw many users asked about how to call the OSD's API in OpenSearch's forum, so I think this new API may reduce the complexity when they need. |
Signed-off-by: gaobinlong <[email protected]>
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.
LGTM
src/plugins/workspace/server/integration_tests/duplicate.test.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: gaobinlong <[email protected]>
Signed-off-by: gaobinlong <[email protected]>
Signed-off-by: gaobinlong <[email protected]>
Signed-off-by: gaobinlong <[email protected]>
* Add copy saved objects API Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Add documents for all saved objects APIs Signed-off-by: gaobinlong <[email protected]> * Revert the yml file change Signed-off-by: gaobinlong <[email protected]> * Move the duplicate api to workspace plugin Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Modify api doc Signed-off-by: gaobinlong <[email protected]> * Check target workspace exists or not Signed-off-by: gaobinlong <[email protected]> * Remove unused import Signed-off-by: gaobinlong <[email protected]> * Fix test failure Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Modify workspace doc Signed-off-by: gaobinlong <[email protected]> * Add more unit tests Signed-off-by: gaobinlong <[email protected]> * Some minor change Signed-off-by: gaobinlong <[email protected]> * Fix test failure Signed-off-by: gaobinlong <[email protected]> * Modify test description Signed-off-by: gaobinlong <[email protected]> * Optimize test description Signed-off-by: gaobinlong <[email protected]> * Modify test case Signed-off-by: gaobinlong <[email protected]> * Minor change Signed-off-by: gaobinlong <[email protected]> --------- Signed-off-by: gaobinlong <[email protected]>
…#326) * Add copy saved objects API * Modify change log * Add documents for all saved objects APIs * Revert the yml file change * Move the duplicate api to workspace plugin * Modify change log * Modify api doc * Check target workspace exists or not * Remove unused import * Fix test failure * Modify change log * Modify workspace doc * Add more unit tests * Some minor change * Fix test failure * Modify test description * Optimize test description * Modify test case * Minor change --------- Signed-off-by: gaobinlong <[email protected]>
* Add copy saved objects API Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Add documents for all saved objects APIs Signed-off-by: gaobinlong <[email protected]> * Revert the yml file change Signed-off-by: gaobinlong <[email protected]> * Move the duplicate api to workspace plugin Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Modify api doc Signed-off-by: gaobinlong <[email protected]> * Check target workspace exists or not Signed-off-by: gaobinlong <[email protected]> * Remove unused import Signed-off-by: gaobinlong <[email protected]> * Fix test failure Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Modify workspace doc Signed-off-by: gaobinlong <[email protected]> * Add more unit tests Signed-off-by: gaobinlong <[email protected]> * Some minor change Signed-off-by: gaobinlong <[email protected]> * Fix test failure Signed-off-by: gaobinlong <[email protected]> * Modify test description Signed-off-by: gaobinlong <[email protected]> * Optimize test description Signed-off-by: gaobinlong <[email protected]> * Modify test case Signed-off-by: gaobinlong <[email protected]> * Minor change Signed-off-by: gaobinlong <[email protected]> --------- Signed-off-by: gaobinlong <[email protected]> (cherry picked from commit 7eda01a) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* Add copy saved objects API Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Add documents for all saved objects APIs Signed-off-by: gaobinlong <[email protected]> * Revert the yml file change Signed-off-by: gaobinlong <[email protected]> * Move the duplicate api to workspace plugin Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Modify api doc Signed-off-by: gaobinlong <[email protected]> * Check target workspace exists or not Signed-off-by: gaobinlong <[email protected]> * Remove unused import Signed-off-by: gaobinlong <[email protected]> * Fix test failure Signed-off-by: gaobinlong <[email protected]> * Modify change log Signed-off-by: gaobinlong <[email protected]> * Modify workspace doc Signed-off-by: gaobinlong <[email protected]> * Add more unit tests Signed-off-by: gaobinlong <[email protected]> * Some minor change Signed-off-by: gaobinlong <[email protected]> * Fix test failure Signed-off-by: gaobinlong <[email protected]> * Modify test description Signed-off-by: gaobinlong <[email protected]> * Optimize test description Signed-off-by: gaobinlong <[email protected]> * Modify test case Signed-off-by: gaobinlong <[email protected]> * Minor change Signed-off-by: gaobinlong <[email protected]> --------- Signed-off-by: gaobinlong <[email protected]> (cherry picked from commit 7eda01a) 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
This PR adds a new server api named
duplicate_saved_objects
which can be used to duplicate saved objects among workspaces, the implementation is simple, we leverage the code of the existing export api and import api to implement this functionality. In addition, same to export api and import api, the duplicate api will also be under the control of the settingsavedObjects.maxImportExportSize
(defaults to 10000) andsavedObjects.maxImportPayloadBytes
(defaults to 26214400).For this new api, the usage is:
Request:
Response:
Issues Resolved
#6286
Screenshot
No UI change in this PR, the UI change will be in the following PR, here is the video about it:
2024-04-07.10.55.45.mov
Testing the changes
config/opensearch_dashboards.yml
, addworkspace.enabled: true
yarn start --no-base-path
Check List
yarn test:jest
yarn test:jest_integration