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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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.77%. Comparing base (5829303) to head (f435d49).

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.77%   60.77%   -0.01%     
==========================================
  Files        3798     3798              
  Lines       90695    90699       +4     
  Branches    14279    14281       +2     
==========================================
+ Hits        55121    55123       +2     
  Misses      32075    32075              
- Partials     3499     3501       +2     
Flag Coverage Δ
Linux_1 29.05% <ø> (ø)
Linux_2 56.39% <ø> (ø)
Linux_3 37.64% <ø> (ø)
Linux_4 29.82% <50.00%> (+<0.01%) ⬆️
Windows_1 29.07% <ø> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.64% <ø> (+<0.01%) ⬆️
Windows_4 29.82% <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.

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.

1 participant