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] Disable select data source panel for non dashboard admin in workspace create/edit page #7213

Merged
merged 13 commits into from
Jul 16, 2024

Conversation

raintygao
Copy link
Contributor

@raintygao raintygao commented Jul 10, 2024

Description

Hide select data source panel for non dashboard admin or when data source is disabled in workspace create/edit page

Screenshot

image
image
Non OSD admin

image
image
OSD admin

Testing the changes

Dashboard admin and data source is enabled
Set username in opensearchDashboards.dashboardAdmin.users and data_source.enabled: true in YML, then go to workspace create page or edit page, you will see select data source panel

Non Dashboard admin
Set other username in opensearchDashboards.dashboardAdmin.users in YML(If you don't set a value you will still be treated as dashboard admin), then go to workspace create page or edit page, you won't see select data source panel.

Data source disabled
Set data_source.enabled: false in YML, then go to workspace create page or edit page, you won't see select data source panel.

Changelog

  • feat: Hide select data source panel for non dashboard admin or when data source is disabled in workspace

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 Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.62%. Comparing base (9893ce1) to head (67bfab1).
Report is 329 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7213      +/-   ##
==========================================
- Coverage   67.62%   67.62%   -0.01%     
==========================================
  Files        3471     3471              
  Lines       68613    68615       +2     
  Branches    11165    11167       +2     
==========================================
  Hits        46399    46399              
- Misses      19510    19511       +1     
- Partials     2704     2705       +1     
Flag Coverage Δ
Linux_1 33.27% <100.00%> (+<0.01%) ⬆️
Linux_2 55.30% <ø> (ø)
Linux_3 45.26% <ø> (-0.02%) ⬇️
Linux_4 34.69% <ø> (ø)
Windows_1 33.29% <100.00%> (+<0.01%) ⬆️
Windows_2 55.25% <ø> (ø)
Windows_3 45.27% <ø> (ø)
Windows_4 34.69% <ø> (ø)

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.

ruanyl
ruanyl previously approved these changes Jul 10, 2024
Copy link
Member

@ruanyl ruanyl left a comment

Choose a reason for hiding this comment

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

Approved with minor comments

opensearch-changeset-bot bot added a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Jul 10, 2024
ruanyl
ruanyl previously approved these changes Jul 10, 2024
raintygao and others added 12 commits July 16, 2024 13:21
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
…ce_form.test.tsx

Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
…ce_form.tsx

Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
@raintygao raintygao dismissed stale reviews from ruanyl and SuZhou-Joe via afa1753 July 16, 2024 05:44
@SuZhou-Joe SuZhou-Joe merged commit 662ee41 into opensearch-project:main Jul 16, 2024
70 of 71 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x 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-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7213-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 662ee4102539a2714090e18fe01486ee0f833420
# Push it to GitHub
git push --set-upstream origin backport/backport-7213-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7213-to-2.x.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 16, 2024
…in workspace create/edit page (#7213)

* only enable select data source panel for dashboard admin

Signed-off-by: tygao <tygao@amazon.com>

* test: update create and update tests setup

Signed-off-by: tygao <tygao@amazon.com>

* Changeset file for PR #7213 created/updated

* test: update workspace create test case

Signed-off-by: tygao <tygao@amazon.com>

* Changeset file for PR #7213 created/updated

* Update src/plugins/workspace/public/components/workspace_form/workspace_form.test.tsx

Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>

* Update src/plugins/workspace/public/components/workspace_form/workspace_form.tsx

Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>

* Update changelogs/fragments/7213.yml

Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>

* add data source judge

Signed-off-by: tygao <tygao@amazon.com>

* update plugin configuration

Signed-off-by: tygao <tygao@amazon.com>

* update with form change

Signed-off-by: tygao <tygao@amazon.com>

* update tests with form change

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Co-authored-by: Yulong Ruan <ruanyl@amazon.com>
(cherry picked from commit 662ee41)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Jul 17, 2024
…in workspace create/edit page (#7213) (#7259)

* only enable select data source panel for dashboard admin



* test: update create and update tests setup



* Changeset file for PR #7213 created/updated

* test: update workspace create test case



* Changeset file for PR #7213 created/updated

* Update src/plugins/workspace/public/components/workspace_form/workspace_form.test.tsx




* Update src/plugins/workspace/public/components/workspace_form/workspace_form.tsx




* Update changelogs/fragments/7213.yml




* add data source judge



* update plugin configuration



* update with form change



* update tests with form change



---------






(cherry picked from commit 662ee41)

Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Tianyu Gao <tygao@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: Yulong Ruan <ruanyu1@gmail.com>
Co-authored-by: Yulong Ruan <ruanyl@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.

4 participants