Skip to content

Commit

Permalink
[Workspace] Hide delete button for non OSD admin (#7987)
Browse files Browse the repository at this point in the history
* Hide workspace delete button for non OSD admin

Signed-off-by: Kapian1234 <[email protected]>

* hide delete action instead of disabled

Signed-off-by: Kapian1234 <[email protected]>

* Changeset file for PR #7987 created/updated

---------

Signed-off-by: Kapian1234 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 7e8612f commit 84d5de3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7987.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Hide delete button for non OSD admin ([#7987](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7987))
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,25 @@ export const WorkspaceDetail = (props: WorkspaceDetailProps) => {
setMountPoint={application.setAppDescriptionControls}
/>
)}
<HeaderControl
controls={[
{
run: () => setDeletedWorkspace(currentWorkspace),
color: 'danger',
iconType: 'trash',
ariaLabel: i18n.translate('workspace.detail.delete.button', {
defaultMessage: 'Delete',
}),
testId: 'workspace-detail-delete-button',
controlType: 'icon',
display: 'base',
} as TopNavControlIconData,
]}
setMountPoint={application.setAppRightControls}
/>
{isDashboardAdmin && (
<HeaderControl
controls={[
{
run: () => setDeletedWorkspace(currentWorkspace),
color: 'danger',
iconType: 'trash',
ariaLabel: i18n.translate('workspace.detail.delete.button', {
defaultMessage: 'Delete',
}),
testId: 'workspace-detail-delete-button',
controlType: 'icon',
display: 'base',
} as TopNavControlIconData,
]}
setMountPoint={application.setAppRightControls}
/>
)}

<EuiPageContent>
<WorkspaceDetailPanel
useCaseUrl={useCaseUrl}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ export const WorkspaceList = ({ registeredUseCases$ }: WorkspaceListProps) => {
type: 'button',
description: 'Delete workspace',
'data-test-subj': 'workspace-list-delete-icon',
available: () => isDashboardAdmin,
render: (item: WorkspaceAttribute) => {
return (
<EuiButtonEmpty
Expand Down

0 comments on commit 84d5de3

Please sign in to comment.