Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Model Registry: Register New Version form #3078

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@patternfly/react-log-viewer": "^5.2.0",
"@patternfly/react-styles": "^5.3.1",
"@patternfly/react-table": "^5.3.3",
"@patternfly/react-templates": "^1.0.4",
"@patternfly/react-tokens": "^5.3.1",
"@patternfly/react-topology": "^5.4.0-prerelease.10",
"@patternfly/react-virtualized-extension": "^5.1.0",
Expand Down Expand Up @@ -149,13 +150,22 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@cypress/code-coverage": "^3.12.34",
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
"@testing-library/cypress": "^10.0.1",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.3.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/chai-subset": "^1.3.5",
"@types/jest": "^28.1.8",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"chai-subset": "^1.6.0",
"cypress": "^13.10.0",
"cypress-axe": "^1.5.0",
"cypress-high-resolution": "^1.0.0",
"cypress-mochawesome-reporter": "^3.8.2",
"cypress-multi-reporters": "^1.6.4",
"@types/jest": "^28.1.8",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-node": "^0.3.7",
Expand All @@ -174,19 +184,10 @@
"jest": "^28.1.3",
"jest-environment-jsdom": "^29.4.3",
"junit-report-merger": "^7.0.0",
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
"mocha-junit-reporter": "^2.2.1",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"serve": "^14.2.1",
"@testing-library/cypress": "^10.0.1",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.3.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/chai-subset": "^1.3.5",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"ts-jest": "^28.0.8",
"wait-on": "^7.2.0"
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/__mocks__/mockModelArtifact.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ModelArtifact } from '~/concepts/modelRegistry/types';

export const mockModelArtifact = (): ModelArtifact => ({
export const mockModelArtifact = (partial?: Partial<ModelArtifact>): ModelArtifact => ({
createTimeSinceEpoch: '1712234877179',
id: '1',
lastUpdateTimeSinceEpoch: '1712234877179',
Expand All @@ -13,4 +13,5 @@ export const mockModelArtifact = (): ModelArtifact => ({
uri: 's3://test-bucket/demo-models/test-path?endpoint=test-endpoint&defaultRegion=test-region',
modelFormatName: 'test model format',
modelFormatVersion: 'test version 1',
...partial,
});
6 changes: 4 additions & 2 deletions frontend/src/__mocks__/mockModelArtifactList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import { ModelArtifactList } from '~/concepts/modelRegistry/types';
import { mockModelArtifact } from './mockModelArtifact';

export const mockModelArtifactList = (): ModelArtifactList => ({
items: [mockModelArtifact()],
export const mockModelArtifactList = ({
items = [mockModelArtifact()],
}: Partial<ModelArtifactList>): ModelArtifactList => ({
items,
nextPageToken: '',
pageSize: 0,
size: 1,
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/__mocks__/mockModelVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type MockModelVersionType = {
labels?: string[];
state?: ModelState;
description?: string;
createTimeSinceEpoch?: string;
};

export const mockModelVersion = ({
Expand All @@ -19,9 +20,10 @@ export const mockModelVersion = ({
id = '1',
state = ModelState.LIVE,
description = 'Description of model version',
createTimeSinceEpoch = '1712234877179',
}: MockModelVersionType): ModelVersion => ({
author,
createTimeSinceEpoch: '1712234877179',
createTimeSinceEpoch,
customProperties: createModelRegistryLabelsObject(labels),
id,
lastUpdateTimeSinceEpoch: '1712234877179',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export enum FormFieldSelector {
REGISTERED_MODEL = '#registered-model-container .pf-m-typeahead',
VERSION_NAME = '#version-name',
VERSION_DESCRIPTION = '#version-description',
SOURCE_MODEL_FORMAT = '#source-model-format',
SOURCE_MODEL_FORMAT_VERSION = '#source-model-format-version',
LOCATION_TYPE_OBJECT_STORAGE = '#location-type-object-storage',
LOCATION_ENDPOINT = '#location-endpoint',
LOCATION_BUCKET = '#location-bucket',
LOCATION_REGION = '#location-region',
LOCATION_PATH = '#location-path',
LOCATION_TYPE_URI = '#location-type-uri',
LOCATION_URI = '#location-uri',
}

class RegisterVersionPage {
visit(registeredModelId?: string) {
const preferredModelRegistry = 'modelregistry-sample';
cy.visitWithLogin(
registeredModelId
? `/modelRegistry/${preferredModelRegistry}/registeredModels/${registeredModelId}/registerVersion`
: `/modelRegistry/${preferredModelRegistry}/registerVersion`,
);
this.wait();
}

private wait() {
const preferredModelRegistry = 'modelregistry-sample';
cy.findByTestId('app-page-title').should('exist');
cy.findByTestId('app-page-title').contains('Register new version');
cy.findByText(`Model registry - ${preferredModelRegistry}`).should('exist');
cy.testA11y();
}

findFormField(selector: FormFieldSelector) {
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');
}
}

export const registerVersionPage = new RegisterVersionPage();
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const initIntercepts = ({
modelVersionId: 1,
},
},
mockModelArtifactList(),
mockModelArtifactList({}),
);

cy.interceptK8sList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const initIntercepts = () => {
modelVersionId: 1,
},
},
mockModelArtifactList(),
mockModelArtifactList({}),
);
};

Expand Down
Loading
Loading