Skip to content

Commit 0c53f67

Browse files
addressed comments
Signed-off-by: Yulia Krimerman <juliapiterova@hotmail.com>
1 parent 8dc2925 commit 0c53f67

7 files changed

Lines changed: 57 additions & 29 deletions

File tree

clients/ui/bff/internal/mocks/static_data_mock.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,14 +1333,17 @@ func CreateSampleCatalogSource(id string, name string, catalogType string) model
13331333
defaultCatalog := id == "catalog-1"
13341334

13351335
sourceConfig := models.CatalogSourceConfig{
1336-
Name: name,
1337-
Id: id,
1338-
Type: catalogType,
1339-
Enabled: BoolPtr(true),
1340-
Labels: []string{"source-1"},
1341-
IsDefault: &defaultCatalog,
1342-
IncludedModels: []string{"rhelai1/modelcar-granite-7b-starter"},
1343-
ExcludedModels: []string{"model-a:1.0", "model-b:*"},
1336+
Name: name,
1337+
Id: id,
1338+
Type: catalogType,
1339+
Enabled: BoolPtr(true),
1340+
Labels: []string{"source-1"},
1341+
IsDefault: &defaultCatalog,
1342+
}
1343+
1344+
if !defaultCatalog {
1345+
sourceConfig.IncludedModels = []string{"rhelai1/modelcar-granite-7b-starter"}
1346+
sourceConfig.ExcludedModels = []string{"model-a:1.0", "model-b:*"}
13441347
}
13451348

13461349
switch catalogType {

clients/ui/frontend/src/__mocks__/mockCatalogSourceConfigList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {
33
CatalogSourceConfigList,
44
YamlCatalogSourceConfig,
55
HuggingFaceCatalogSourceConfig,
6+
CatalogSourceType,
67
} from '~/app/modelCatalogTypes';
7-
import { CatalogSourceType } from '~/concepts/modelCatalogSettings/const';
88

99
export const mockYamlCatalogSourceConfig = (
1010
partial?: Partial<YamlCatalogSourceConfig>,

clients/ui/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalogSettings/modelCatalogSettings.cy.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,22 @@ describe('Catalog Source Configs Table', () => {
192192
});
193193

194194
describe('Enable toggle functionality', () => {
195-
it('should show notification when enable toggle is clicked', () => {
195+
it('should show alert when enable toggle is clicked', () => {
196196
modelCatalogSettings.visit();
197197
const row = modelCatalogSettings.getRow('HuggingFace Google');
198198
row.findName().should('be.visible');
199199
row.findEnableToggle().should('exist').and('be.checked');
200+
201+
cy.window().then((win) => {
202+
cy.stub(win, 'alert').as('windowAlert');
203+
});
204+
200205
row.toggleEnable();
201-
cy.get('.pf-v6-c-alert-group', { timeout: 5000 }).should('be.visible');
202-
cy.get('.pf-v6-c-alert').should('be.visible').and('contain', 'Toggle disabled');
206+
207+
cy.get('@windowAlert').should(
208+
'have.been.calledWith',
209+
'Toggle clicked! "HuggingFace Google" will be disabled when functionality is implemented.',
210+
);
203211
});
204212

205213
it('should not show toggle for default sources', () => {

clients/ui/frontend/src/app/modelCatalogTypes.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ export enum SourceLabel {
7070
other = 'null',
7171
}
7272

73+
export enum CatalogSourceType {
74+
YAML = 'yaml',
75+
HUGGING_FACE = 'huggingface',
76+
}
77+
7378
export type CatalogArtifactBase = {
7479
createTimeSinceEpoch: string;
7580
lastUpdateTimeSinceEpoch: string;
@@ -243,12 +248,12 @@ export type CatalogSourceConfigCommon = {
243248
};
244249

245250
export type YamlCatalogSourceConfig = CatalogSourceConfigCommon & {
246-
type: 'yaml';
251+
type: CatalogSourceType.YAML;
247252
yaml?: string;
248253
};
249254

250255
export type HuggingFaceCatalogSourceConfig = CatalogSourceConfigCommon & {
251-
type: 'huggingface';
256+
type: CatalogSourceType.HUGGING_FACE;
252257
allowedOrganization?: string;
253258
apiKey?: string;
254259
};

clients/ui/frontend/src/app/pages/modelCatalogSettings/screens/CatalogSourceConfigsTableColumns.ts renamed to clients/ui/frontend/src/app/pages/modelCatalogSettings/screens/CatalogSourceConfigsTableColumns.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as React from 'react';
2+
import { List, ListItem } from '@patternfly/react-core';
13
import { kebabTableColumn, SortableData } from 'mod-arch-shared';
24
import { CatalogSourceConfig } from '~/app/modelCatalogTypes';
35

@@ -23,8 +25,23 @@ export const catalogSourceConfigsColumns: SortableData<CatalogSourceConfig>[] =
2325
label: 'Model visibility',
2426
sortable: false,
2527
info: {
26-
popover:
27-
'Shows whether all models from a source appear in the model catalog or if visibility is filtered.\n\nAll models: Every model from the source appears in the catalog.\n\nFiltered: Only specific models appear, based on the visibility settings for that source.',
28+
popover: (
29+
<div>
30+
<p>
31+
Shows whether all models from a source appear in the model catalog or if visibility is
32+
filtered.
33+
</p>
34+
<List>
35+
<ListItem>
36+
<strong>All models:</strong> Every model from the source appears in the catalog.
37+
</ListItem>
38+
<ListItem>
39+
<strong>Filtered:</strong> Only specific models appear, based on the visibility
40+
settings for that source.
41+
</ListItem>
42+
</List>
43+
</div>
44+
),
2845
},
2946
width: 15,
3047
},

clients/ui/frontend/src/app/pages/modelCatalogSettings/screens/CatalogSourceConfigsTableRow.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Button, Label, Switch } from '@patternfly/react-core';
44
import { useNavigate } from 'react-router-dom';
55
import { CatalogSourceConfig } from '~/app/modelCatalogTypes';
66
import { manageSourceUrl } from '~/app/routes/modelCatalogSettings/modelCatalogSettings';
7-
import { useNotification } from '~/app/hooks/useNotification';
87
import {
98
CATALOG_SOURCE_TYPE_LABELS,
109
ModelVisibilityBadgeColor,
@@ -21,7 +20,6 @@ const CatalogSourceConfigsTableRow: React.FC<CatalogSourceConfigsTableRowProps>
2120
onDelete,
2221
}) => {
2322
const navigate = useNavigate();
24-
const notification = useNotification();
2523
const isDefault = catalogSourceConfig.isDefault ?? false;
2624
const isEnabled = catalogSourceConfig.enabled ?? true;
2725

@@ -31,11 +29,9 @@ const CatalogSourceConfigsTableRow: React.FC<CatalogSourceConfigsTableRowProps>
3129
);
3230

3331
const handleEnableToggle = (checked: boolean) => {
34-
// For now, just show a notification as per requirements
35-
// TODO: RHOAIENG-38347 - Implement actual enable/disable functionality
36-
notification.info(
37-
`Toggle ${checked ? 'enabled' : 'disabled'}`,
38-
`"${catalogSourceConfig.name}" will be ${checked ? 'enabled' : 'disabled'} when functionality is implemented.`,
32+
// TODO: Implement actual enable/disable functionality
33+
window.alert(
34+
`Toggle clicked! "${catalogSourceConfig.name}" will be ${checked ? 'enabled' : 'disabled'} when functionality is implemented.`,
3935
);
4036
};
4137

clients/ui/frontend/src/concepts/modelCatalogSettings/const.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { CatalogSourceConfig, HuggingFaceCatalogSourceConfig } from '~/app/modelCatalogTypes';
2-
3-
export enum CatalogSourceType {
4-
YAML = 'yaml',
5-
HUGGING_FACE = 'huggingface',
6-
}
1+
import {
2+
CatalogSourceConfig,
3+
HuggingFaceCatalogSourceConfig,
4+
CatalogSourceType,
5+
} from '~/app/modelCatalogTypes';
76

87
export const CATALOG_SOURCE_TYPE_LABELS: Record<CatalogSourceType, string> = {
98
[CatalogSourceType.YAML]: 'YAML file',

0 commit comments

Comments
 (0)