OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[Workspace]Import sample data to current workspace

Open wanglam opened this issue 11 months ago β€’ 15 comments

Description

For now, the import sample data page is a sub page under home application. The home application is not visible inside specific workspace. This PR separate import sample data page and register it as a new standalone application. Then import sample data page can be used inside workspace. This PR added a new entry point for import sample data in workspace overview page. User can visit import sample data page by this link quickly.

Issues Resolved

#6106

Screenshot

image

image

image

The sample data can be imported to specific workspace.

Testing the changes

Since switch workspace by manually wasn't support in current main branch. We need to apply some patch to testing all the changes.

  1. Checkout the branch code and run yarn osd bootstrap
  2. enable workspace and start OSD server
  • add workspace.enabled: true and savedObjects.permission.enabled: true to the config/opensearch_dashboards.yml to enable workspace feature flag
  • run yarn start --no-base-path start OSD server to make sure no random base path will be appended
  1. Navigate to workspace creator page and create a test workspace

  2. Click left dropdown switch to created workspace image

  3. Click "Discover pre-loaded datasets before adding your own." to visit workspace's Add sample data page image

  4. Click all Add data button, all sample data will be imported like below image

image There will be four dashboards in current workspace.

  1. Click View data to view imported dashboard like below image image

  2. Create another workspace, and visit another workspace's add sample data page like step 4 & 5. image

The sample data was not import in the new workspace.

  1. Switch back to the first workspace, click remove button, the sample data will be removed like below image image image The [Flights] Global Flight Dashboard will be removed in this workspace like above image.

Changelog

  • feat: [Workspace]Import sample data to current workspace

Check List

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

wanglam avatar Mar 11 '24 09:03 wanglam

Codecov Report

Attention: Patch coverage is 83.90805% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 67.37%. Comparing base (54b5eb5) to head (9a2bd3e).

Files Patch % Lines
src/plugins/home/public/plugin.ts 16.66% 10 Missing :warning:
...home/server/services/sample_data/data_sets/util.ts 95.23% 0 Missing and 2 partials :warning:
.../services/sample_data/data_sets/ecommerce/index.ts 0.00% 1 Missing :warning:
...erver/services/sample_data/data_sets/logs/index.ts 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6105      +/-   ##
==========================================
- Coverage   67.55%   67.37%   -0.19%     
==========================================
  Files        3428     3443      +15     
  Lines       67344    67762     +418     
  Branches    10996    11024      +28     
==========================================
+ Hits        45497    45653     +156     
- Misses      19177    19439     +262     
  Partials     2670     2670              
Flag Coverage Ξ”
Linux_1 33.04% <7.69%> (-0.01%) :arrow_down:
Linux_2 55.13% <ΓΈ> (ΓΈ)
Linux_3 45.15% <7.69%> (-0.01%) :arrow_down:
Linux_4 34.81% <83.90%> (+0.08%) :arrow_up:
Windows_1 33.06% <7.69%> (-0.01%) :arrow_down:
Windows_2 55.10% <ΓΈ> (ΓΈ)
Windows_3 45.16% <7.69%> (-0.02%) :arrow_down:
Windows_4 34.81% <83.90%> (+0.08%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 11 '24 09:03 codecov[bot]

❌ Invalid Changelog Heading

The '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Changelog Heading

The '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Changelog Heading

The '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Changelog Heading

The '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Changelog Heading

The '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Changeset File Must Not Exist With Skip Entry

Changeset file 6105.yml under folder changelogs/fragments must not exist if ##Changelog section in PR description includes a "skip" entry option. Please remove the changeset file and try again.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Changeset File Must Not Exist With Skip Entry

Changeset file 6105.yml under folder changelogs/fragments must not exist if ##Changelog section in PR description includes a "skip" entry option. Please remove the changeset file and try again.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "[Workspace]Import sample data to current workspace". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.

github-actions[bot] avatar May 08 '24 07:05 github-actions[bot]

Is it workspace.enabled: true? maybe you need to update your test steps in above

add workspace.enabled=true to the config/opensearch_dashboards.yml to enable workspace feature flag

Flyingliuhub avatar May 16 '24 16:05 Flyingliuhub

@wanglam do you have a chance to verify the all different cases for import sample data. And how to work with MDS to add sample data too

  1. user1 not link to any workspace, does user1 see the workspace sample indices from users who link to workspace and created sample indices?
  2. user2 create workspace and import sample data, does user2 can see the user1's sample data
  3. user3 create workspace and import sample data, and add user2 to user3's works space, does user2 can see user3's imported sample data? I tried to assign other users to the created workspace, but cannot find where to add, do you have any introduction for assign user to workspace?

Thanks

Flyingliuhub avatar May 16 '24 18:05 Flyingliuhub

@wanglam do you have a chance to verify the all different cases for import sample data. And how to work with MDS to add sample data too

  1. user1 not link to any workspace, does user1 see the workspace sample indices from users who link to workspace and created sample indices?
  2. user2 create workspace and import sample data, does user2 can see the user1's sample data
  3. user3 create workspace and import sample data, and add user2 to user3's works space, does user2 can see user3's imported sample data? I tried to assign other users to the created workspace, but cannot find where to add, do you have any introduction for assign user to workspace?

Thanks

Sure. I think these three cases would work fine. I will test them. For add user to created workspace, you can follow the test steps of this PR. First of all we need to add savedObjects.permission.enabled: true to the config/opensearch_dashboards.yml file. Then the permission tab will be exists in the workspace create / update form.

For update existing workspace, we can go to the workspace list page. Then click the pencil icon, we will navigate to the workspace update page. Click the Users & Permissions tab in the workspace update page, and then we can add new user to workspace by clicking "Add new" button under Users section like below image: image

wanglam avatar May 17 '24 15:05 wanglam

@wanglam do you have a chance to verify the all different cases for import sample data. And how to work with MDS to add sample data too

  1. user1 not link to any workspace, does user1 see the workspace sample indices from users who link to workspace and created sample indices?
  2. user2 create workspace and import sample data, does user2 can see the user1's sample data
  3. user3 create workspace and import sample data, and add user2 to user3's works space, does user2 can see user3's imported sample data? I tried to assign other users to the created workspace, but cannot find where to add, do you have any introduction for assign user to workspace?

Thanks

Hi @Flyingliuhub , I've tested these three scenarios in my local. Here are all the findings: First of all, for all imported saved objects to specific workspace can be found in Dashboards Management -> Saved Objects list. So for import sample data to workspace, it means these data can be displayed in the dashboards and visualizations list.

  • For scenario 1, since all imported sample data share the same data index. The user1 can see the imported data indices whatever imported from workspace or out of workspace
  • For scenario 2, user2 won't see user1 imported sample saved objects includes index patterns, visualizations and dashboards if user1 and user2 not in the same workspace. user2 can't see user1's workspace.
  • For scenario 3, user3 will see user2 imported sample saved objects after user2 be assigned to the same workspace.

wanglam avatar May 21 '24 13:05 wanglam