Skip to content

Commit

Permalink
[Worksapce] Hide delete button for non osd admins in workspace list (#…
Browse files Browse the repository at this point in the history
…8315)

* hide delete_workspace button for non osd admins in workspace list

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Changeset file for PR #8315 created/updated

* Disable selection of workspaces for non osd admins

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

---------

Signed-off-by: Kapian1234 <wanjinch@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 09bd013 commit 8fb8fed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8315.yml
Original file line number Diff line number Diff line change
@@ -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))
28 changes: 15 additions & 13 deletions src/plugins/workspace/public/components/workspace_list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,19 @@ export const WorkspaceListInner = ({
};

return (
<>
<EuiButton color="danger" iconType="trash" onClick={onClick}>
Delete {selection.length} Workspace
</EuiButton>
{deletedWorkspaces && deletedWorkspaces.length > 0 && (
<DeleteWorkspaceModal
selectedWorkspaces={deletedWorkspaces}
onClose={() => setDeletedWorkspaces([])}
/>
)}
</>
isDashboardAdmin && (
<>
<EuiButton color="danger" iconType="trash" onClick={onClick}>
Delete {selection.length} Workspace
</EuiButton>
{deletedWorkspaces && deletedWorkspaces.length > 0 && (
<DeleteWorkspaceModal
selectedWorkspaces={deletedWorkspaces}
onClose={() => setDeletedWorkspaces([])}
/>
)}
</>
)
);
};

Expand Down Expand Up @@ -601,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}
/>
);

Expand Down

0 comments on commit 8fb8fed

Please sign in to comment.