-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up model registry context and apiHooks #360
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ module.exports = merge(common('development'), { | |
host: HOST, | ||
port: PORT, | ||
historyApiFallback: true, | ||
open: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just removed the auto open, we disabled it in other projects cause some people in the community tend to dislike it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks... auto open drives me nuts because I'm lame and use Safari as my default browser but like to develop in chrome :D |
||
static: { | ||
directory: path.resolve(relativeDir, 'dist'), | ||
}, | ||
|
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', | ||
}); |
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, | ||
}); |
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, | ||
}); |
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, | ||
}); |
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, | ||
}); |
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, | ||
}); |
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(); |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcreasy @ederign @Griffin-Sullivan I've just updated this enpoint cause it wasn't using the api specification and it was making the dev env to fail, I can leave this out of the PR if you guys wanna add it into other PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this, but could you update the BFF readme so the examples are correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks a lot for the review!!