Skip to content

Commit c073d6e

Browse files
fix changes requested
Signed-off-by: Philip Colares Carneiro <philip.colares@gmail.com>
1 parent 4f73813 commit c073d6e

4 files changed

Lines changed: 73 additions & 5 deletions

File tree

clients/ui/frontend/src/app/pages/mcpCatalog/screens/McpCatalog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ const McpCatalog: React.FC = () => {
9494
{isAllServersView && !isSingleCategory ? (
9595
<McpCatalogAllServersView searchTerm={searchQuery} />
9696
) : (
97-
<McpCatalogGalleryView handleFilterReset={handleResetAllFilters} />
97+
<McpCatalogGalleryView
98+
handleFilterReset={handleResetAllFilters}
99+
isSingleCategory={isSingleCategory}
100+
/>
98101
)}
99102
</PageSection>
100103
</Stack>

clients/ui/frontend/src/app/pages/mcpCatalog/screens/McpCatalogGalleryView.tsx

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Alert,
44
Bullseye,
55
Button,
6+
Content,
67
EmptyState,
78
Flex,
89
Grid,
@@ -13,8 +14,12 @@ import {
1314
import { SearchIcon } from '@patternfly/react-icons';
1415
import { McpCatalogContext } from '~/app/context/mcpCatalog/McpCatalogContext';
1516
import { useMcpServersBySourceLabelWithAPI } from '~/app/hooks/mcpServerCatalog/useMcpServersBySourceLabel';
16-
import { MCP_CATALOG_GRID_SPAN } from '~/app/pages/mcpCatalog/const';
17+
import { MCP_CATALOG_GRID_SPAN, OTHER_MCP_SERVERS_DISPLAY_NAME } from '~/app/pages/mcpCatalog/const';
1718
import { mcpFiltersToFilterQuery } from '~/app/pages/mcpCatalog/utils/mcpCatalogUtils';
19+
import {
20+
getLabelDisplayName,
21+
getLabelDescription,
22+
} from '~/app/pages/modelCatalog/utils/modelCatalogUtils';
1823
import EmptyModelCatalogState from '~/app/pages/modelCatalog/EmptyModelCatalogState';
1924
import ScrollViewOnMount from '~/app/shared/components/ScrollViewOnMount';
2025
import McpCatalogCard from '~/app/pages/mcpCatalog/components/McpCatalogCard';
@@ -23,11 +28,21 @@ const PAGE_SIZE = 10;
2328

2429
type McpCatalogGalleryViewProps = {
2530
handleFilterReset: () => void;
31+
isSingleCategory?: boolean;
2632
};
2733

28-
const McpCatalogGalleryView: React.FC<McpCatalogGalleryViewProps> = ({ handleFilterReset }) => {
29-
const { mcpApiState, selectedSourceLabel, searchQuery, filters, catalogLabelsLoaded } =
30-
React.useContext(McpCatalogContext);
34+
const McpCatalogGalleryView: React.FC<McpCatalogGalleryViewProps> = ({
35+
handleFilterReset,
36+
isSingleCategory = false,
37+
}) => {
38+
const {
39+
mcpApiState,
40+
selectedSourceLabel,
41+
searchQuery,
42+
filters,
43+
catalogLabels,
44+
catalogLabelsLoaded,
45+
} = React.useContext(McpCatalogContext);
3146

3247
const filterQuery = React.useMemo(() => mcpFiltersToFilterQuery(filters), [filters]);
3348

@@ -80,9 +95,33 @@ const McpCatalogGalleryView: React.FC<McpCatalogGalleryViewProps> = ({ handleFil
8095
);
8196
}
8297

98+
const categoryTitle = isSingleCategory
99+
? getLabelDisplayName(
100+
selectedSourceLabel || '',
101+
catalogLabels,
102+
OTHER_MCP_SERVERS_DISPLAY_NAME,
103+
'servers',
104+
)
105+
: undefined;
106+
const categoryDescription = isSingleCategory
107+
? getLabelDescription(selectedSourceLabel || '', catalogLabels)
108+
: undefined;
109+
83110
return (
84111
<>
85112
<ScrollViewOnMount shouldScroll scrollToTop />
113+
{isSingleCategory && categoryTitle && (
114+
<div className="pf-v6-u-mb-lg" data-testid="single-category-header">
115+
<Title headingLevel="h3" size="lg">
116+
{categoryTitle}
117+
</Title>
118+
{categoryDescription && (
119+
<Content component="p" className="pf-v6-u-color-200 pf-v6-u-mt-sm">
120+
{categoryDescription}
121+
</Content>
122+
)}
123+
</div>
124+
)}
86125
<Grid hasGutter>
87126
{items.map((server) => (
88127
<GridItem

clients/ui/frontend/src/app/pages/modelCatalog/screens/ModelCatalog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ const ModelCatalog: React.FC = () => {
9292
<ModelCatalogGalleryView
9393
searchTerm={searchTerm}
9494
handleFilterReset={handleFilterReset}
95+
isSingleCategory={isSingleCategory}
9596
/>
9697
)}
9798
</PageSection>

clients/ui/frontend/src/app/pages/modelCatalog/screens/ModelCatalogGalleryView.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
Alert,
33
Bullseye,
44
Button,
5+
Content,
56
EmptyState,
67
EmptyStateVariant,
78
Flex,
@@ -22,6 +23,8 @@ import {
2223
getActiveLatencyFieldName,
2324
getSortParams,
2425
generateCategoryName,
26+
getLabelDisplayName,
27+
getLabelDescription,
2528
hasFiltersApplied,
2629
isValueDifferentFromDefault,
2730
} from '~/app/pages/modelCatalog/utils/modelCatalogUtils';
@@ -38,11 +41,13 @@ import {
3841
type ModelCatalogPageProps = {
3942
searchTerm: string;
4043
handleFilterReset: () => void;
44+
isSingleCategory?: boolean;
4145
};
4246

4347
const ModelCatalogGalleryView: React.FC<ModelCatalogPageProps> = ({
4448
searchTerm,
4549
handleFilterReset,
50+
isSingleCategory = false,
4651
}) => {
4752
const {
4853
selectedSourceLabel,
@@ -51,6 +56,7 @@ const ModelCatalogGalleryView: React.FC<ModelCatalogPageProps> = ({
5156
filterOptionsLoaded,
5257
filterOptionsLoadError,
5358
catalogSources,
59+
catalogLabels,
5460
catalogLabelsLoaded,
5561
catalogLabelsLoadError,
5662
setPerformanceViewEnabled,
@@ -270,9 +276,28 @@ const ModelCatalogGalleryView: React.FC<ModelCatalogPageProps> = ({
270276
);
271277
}
272278

279+
const categoryTitle = isSingleCategory
280+
? getLabelDisplayName(selectedSourceLabel || '', catalogLabels)
281+
: undefined;
282+
const categoryDescription = isSingleCategory
283+
? getLabelDescription(selectedSourceLabel || '', catalogLabels)
284+
: undefined;
285+
273286
return (
274287
<>
275288
<ScrollViewOnMount shouldScroll scrollToTop />
289+
{isSingleCategory && categoryTitle && (
290+
<div className="pf-v6-u-mb-lg" data-testid="single-category-header">
291+
<Title headingLevel="h3" size="lg">
292+
{categoryTitle}
293+
</Title>
294+
{categoryDescription && (
295+
<Content component="p" className="pf-v6-u-color-200 pf-v6-u-mt-sm">
296+
{categoryDescription}
297+
</Content>
298+
)}
299+
</div>
300+
)}
276301
<Grid hasGutter>
277302
{catalogModels.items.map((model: CatalogModel) => (
278303
<GridItem key={`${model.name}/${model.source_id}`} sm={6} md={6} lg={6} xl={6} xl2={3}>

0 commit comments

Comments
 (0)