Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Worksapce] Hide delete button for non osd admins in workspace list #8315

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
};

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([])}

Check warning on line 328 in src/plugins/workspace/public/components/workspace_list/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/workspace/public/components/workspace_list/index.tsx#L328

Added line #L328 was not covered by tests
/>
)}
</>
)
);
Comment on lines +320 to 333
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we hide the checkbox as well? the only action user can take for multiple select is batch delete, if we hide the delete button and keep multi select, that looks a little wired user can't do anything after select.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

};

Expand Down Expand Up @@ -601,9 +603,9 @@
direction: initialSortDirection,
},
}}
isSelectable={selectable}
isSelectable={selectable && !!isDashboardAdmin}
search={searchable ? search : undefined}
selection={selectable ? selectionValue : undefined}
selection={selectable && !!isDashboardAdmin ? selectionValue : undefined}
/>
);

Expand Down
Loading