diff --git a/clients/ui/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalog/modelCatalog.cy.ts b/clients/ui/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalog/modelCatalog.cy.ts index d04b853869..6452e8e358 100644 --- a/clients/ui/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalog/modelCatalog.cy.ts +++ b/clients/ui/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalog/modelCatalog.cy.ts @@ -485,6 +485,66 @@ describe('Performance Empty State', () => { }); }); + describe('Single Category Empty State Actions', () => { + it('should show single-category title and description when performance empty state is displayed', () => { + initIntercepts({ + sources: [mockCatalogSource({ labels: ['Provider one'] })], + hasValidatedModels: false, + }); + setupFilteredModelsIntercept({ returnModelsForFilters: false }); + modelCatalog.visit(); + + modelCatalog.togglePerformanceView(); + modelCatalog.findPerformanceEmptyState().should('be.visible'); + + modelCatalog + .findPerformanceEmptyState() + .should('contain.text', 'No performance data available.') + .and('not.contain.text', 'in selected category'); + + modelCatalog + .findPerformanceEmptyState() + .should( + 'contain.text', + 'No models have performance data available. Turn off model performance view to see all models.', + ); + }); + + it('should not show "View all models with performance data" button when single category', () => { + initIntercepts({ + sources: [mockCatalogSource({ labels: ['Provider one'] })], + hasValidatedModels: false, + }); + setupFilteredModelsIntercept({ returnModelsForFilters: false }); + modelCatalog.visit(); + + modelCatalog.togglePerformanceView(); + modelCatalog.findPerformanceEmptyState().should('be.visible'); + + modelCatalog + .findPerformanceEmptyState() + .contains('button', /View all models with performance data/i) + .should('not.exist'); + }); + + it('should turn off toggle when clicking "Turn off model performance view" in single category', () => { + initIntercepts({ + sources: [mockCatalogSource({ labels: ['Provider one'] })], + hasValidatedModels: false, + }); + setupFilteredModelsIntercept({ returnModelsForFilters: false }); + modelCatalog.visit(); + + modelCatalog.togglePerformanceView(); + modelCatalog.findPerformanceEmptyState().should('be.visible'); + + modelCatalog.findSetPerformanceOffLink().click(); + + modelCatalog.findPerformanceViewToggleValue().should('not.be.checked'); + modelCatalog.findModelCatalogCards().should('have.length.at.least', 1); + }); + }); + it('should work correctly when toggling performance view', () => { initIntercepts({ sources: mockProviderAndCustomSources(), diff --git a/clients/ui/frontend/src/app/pages/modelCatalog/screens/ModelCatalogGalleryView.tsx b/clients/ui/frontend/src/app/pages/modelCatalog/screens/ModelCatalogGalleryView.tsx index ac616fe0f5..e852234836 100644 --- a/clients/ui/frontend/src/app/pages/modelCatalog/screens/ModelCatalogGalleryView.tsx +++ b/clients/ui/frontend/src/app/pages/modelCatalog/screens/ModelCatalogGalleryView.tsx @@ -220,25 +220,35 @@ const ModelCatalogGalleryView: React.FC = ({ return ( - No models in the{' '} - - {selectedSourceLabel === 'null' - ? CategoryName.otherModels - : generateCategoryName(selectedSourceLabel || '')} - {' '} - category have performance data. Select another model category, or turn off model - performance view to see models in the selected category. - + isSingleCategory ? ( + 'No models have performance data available. Turn off model performance view to see all models.' + ) : ( + <> + No models in the{' '} + + {selectedSourceLabel === 'null' + ? CategoryName.otherModels + : generateCategoryName(selectedSourceLabel || '')} + {' '} + category have performance data. Select another model category, or turn off model + performance view to see models in the selected category. + + ) } primaryAction={ - + isSingleCategory ? undefined : ( + + ) } secondaryAction={