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]Fix flights sample data copy in workspace assets page #8786

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Nov 1, 2024

Description

This PR fixes an issue where the flights sample data failed to copy to other workspaces due to missing index patterns in the workspace assets page. The root cause of this issue was that the index under the import sample data saved object's search source filter metadata was not regenerated with the data source ID and workspace ID. The visualization migration function adds used index patterns from the imported sample data saved object's search source. After that, when we call the duplicate saved objects API to copy assets, it returns a missing_references error, and the assets are not copied.
To address this issue, we need to add index pattern ID regeneration logic in the import sample data util.

Screenshot

No UI changes

Testing the changes

  • Clone branch code and run yarn osd bootstrap --single-version loose
  • Add below configs in config/opensearch_dashboards.yml
savedObjects.permission.enabled: true
workspace.enabled: true
uiSettings:
  overrides:
    'home:useNewHomePage': true
  • Run yarn start --no-base-path
  • Login with admin user
  • Create a observability workspace named test1
  • Create a observability workspace named test2
  • Visit sample data page inside workspace test2
  • Click "Add data" inside flights sample data card
  • Visit workspace assets page
  • Click the checkbox on the left of "[Flights] Delay Buckets"
  • Click "Copy to ..." and select "test1" as target workspace
  • Click "Copy" button, the selected assets should be copied
  • Visit assets page inside test1 workspace
  • The "[Flights] Delay Buckets" should be exists

Changelog

  • fix: [Workspace]Fix flights sample data copy in workspace assets page

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 60.78%. Comparing base (4f6b287) to head (90bb3ea).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...home/server/services/sample_data/data_sets/util.ts 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8786      +/-   ##
==========================================
- Coverage   60.78%   60.78%   -0.01%     
==========================================
  Files        3798     3798              
  Lines       90701    90705       +4     
  Branches    14284    14286       +2     
==========================================
  Hits        55136    55136              
- Misses      32065    32067       +2     
- Partials     3500     3502       +2     
Flag Coverage Δ
Linux_1 29.05% <ø> (ø)
Linux_2 56.39% <ø> (ø)
Linux_3 37.65% <ø> (-0.01%) ⬇️
Linux_4 29.83% <50.00%> (+<0.01%) ⬆️
Windows_1 29.06% <ø> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.65% <ø> (ø)
Windows_4 29.83% <50.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SuZhou-Joe SuZhou-Joe merged commit af4943d into opensearch-project:main Nov 7, 2024
68 of 71 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 7, 2024
* Fix workspace id missing in sample data filter meta index

Signed-off-by: Lin Wang <[email protected]>

* Changeset file for PR #8786 created/updated

---------

Signed-off-by: Lin Wang <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit af4943d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Hailong-am pushed a commit that referenced this pull request Nov 8, 2024
…) (#8825)

* Fix workspace id missing in sample data filter meta index



* Changeset file for PR #8786 created/updated

---------



(cherry picked from commit af4943d)

Signed-off-by: Lin Wang <[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>
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.

3 participants