mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Feature/issue474 algorithms timeout (#483)
* timeout added for algorithm publish * publish algorithm fixes * set termsAndConditions fix Co-authored-by: claudia.holhos <claudia.holhos@hpm.ro>
This commit is contained in:
parent
1d13000772
commit
ccfb381d9d
@ -46,6 +46,16 @@
|
||||
"help": "Provide the tag for your Docker image.",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"name": "timeout",
|
||||
"label": "Timeout",
|
||||
"help": "Define how long buyers should be able to download the algorithm again after the initial purchase.",
|
||||
"placeholder": "Forever",
|
||||
"type": "select",
|
||||
"options": ["Forever", "1 day", "1 week", "1 month", "1 year"],
|
||||
"sortOptions": false,
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "entrypoint",
|
||||
"label": "Entrypoint",
|
||||
|
1
src/@types/MetaData.d.ts
vendored
1
src/@types/MetaData.d.ts
vendored
@ -48,6 +48,7 @@ export interface MetadataPublishFormAlgorithm {
|
||||
author: string
|
||||
dockerImage: string
|
||||
algorithmPrivacy: boolean
|
||||
timeout: string
|
||||
termsAndConditions: boolean
|
||||
// ---- optional fields ----
|
||||
image: string
|
||||
|
@ -100,7 +100,9 @@ export default function FormPublish(): ReactElement {
|
||||
field: FormFieldProps
|
||||
) {
|
||||
const value =
|
||||
field.type === 'checkbox' ? !JSON.parse(e.target.value) : e.target.value
|
||||
field.type === 'checkbox' || field.type === 'terms'
|
||||
? !JSON.parse(e.target.value)
|
||||
: e.target.value
|
||||
if (field.name === 'dockerImage') {
|
||||
setSelectedDockerImage(e.target.value)
|
||||
handleImageSelectChange(e.target.value)
|
||||
|
@ -159,6 +159,7 @@ export default function PublishPage({
|
||||
) => void
|
||||
): Promise<void> {
|
||||
const metadata = transformPublishAlgorithmFormToMetadata(values)
|
||||
const timeout = mapTimeoutStringToSeconds(values.timeout)
|
||||
const validDockerImage =
|
||||
values.dockerImage === 'custom image'
|
||||
? await validateDockerImage(values.image, values.containerTag)
|
||||
@ -169,7 +170,9 @@ export default function PublishPage({
|
||||
|
||||
const ddo = await publish(
|
||||
(metadata as unknown) as Metadata,
|
||||
values.algorithmPrivacy === true ? 'compute' : 'access'
|
||||
values.algorithmPrivacy === true ? 'compute' : 'access',
|
||||
undefined,
|
||||
timeout
|
||||
)
|
||||
|
||||
// Publish failed
|
||||
|
@ -10,6 +10,7 @@ export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> = Yup.
|
||||
.required('Required'),
|
||||
description: Yup.string().min(10).required('Required'),
|
||||
files: Yup.array<FileMetadata>().required('Required').nullable(),
|
||||
timeout: Yup.string().required('Required'),
|
||||
dockerImage: Yup.string()
|
||||
.matches(/node:latest|python:latest|custom image/g, {
|
||||
excludeEmptyString: true
|
||||
@ -38,5 +39,6 @@ export const initialValues: Partial<MetadataPublishFormAlgorithm> = {
|
||||
description: '',
|
||||
algorithmPrivacy: false,
|
||||
termsAndConditions: false,
|
||||
tags: ''
|
||||
tags: '',
|
||||
timeout: 'Forever'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user