Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -272,16 +272,23 @@ describe('Model Catalog Performance Filters API Behavior', () => {

cy.findByTestId(PERFORMANCE_FILTER_TEST_IDS.hardwareTable).should('exist');

// Change a filter to ensure something is set
// Change workload type filter
changeWorkloadTypeFilter();

// Click Clear all filters button in the toolbar (PatternFly's native button)
// Apply cold start filter (applies with default max value)
modelCatalog.openColdStartLatencyFilter();
modelCatalog.applyColdStartLatencyFilter();

// Click Reset all defaults button in the toolbar
cy.findByRole('button', { name: 'Reset all defaults' }).click();

// Verify filters are reset to defaults - workload type should NOT show Code Fixing
// Verify workload type is reset - should NOT show Code Fixing
cy.findByTestId(PERFORMANCE_FILTER_TEST_IDS.workloadType)
.should('be.visible')
.and('not.contain.text', 'Code Fixing');

// Verify cold start filter is still visible and reset to default
cy.findByTestId(PERFORMANCE_FILTER_TEST_IDS.coldStartLoadTime).should('be.visible');
});

it('should reset latency filter when Reset all filters is clicked', () => {
Expand Down Expand Up @@ -321,25 +328,6 @@ describe('Model Catalog Performance Filters API Behavior', () => {
});
});

it('should NOT include cold_start_time_to_load_seconds after toggle is turned OFF', () => {
visitWithPerformanceToggle(true);

modelCatalog.openColdStartLatencyFilter();
modelCatalog.applyColdStartLatencyFilter();

modelCatalog.togglePerformanceView();
modelCatalog.findLoadingState().should('not.exist');

cy.intercept('GET', '**/model_catalog/models*').as('getModelsWithoutColdStart');

triggerFilterRefresh();

cy.wait('@getModelsWithoutColdStart').then((interception) => {
const decodedUrl = decodeURIComponent(interception.request.url);
expect(decodedUrl).to.not.include('cold_start_time_to_load_seconds');
});
});

it('should pass cold_start_time_to_load_seconds as orderBy when cold start sort is selected', () => {
visitWithPerformanceToggle(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ function useModelCatalogSetup(providerState: CatalogProviderState) {
baseSetFilterData(latencyKey, undefined);
});
baseSetFilterData(ModelCatalogStringFilterKey.HARDWARE_CONFIGURATION, []);
baseSetFilterData(ModelCatalogNumberFilterKey.MAX_RPS, undefined);
baseSetFilterData(ModelCatalogNumberFilterKey.COLD_START_LOAD_TIME, undefined);
baseSetFilterData(ModelCatalogNumberFilterKey.MIN_VRAM, undefined);
baseSetFilterData(ModelCatalogNumberFilterKey.IMAGE_SIZE, undefined);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Content, ContentVariants, Flex } from '@patternfly/react-core';
import { Content, ContentVariants, Divider, Flex } from '@patternfly/react-core';
import { ModelCatalogContext } from '~/app/context/modelCatalog/ModelCatalogContext';
import {
ModelCatalogNumberFilterKey,
Expand Down Expand Up @@ -124,6 +124,7 @@ const ModelCatalogFilters: React.FC = () => {
fallbackMin={4}
fallbackMax={480}
/>
<Divider />
<SidebarSliderFilter
filterKey={ModelCatalogNumberFilterKey.IMAGE_SIZE}
label="Container size"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const SidebarSliderFilter: React.FC<SidebarSliderFilterProps> = ({
if (option && option.range) {
const { min, max } = option.range;
if (min != null && max != null) {
return { min, max };
return { min: Math.floor(min), max: Math.ceil(max) };
}
}
return { min: fallbackMin, max: fallbackMax };
Expand Down Expand Up @@ -116,6 +116,7 @@ const SidebarSliderFilter: React.FC<SidebarSliderFilterProps> = ({
suffix={suffix}
ariaLabel={`${label} filter value`}
showBoundaries
shouldRound
/>
</FlexItem>
<FlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SliderWithInput: React.FC<SliderWithInputProps> = ({
hasTooltipOverThumb = false,
}) => {
const roundValue = React.useCallback(
(val: number) => (shouldRound ? Math.ceil(val * 100) / 100 : val),
(val: number) => (shouldRound ? Math.round(val) : val),
[shouldRound],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ export const getDefaultFiltersFromNamedQuery = (
if (resolvedValue !== undefined) {
if (fieldName === ModelCatalogNumberFilterKey.MAX_RPS) {
result[ModelCatalogNumberFilterKey.MAX_RPS] = resolvedValue;
} else {
} else if (fieldName === ModelCatalogNumberFilterKey.COLD_START_LOAD_TIME) {
result[ModelCatalogNumberFilterKey.COLD_START_LOAD_TIME] = resolvedValue;
} else if (fieldName === ModelCatalogNumberFilterKey.MIN_VRAM) {
result[ModelCatalogNumberFilterKey.MIN_VRAM] = resolvedValue;
} else {
result[ModelCatalogNumberFilterKey.IMAGE_SIZE] = resolvedValue;
}
}
return;
Expand Down
Loading