hide All models toggle when only one category has models - #3157
Conversation
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
|
/ok-to-test |
|
/retest |
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
Signed-off-by: Conor O'Malley <97108400+ConorOM1@users.noreply.github.com>
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
|
/retest |
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
|
/retest |
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
manaswinidas
left a comment
There was a problem hiding this comment.
Core empty-category hide looks right. Blocking concerns: reset/search regressions from forking shared CatalogSourceLabelSelector, plus incomplete Cypress coverage for single-category sort. Prefer restore shared selector and keep only the empty-aware category count change.
| }, [hasActiveFilters, onResetAllFilters]); | ||
|
|
||
| React.useEffect(() => { | ||
| setInputValue(searchTerm || ''); |
There was a problem hiding this comment.
🔴 bug: shared CatalogSourceLabelSelector reset clears search (onClearSearch + input). This only calls onResetAllFilters. Restore clear-search here or keep using the shared component.
| } | ||
| : {})} | ||
| > | ||
| <ToolbarContent rowWrap={{ default: 'wrap' }}> |
There was a problem hiding this comment.
🔴 bug: was hasBasicFiltersApplied || hasSearchTerm. Search-only now hides "Reset all filters". Restore hasSearchTerm (or go back to shared selector).
| const hasMultipleCategories = React.useMemo(() => { | ||
| const activeLabels = getActiveSourceLabels(catalogSources, catalogLabels); | ||
| if (!categoriesResolved) { | ||
| return activeLabels.length > 1; | ||
| } |
There was a problem hiding this comment.
🟡 risk: before categoriesResolved, empty labels still count — toggle can flash then hide. Prefer hide until resolved, or reuse layout’s effectiveCategories helper.
| // Use PatternFly's native clearAllFilters - it automatically shows/hides based on ToolbarFilter labels | ||
| // When performance view is OFF, show reset button for basic filters | ||
| // When performance view is ON, the HardwareConfigurationFilterToolbar handles resetting | ||
| {...(onResetAllFilters && !performanceViewEnabled && hasBasicFiltersApplied |
There was a problem hiding this comment.
🟡 maintenance: this forks shared CatalogSourceLabelSelector (~agents/MCP still use it). Core fix only needs empty-aware hasMultipleCategories + render props — please restore shared component to avoid drift (reset/CSS already diverged).
There was a problem hiding this comment.
restored to upstream
| emptyCategoryLabels={emptyCategoryLabels} | ||
| className="pf-v6-u-pb-0" | ||
| ariaLabel="Source label selection" | ||
| hideWhenSingleCategory |
There was a problem hiding this comment.
🔵 nit: redundant with parent hasMultipleCategories gate. Keep one source of truth.
| selectAnySortOption(testId: string) { | ||
| cy.get( | ||
| '[data-testid="model-catalog-sort-dropdown"], [data-testid="model-catalog-category-sort-dropdown"]', | ||
| ).click(); |
There was a problem hiding this comment.
🟡 risk: papers over dual sort dropdowns (sort vs category-sort). Prefer asserting the active surface, or one helper that picks by view — don’t leave both selectSortOption and this forever.
There was a problem hiding this comment.
reworked for existing pattern
| it('should show sort dropdown when performance toggle is enabled', () => { | ||
| // Default intercepts have multiple categories | ||
| modelCatalog.togglePerformanceView(); | ||
| modelCatalog.findLoadingState().should('not.exist'); | ||
|
|
||
| modelCatalog.findSortDropdown().should('be.visible'); | ||
| }); | ||
|
|
||
| it('should hide All models toggle when only one non-empty category remains', () => { |
There was a problem hiding this comment.
🟡 gap: only covers multi-category. Also assert single non-empty category + perf on → findCategorySortDropdown() visible (as requested earlier).
| modelCatalog.findCategoryToggle('label-Empty Category').should('not.exist'); | ||
| modelCatalog.findCategoryToggle('label-Hugging Face').should('not.exist'); | ||
| }); |
There was a problem hiding this comment.
🟡 gap: only asserts toggles absent. Also assert models / category title still show (gallery single-category path).
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
|
/retest |
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
|
/ok-to-test |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ppadti The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
The "All models" toggle was still shown whenever 2+ category labels existed, even if only one of them actually had models.
This hides the toggle bar entirely when just one category has models, by excluding empty categories
from the count.
How Has This Been Tested?
clients/ui/bff/internal/mocks/static_data_mock.go:GetCatalogSourceMocks(), put all model-bearing sources under a singlelabel (e.g.
"Sample category 1") and add one additional source with adistinct label and no models, e.g.:
{ Id: "empty-models-source", Name: "Empty Models Source", Enabled: &enabled, Labels: []string{"empty models category"}, Status: &availableStatus, },GetCatalogLabelListMock(), add a matching label entry for"empty models category".clients/ui/, runmake dev-start.http://localhost:9000→ Model Catalog.Before: Both "All models" and the populated category's tab would incorrectly appear.
Cypress test case added in (
modelCatalogAllModelsView.cy.ts)Merge criteria:
DCOcheck)ok-to-testhas been added to the PR.If you have UI changes