Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

IAM RBAC: Add a 'Not Found' state for tabs if the user doesn't exist ([#12094](https://github.com/linode/manager/pull/12094))
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useAccountUser } from '@linode/queries';
import { CircleProgress, ErrorState, Stack } from '@linode/ui';
import React from 'react';
import { useParams } from 'react-router-dom';

import { DocumentTitleSegment } from 'src/components/DocumentTitle';
import { NotFound } from 'src/components/NotFound';
import { useAccountUser } from '@linode/queries';
import { useAccountUserPermissions } from 'src/queries/iam/iam';

import { DeleteUserPanel } from './DeleteUserPanel';
Expand Down Expand Up @@ -33,7 +33,10 @@ export const UserProfile = () => {
return (
<>
<DocumentTitleSegment segment={`${username} - Profile`} />
<Stack spacing={2} sx={(theme) => ({ marginTop: theme.spacing(2) })}>
<Stack
spacing={2}
sx={(theme) => ({ marginTop: theme.tokens.spacing.S16 })}
>
<UserDetailsPanel assignedRoles={assignedRoles} user={user} />
<UsernamePanel user={user} />
<UserEmailPanel user={user} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { CircleProgress, Paper, Stack, Typography } from '@linode/ui';
import { useAccountUser } from '@linode/queries';
import {
CircleProgress,
ErrorState,
Paper,
Stack,
Typography,
} from '@linode/ui';
import { isEmpty } from 'ramda';
import React from 'react';
import { useParams } from 'react-router-dom';
Expand All @@ -15,6 +22,7 @@ export const UserEntities = () => {
const { data: assignedRoles, isLoading } = useAccountUserPermissions(
username ?? ''
);
const { error } = useAccountUser(username ?? '');

const hasAssignedRoles = assignedRoles
? !isEmpty(assignedRoles.entity_access)
Expand All @@ -24,6 +32,10 @@ export const UserEntities = () => {
return <CircleProgress />;
}

if (error) {
return <ErrorState errorText={error[0].reason} />;
}

return (
<>
<DocumentTitleSegment segment={`${username} - User Entities`} />
Expand Down
16 changes: 15 additions & 1 deletion packages/manager/src/features/IAM/Users/UserRoles/UserRoles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Button, CircleProgress, Paper, Stack, Typography } from '@linode/ui';
import { useAccountUser } from '@linode/queries';
import {
Button,
CircleProgress,
ErrorState,
Paper,
Stack,
Typography,
} from '@linode/ui';
import { isEmpty } from 'ramda';
import React from 'react';
import { useParams } from 'react-router-dom';
Expand All @@ -17,6 +25,8 @@ export const UserRoles = () => {
const { data: assignedRoles, isLoading } = useAccountUserPermissions(
username ?? ''
);
const { error } = useAccountUser(username ?? '');

const [isDrawerOpen, setIsDrawerOpen] = React.useState<boolean>(false);

const hasAssignedRoles = assignedRoles
Expand All @@ -28,6 +38,10 @@ export const UserRoles = () => {
return <CircleProgress />;
}

if (error) {
return <ErrorState errorText={error[0].reason} />;
}

return (
<>
<DocumentTitleSegment segment={`${username} - User Roles`} />
Expand Down