1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Author metadata update (#763)

* Adding content for update author

* Updating types

* Updating DDO

* Bumping ocean.js

* Making the author optional

Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
This commit is contained in:
Jamie Hewitt 2021-08-03 17:07:51 +02:00 committed by GitHub
parent 58781ff95f
commit 46cf119afe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 3 deletions

View File

@ -44,6 +44,13 @@
"options": ["Forever", "1 day", "1 week", "1 month", "1 year"], "options": ["Forever", "1 day", "1 week", "1 month", "1 year"],
"sortOptions": false, "sortOptions": false,
"required": true "required": true
},
{
"name": "author",
"label": "New Author",
"placeholder": "e.g. Mrs McJellyfish",
"help": "Give proper attribution for your data set.",
"required": false
} }
] ]
} }

View File

@ -64,6 +64,7 @@ export interface MetadataEditForm {
timeout: string timeout: string
price?: number price?: number
links?: string | EditableMetadataLinks[] links?: string | EditableMetadataLinks[]
author?: string
} }
export interface ServiceMetadataMarket extends ServiceMetadata { export interface ServiceMetadataMarket extends ServiceMetadata {

View File

@ -105,7 +105,8 @@ export default function Edit({
const ddoEditedMetdata = await ocean.assets.editMetadata(ddo, { const ddoEditedMetdata = await ocean.assets.editMetadata(ddo, {
title: values.name, title: values.name,
description: values.description, description: values.description,
links: typeof values.links !== 'string' ? values.links : [] links: typeof values.links !== 'string' ? values.links : [],
author: values.author === '' ? ' ' : values.author
}) })
price.type === 'exchange' && price.type === 'exchange' &&

View File

@ -10,7 +10,8 @@ export const validationSchema = Yup.object().shape({
description: Yup.string().required('Required').min(10), description: Yup.string().required('Required').min(10),
price: Yup.number().required('Required'), price: Yup.number().required('Required'),
links: Yup.array<EditableMetadataLinks[]>().nullable(), links: Yup.array<EditableMetadataLinks[]>().nullable(),
timeout: Yup.string().required('Required') timeout: Yup.string().required('Required'),
author: Yup.string().nullable()
}) })
export function getInitialValues( export function getInitialValues(
@ -23,6 +24,7 @@ export function getInitialValues(
description: metadata.additionalInformation.description, description: metadata.additionalInformation.description,
price, price,
links: metadata.additionalInformation.links, links: metadata.additionalInformation.links,
timeout: secondsToString(timeout) timeout: secondsToString(timeout),
author: metadata.main.author
} }
} }