-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the Model Version Details and Model Version Archive pages (#428)
Signed-off-by: Griffin-Sullivan <[email protected]>
- Loading branch information
1 parent
3761a6a
commit 97f5751
Showing
48 changed files
with
2,835 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,17 @@ | ||
import { ModelArtifact, ModelArtifactState } from '~/app/types'; | ||
import { ModelArtifact } from '~/app/types'; | ||
|
||
type MockModelArtifact = { | ||
id?: string; | ||
name?: string; | ||
uri?: string; | ||
state?: ModelArtifactState; | ||
author?: string; | ||
}; | ||
|
||
export const mockModelArtifact = ({ | ||
id = '1', | ||
name = 'test', | ||
uri = 'test', | ||
state = ModelArtifactState.LIVE, | ||
author = 'Author 1', | ||
}: MockModelArtifact): ModelArtifact => ({ | ||
id, | ||
name, | ||
externalID: '1234132asdfasdf', | ||
description: '', | ||
createTimeSinceEpoch: '1710404288975', | ||
lastUpdateTimeSinceEpoch: '1710404288975', | ||
export const mockModelArtifact = (partial?: Partial<ModelArtifact>): ModelArtifact => ({ | ||
createTimeSinceEpoch: '1712234877179', | ||
id: '1', | ||
lastUpdateTimeSinceEpoch: '1712234877179', | ||
name: 'fraud detection model version 1', | ||
description: 'Description of model version', | ||
artifactType: 'model-artifact', | ||
customProperties: {}, | ||
uri, | ||
state, | ||
author, | ||
modelFormatName: 'test', | ||
storageKey: 'test', | ||
storagePath: 'test', | ||
modelFormatVersion: 'test', | ||
serviceAccountName: 'test', | ||
artifactType: 'test', | ||
storageKey: 'test storage key', | ||
storagePath: 'test path', | ||
uri: 's3://test-bucket/demo-models/test-path?endpoint=test-endpoint&defaultRegion=test-region', | ||
modelFormatName: 'test model format', | ||
modelFormatVersion: 'test version 1', | ||
...partial, | ||
}); |
11 changes: 11 additions & 0 deletions
11
clients/ui/frontend/src/__mocks__/mockModelArtifactList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable camelcase */ | ||
import { ModelArtifactList } from '~/app/types'; | ||
|
||
export const mockModelArtifactList = ({ | ||
items = [], | ||
}: Partial<ModelArtifactList>): ModelArtifactList => ({ | ||
items, | ||
nextPageToken: '', | ||
pageSize: 0, | ||
size: 1, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
.../ui/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/modelVersionArchive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import { TableRow } from '~/__tests__/cypress/cypress/pages/components/table'; | ||
import { Modal } from '~/__tests__/cypress/cypress/pages/components/Modal'; | ||
|
||
class ArchiveVersionTableRow extends TableRow { | ||
findName() { | ||
return this.find().findByTestId('model-version-name'); | ||
} | ||
|
||
findDescription() { | ||
return this.find().findByTestId('model-version-description'); | ||
} | ||
|
||
findLabelPopoverText() { | ||
return this.find().findByTestId('popover-label-text'); | ||
} | ||
|
||
findLabelModalText() { | ||
return this.find().findByTestId('modal-label-text'); | ||
} | ||
|
||
shouldContainsPopoverLabels(labels: string[]) { | ||
cy.findByTestId('popover-label-group').within(() => labels.map((label) => cy.contains(label))); | ||
return this; | ||
} | ||
} | ||
|
||
class RestoreVersionModal extends Modal { | ||
constructor() { | ||
super('Restore version?'); | ||
} | ||
|
||
findRestoreButton() { | ||
return cy.findByTestId('modal-submit-button'); | ||
} | ||
} | ||
|
||
class ArchiveVersionModal extends Modal { | ||
constructor() { | ||
super('Archive version?'); | ||
} | ||
|
||
findArchiveButton() { | ||
return cy.findByTestId('modal-submit-button'); | ||
} | ||
|
||
findModalTextInput() { | ||
return cy.findByTestId('confirm-archive-input'); | ||
} | ||
} | ||
|
||
class ModelVersionArchive { | ||
private wait() { | ||
cy.findByTestId('app-page-title').should('exist'); | ||
cy.testA11y(); | ||
} | ||
|
||
visit() { | ||
const rmId = '1'; | ||
const preferredModelRegistry = 'modelregistry-sample'; | ||
cy.visit(`/modelRegistry/${preferredModelRegistry}/registeredModels/${rmId}/versions/archive`); | ||
this.wait(); | ||
} | ||
|
||
visitArchiveVersionDetail() { | ||
const mvId = '2'; | ||
const rmId = '1'; | ||
const preferredModelRegistry = 'modelregistry-sample'; | ||
cy.visit( | ||
`/modelRegistry/${preferredModelRegistry}/registeredModels/${rmId}/versions/archive/${mvId}`, | ||
); | ||
} | ||
|
||
visitModelVersionList() { | ||
const rmId = '1'; | ||
const preferredModelRegistry = 'modelregistry-sample'; | ||
cy.visit(`/modelRegistry/${preferredModelRegistry}/registeredModels/${rmId}/versions`); | ||
this.wait(); | ||
} | ||
|
||
visitModelVersionDetails() { | ||
const mvId = '3'; | ||
const rmId = '1'; | ||
const preferredModelRegistry = 'modelregistry-sample'; | ||
cy.visit(`/modelRegistry/${preferredModelRegistry}/registeredModels/${rmId}/versions/${mvId}`); | ||
this.wait(); | ||
} | ||
|
||
findModelVersionsTableKebab() { | ||
return cy.findByTestId('model-versions-table-kebab-action'); | ||
} | ||
|
||
shouldArchiveVersionsEmpty() { | ||
cy.findByTestId('empty-archive-state').should('exist'); | ||
} | ||
|
||
findArchiveVersionBreadcrumbItem() { | ||
return cy.findByTestId('archive-version-page-breadcrumb'); | ||
} | ||
|
||
findArchiveVersionTable() { | ||
return cy.findByTestId('model-versions-archive-table'); | ||
} | ||
|
||
findArchiveVersionsTableRows() { | ||
return this.findArchiveVersionTable().find('tbody tr'); | ||
} | ||
|
||
findRestoreButton() { | ||
return cy.findByTestId('restore-button'); | ||
} | ||
|
||
getRow(name: string) { | ||
return new ArchiveVersionTableRow(() => | ||
this.findArchiveVersionTable() | ||
.find(`[data-label="Version name"]`) | ||
.contains(name) | ||
.parents('tr'), | ||
); | ||
} | ||
|
||
findModelVersionsDetailsHeaderAction() { | ||
return cy.findByTestId('model-version-details-action-button'); | ||
} | ||
} | ||
|
||
export const modelVersionArchive = new ModelVersionArchive(); | ||
export const restoreVersionModal = new RestoreVersionModal(); | ||
export const archiveVersionModal = new ArchiveVersionModal(); |
73 changes: 73 additions & 0 deletions
73
.../ui/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/modelVersionDetails.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
class ModelVersionDetails { | ||
visit() { | ||
const preferredModelRegistry = 'modelregistry-sample'; | ||
const rmId = '1'; | ||
const mvId = '1'; | ||
cy.visit(`/modelRegistry/${preferredModelRegistry}/registeredModels/${rmId}/versions/${mvId}`); | ||
this.wait(); | ||
} | ||
|
||
private wait() { | ||
cy.findByTestId('app-page-title').should('exist'); | ||
cy.testA11y(); | ||
} | ||
|
||
findVersionId() { | ||
return cy.findByTestId('model-version-id'); | ||
} | ||
|
||
findDescription() { | ||
return cy.findByTestId('model-version-description'); | ||
} | ||
|
||
findMoreLabelsButton() { | ||
return cy.findByTestId('label-group').find('button'); | ||
} | ||
|
||
findStorageURI() { | ||
return cy.findByTestId('storage-uri'); | ||
} | ||
|
||
findStorageEndpoint() { | ||
return cy.findByTestId('storage-endpoint'); | ||
} | ||
|
||
findStorageRegion() { | ||
return cy.findByTestId('storage-region'); | ||
} | ||
|
||
findStorageBucket() { | ||
return cy.findByTestId('storage-bucket'); | ||
} | ||
|
||
findStoragePath() { | ||
return cy.findByTestId('storage-path'); | ||
} | ||
|
||
shouldContainsModalLabels(labels: string[]) { | ||
cy.findByTestId('label-group').within(() => labels.map((label) => cy.contains(label))); | ||
return this; | ||
} | ||
|
||
findModelVersionDropdownButton() { | ||
return cy.findByTestId('model-version-toggle-button'); | ||
} | ||
|
||
findModelVersionDropdownSearch() { | ||
return cy.findByTestId('search-input'); | ||
} | ||
|
||
findModelVersionDropdownItem(name: string) { | ||
return cy.findByTestId('model-version-selector-list').find('li').contains(name); | ||
} | ||
|
||
findDetailsTab() { | ||
return cy.findByTestId('model-versions-details-tab'); | ||
} | ||
|
||
findRegisteredDeploymentsTab() { | ||
return cy.findByTestId('deployments-tab'); | ||
} | ||
} | ||
|
||
export const modelVersionDetails = new ModelVersionDetails(); |
Oops, something went wrong.