Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,25 +220,35 @@ const ModelCatalogGalleryView: React.FC<ModelCatalogPageProps> = ({
return (
<EmptyModelCatalogState
testid="performance-empty-state"
title="No performance data available in selected category"
title={
isSingleCategory
? 'No performance data available.'
: 'No performance data available in selected category'
}
headerIcon={ChartBarIcon}
variant={EmptyStateVariant.lg}
description={
<>
No models in the{' '}
<strong>
{selectedSourceLabel === 'null'
? CategoryName.otherModels
: generateCategoryName(selectedSourceLabel || '')}
</strong>{' '}
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{' '}
<strong>
{selectedSourceLabel === 'null'
? CategoryName.otherModels
: generateCategoryName(selectedSourceLabel || '')}
</strong>{' '}
category have performance data. Select another model category, or turn off model
performance view to see models in the selected category.
</>
)
}
primaryAction={
<Button variant="primary" onClick={handleSelectAllModels}>
View all models with performance data
</Button>
isSingleCategory ? undefined : (
<Button variant="primary" onClick={handleSelectAllModels}>
View all models with performance data
</Button>
)
}
secondaryAction={
<Button variant="link" onClick={handleDisablePerformanceView}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Button,
Content,
Flex,
FlexItem,
Stack,
StackItem,
Toolbar,
Expand Down Expand Up @@ -193,12 +194,11 @@ const ModelCatalogSourceLabelSelector: React.FC<ModelCatalogSourceLabelSelectorP
</>
)}
<StackItem>
<Flex
justifyContent={{ default: 'justifyContentSpaceBetween' }}
alignItems={{ default: 'alignItemsCenter' }}
>
<Flex alignItems={{ default: 'alignItemsCenter' }}>
<ModelCatalogSourceLabelBlocks />
<ModelCatalogSortDropdown performanceViewEnabled={performanceViewEnabled} />
<FlexItem align={{ default: 'alignRight' }}>
<ModelCatalogSortDropdown performanceViewEnabled={performanceViewEnabled} />
</FlexItem>
</Flex>
</StackItem>
{shouldShowAlert && (
Expand Down
Loading