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 optional workspaces parameter to all saved objects API #185

Merged
merged 17 commits into from
Sep 28, 2023

Conversation

gaobinlong
Copy link
Collaborator

@gaobinlong gaobinlong commented Sep 20, 2023

Description

The main change of this PR are:

  1. Add workspaces field to the mappings of the OSD index(.kibana)
  2. Add optional workspaces parameter to all the saved objects API
  3. Update some test snapshot because of the above change.

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: gaobinlong <gbinlong@amazon.com>
@gaobinlong gaobinlong changed the title [Workspace] Add optional workspaces parameters to all saved objects API [Workspace] Add optional workspaces parameter to all saved objects API Sep 20, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2023

Codecov Report

Merging #185 (5b0e31b) into workspace-pr-integr (d7d712e) will decrease coverage by 0.03%.
Report is 5 commits behind head on workspace-pr-integr.
The diff coverage is 67.41%.

@@                   Coverage Diff                   @@
##           workspace-pr-integr     #185      +/-   ##
=======================================================
- Coverage                66.49%   66.47%   -0.03%     
=======================================================
  Files                     3408     3408              
  Lines                    65149    65222      +73     
  Branches                 10431    10457      +26     
=======================================================
+ Hits                     43323    43355      +32     
- Misses                   19237    19344     +107     
+ Partials                  2589     2523      -66     
Flag Coverage Δ
Linux_ 66.05% <67.41%> (?)
Linux_1 ?
Linux_2 ?
Linux_3 ?
Linux_4 ?
Windows_1 ?
Windows_2 ?
Windows_3 ?
Windows_4 ?
_1 34.82% <ø> (?)
_2 55.45% <67.41%> (?)
_3 44.49% <1.12%> (?)
_4 34.82% <1.12%> (?)

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

Files Coverage Δ
.../core/public/saved_objects/saved_objects_client.ts 92.55% <ø> (ø)
...ore/server/saved_objects/import/check_conflicts.ts 100.00% <ø> (ø)
...erver/saved_objects/import/create_saved_objects.ts 100.00% <ø> (ø)
...core/server/saved_objects/import/regenerate_ids.ts 100.00% <100.00%> (ø)
...rver/saved_objects/import/resolve_import_errors.ts 96.42% <ø> (ø)
...d_objects/migrations/core/build_active_mappings.ts 87.09% <ø> (ø)
...e/server/saved_objects/serialization/serializer.ts 100.00% <100.00%> (ø)
...saved_objects/service/lib/search_dsl/search_dsl.ts 100.00% <ø> (ø)
src/core/server/saved_objects/service/lib/utils.ts 100.00% <100.00%> (ø)
...ed_objects/export/get_sorted_objects_for_export.ts 81.57% <50.00%> (-2.21%) ⬇️
... and 10 more

... and 30 files with indirect coverage changes

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

SuZhou-Joe and others added 13 commits September 22, 2023 13:52
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
…oject#189)

* feat: optimize logic when checkConflict and bulkCreate

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

* feat: add options.workspace check

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

* feat: throw error when workspace check error in repository create

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

* feat: modify judgement

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

* feat: always get objects from DB when create-with-override

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>
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/types/saved_objects.ts Show resolved Hide resolved
src/core/server/saved_objects/types.ts Show resolved Hide resolved
src/core/server/saved_objects/types.ts Show resolved Hide resolved
src/core/server/saved_objects/service/lib/utils.ts Outdated Show resolved Hide resolved
@@ -625,6 +625,27 @@ describe('#getQueryParams', () => {
]);
});
});

describe('when using workspace search', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add cases for searching multiple workspaces? We need to test the OR logic among workspaces.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can add later when we start supporting share case, currently we should only have one workspace.

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 c05b434 into ruanyl:workspace-pr-integr Sep 28, 2023
32 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-185-to-workspace
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c05b434ec10726e6e1034a97d215887372ff8c51
# Push it to GitHub
git push --set-upstream origin backport/backport-185-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-185-to-workspace.

wanglam pushed a commit that referenced this pull request Feb 26, 2024
…PI (#185)

* [Workspace] Add workspaces parameters to all saved objects API

Signed-off-by: gaobinlong <gbinlong@amazon.com>

* feat: update snapshot

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

* feat: optimize logic when checkConflict and bulkCreate (#189)

* feat: optimize logic when checkConflict and bulkCreate

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

* feat: add options.workspace check

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

* feat: throw error when workspace check error in repository create

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

* feat: modify judgement

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

* feat: always get objects from DB when create-with-override

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

---------

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

* feat: call get when create with override

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

* feat: update test according to count

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

* feat: add integration test

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

* fix: unit test

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

* feat: regenerate ids when import

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

* feat: add more unit test

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

* feat: minor changes logic on repository

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

* feat: update unit test

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

* feat: update test

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

* feat: optimization according to comments

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

* feat: update test

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

* feat: optimize code

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

---------

Signed-off-by: gaobinlong <gbinlong@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
SuZhou-Joe added a commit that referenced this pull request Mar 11, 2024
…PI (#185)

* [Workspace] Add workspaces parameters to all saved objects API

Signed-off-by: gaobinlong <gbinlong@amazon.com>

* feat: update snapshot

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

* feat: optimize logic when checkConflict and bulkCreate (#189)

* feat: optimize logic when checkConflict and bulkCreate

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

* feat: add options.workspace check

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

* feat: throw error when workspace check error in repository create

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

* feat: modify judgement

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

* feat: always get objects from DB when create-with-override

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

---------

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

* feat: call get when create with override

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

* feat: update test according to count

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

* feat: add integration test

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

* fix: unit test

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

* feat: regenerate ids when import

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

* feat: add more unit test

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

* feat: minor changes logic on repository

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

* feat: update unit test

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

* feat: update test

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

* feat: optimization according to comments

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

* feat: update test

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

* feat: optimize code

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

---------

Signed-off-by: gaobinlong <gbinlong@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
SuZhou-Joe added a commit that referenced this pull request Mar 18, 2024
…PI (#185)

* [Workspace] Add workspaces parameters to all saved objects API

Signed-off-by: gaobinlong <gbinlong@amazon.com>

* feat: update snapshot

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

* feat: optimize logic when checkConflict and bulkCreate (#189)

* feat: optimize logic when checkConflict and bulkCreate

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

* feat: add options.workspace check

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

* feat: throw error when workspace check error in repository create

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

* feat: modify judgement

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

* feat: always get objects from DB when create-with-override

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

---------

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

* feat: call get when create with override

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

* feat: update test according to count

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

* feat: add integration test

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

* fix: unit test

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

* feat: regenerate ids when import

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

* feat: add more unit test

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

* feat: minor changes logic on repository

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

* feat: update unit test

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

* feat: update test

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

* feat: optimization according to comments

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

* feat: update test

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

* feat: optimize code

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

---------

Signed-off-by: gaobinlong <gbinlong@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.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.

8 participants