From 401731fc1b6897c98418be45db0d1554be1667d9 Mon Sep 17 00:00:00 2001 From: Mike Turley Date: Wed, 14 Aug 2024 16:51:10 -0400 Subject: [PATCH] Finish tests Signed-off-by: Mike Turley --- frontend/src/__mocks__/mockModelArtifact.ts | 2 +- .../modelRegistry/registerVersionPage.ts | 11 +- .../modelRegistry/registerVersion.cy.ts | 311 ++++++++++++++---- .../modelRegistry/__tests__/utils.spec.ts | 25 ++ frontend/src/concepts/modelRegistry/utils.ts | 2 +- .../screens/RegisterModel/RegisterVersion.tsx | 3 +- .../RegisterModel/RegisteredModelSelector.tsx | 4 +- 7 files changed, 290 insertions(+), 68 deletions(-) diff --git a/frontend/src/__mocks__/mockModelArtifact.ts b/frontend/src/__mocks__/mockModelArtifact.ts index 4fd773f485..162a3af85e 100644 --- a/frontend/src/__mocks__/mockModelArtifact.ts +++ b/frontend/src/__mocks__/mockModelArtifact.ts @@ -1,7 +1,6 @@ import { ModelArtifact } from '~/concepts/modelRegistry/types'; export const mockModelArtifact = (partial?: Partial): ModelArtifact => ({ - ...partial, createTimeSinceEpoch: '1712234877179', id: '1', lastUpdateTimeSinceEpoch: '1712234877179', @@ -14,4 +13,5 @@ export const mockModelArtifact = (partial?: Partial): ModelArtifa uri: 's3://test-bucket/demo-models/test-path?endpoint=test-endpoint&defaultRegion=test-region', modelFormatName: 'test model format', modelFormatVersion: 'test version 1', + ...partial, }); diff --git a/frontend/src/__tests__/cypress/cypress/pages/modelRegistry/registerVersionPage.ts b/frontend/src/__tests__/cypress/cypress/pages/modelRegistry/registerVersionPage.ts index f916e83cd5..d08eb3c7ea 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/modelRegistry/registerVersionPage.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/modelRegistry/registerVersionPage.ts @@ -1,5 +1,5 @@ export enum FormFieldSelector { - REGISTERED_MODEL = '#registered-model', + REGISTERED_MODEL = '#registered-model-container .pf-m-typeahead', VERSION_NAME = '#version-name', VERSION_DESCRIPTION = '#version-description', SOURCE_MODEL_FORMAT = '#source-model-format', @@ -28,7 +28,7 @@ class RegisterVersionPage { const preferredModelRegistry = 'modelregistry-sample'; cy.findByTestId('app-page-title').should('exist'); cy.findByTestId('app-page-title').contains('Register new version'); - cy.findByText(preferredModelRegistry).should('exist'); + cy.findByText(`Model registry - ${preferredModelRegistry}`).should('exist'); cy.testA11y(); } @@ -36,6 +36,13 @@ class RegisterVersionPage { return cy.get(selector); } + selectRegisteredModel(name: string) { + this.findFormField(FormFieldSelector.REGISTERED_MODEL) + .findByRole('button', { name: 'Typeahead menu toggle' }) + .findSelectOption(name) + .click(); + } + findSubmitButton() { return cy.findByTestId('create-button'); } diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/registerVersion.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/registerVersion.cy.ts index 78e2f82e6b..6afbd33bd2 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/registerVersion.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/registerVersion.cy.ts @@ -9,17 +9,16 @@ import { import { mockRegisteredModel } from '~/__mocks__/mockRegisteredModel'; import { mockModelVersion } from '~/__mocks__/mockModelVersion'; import { mockModelArtifact } from '~/__mocks__/mockModelArtifact'; +import { mockModelRegistryService } from '~/__mocks__/mockModelRegistryService'; +import { mockRegisteredModelList } from '~/__mocks__/mockRegisteredModelsList'; +import { mockModelVersionList } from '~/__mocks__/mockModelVersionList'; +import { mockModelArtifactList } from '~/__mocks__/mockModelArtifactList'; import { ModelArtifactState, ModelState, - type RegisteredModel, type ModelVersion, type ModelArtifact, } from '~/concepts/modelRegistry/types'; -import { mockModelRegistryService } from '~/__mocks__/mockModelRegistryService'; -import { mockRegisteredModelList } from '~/__mocks__/mockRegisteredModelsList'; -import { mockModelVersionList } from '~/__mocks__/mockModelVersionList'; -import { mockModelArtifactList } from '~/__mocks__/mockModelArtifactList'; const MODEL_REGISTRY_API_VERSION = 'v1alpha3'; @@ -172,7 +171,7 @@ const initIntercepts = () => { mockModelArtifact({ modelFormatName: 'test-version-id-2-format-name', modelFormatVersion: 'test-version-id-2-format-version', - uri: 's3://test-bucket-version-id-2/demo-models/test-path?endpoint=test-endpoint&defaultRegion=test-region', + uri: 's3://test-bucket-version-id-2/demo-models/test-path?endpoint=test-endpoint-version-id-2&defaultRegion=test-region-version-id-2', }), ], }), @@ -245,16 +244,105 @@ describe('Register model page with no preselected model', () => { registerVersionPage.visit(); }); + it('Prefills version/artifact details when a model is selected', () => { + registerVersionPage.selectRegisteredModel('Test model 1'); + cy.findByText('Current version is Test latest version for model 1').should('exist'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT) + .should('have.value', 'test-version-id-2-format-name'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION) + .should('have.value', 'test-version-id-2-format-version'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE) + .should('be.checked'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_ENDPOINT) + .should('have.value', 'test-endpoint-version-id-2'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_BUCKET) + .should('have.value', 'test-bucket-version-id-2'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_REGION) + .should('have.value', 'test-region-version-id-2'); + + // Test model 2 has an invalid artifact URI so its object fields are reset + registerVersionPage.selectRegisteredModel('Test model 2'); + cy.findByText('Current version is Test latest version for model 2').should('exist'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT) + .should('have.value', 'test-version-id-4-format-name'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION) + .should('have.value', 'test-version-id-4-format-version'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE) + .should('be.checked'); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_ENDPOINT).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_BUCKET).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_REGION).should('have.value', ''); + + // Switching back should prefill them again + registerVersionPage.selectRegisteredModel('Test model 1'); + cy.findByText('Current version is Test latest version for model 1').should('exist'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT) + .should('have.value', 'test-version-id-2-format-name'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION) + .should('have.value', 'test-version-id-2-format-version'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE) + .should('be.checked'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_ENDPOINT) + .should('have.value', 'test-endpoint-version-id-2'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_BUCKET) + .should('have.value', 'test-bucket-version-id-2'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_REGION) + .should('have.value', 'test-region-version-id-2'); + }); + + it('Clears prefilled details if switching to a model with missing artifact', () => { + registerVersionPage.selectRegisteredModel('Test model 1'); + registerVersionPage.selectRegisteredModel('Test model 3 has version but is missing artifact'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT) + .should('have.value', ''); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION) + .should('have.value', ''); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE) + .should('be.checked'); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_ENDPOINT).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_BUCKET).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_REGION).should('have.value', ''); + }); + + it('Clears prefilled details if switching to a model with missing version', () => { + registerVersionPage.selectRegisteredModel('Test model 1'); + registerVersionPage.selectRegisteredModel('Test model 4 is missing version and artifact'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT) + .should('have.value', ''); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION) + .should('have.value', ''); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE) + .should('be.checked'); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_ENDPOINT).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_BUCKET).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_REGION).should('have.value', ''); + }); + it('Disables submit until required fields are filled in object storage mode', () => { registerVersionPage.findSubmitButton().should('be.disabled'); - // TODO select a model - // registerVersionPage.findFormField(FormFieldSelector.MODEL_NAME).type('Test model name'); + registerVersionPage.selectRegisteredModel('Test model 1'); registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); - registerVersionPage.findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE).click(); - registerVersionPage - .findFormField(FormFieldSelector.LOCATION_ENDPOINT) - .type('http://s3.amazonaws.com/'); - registerVersionPage.findFormField(FormFieldSelector.LOCATION_BUCKET).type('test-bucket'); registerVersionPage .findFormField(FormFieldSelector.LOCATION_PATH) .type('demo-models/flan-t5-small-caikit'); @@ -262,22 +350,11 @@ describe('Register model page with no preselected model', () => { }); it('Creates expected resources on submit in object storage mode', () => { - registerVersionPage.findFormField(FormFieldSelector.MODEL_NAME).type('Test model name'); - registerVersionPage - .findFormField(FormFieldSelector.MODEL_DESCRIPTION) - .type('Test model description'); + registerVersionPage.selectRegisteredModel('Test model 1'); registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); registerVersionPage .findFormField(FormFieldSelector.VERSION_DESCRIPTION) .type('Test version description'); - registerVersionPage.findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT).type('caikit'); - registerVersionPage.findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION).type('1'); - registerVersionPage.findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE).click(); - registerVersionPage - .findFormField(FormFieldSelector.LOCATION_ENDPOINT) - .type('http://s3.amazonaws.com/'); - registerVersionPage.findFormField(FormFieldSelector.LOCATION_BUCKET).type('test-bucket'); - registerVersionPage.findFormField(FormFieldSelector.LOCATION_REGION).type('us-east-1'); registerVersionPage .findFormField(FormFieldSelector.LOCATION_PATH) .type('demo-models/flan-t5-small-caikit'); @@ -296,25 +373,27 @@ describe('Register model page with no preselected model', () => { }); cy.wait('@createModelArtifact').then((interception) => { expect(interception.request.body).to.containSubset({ - name: 'Test model name-Test version name-artifact', + name: 'Test model 1-Test version name-artifact', description: 'Test version description', customProperties: {}, state: ModelArtifactState.LIVE, author: 'test-user', - modelFormatName: 'caikit', - modelFormatVersion: '1', - uri: 's3://test-bucket/demo-models/flan-t5-small-caikit?endpoint=http%3A%2F%2Fs3.amazonaws.com%2F&defaultRegion=us-east-1', + modelFormatName: 'test-version-id-2-format-name', + modelFormatVersion: 'test-version-id-2-format-version', + uri: 's3://test-bucket-version-id-2/demo-models/flan-t5-small-caikit?endpoint=test-endpoint-version-id-2&defaultRegion=test-region-version-id-2', artifactType: 'model-artifact', } satisfies Partial); }); - // TODO should be the version URL - cy.url().should('include', '/modelRegistry/modelregistry-sample/registeredModels/1'); + cy.url().should( + 'include', + '/modelRegistry/modelregistry-sample/registeredModels/1/versions/6/details', + ); }); it('Disables submit until required fields are filled in URI mode', () => { registerVersionPage.findSubmitButton().should('be.disabled'); - registerVersionPage.findFormField(FormFieldSelector.MODEL_NAME).type('Test model name'); + registerVersionPage.selectRegisteredModel('Test model 1'); registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); registerVersionPage.findFormField(FormFieldSelector.LOCATION_TYPE_URI).click(); registerVersionPage @@ -326,16 +405,11 @@ describe('Register model page with no preselected model', () => { }); it('Creates expected resources on submit in URI mode', () => { - registerVersionPage.findFormField(FormFieldSelector.MODEL_NAME).type('Test model name'); - registerVersionPage - .findFormField(FormFieldSelector.MODEL_DESCRIPTION) - .type('Test model description'); + registerVersionPage.selectRegisteredModel('Test model 1'); registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); registerVersionPage .findFormField(FormFieldSelector.VERSION_DESCRIPTION) .type('Test version description'); - registerVersionPage.findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT).type('caikit'); - registerVersionPage.findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION).type('1'); registerVersionPage.findFormField(FormFieldSelector.LOCATION_TYPE_URI).click(); registerVersionPage .findFormField(FormFieldSelector.LOCATION_URI) @@ -357,32 +431,23 @@ describe('Register model page with no preselected model', () => { }); cy.wait('@createModelArtifact').then((interception) => { expect(interception.request.body).to.containSubset({ - name: 'Test model name-Test version name-artifact', + name: 'Test model 1-Test version name-artifact', description: 'Test version description', customProperties: {}, state: ModelArtifactState.LIVE, author: 'test-user', - modelFormatName: 'caikit', - modelFormatVersion: '1', + modelFormatName: 'test-version-id-2-format-name', + modelFormatVersion: 'test-version-id-2-format-version', uri: 's3://test-bucket/demo-models/flan-t5-small-caikit?endpoint=http%3A%2F%2Fs3.amazonaws.com%2F&defaultRegion=us-east-1', artifactType: 'model-artifact', } satisfies Partial); }); - // TODO should be the version URL - cy.url().should('include', '/modelRegistry/modelregistry-sample/registeredModels/1'); + cy.url().should( + 'include', + '/modelRegistry/modelregistry-sample/registeredModels/1/versions/6/details', + ); }); - - it('Prefills version/artifact details when a model is selected', () => { - // TODO select a model - // TODO assert the fields have the details in them - // TODO select a different model - // TODO assert that the fields changed - }); - - it('Clears prefilled details if switching to a model with missing version', () => {}); - - it('Clears prefilled details if switching to a model with missing artifact', () => {}); }); describe('Register model page with preselected model', () => { @@ -392,17 +457,141 @@ describe('Register model page with preselected model', () => { it('Prefills version/artifact details for the preselected model', () => { registerVersionPage.visit('1'); - // Don't select a model, model 1 is already selected + cy.findByText('Current version is Test latest version for model 1').should('exist'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT) + .should('have.value', 'test-version-id-2-format-name'); + registerVersionPage + .findFormField(FormFieldSelector.SOURCE_MODEL_FORMAT_VERSION) + .should('have.value', 'test-version-id-2-format-version'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_TYPE_OBJECT_STORAGE) + .should('be.checked'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_ENDPOINT) + .should('have.value', 'test-endpoint-version-id-2'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_BUCKET) + .should('have.value', 'test-bucket-version-id-2'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_REGION) + .should('have.value', 'test-region-version-id-2'); + }); + + it('Does not prefill location fields if the URI on the artifact is malformed', () => { + registerVersionPage.visit('2'); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_ENDPOINT).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_BUCKET).should('have.value', ''); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_REGION).should('have.value', ''); + }); + + it('Disables submit until required fields are filled in object storage mode', () => { + registerVersionPage.visit('1'); + registerVersionPage.findSubmitButton().should('be.disabled'); registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); - // Don't prefill an endpoint or bucket registerVersionPage .findFormField(FormFieldSelector.LOCATION_PATH) .type('demo-models/flan-t5-small-caikit'); registerVersionPage.findSubmitButton().should('be.enabled'); }); - it('Does not prefill location fields if the URI on the artifact is malformed', () => {}); - it('Disables submit until required fields are filled in object storage mode', () => {}); - it('Creates expected resources in object storage mode', () => {}); - it('Disables submit until required fields are filled in URI mode', () => {}); - it('Creates expected resources in URI mode', () => {}); + + it('Creates expected resources in object storage mode', () => { + registerVersionPage.visit('1'); + registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); + registerVersionPage + .findFormField(FormFieldSelector.VERSION_DESCRIPTION) + .type('Test version description'); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_PATH) + .type('demo-models/flan-t5-small-caikit'); + + registerVersionPage.findSubmitButton().click(); + + cy.wait('@createModelVersion').then((interception) => { + expect(interception.request.body).to.containSubset({ + name: 'Test version name', + description: 'Test version description', + customProperties: {}, + state: ModelState.LIVE, + author: 'test-user', + registeredModelId: '1', + } satisfies Partial); + }); + cy.wait('@createModelArtifact').then((interception) => { + expect(interception.request.body).to.containSubset({ + name: 'Test model 1-Test version name-artifact', + description: 'Test version description', + customProperties: {}, + state: ModelArtifactState.LIVE, + author: 'test-user', + modelFormatName: 'test-version-id-2-format-name', + modelFormatVersion: 'test-version-id-2-format-version', + uri: 's3://test-bucket-version-id-2/demo-models/flan-t5-small-caikit?endpoint=test-endpoint-version-id-2&defaultRegion=test-region-version-id-2', + artifactType: 'model-artifact', + } satisfies Partial); + }); + + cy.url().should( + 'include', + '/modelRegistry/modelregistry-sample/registeredModels/1/versions/6/details', + ); + }); + + it('Disables submit until required fields are filled in URI mode', () => { + registerVersionPage.visit('1'); + registerVersionPage.findSubmitButton().should('be.disabled'); + registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_TYPE_URI).click(); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_URI) + .type( + 's3://test-bucket/demo-models/flan-t5-small-caikit?endpoint=http%3A%2F%2Fs3.amazonaws.com%2F&defaultRegion=us-east-1', + ); + registerVersionPage.findSubmitButton().should('be.enabled'); + }); + + it('Creates expected resources in URI mode', () => { + registerVersionPage.visit('1'); + registerVersionPage.findFormField(FormFieldSelector.VERSION_NAME).type('Test version name'); + registerVersionPage + .findFormField(FormFieldSelector.VERSION_DESCRIPTION) + .type('Test version description'); + registerVersionPage.findFormField(FormFieldSelector.LOCATION_TYPE_URI).click(); + registerVersionPage + .findFormField(FormFieldSelector.LOCATION_URI) + .type( + 's3://test-bucket/demo-models/flan-t5-small-caikit?endpoint=http%3A%2F%2Fs3.amazonaws.com%2F&defaultRegion=us-east-1', + ); + + registerVersionPage.findSubmitButton().click(); + + cy.wait('@createModelVersion').then((interception) => { + expect(interception.request.body).to.containSubset({ + name: 'Test version name', + description: 'Test version description', + customProperties: {}, + state: ModelState.LIVE, + author: 'test-user', + registeredModelId: '1', + } satisfies Partial); + }); + cy.wait('@createModelArtifact').then((interception) => { + expect(interception.request.body).to.containSubset({ + name: 'Test model 1-Test version name-artifact', + description: 'Test version description', + customProperties: {}, + state: ModelArtifactState.LIVE, + author: 'test-user', + modelFormatName: 'test-version-id-2-format-name', + modelFormatVersion: 'test-version-id-2-format-version', + uri: 's3://test-bucket/demo-models/flan-t5-small-caikit?endpoint=http%3A%2F%2Fs3.amazonaws.com%2F&defaultRegion=us-east-1', + artifactType: 'model-artifact', + } satisfies Partial); + }); + + cy.url().should( + 'include', + '/modelRegistry/modelregistry-sample/registeredModels/1/versions/6/details', + ); + }); }); diff --git a/frontend/src/concepts/modelRegistry/__tests__/utils.spec.ts b/frontend/src/concepts/modelRegistry/__tests__/utils.spec.ts index a577aa53cd..95a80e406c 100644 --- a/frontend/src/concepts/modelRegistry/__tests__/utils.spec.ts +++ b/frontend/src/concepts/modelRegistry/__tests__/utils.spec.ts @@ -5,6 +5,7 @@ import { filterArchiveVersions, filterLiveModels, filterLiveVersions, + getLastCreatedItem, ObjectStorageFields, objectStorageFieldsToUri, uriToObjectStorageFields, @@ -128,6 +129,30 @@ describe('uriToObjectStorageFields', () => { }); }); +describe('getLastCreatedItem', () => { + it('returns the latest item correctly', () => { + const items = [ + { + foo: 'a', + createTimeSinceEpoch: '1712234877179', // Apr 04 2024 + }, + { + foo: 'b', + createTimeSinceEpoch: '1723659611927', // Aug 14 2024 + }, + ]; + expect(getLastCreatedItem(items)).toBe(items[1]); + }); + + it('returns first item if items have no createTimeSinceEpoch', () => { + const items = [ + { foo: 'a', createTimeSinceEpoch: undefined }, + { foo: 'b', createTimeSinceEpoch: undefined }, + ]; + expect(getLastCreatedItem(items)).toBe(items[0]); + }); +}); + describe('Filter model state', () => { const models: RegisteredModel[] = [ mockRegisteredModel({ name: 'Test 1', state: ModelState.ARCHIVED }), diff --git a/frontend/src/concepts/modelRegistry/utils.ts b/frontend/src/concepts/modelRegistry/utils.ts index 7b08a73c48..4d203e93f6 100644 --- a/frontend/src/concepts/modelRegistry/utils.ts +++ b/frontend/src/concepts/modelRegistry/utils.ts @@ -48,7 +48,7 @@ export const getLastCreatedItem = ( if (!createTimeA || !createTimeB) { return 0; } - return new Date(createTimeB).getTime() - new Date(createTimeA).getTime(); + return Number(createTimeB) - Number(createTimeA); }, )[0]; diff --git a/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterVersion.tsx b/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterVersion.tsx index 437104d9a3..92f787e435 100644 --- a/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterVersion.tsx +++ b/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterVersion.tsx @@ -76,7 +76,7 @@ const RegisterVersion: React.FC = () => { breadcrumb={ Registered models - {mrName}} + render={() => Model registry - {mrName}} /> {prefilledRegisteredModelId && registeredModel && ( { = ({ isDisabled isRequired type="text" - id="registered-model-prefilled" + id="model-name" name="registered-model-prefilled" value={options.find(({ value }) => value === registeredModelId)?.content} /> @@ -46,7 +46,7 @@ const RegisteredModelSelector: React.FC = ({ return ( `No results found for "${filter}"`}