mirror of
https://github.com/quay/quay.git
synced 2026-01-26 06:21:37 +03:00
[redhat-3.16] fix(ui): add user status labels to organizations table (PROJQUAY-9656) (#4475)
fix(ui): add user status labels to organizations table (PROJQUAY-9656) Signed-off-by: Brady Pratt <bpratt@redhat.com> Co-authored-by: Brady Pratt <bpratt@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
e697b59475
commit
675b2c7afa
@@ -242,4 +242,30 @@ describe('Org List Page', () => {
|
||||
// The quota should be displayed as "10.0 GiB / 50.0 GiB" format
|
||||
cy.get('td[data-label="Size"]').first().should('not.contain.text', '—');
|
||||
});
|
||||
|
||||
it('Superuser displays user status labels', () => {
|
||||
// Mock config with superuser features enabled
|
||||
cy.fixture('config.json').then((config) => {
|
||||
config.features.SUPER_USERS = true;
|
||||
config.features.SUPERUSERS_FULL_ACCESS = true;
|
||||
cy.intercept('GET', '/config', config).as('getConfig');
|
||||
});
|
||||
|
||||
// Mock superuser
|
||||
cy.fixture('superuser.json').then((user) => {
|
||||
cy.intercept('GET', '/api/v1/user/', user).as('getSuperUser');
|
||||
});
|
||||
|
||||
cy.visit('/organization');
|
||||
cy.wait('@getConfig');
|
||||
cy.wait('@getSuperUser');
|
||||
|
||||
cy.get('#orgslist-search-input').type('user1');
|
||||
|
||||
cy.contains('a', 'user1')
|
||||
.parents('tr')
|
||||
.within(() => {
|
||||
cy.contains('Superuser').should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Td} from '@patternfly/react-table';
|
||||
import {Skeleton, Flex, FlexItem} from '@patternfly/react-core';
|
||||
import {Skeleton, Flex, FlexItem, Label} from '@patternfly/react-core';
|
||||
import './css/Organizations.scss';
|
||||
import {Link} from 'react-router-dom';
|
||||
import {fetchOrg} from 'src/resources/OrganizationResource';
|
||||
@@ -126,24 +126,49 @@ export default function OrgTableData(props: OrgTableDataProps) {
|
||||
return (
|
||||
<>
|
||||
<Td dataLabel={ColumnNames.name}>
|
||||
<Flex alignItems={{default: 'alignItemsCenter'}}>
|
||||
{/* Show avatar for organizations OR current user */}
|
||||
{((props.isUser &&
|
||||
currentUser?.username === props.name &&
|
||||
currentUser?.avatar) ||
|
||||
(!props.isUser && organization?.avatar)) && (
|
||||
<FlexItem spacer={{default: 'spacerSm'}}>
|
||||
<Avatar
|
||||
avatar={
|
||||
props.isUser ? currentUser?.avatar : organization?.avatar
|
||||
}
|
||||
size="sm"
|
||||
/>
|
||||
<Flex
|
||||
alignItems={{default: 'alignItemsCenter'}}
|
||||
justifyContent={{default: 'justifyContentSpaceBetween'}}
|
||||
>
|
||||
<Flex alignItems={{default: 'alignItemsCenter'}}>
|
||||
{/* Show avatar for organizations OR current user */}
|
||||
{((props.isUser &&
|
||||
currentUser?.username === props.name &&
|
||||
currentUser?.avatar) ||
|
||||
(!props.isUser && organization?.avatar)) && (
|
||||
<FlexItem spacer={{default: 'spacerSm'}}>
|
||||
<Avatar
|
||||
avatar={
|
||||
props.isUser ? currentUser?.avatar : organization?.avatar
|
||||
}
|
||||
size="sm"
|
||||
/>
|
||||
</FlexItem>
|
||||
)}
|
||||
<FlexItem>
|
||||
<Link to={props.name}>{props.name}</Link>
|
||||
</FlexItem>
|
||||
</Flex>
|
||||
{/* Show status labels for users (right-aligned, superuser only) */}
|
||||
{isSuperUser && props.isUser && (
|
||||
<Flex spaceItems={{default: 'spaceItemsXs'}}>
|
||||
{currentUser?.username === props.name && (
|
||||
<FlexItem>
|
||||
<Label color="green">You</Label>
|
||||
</FlexItem>
|
||||
)}
|
||||
{props.userSuperuser && (
|
||||
<FlexItem>
|
||||
<Label color="blue">Superuser</Label>
|
||||
</FlexItem>
|
||||
)}
|
||||
{props.userEnabled === false && (
|
||||
<FlexItem>
|
||||
<Label>Disabled</Label>
|
||||
</FlexItem>
|
||||
)}
|
||||
</Flex>
|
||||
)}
|
||||
<FlexItem>
|
||||
<Link to={props.name}>{props.name}</Link>
|
||||
</FlexItem>
|
||||
</Flex>
|
||||
</Td>
|
||||
{isSuperUser && config?.features?.MAILING && (
|
||||
|
||||
Reference in New Issue
Block a user