-
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.
Set up model registry context and apiHooks (#360)
* Set up model registry context and apiHooks Signed-off-by: lucferbux <[email protected]> * Add selector core loader Signed-off-by: lucferbux <[email protected]> --------- Signed-off-by: lucferbux <[email protected]>
- Loading branch information
Showing
51 changed files
with
2,341 additions
and
306 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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ModelArtifact, ModelArtifactState } 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', | ||
customProperties: {}, | ||
uri, | ||
state, | ||
author, | ||
modelFormatName: 'test', | ||
storageKey: 'test', | ||
storagePath: 'test', | ||
modelFormatVersion: 'test', | ||
serviceAccountName: 'test', | ||
artifactType: 'test', | ||
}); |
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,17 @@ | ||
import { ModelRegistry } from '~/app/types'; | ||
|
||
type MockModelRegistry = { | ||
name?: string; | ||
description?: string; | ||
displayName?: string; | ||
}; | ||
|
||
export const mockModelRegistry = ({ | ||
name = 'modelregistry-sample', | ||
description = 'New model registry', | ||
displayName = 'Model Registry Sample', | ||
}: MockModelRegistry): ModelRegistry => ({ | ||
name, | ||
description, | ||
displayName, | ||
}); |
8 changes: 8 additions & 0 deletions
8
clients/ui/frontend/src/__mocks__/mockModelRegistryResponse.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,8 @@ | ||
/* eslint-disable camelcase */ | ||
import { ModelRegistryResponse } from '~/app/types'; | ||
|
||
export const mockModelRegistryResponse = ({ | ||
model_registry = [], | ||
}: Partial<ModelRegistryResponse>): ModelRegistryResponse => ({ | ||
model_registry, | ||
}); |
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,36 @@ | ||
import { ModelVersion, ModelState } from '~/app/types'; | ||
import { createModelRegistryLabelsObject } from './utils'; | ||
|
||
type MockModelVersionType = { | ||
author?: string; | ||
id?: string; | ||
registeredModelId?: string; | ||
name?: string; | ||
labels?: string[]; | ||
state?: ModelState; | ||
description?: string; | ||
createTimeSinceEpoch?: string; | ||
lastUpdateTimeSinceEpoch?: string; | ||
}; | ||
|
||
export const mockModelVersion = ({ | ||
author = 'Test author', | ||
registeredModelId = '1', | ||
name = 'new model version', | ||
labels = [], | ||
id = '1', | ||
state = ModelState.LIVE, | ||
description = 'Description of model version', | ||
createTimeSinceEpoch = '1712234877179', | ||
lastUpdateTimeSinceEpoch = '1712234877179', | ||
}: MockModelVersionType): ModelVersion => ({ | ||
author, | ||
createTimeSinceEpoch, | ||
customProperties: createModelRegistryLabelsObject(labels), | ||
id, | ||
lastUpdateTimeSinceEpoch, | ||
name, | ||
state, | ||
registeredModelId, | ||
description, | ||
}); |
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 { ModelVersionList } from '~/app/types'; | ||
|
||
export const mockModelVersionList = ({ | ||
items = [], | ||
}: Partial<ModelVersionList>): ModelVersionList => ({ | ||
items, | ||
nextPageToken: '', | ||
pageSize: 0, | ||
size: items.length, | ||
}); |
53 changes: 53 additions & 0 deletions
53
clients/ui/frontend/src/__mocks__/mockRegisteredModelsList.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,53 @@ | ||
import { RegisteredModelList } from '~/app/types'; | ||
import { mockRegisteredModel } from './mockRegisteredModel'; | ||
|
||
export const mockRegisteredModelList = ({ | ||
size = 5, | ||
items = [ | ||
mockRegisteredModel({ name: 'test-1' }), | ||
mockRegisteredModel({ name: 'test-2' }), | ||
mockRegisteredModel({ | ||
name: 'Fraud detection model', | ||
description: | ||
'A machine learning model trained to detect fraudulent transactions in financial data', | ||
labels: [ | ||
'Financial data', | ||
'Fraud detection', | ||
'Test label', | ||
'Machine learning', | ||
'Next data to be overflow', | ||
], | ||
}), | ||
mockRegisteredModel({ | ||
name: 'Credit Scoring', | ||
labels: [ | ||
'Credit Score Predictor', | ||
'Creditworthiness scoring system', | ||
'Default Risk Analyzer', | ||
'Portfolio Management', | ||
'Risk Assessment', | ||
], | ||
}), | ||
mockRegisteredModel({ | ||
name: 'Label modal', | ||
description: | ||
'A machine learning model trained to detect fraudulent transactions in financial data', | ||
labels: [ | ||
'Testing label', | ||
'Financial data', | ||
'Fraud detection', | ||
'Long label data to be truncated abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc', | ||
'Machine learning', | ||
'Next data to be overflow', | ||
'Label x', | ||
'Label y', | ||
'Label z', | ||
], | ||
}), | ||
], | ||
}: Partial<RegisteredModelList>): RegisteredModelList => ({ | ||
items, | ||
nextPageToken: '', | ||
pageSize: 0, | ||
size, | ||
}); |
45 changes: 45 additions & 0 deletions
45
clients/ui/frontend/src/__tests__/cypress/cypress/pages/appChrome.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,45 @@ | ||
class AppChrome { | ||
visit() { | ||
cy.visit('/'); | ||
this.wait(); | ||
} | ||
|
||
private wait() { | ||
cy.get('#dashboard-page-main'); | ||
cy.testA11y(); | ||
} | ||
|
||
// TODO: implement when authorization is enabled | ||
// shouldBeUnauthorized() { | ||
// cy.findByTestId('unauthorized-error'); | ||
// return this; | ||
// } | ||
|
||
findNavToggle() { | ||
return cy.get('#page-nav-toggle'); | ||
} | ||
|
||
findSideBar() { | ||
return cy.get('#page-sidebar'); | ||
} | ||
|
||
findNavSection(name: string) { | ||
return this.findSideBar().findByRole('button', { name }); | ||
} | ||
|
||
findNavItem(name: string, section?: string) { | ||
if (section) { | ||
this.findNavSection(section) | ||
// do not fail if the section is not found | ||
.should('have.length.at.least', 0) | ||
.then(($el) => { | ||
if ($el.attr('aria-expanded') === 'false') { | ||
cy.wrap($el).click(); | ||
} | ||
}); | ||
} | ||
return this.findSideBar().findByRole('link', { name }); | ||
} | ||
} | ||
|
||
export const appChrome = new AppChrome(); |
11 changes: 0 additions & 11 deletions
11
clients/ui/frontend/src/__tests__/cypress/cypress/pages/home.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.