1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

feat: handle owners and project roles in the UI (#8315)

This commit uses the now-included project owner and role information
to populate the owner/role section. If you have no roles, we'll tell
you that you don't instead of displaying an empty set of badges.
This commit is contained in:
Thomas Heartman 2024-10-02 09:37:02 +02:00 committed by GitHub
parent f47ae12263
commit 6936da7403
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 9 deletions

View File

@ -163,10 +163,12 @@ export const MyProjects: FC<{
</SpacedGridItem> </SpacedGridItem>
<SpacedGridItem item lg={4} md={1} /> <SpacedGridItem item lg={4} md={1} />
<SpacedGridItem item lg={8} md={1}> <SpacedGridItem item lg={8} md={1}>
{activeProject ? ( {personalDashboardProjectDetails ? (
<RoleAndOwnerInfo <RoleAndOwnerInfo
roles={['owner', 'custom']} roles={personalDashboardProjectDetails.roles.map(
owners={[{ ownerType: 'system' }]} (role) => role.name,
)}
owners={personalDashboardProjectDetails.owners}
/> />
) : null} ) : null}
</SpacedGridItem> </SpacedGridItem>

View File

@ -25,12 +25,18 @@ export const RoleAndOwnerInfo = ({ roles, owners }: Props) => {
return ( return (
<Wrapper> <Wrapper>
<InfoSection> <InfoSection>
{roles.length > 0 ? (
<>
<span>Your roles in this project:</span> <span>Your roles in this project:</span>
{roles.map((role) => ( {roles.map((role) => (
<Badge key={role} color='secondary'> <Badge key={role} color='secondary'>
{role} {role}
</Badge> </Badge>
))} ))}
</>
) : (
<span>You have no project roles in this project.</span>
)}
</InfoSection> </InfoSection>
<InfoSection> <InfoSection>
<span>Project owner{owners.length > 1 ? 's' : ''}</span> <span>Project owner{owners.length > 1 ? 's' : ''}</span>