1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-07-01 06:11:43 +02:00

add sample file during publish

This commit is contained in:
Matthias Kretschmann 2020-09-02 12:22:48 +02:00
parent 16fc0aef03
commit a3721502f5
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 25 additions and 16 deletions

View File

@ -20,12 +20,19 @@
},
{
"name": "files",
"label": "Files",
"label": "File",
"placeholder": "e.g. https://file.com/file.json",
"help": "Please provide a URL to your data set file.",
"type": "files",
"required": true
},
{
"name": "links",
"label": "Sample file",
"placeholder": "e.g. https://file.com/samplefile.json",
"help": "Please provide a URL to a sample of your data set file. This file should reveal the data structure of your data set, e.g. by including the header and one line of a CSV file.",
"type": "files"
},
{
"name": "access",
"label": "Access Type",

View File

@ -17,6 +17,8 @@ interface ButtonProps {
style?: 'primary' | 'ghost' | 'text'
type?: 'submit'
download?: boolean
target?: string
rel?: string
}
export default function Button({

View File

@ -6,6 +6,7 @@ import MetaItem from '../../organisms/AssetContent/MetaItem'
import styles from './Preview.module.css'
import File from '../../atoms/File'
import { MetadataPublishForm } from '../../../@types/MetaData'
import Button from '../../atoms/Button'
export default function Preview({
values
@ -25,6 +26,18 @@ export default function Preview({
small
/>
)}
{values.links && values.links.length && (
<Button
href={(values.links[0] as FileMetadata).url}
target="_blank"
rel="noreferrer"
download
style="text"
size="small"
>
Download Sample
</Button>
)}
{values.tags && <Tags items={values.tags.split(',')} />}
</header>
@ -37,6 +50,7 @@ export default function Preview({
key.includes('description') ||
key.includes('tags') ||
key.includes('files') ||
key.includes('links') ||
key.includes('termsAndConditions') ||
key.includes('price') ||
value === undefined ||

View File

@ -1,6 +1,6 @@
import React, { ReactElement, useEffect, FormEvent } from 'react'
import styles from './PublishForm.module.css'
import { useOcean, usePublish } from '@oceanprotocol/react'
import { useOcean } from '@oceanprotocol/react'
import { useFormikContext, Form, Field } from 'formik'
import Input from '../../atoms/Input'
import Button from '../../atoms/Button'
@ -25,7 +25,6 @@ export default function PublishForm({
setErrors,
setTouched,
resetForm,
setValues,
initialValues
} = useFormikContext()
const formName = 'ocean-publish-form'

View File

@ -27,12 +27,6 @@ export default function PublishPage({
values: MetadataPublishForm,
resetForm: () => void
): Promise<void> {
// console.log(`
// Collected form values:
// ----------------------
// ${JSON.stringify(values, null, 2)}
// `)
const metadata = transformPublishFormToMetadata(values)
const {
tokensToMint,
@ -42,13 +36,6 @@ export default function PublishPage({
} = values.price
const serviceType = values.access === 'Download' ? 'access' : 'compute'
// console.log(`
// Transformed metadata values:
// ----------------------
// ${JSON.stringify(metadata, null, 2)}
// Tokens to mint: ${tokensToMint}
// `)
try {
// mpAddress and mpFee are not yet implemented in ocean js so are not uset
const ddo = await publish(