Skip to content

Commit

Permalink
changed the source of Owner and updated field to be searchable and so…
Browse files Browse the repository at this point in the history
…rtable
  • Loading branch information
YuliaKrimerman committed Aug 15, 2024
1 parent 1ade788 commit b0f9e16
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('Model Registry core', () => {
.contains(
'A machine learning model trained to detect fraudulent transactions in financial data',
);
registeredModelRow.findOwner().contains('Author 1');
registeredModelRow.findOwner().contains('Author 1' || '-');

Check failure on line 181 in frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelRegistry.cy.ts

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Delete `··`

Check failure on line 181 in frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelRegistry.cy.ts

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Unnecessary conditional, value is always truthy

// Label popover
registeredModelRow.findLabelPopoverText().contains('2 more');
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/concepts/modelRegistry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export type ModelRegistryBase = {
id: string;
name: string;
externalID?: string;
author?: string;
owner?: string;
description?: string;
createTimeSinceEpoch?: string;
lastUpdateTimeSinceEpoch: string;
Expand All @@ -94,7 +96,6 @@ export type ModelRegistryBase = {
export type ModelArtifact = ModelRegistryBase & {
uri?: string;
state?: ModelArtifactState;
author?: string;
modelFormatName?: string;
storageKey?: string;
storagePath?: string;
Expand All @@ -105,7 +106,6 @@ export type ModelArtifact = ModelRegistryBase & {

export type ModelVersion = ModelRegistryBase & {
state?: ModelState;
author?: string;
registeredModelId: string;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as React from 'react';
import { ClipboardCopy, DescriptionList, Flex, FlexItem } from '@patternfly/react-core';
import { ClipboardCopy, DescriptionList, Flex, FlexItem, Text } from '@patternfly/react-core';
import { RegisteredModel } from '~/concepts/modelRegistry/types';
import { ModelRegistryContext } from '~/concepts/modelRegistry/context/ModelRegistryContext';
import DashboardDescriptionListGroup from '~/components/DashboardDescriptionListGroup';
import EditableTextDescriptionListGroup from '~/components/EditableTextDescriptionListGroup';
import EditableLabelsDescriptionListGroup from '~/components/EditableLabelsDescriptionListGroup';
import RegisteredModelOwner from '~/pages/modelRegistry/screens/RegisteredModels/RegisteredModelOwner';
import ModelTimestamp from '~/pages/modelRegistry/screens/components/ModelTimestamp';
import {
getLabels,
Expand Down Expand Up @@ -83,7 +82,7 @@ const ModelDetailsView: React.FC<ModelDetailsViewProps> = ({ registeredModel: rm
</ClipboardCopy>
</DashboardDescriptionListGroup>
<DashboardDescriptionListGroup title="Owner">
<RegisteredModelOwner registeredModelId={rm.id} />
<Text data-testid="registered-model-owner">{rm.author || '-'}</Text>
</DashboardDescriptionListGroup>
<DashboardDescriptionListGroup
title="Last modified at"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const registerModel = async (
name: formData.modelName,
description: formData.modelDescription,
customProperties: {},
author,
state: ModelState.LIVE,
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const RegisteredModelListView: React.FC<RegisteredModelListViewProps> = ({
const [searchType, setSearchType] = React.useState<SearchType>(SearchType.KEYWORD);
const [search, setSearch] = React.useState('');

const searchTypes = React.useMemo(() => [SearchType.KEYWORD], []); // TODO Add owner once RHOAIENG-7566 is completed.
const searchTypes = React.useMemo(() => [SearchType.KEYWORD, SearchType.OWNER], []);

if (unfilteredRegisteredModels.length === 0) {
return (
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { ModelRegistryContext } from '~/concepts/modelRegistry/context/ModelRegi
import { ArchiveRegisteredModelModal } from '~/pages/modelRegistry/screens/components/ArchiveRegisteredModelModal';
import { getPatchBodyForRegisteredModel } from '~/pages/modelRegistry/screens/utils';
import { RestoreRegisteredModelModal } from '~/pages/modelRegistry/screens/components/RestoreRegisteredModel';
import RegisteredModelOwner from './RegisteredModelOwner';

type RegisteredModelTableRowProps = {
registeredModel: RegisteredModel;
Expand Down Expand Up @@ -77,7 +76,7 @@ const RegisteredModelTableRow: React.FC<RegisteredModelTableRowProps> = ({
<ModelTimestamp timeSinceEpoch={rm.lastUpdateTimeSinceEpoch} />
</Td>
<Td dataLabel="Owner">
<RegisteredModelOwner registeredModelId={rm.id} />
<Text data-testid="registered-model-owner">{rm.owner || '-'}</Text>
</Td>
<Td isActionCell>
<ActionsColumn items={actions} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const rmColumns: SortableData<RegisteredModel>[] = [
{
field: 'owner',
label: 'Owner',
sortable: false, // TODO Add sortable once RHOAIENG-7566 is completed.
sortable: true,
},
{
field: 'kebab',
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/modelRegistry/screens/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ export const filterRegisteredModels = (
);

case SearchType.OWNER:
// TODO Implement owner search functionality once RHOAIENG-7566 is completed.
return;
return rm.owner && rm.owner.toLowerCase().includes(search.toLowerCase());

default:
return true;
Expand Down

0 comments on commit b0f9e16

Please sign in to comment.