Skip to content

Commit

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

* hide delete action instead of disabled

* Changeset file for PR #7987 created/updated

---------

(cherry picked from commit 84d5de3)





(cherry picked from commit a49876b)

Signed-off-by: Kapian1234 <[email protected]>
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>
  • Loading branch information
3 people authored Sep 6, 2024
1 parent 0134eb6 commit e35f80e
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 @@ -168,22 +168,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 e35f80e

Please sign in to comment.