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]Hide create workspace button for non dashboard admin #7357

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Jul 22, 2024

Description

Only dashboard admin can create workspace, this PR hide create workspace entry in workspace menu and workspace list.

Issues Resolved

#7358

Screenshot

  • Workspace Menu
    image

  • Workspace list
    image

Testing the changes

  • Checkout branch code and run yarn osd bootstrap
  • Add below config to config/opensearch_dashboards.yml
workspace.enabled: true
savedObjects.permission.enabled: true
opensearchDashboards.dashboardAdmin.users: ['dashboard_admin']
uiSettings.overrides["home:useNewHomePage"]: true
  • Run yarn start --no-base-path
  • Login with admin account and click left bottom workspace picker
  • The Create workspace button should not be displayed
  • Click "view all" to workspace list page
  • The Create workspace button should not be displayed
  • Remove opensearchDashboards.dashboardAdmin.users in config/opensearch_dashboards.yml
  • Refresh workspace list page, the "Create workspace" button should be displayed
  • Click left bottom workspace picker, the "Create workspace" button should be displayed

Changelog

  • feat: [Workspace]Hide create workspace button for non dashboard admin

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

Signed-off-by: Lin Wang <wonglam@amazon.com>
Copy link
Contributor

❌ Changelog Entry Missing Hyphen

Changelog entries must begin with a hyphen (-).

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.70%. Comparing base (e64de15) to head (c04e435).
Report is 290 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7357   +/-   ##
=======================================
  Coverage   67.70%   67.70%           
=======================================
  Files        3520     3520           
  Lines       69700    69704    +4     
  Branches    11376    11378    +2     
=======================================
+ Hits        47189    47193    +4     
  Misses      19716    19716           
  Partials     2795     2795           
Flag Coverage Δ
Linux_1 33.19% <100.00%> (+<0.01%) ⬆️
Linux_2 55.46% <ø> (ø)
Linux_3 43.30% <ø> (-0.02%) ⬇️
Linux_4 34.71% <ø> (ø)
Windows_1 33.21% <100.00%> (+<0.01%) ⬆️
Windows_2 55.41% <ø> (ø)
Windows_3 43.32% <ø> (ø)
Windows_4 34.71% <ø> (ø)

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.

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Copy link
Collaborator

@virajsanghvi virajsanghvi left a comment

Choose a reason for hiding this comment

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

Change lgtm, cypress test failure seems unrelated, but please validate

@ruanyl
Copy link
Member

ruanyl commented Jul 22, 2024

The failed cypress test is unrelated, merging now.

@ruanyl ruanyl merged commit c1dd5c1 into opensearch-project:main Jul 22, 2024
72 of 73 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-7357-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c1dd5c109f01faec151990a8864fcee80d218699
# Push it to GitHub
git push --set-upstream origin backport/backport-7357-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-7357-to-2.x.

wanglam added a commit to wanglam/OpenSearch-Dashboards that referenced this pull request Jul 23, 2024
…search-project#7357)

* Hide create workspace for non dashboard admin

Signed-off-by: Lin Wang <wonglam@amazon.com>

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

* Add more cases and update snapshot

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update match rule

Signed-off-by: Lin Wang <wonglam@amazon.com>

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Jul 23, 2024
… (#7382)

* Hide create workspace for non dashboard admin



* Changeset file for PR #7357 created/updated

* Add more cases and update snapshot



* Update match rule



---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 23, 2024
… (#7382)

* Hide create workspace for non dashboard admin

* Changeset file for PR #7357 created/updated

* Add more cases and update snapshot

* Update match rule

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 1f5f461)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Jul 23, 2024
… (#7382) (#7390)

* Hide create workspace for non dashboard admin

* Changeset file for PR #7357 created/updated

* Add more cases and update snapshot

* Update match rule

---------



(cherry picked from commit 1f5f461)

Signed-off-by: Lin Wang <wonglam@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>
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