-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [UIE-8138] - add new no assigned roles component (#11401)
- Loading branch information
1 parent
c8fa6b3
commit 456b923
Showing
10 changed files
with
170 additions
and
7 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-11401-upcoming-features-1733923108694.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Add new no assigned roles component for iam ([#11401](https://github.com/linode/manager/pull/11401)) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
packages/manager/src/features/IAM/Shared/NoAssignedRoles/NoAssignedRoles.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
||
import { | ||
NO_ASSIGNED_RESOURCES_TEXT, | ||
NO_ASSIGNED_ROLES_TEXT, | ||
} from '../constants'; | ||
import { NoAssignedRoles } from './NoAssignedRoles'; | ||
|
||
describe('NoAssignedRoles', () => { | ||
it('renders with correct text for the Assigned Roles tab', () => { | ||
const { getByText } = renderWithTheme( | ||
<NoAssignedRoles text={NO_ASSIGNED_ROLES_TEXT} /> | ||
); | ||
expect(getByText(NO_ASSIGNED_ROLES_TEXT)).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders with correct text for the Assigned Resources tab', () => { | ||
const { getByText } = renderWithTheme( | ||
<NoAssignedRoles text={NO_ASSIGNED_RESOURCES_TEXT} /> | ||
); | ||
expect(getByText(NO_ASSIGNED_RESOURCES_TEXT)).toBeInTheDocument(); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
packages/manager/src/features/IAM/Shared/NoAssignedRoles/NoAssignedRoles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Paper, Stack, Typography } from '@linode/ui'; | ||
import React from 'react'; | ||
|
||
import EmptyNotificationIcon from 'src/assets/icons/emptynotification.svg'; | ||
|
||
interface Props { | ||
text: string; | ||
} | ||
|
||
export const NoAssignedRoles = (props: Props) => { | ||
const { text } = props; | ||
|
||
return ( | ||
<Paper variant="outlined"> | ||
<Stack alignItems="center" paddingY={10} spacing={2}> | ||
<EmptyNotificationIcon /> | ||
<Typography sx={{ marginTop: 1 }}>{text}</Typography> | ||
</Stack> | ||
</Paper> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/manager/src/features/IAM/Users/UserResources/UserResources.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Paper, Stack, Typography } from '@linode/ui'; | ||
import { isEmpty } from 'ramda'; | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import { DocumentTitleSegment } from 'src/components/DocumentTitle'; | ||
|
||
import { NO_ASSIGNED_RESOURCES_TEXT } from '../../Shared/constants'; | ||
import { NoAssignedRoles } from '../../Shared/NoAssignedRoles/NoAssignedRoles'; | ||
|
||
import type { IamUserPermissions } from '@linode/api-v4'; | ||
|
||
interface Props { | ||
assignedRoles?: IamUserPermissions; | ||
} | ||
|
||
export const UserResources = ({ assignedRoles }: Props) => { | ||
const { username } = useParams<{ username: string }>(); | ||
|
||
const hasAssignedRoles = assignedRoles ? !isEmpty(assignedRoles) : false; | ||
|
||
return ( | ||
<> | ||
<DocumentTitleSegment segment={`${username} - User Resources`} /> | ||
<Paper> | ||
<Stack spacing={3}> | ||
<Typography variant="h2">Assigned Resources</Typography> | ||
{hasAssignedRoles ? ( | ||
<p>UIE-8139 - RBAC-5: User Roles - Resources Table</p> | ||
) : ( | ||
<NoAssignedRoles text={NO_ASSIGNED_RESOURCES_TEXT} /> | ||
)} | ||
</Stack> | ||
</Paper> | ||
</> | ||
); | ||
}; |
50 changes: 50 additions & 0 deletions
50
packages/manager/src/features/IAM/Users/UserRoles/UserRoles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Button, Paper, Stack, Typography } from '@linode/ui'; | ||
import { isEmpty } from 'ramda'; | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import { DocumentTitleSegment } from 'src/components/DocumentTitle'; | ||
|
||
import { NO_ASSIGNED_ROLES_TEXT } from '../../Shared/constants'; | ||
import { NoAssignedRoles } from '../../Shared/NoAssignedRoles/NoAssignedRoles'; | ||
|
||
import type { IamUserPermissions } from '@linode/api-v4'; | ||
|
||
interface Props { | ||
assignedRoles?: IamUserPermissions; | ||
} | ||
|
||
export const UserRoles = ({ assignedRoles }: Props) => { | ||
const { username } = useParams<{ username: string }>(); | ||
|
||
const handleClick = () => { | ||
// mock for UIE-8140: RBAC-4: User Roles - Assign New Role | ||
}; | ||
|
||
const hasAssignedRoles = assignedRoles ? !isEmpty(assignedRoles) : false; | ||
|
||
return ( | ||
<> | ||
<DocumentTitleSegment segment={`${username} - User Roles`} /> | ||
<Paper> | ||
<Stack spacing={3}> | ||
<Stack | ||
alignItems="center" | ||
direction="row" | ||
justifyContent="space-between" | ||
> | ||
<Typography variant="h2">Assigned Roles</Typography> | ||
<Button buttonType="primary" onClick={handleClick}> | ||
Assign New Role | ||
</Button> | ||
</Stack> | ||
{hasAssignedRoles ? ( | ||
<p>UIE-8138 - assigned roles table</p> | ||
) : ( | ||
<NoAssignedRoles text={NO_ASSIGNED_ROLES_TEXT} /> | ||
)} | ||
</Stack> | ||
</Paper> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters