Skip to content

hide All models toggle when only one category has models - #3157

Merged
google-oss-prow[bot] merged 10 commits into
kubeflow:mainfrom
ConorOM1:all_model_fix
Oct 1, 2026
Merged

google-oss-prow[bot] merged 10 commits into
kubeflow:mainfrom
ConorOM1:all_model_fix

Conversation

@ConorOM1

@ConorOM1 ConorOM1 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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?

  1. Edit clients/ui/bff/internal/mocks/static_data_mock.go:
    • In GetCatalogSourceMocks(), put all model-bearing sources under a single
      label (e.g. "Sample category 1") and add one additional source with a
      distinct label and no models, e.g.:
      {
          Id:      "empty-models-source",
          Name:    "Empty Models Source",
          Enabled: &enabled,
          Labels:  []string{"empty models category"},
          Status:  &availableStatus,
      },
    • In GetCatalogLabelListMock(), add a matching label entry for
      "empty models category".
  2. From clients/ui/, run make dev-start.
  3. Open http://localhost:9000 → Model Catalog.
  • Expected: No "All models" tab and no empty category tab are shown — just the single populated category's models, with no toggle bar at all.
image
  • Before: Both "All models" and the populated category's tab would incorrectly appear.

  • Cypress test case added in (modelCatalogAllModelsView.cy.ts)

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages
  • Automated tests are provided as part of the PR for major new functionalities; testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.
  • For first time contributors: Please reach out to the Reviewers to ensure all tests are being run, ensuring the label ok-to-test has been added to the PR.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
@manaswinidas

Copy link
Copy Markdown
Contributor

/ok-to-test

@ConorOM1

ConorOM1 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
ConorOM1 and others added 2 commits September 7, 2026 11:04
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
Signed-off-by: Conor O'Malley <97108400+ConorOM1@users.noreply.github.com>
@google-oss-prow google-oss-prow Bot added size/L and removed size/M labels Sep 7, 2026
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
@ConorOM1

ConorOM1 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
@ConorOM1
ConorOM1 requested a review from ppadti September 7, 2026 11:10
@ConorOM1

ConorOM1 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
Signed-off-by: Conor O'Malley <conormomalley@gmail.com>

@manaswinidas manaswinidas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 || '');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 bug: shared CatalogSourceLabelSelector reset clears search (onClearSearch + input). This only calls onResetAllFilters. Restore clear-search here or keep using the shared component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored

}
: {})}
>
<ToolbarContent rowWrap={{ default: 'wrap' }}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 bug: was hasBasicFiltersApplied || hasSearchTerm. Search-only now hides "Reset all filters". Restore hasSearchTerm (or go back to shared selector).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored

Comment on lines +55 to +59
const hasMultipleCategories = React.useMemo(() => {
const activeLabels = getActiveSourceLabels(catalogSources, catalogLabels);
if (!categoriesResolved) {
return activeLabels.length > 1;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 risk: before categoriesResolved, empty labels still count — toggle can flash then hide. Prefer hide until resolved, or reuse layout’s effectiveCategories helper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already handled

// 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored to upstream

emptyCategoryLabels={emptyCategoryLabels}
className="pf-v6-u-pb-0"
ariaLabel="Source label selection"
hideWhenSingleCategory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 nit: redundant with parent hasMultipleCategories gate. Keep one source of truth.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, removed

Comment on lines +489 to +492
selectAnySortOption(testId: string) {
cy.get(
'[data-testid="model-catalog-sort-dropdown"], [data-testid="model-catalog-category-sort-dropdown"]',
).click();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reworked for existing pattern

Comment on lines +233 to +241
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', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 gap: only covers multi-category. Also assert single non-empty category + perf on → findCategorySortDropdown() visible (as requested earlier).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment on lines +270 to +272
modelCatalog.findCategoryToggle('label-Empty Category').should('not.exist');
modelCatalog.findCategoryToggle('label-Hugging Face').should('not.exist');
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 gap: only asserts toggles absent. Also assert models / category title still show (gallery single-category path).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
@ConorOM1

Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Conor O'Malley <conormomalley@gmail.com>
@ppadti

ppadti commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@ppadti ppadti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ConorOM1
/lgtm
/approve

@google-oss-prow google-oss-prow Bot added the lgtm label Oct 1, 2026
@google-oss-prow

Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
google-oss-prow Bot merged commit e5987f9 into kubeflow:main Oct 1, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants