diff --git a/changelogs/fragments/7987.yml b/changelogs/fragments/7987.yml new file mode 100644 index 000000000000..0b67c17de12d --- /dev/null +++ b/changelogs/fragments/7987.yml @@ -0,0 +1,2 @@ +fix: +- Hide delete button for non OSD admin ([#7987](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7987)) \ No newline at end of file diff --git a/src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx b/src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx index 952a3d7b0148..11c72960ef59 100644 --- a/src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx +++ b/src/plugins/workspace/public/components/workspace_detail/workspace_detail.tsx @@ -168,22 +168,25 @@ export const WorkspaceDetail = (props: WorkspaceDetailProps) => { setMountPoint={application.setAppDescriptionControls} /> )} - 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 && ( + 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} + /> + )} + { type: 'button', description: 'Delete workspace', 'data-test-subj': 'workspace-list-delete-icon', + available: () => isDashboardAdmin, render: (item: WorkspaceAttribute) => { return (