"Community and custom models" section should be hidden if there are no catalog sources without labels#1836
Conversation
Signed-off-by: Yulia Krimerman <juliapiterova@hotmail.com>
mturley
left a comment
There was a problem hiding this comment.
Tiny nit with the test, otherwise LGTM
| const defaultSources = [ | ||
| mockCatalogSource({}), | ||
| mockCatalogSource({ id: 'source-2', name: 'source 2' }), | ||
| ]; |
There was a problem hiding this comment.
It looks like you never actually use defaultSources in an intercept, I think the test only passes because it happens to match the default currently implemented in initIntercepts. In case that changes later I think you need to pass this into the initIntercepts call on line 203 here.
There was a problem hiding this comment.
@mturley fixed. I think it needs /retest though :(
Signed-off-by: Yulia Krimerman <juliapiterova@hotmail.com>
| @@ -828,9 +828,10 @@ func GetCatalogSourceMocks() []models.CatalogSource { | |||
| Labels: []string{"Sample category 1"}, | |||
| }, | |||
| { | |||
| Id: "dora", | |||
| Name: "Dora source", | |||
| Labels: []string{}, | |||
| Id: "dora", | |||
| Name: "Dora source", | |||
| Enabled: &disabled, | |||
| Labels: []string{}, | |||
There was a problem hiding this comment.
@YuliaKrimerman would like to revert this changes in this PR to make community and custom visible in mock mode? Because this changes were mentioned in PR description to test this PR. so should we revert it or is this changes intentional?
|
@ppadti: changing LGTM is restricted to collaborators DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/retest |
Signed-off-by: Yulia Krimerman <juliapiterova@hotmail.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mturley 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 |
Summary
Hide the "Community and custom models" section when there are no enabled catalog sources without labels.
Description
Hides the "Community and custom models" section in the Model Catalog UI when no enabled catalog sources have empty labels.
Changes made:
hasSourcesWithoutLabels()inmodelCatalogUtils.tsto detect enabled sources with empty or whitespace-only labelsModelCatalogAllModelsView.tsxto conditionally render the "Community and custom models" sectionModelCatalogSourceLabelBlocks.tsxto conditionally show the "no-labels" toggle buttonHow Has This Been Tested?
Manual Testing:

Run from the ui folder make dev-start
Verified section appears when enabled sources without labels exist
then modify clients/ui/bff/internal/mocks/static_data_mock.go :
{
Id: "adminModel1",
Name: "Admin model 1",
Enabled: &disabled, // Change from &enabled to &disabled
Labels: []string{},
},
And for
dora:{
Id: "dora",
Name: "Dora source",
Enabled: &disabled, // Add this line
Labels: []string{},
},
Re run and verified section hides when all sources have labels or sources without labels are disabled
Automated Testing:
modelCatalogAllModelsView.cy.ts: Added test for hiding behavior; updated existing tests to handle conditional renderingmodelCatalog.cy.ts: Fixed API call count to match dynamic category sectionsMerge Criteria
For UI changes: