mirror of
https://github.com/quay/quay.git
synced 2026-01-26 06:21:37 +03:00
fix(ui): show quota consumed column for all users in organizations list (PROJQUAY-9850) (#4634)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
79f75e24b6
commit
36dff40df7
@@ -252,6 +252,74 @@ describe('Org List Page', () => {
|
||||
cy.get('td[data-label="Size"]').first().should('not.contain.text', '—');
|
||||
});
|
||||
|
||||
it('Regular user displays quota consumed column', () => {
|
||||
// This test verifies that regular (non-superuser) users can see quota consumed
|
||||
// data for their organizations and user namespaces in the organizations list
|
||||
|
||||
// Mock config with quota features enabled
|
||||
cy.fixture('config.json').then((config) => {
|
||||
config.features.QUOTA_MANAGEMENT = true;
|
||||
config.features.EDIT_QUOTA = true;
|
||||
config.features.SUPER_USERS = true;
|
||||
cy.intercept('GET', '/config', config).as('getConfig');
|
||||
});
|
||||
|
||||
// Mock regular user (non-superuser)
|
||||
cy.fixture('user.json').then((user) => {
|
||||
user.super_user = false;
|
||||
user.username = 'user2';
|
||||
cy.intercept('GET', '/api/v1/user/', user).as('getUser');
|
||||
});
|
||||
|
||||
// Mock organization with quota_report
|
||||
cy.intercept('GET', '/api/v1/organization/testorg', {
|
||||
statusCode: 200,
|
||||
body: {
|
||||
name: 'testorg',
|
||||
email: 'testorg@example.com',
|
||||
teams: {owners: 'admin'},
|
||||
quota_report: {
|
||||
quota_bytes: 2279743488,
|
||||
configured_quota: 10737418240,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Mock robots/members/repositories
|
||||
cy.intercept('GET', '/api/v1/organization/*/robots', {
|
||||
statusCode: 200,
|
||||
body: {robots: []},
|
||||
});
|
||||
|
||||
cy.intercept('GET', '/api/v1/organization/*/members', {
|
||||
statusCode: 200,
|
||||
body: {members: []},
|
||||
});
|
||||
|
||||
cy.intercept('GET', '/api/v1/repository?namespace=*', {
|
||||
statusCode: 200,
|
||||
body: {repositories: []},
|
||||
});
|
||||
|
||||
cy.visit('/organization');
|
||||
cy.wait('@getConfig');
|
||||
cy.wait('@getUser');
|
||||
|
||||
// Verify the Size column header exists for regular users
|
||||
cy.contains('th', 'Size').should('exist');
|
||||
|
||||
// Verify quota data cells are visible
|
||||
cy.get('td[data-label="Size"]').should('exist');
|
||||
|
||||
// Verify that at least one organization row shows quota data
|
||||
// (testorg should show quota since we mocked it with quota_report)
|
||||
cy.contains('a', 'testorg')
|
||||
.parents('tr')
|
||||
.within(() => {
|
||||
cy.get('td[data-label="Size"]').should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
it('Superuser displays user status labels', () => {
|
||||
// Mock config with superuser features enabled
|
||||
cy.fixture('config.json').then((config) => {
|
||||
|
||||
@@ -533,8 +533,7 @@ export default function OrganizationsList() {
|
||||
<Th>{ColumnNames.membersCount}</Th>
|
||||
<Th>{ColumnNames.robotsCount}</Th>
|
||||
<Th>{ColumnNames.lastModified}</Th>
|
||||
{isSuperUser &&
|
||||
quayConfig?.features?.QUOTA_MANAGEMENT &&
|
||||
{quayConfig?.features?.QUOTA_MANAGEMENT &&
|
||||
quayConfig?.features?.EDIT_QUOTA && <Th>{ColumnNames.size}</Th>}
|
||||
{isSuperUser && !isReadOnlySuperUser && (
|
||||
<Th>{ColumnNames.options}</Th>
|
||||
|
||||
@@ -186,32 +186,30 @@ export default function OrgTableData(props: OrgTableDataProps) {
|
||||
lastModifiedDate={lastModifiedDate}
|
||||
></RepoLastModifiedDate>
|
||||
</Td>
|
||||
{isSuperUser &&
|
||||
config?.features?.QUOTA_MANAGEMENT &&
|
||||
config?.features?.EDIT_QUOTA && (
|
||||
<Td dataLabel={ColumnNames.size}>
|
||||
{props.isUser ? (
|
||||
props.quota_report ? (
|
||||
renderQuotaConsumed(props.quota_report, {
|
||||
showPercentage: true,
|
||||
showTotal: true,
|
||||
showBackfill: true,
|
||||
})
|
||||
) : (
|
||||
<span style={{color: '#888'}}>—</span>
|
||||
)
|
||||
{config?.features?.QUOTA_MANAGEMENT && config?.features?.EDIT_QUOTA && (
|
||||
<Td dataLabel={ColumnNames.size}>
|
||||
{props.isUser ? (
|
||||
props.quota_report ? (
|
||||
renderQuotaConsumed(props.quota_report, {
|
||||
showPercentage: true,
|
||||
showTotal: true,
|
||||
showBackfill: true,
|
||||
})
|
||||
) : (
|
||||
renderQuotaConsumed(
|
||||
props.quota_report || organization?.quota_report,
|
||||
{
|
||||
showPercentage: true,
|
||||
showTotal: true,
|
||||
showBackfill: true,
|
||||
},
|
||||
)
|
||||
)}
|
||||
</Td>
|
||||
)}
|
||||
<span style={{color: '#888'}}>—</span>
|
||||
)
|
||||
) : (
|
||||
renderQuotaConsumed(
|
||||
props.quota_report || organization?.quota_report,
|
||||
{
|
||||
showPercentage: true,
|
||||
showTotal: true,
|
||||
showBackfill: true,
|
||||
},
|
||||
)
|
||||
)}
|
||||
</Td>
|
||||
)}
|
||||
{isSuperUser && (
|
||||
<Td dataLabel={ColumnNames.options}>
|
||||
<OrganizationOptionsKebab
|
||||
|
||||
Reference in New Issue
Block a user