Skip to content

Commit

Permalink
frontend: disable edit user button when when roles api is not enabled (
Browse files Browse the repository at this point in the history
  • Loading branch information
rikimaru0345 authored Aug 12, 2024
1 parent 3c70eac commit fb8e382
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions frontend/src/components/pages/acls/UserDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,16 @@ class UserDetailsPage extends PageComponent<{ userName: string; }> {

const isServiceAccount = api.serviceAccounts.users.includes(userName);

// If its an "inferred" user, and we can't change roles, then there's no way to edit
// - Can't change name because its an inferred user
// - Can't change roles because the API is not available
const disableEdit = !isServiceAccount && !Features.rolesApi;
let canEdit = true;
// The only thing that can be editted in a user is its roles
// If the roles api is not available, then no need for an edit button
if (!Features.rolesApi)
canEdit = false;

return <>
<PageContent>
<Flex gap="4">
<Button variant="outline" onClick={() => appGlobal.history.push(`/security/users/${userName}/edit`)} isDisabled={disableEdit}>
<Button variant="outline" onClick={() => appGlobal.history.push(`/security/users/${userName}/edit`)} isDisabled={!canEdit}>
Edit
</Button>
{/* todo: refactor delete user dialog into a "fire and forget" dialog and use it in the overview list (and here) */}
Expand Down

0 comments on commit fb8e382

Please sign in to comment.