From a2750cb55296d72d06a2977cf9c1f4d4cc959af7 Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Tue, 24 Sep 2024 17:12:54 +0800 Subject: [PATCH 1/3] hide delete_workspace button for non osd admins in workspace list Signed-off-by: Kapian1234 --- .../components/workspace_list/index.tsx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_list/index.tsx b/src/plugins/workspace/public/components/workspace_list/index.tsx index 8366c240cca..d92df0c5045 100644 --- a/src/plugins/workspace/public/components/workspace_list/index.tsx +++ b/src/plugins/workspace/public/components/workspace_list/index.tsx @@ -317,17 +317,19 @@ export const WorkspaceListInner = ({ }; return ( - <> - - Delete {selection.length} Workspace - - {deletedWorkspaces && deletedWorkspaces.length > 0 && ( - setDeletedWorkspaces([])} - /> - )} - + isDashboardAdmin && ( + <> + + Delete {selection.length} Workspace + + {deletedWorkspaces && deletedWorkspaces.length > 0 && ( + setDeletedWorkspaces([])} + /> + )} + + ) ); }; From c720b15ff814e5fa5db7eb0d61b3d17550e52ad5 Mon Sep 17 00:00:00 2001 From: "opensearch-changeset-bot[bot]" <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 09:14:53 +0000 Subject: [PATCH 2/3] Changeset file for PR #8315 created/updated --- changelogs/fragments/8315.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/8315.yml diff --git a/changelogs/fragments/8315.yml b/changelogs/fragments/8315.yml new file mode 100644 index 00000000000..77f37040873 --- /dev/null +++ b/changelogs/fragments/8315.yml @@ -0,0 +1,2 @@ +fix: +- Hide delete button for non osd admins in workspace list ([#8315](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8315)) \ No newline at end of file From 2437438a7e18aafb0ac01f3ad43228c8217e8f45 Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Wed, 25 Sep 2024 17:30:21 +0800 Subject: [PATCH 3/3] Disable selection of workspaces for non osd admins Signed-off-by: Kapian1234 --- .../workspace/public/components/workspace_list/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_list/index.tsx b/src/plugins/workspace/public/components/workspace_list/index.tsx index d92df0c5045..68b4e2acc88 100644 --- a/src/plugins/workspace/public/components/workspace_list/index.tsx +++ b/src/plugins/workspace/public/components/workspace_list/index.tsx @@ -603,9 +603,9 @@ export const WorkspaceListInner = ({ direction: initialSortDirection, }, }} - isSelectable={selectable} + isSelectable={selectable && !!isDashboardAdmin} search={searchable ? search : undefined} - selection={selectable ? selectionValue : undefined} + selection={selectable && !!isDashboardAdmin ? selectionValue : undefined} /> );