From 36dff40df782cb5cd7b5264f03ade7d5fcc0ed1e Mon Sep 17 00:00:00 2001 From: Harish Govindarajulu Date: Tue, 25 Nov 2025 19:37:21 +0530 Subject: [PATCH] fix(ui): show quota consumed column for all users in organizations list (PROJQUAY-9850) (#4634) Co-authored-by: Claude --- web/cypress/e2e/org-list.cy.ts | 68 +++++++++++++++++++ .../OrganizationsList/OrganizationsList.tsx | 3 +- .../OrganizationsListTableData.tsx | 48 +++++++------ 3 files changed, 92 insertions(+), 27 deletions(-) diff --git a/web/cypress/e2e/org-list.cy.ts b/web/cypress/e2e/org-list.cy.ts index ddb57a3d4..4ce118c5f 100644 --- a/web/cypress/e2e/org-list.cy.ts +++ b/web/cypress/e2e/org-list.cy.ts @@ -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) => { diff --git a/web/src/routes/OrganizationsList/OrganizationsList.tsx b/web/src/routes/OrganizationsList/OrganizationsList.tsx index fca556627..8e9f3fc83 100644 --- a/web/src/routes/OrganizationsList/OrganizationsList.tsx +++ b/web/src/routes/OrganizationsList/OrganizationsList.tsx @@ -533,8 +533,7 @@ export default function OrganizationsList() { {ColumnNames.membersCount} {ColumnNames.robotsCount} {ColumnNames.lastModified} - {isSuperUser && - quayConfig?.features?.QUOTA_MANAGEMENT && + {quayConfig?.features?.QUOTA_MANAGEMENT && quayConfig?.features?.EDIT_QUOTA && {ColumnNames.size}} {isSuperUser && !isReadOnlySuperUser && ( {ColumnNames.options} diff --git a/web/src/routes/OrganizationsList/OrganizationsListTableData.tsx b/web/src/routes/OrganizationsList/OrganizationsListTableData.tsx index 3ad766b7c..a656e2d0e 100644 --- a/web/src/routes/OrganizationsList/OrganizationsListTableData.tsx +++ b/web/src/routes/OrganizationsList/OrganizationsListTableData.tsx @@ -186,32 +186,30 @@ export default function OrgTableData(props: OrgTableDataProps) { lastModifiedDate={lastModifiedDate} > - {isSuperUser && - config?.features?.QUOTA_MANAGEMENT && - config?.features?.EDIT_QUOTA && ( - - {props.isUser ? ( - props.quota_report ? ( - renderQuotaConsumed(props.quota_report, { - showPercentage: true, - showTotal: true, - showBackfill: true, - }) - ) : ( - - ) + {config?.features?.QUOTA_MANAGEMENT && config?.features?.EDIT_QUOTA && ( + + {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, - }, - ) - )} - - )} + + ) + ) : ( + renderQuotaConsumed( + props.quota_report || organization?.quota_report, + { + showPercentage: true, + showTotal: true, + showBackfill: true, + }, + ) + )} + + )} {isSuperUser && (