mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
add sample file during publish
This commit is contained in:
parent
16fc0aef03
commit
a3721502f5
@ -20,12 +20,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "files",
|
"name": "files",
|
||||||
"label": "Files",
|
"label": "File",
|
||||||
"placeholder": "e.g. https://file.com/file.json",
|
"placeholder": "e.g. https://file.com/file.json",
|
||||||
"help": "Please provide a URL to your data set file.",
|
"help": "Please provide a URL to your data set file.",
|
||||||
"type": "files",
|
"type": "files",
|
||||||
"required": true
|
"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",
|
"name": "access",
|
||||||
"label": "Access Type",
|
"label": "Access Type",
|
||||||
|
@ -17,6 +17,8 @@ interface ButtonProps {
|
|||||||
style?: 'primary' | 'ghost' | 'text'
|
style?: 'primary' | 'ghost' | 'text'
|
||||||
type?: 'submit'
|
type?: 'submit'
|
||||||
download?: boolean
|
download?: boolean
|
||||||
|
target?: string
|
||||||
|
rel?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Button({
|
export default function Button({
|
||||||
|
@ -6,6 +6,7 @@ import MetaItem from '../../organisms/AssetContent/MetaItem'
|
|||||||
import styles from './Preview.module.css'
|
import styles from './Preview.module.css'
|
||||||
import File from '../../atoms/File'
|
import File from '../../atoms/File'
|
||||||
import { MetadataPublishForm } from '../../../@types/MetaData'
|
import { MetadataPublishForm } from '../../../@types/MetaData'
|
||||||
|
import Button from '../../atoms/Button'
|
||||||
|
|
||||||
export default function Preview({
|
export default function Preview({
|
||||||
values
|
values
|
||||||
@ -25,6 +26,18 @@ export default function Preview({
|
|||||||
small
|
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(',')} />}
|
{values.tags && <Tags items={values.tags.split(',')} />}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@ -37,6 +50,7 @@ export default function Preview({
|
|||||||
key.includes('description') ||
|
key.includes('description') ||
|
||||||
key.includes('tags') ||
|
key.includes('tags') ||
|
||||||
key.includes('files') ||
|
key.includes('files') ||
|
||||||
|
key.includes('links') ||
|
||||||
key.includes('termsAndConditions') ||
|
key.includes('termsAndConditions') ||
|
||||||
key.includes('price') ||
|
key.includes('price') ||
|
||||||
value === undefined ||
|
value === undefined ||
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { ReactElement, useEffect, FormEvent } from 'react'
|
import React, { ReactElement, useEffect, FormEvent } from 'react'
|
||||||
import styles from './PublishForm.module.css'
|
import styles from './PublishForm.module.css'
|
||||||
import { useOcean, usePublish } from '@oceanprotocol/react'
|
import { useOcean } from '@oceanprotocol/react'
|
||||||
import { useFormikContext, Form, Field } from 'formik'
|
import { useFormikContext, Form, Field } from 'formik'
|
||||||
import Input from '../../atoms/Input'
|
import Input from '../../atoms/Input'
|
||||||
import Button from '../../atoms/Button'
|
import Button from '../../atoms/Button'
|
||||||
@ -25,7 +25,6 @@ export default function PublishForm({
|
|||||||
setErrors,
|
setErrors,
|
||||||
setTouched,
|
setTouched,
|
||||||
resetForm,
|
resetForm,
|
||||||
setValues,
|
|
||||||
initialValues
|
initialValues
|
||||||
} = useFormikContext()
|
} = useFormikContext()
|
||||||
const formName = 'ocean-publish-form'
|
const formName = 'ocean-publish-form'
|
||||||
|
@ -27,12 +27,6 @@ export default function PublishPage({
|
|||||||
values: MetadataPublishForm,
|
values: MetadataPublishForm,
|
||||||
resetForm: () => void
|
resetForm: () => void
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// console.log(`
|
|
||||||
// Collected form values:
|
|
||||||
// ----------------------
|
|
||||||
// ${JSON.stringify(values, null, 2)}
|
|
||||||
// `)
|
|
||||||
|
|
||||||
const metadata = transformPublishFormToMetadata(values)
|
const metadata = transformPublishFormToMetadata(values)
|
||||||
const {
|
const {
|
||||||
tokensToMint,
|
tokensToMint,
|
||||||
@ -42,13 +36,6 @@ export default function PublishPage({
|
|||||||
} = values.price
|
} = values.price
|
||||||
const serviceType = values.access === 'Download' ? 'access' : 'compute'
|
const serviceType = values.access === 'Download' ? 'access' : 'compute'
|
||||||
|
|
||||||
// console.log(`
|
|
||||||
// Transformed metadata values:
|
|
||||||
// ----------------------
|
|
||||||
// ${JSON.stringify(metadata, null, 2)}
|
|
||||||
// Tokens to mint: ${tokensToMint}
|
|
||||||
// `)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// mpAddress and mpFee are not yet implemented in ocean js so are not uset
|
// mpAddress and mpFee are not yet implemented in ocean js so are not uset
|
||||||
const ddo = await publish(
|
const ddo = await publish(
|
||||||
|
Loading…
Reference in New Issue
Block a user