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] Handle data sources and advanced settings as global object. #6524

Merged

Conversation

SuZhou-Joe
Copy link
Member

@SuZhou-Joe SuZhou-Joe commented Apr 18, 2024

Description

This PR handles data sources and advanced settings specially to make global objects will be correctly handled inside workspace.

For 2.14:

  • Always list data sources from global.
  • Prevent data sources being created inside workspace.
  • Prevent data sources being imported inside workspace.

For the long future:

  • Prevent advanced settings being created inside workspace.
  • Prevent advanced settings being imported inside workspace.

For the visualizations and dashboards that rely on the data sources, when importing, the reference id won't be regenerated per https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/server/saved_objects/import/regenerate_ids.ts#L41. So if users import visualizations along with data sources into a workspace, only the visualizations will be imported and it will try to reference a should-existing global data source.

Issues Resolved

closes #6523

Screenshot

Import data source

image

Testing the changes

  • Change the yml file to enable workspace and data sources.
workspace.enabled: true
data_source.enabled: true
  • Goes to advanced settings page, which will create an advanced settings objects automatically.
  • Goes to saved objects management page, export all the objects
  • Create a workspace
  • Enter the workspace
  • Goes to the saved objects management page inside the workspace
  • Import objects
  • There should be a error beside advanced settings saying the object can not be created inside workspace.

Changelog

  • feat: [Workspace] Handle data sources and advanced settings as global object.

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

…ch-project#313)

* feat: POC implementation

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

* feat: add some comment

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

* feat: revert dependency

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

* feat: update comment

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

* feat: address one TODO

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

* feat: address TODO

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

* feat: add unit test

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

* feat: some special logic on specific operation

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

* feat: add integration test

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

* feat: declare workspaces as empty array for advanced settings

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

* feat: unified workspaces parameters when parsing from router

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

* feat: improve code coverage

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

* feat: declare workspaces as null

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

* feat: use unified types

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

* feat: update comment

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

* feat: remove null

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

* feat: address comments

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

* feat: use request app to store request workspace id

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

* feat: use app state to store request workspace id

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

* feat: remove workspaces when listing data sources

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

* feat: remove useless code change

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

* feat: throw error if the type is not allowed

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

* feat: add unit test

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

* feat: add integration test

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

* feat: change the implementation

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

* feat: remove useless change

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

* feat: remove useless change

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: add error message

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

* fix: integration test

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

* fix: integration test

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

* feat: remove useless change

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

* feat: add test case and add restrict on create method

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

* feat: change type

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

* feat: change comment

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

* feat: optimize test

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

* refactor: move logic to conflict check wrapper

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

* feat: remove useless change

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

* fix: unit test

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

* fix: unit test

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

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
SuZhou-Joe and others added 2 commits April 18, 2024 13:46
Co-authored-by: Lu Yu <nluyu@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>
@BionIT BionIT merged commit da88296 into opensearch-project:main Apr 19, 2024
65 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 23, 2024
…t. (#6524)

* Handle data sources and advanced settings as global object. (#313)

* feat: POC implementation

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

* feat: add some comment

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

* feat: revert dependency

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

* feat: update comment

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

* feat: address one TODO

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

* feat: address TODO

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

* feat: add unit test

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

* feat: some special logic on specific operation

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

* feat: add integration test

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

* feat: declare workspaces as empty array for advanced settings

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

* feat: unified workspaces parameters when parsing from router

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

* feat: improve code coverage

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

* feat: declare workspaces as null

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

* feat: use unified types

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

* feat: update comment

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

* feat: remove null

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

* feat: address comments

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

* feat: use request app to store request workspace id

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

* feat: use app state to store request workspace id

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

* feat: remove workspaces when listing data sources

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

* feat: remove useless code change

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

* feat: throw error if the type is not allowed

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

* feat: add unit test

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

* feat: add integration test

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

* feat: change the implementation

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

* feat: remove useless change

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

* feat: remove useless change

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: add error message

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

* fix: integration test

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

* fix: integration test

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

* feat: remove useless change

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

* feat: add test case and add restrict on create method

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

* feat: change type

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

* feat: change comment

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

* feat: optimize test

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

* refactor: move logic to conflict check wrapper

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

* feat: remove useless change

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

* fix: unit test

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

* fix: unit test

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

---------

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

* Changeset file for PR #6524 created/updated

* Apply suggestions from code review

Co-authored-by: Lu Yu <nluyu@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize based on comment

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

* feat: remove useless default value

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

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Lu Yu <nluyu@amazon.com>
(cherry picked from commit da88296)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Apr 23, 2024
…t. (#6524) (#6611)

* Handle data sources and advanced settings as global object. (#313)

* feat: POC implementation



* feat: add some comment



* feat: revert dependency



* feat: update comment



* feat: address one TODO



* feat: address TODO



* feat: add unit test



* feat: some special logic on specific operation



* feat: add integration test



* feat: declare workspaces as empty array for advanced settings



* feat: unified workspaces parameters when parsing from router



* feat: improve code coverage



* feat: declare workspaces as null



* feat: use unified types



* feat: update comment



* feat: remove null



* feat: address comments



* feat: use request app to store request workspace id



* feat: use app state to store request workspace id



* feat: remove workspaces when listing data sources



* feat: remove useless code change



* feat: throw error if the type is not allowed



* feat: add unit test



* feat: add integration test



* feat: change the implementation



* feat: remove useless change



* feat: remove useless change



* feat: add integration test



* fix: unit test



* feat: add error message



* fix: integration test



* fix: integration test



* feat: remove useless change



* feat: add test case and add restrict on create method



* feat: change type



* feat: change comment



* feat: optimize test



* refactor: move logic to conflict check wrapper



* feat: remove useless change



* fix: unit test



* fix: unit test



---------



* Changeset file for PR #6524 created/updated

* Apply suggestions from code review




* feat: optimize based on comment



* feat: remove useless default value



---------




(cherry picked from commit da88296)

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
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>
Co-authored-by: Lu Yu <nluyu@amazon.com>
LDrago27 pushed a commit to LDrago27/OpenSearch-Dashboards that referenced this pull request Jun 3, 2024
…t. (opensearch-project#6524)

* Handle data sources and advanced settings as global object. (opensearch-project#313)

* feat: POC implementation

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

* feat: add some comment

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

* feat: revert dependency

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

* feat: update comment

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

* feat: address one TODO

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

* feat: address TODO

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

* feat: add unit test

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

* feat: some special logic on specific operation

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

* feat: add integration test

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

* feat: declare workspaces as empty array for advanced settings

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

* feat: unified workspaces parameters when parsing from router

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

* feat: improve code coverage

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

* feat: declare workspaces as null

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

* feat: use unified types

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

* feat: update comment

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

* feat: remove null

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

* feat: address comments

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

* feat: use request app to store request workspace id

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

* feat: use app state to store request workspace id

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

* feat: remove workspaces when listing data sources

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

* feat: remove useless code change

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

* feat: throw error if the type is not allowed

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

* feat: add unit test

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

* feat: add integration test

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

* feat: change the implementation

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

* feat: remove useless change

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

* feat: remove useless change

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: add error message

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

* fix: integration test

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

* fix: integration test

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

* feat: remove useless change

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

* feat: add test case and add restrict on create method

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

* feat: change type

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

* feat: change comment

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

* feat: optimize test

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

* refactor: move logic to conflict check wrapper

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

* feat: remove useless change

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

* fix: unit test

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

* fix: unit test

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

---------

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

* Changeset file for PR opensearch-project#6524 created/updated

* Apply suggestions from code review

Co-authored-by: Lu Yu <nluyu@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* feat: optimize based on comment

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

* feat: remove useless default value

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

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Lu Yu <nluyu@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.

[Workspace] global objects should be handled specially within workspace
4 participants