mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge branch 'main' into feature/compute
This commit is contained in:
commit
e180ab0085
@ -20,6 +20,13 @@
|
|||||||
"rows": 10,
|
"rows": 10,
|
||||||
"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. This file URL will be publicly available after publishing.",
|
||||||
|
"type": "files"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "timeout",
|
"name": "timeout",
|
||||||
"label": "Timeout",
|
"label": "Timeout",
|
||||||
|
16583
package-lock.json
generated
16583
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,8 +27,8 @@
|
|||||||
"@coingecko/cryptoformat": "^0.4.2",
|
"@coingecko/cryptoformat": "^0.4.2",
|
||||||
"@loadable/component": "^5.14.1",
|
"@loadable/component": "^5.14.1",
|
||||||
"@oceanprotocol/art": "^3.0.0",
|
"@oceanprotocol/art": "^3.0.0",
|
||||||
"@oceanprotocol/lib": "^0.10.1",
|
"@oceanprotocol/lib": "^0.11.4",
|
||||||
"@oceanprotocol/react": "^0.5.1",
|
"@oceanprotocol/react": "^0.5.5",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@portis/web3": "^3.0.3",
|
"@portis/web3": "^3.0.3",
|
||||||
"@sindresorhus/slugify": "^1.0.0",
|
"@sindresorhus/slugify": "^1.0.0",
|
||||||
|
9
src/@types/MetaData.d.ts
vendored
9
src/@types/MetaData.d.ts
vendored
@ -36,7 +36,7 @@ export interface MetadataPublishFormDataset {
|
|||||||
termsAndConditions: boolean
|
termsAndConditions: boolean
|
||||||
// ---- optional fields ----
|
// ---- optional fields ----
|
||||||
tags?: string
|
tags?: string
|
||||||
links?: string | File[]
|
links?: string | EditableMetadataLinks[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MetadataPublishFormAlgorithm {
|
export interface MetadataPublishFormAlgorithm {
|
||||||
@ -55,6 +55,13 @@ export interface MetadataPublishFormAlgorithm {
|
|||||||
tags?: string
|
tags?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MetadataEditForm {
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
timeout: string
|
||||||
|
links?: string | EditableMetadataLinks[]
|
||||||
|
}
|
||||||
|
|
||||||
export interface ServiceMetadataMarket extends ServiceMetadata {
|
export interface ServiceMetadataMarket extends ServiceMetadata {
|
||||||
attributes: MetadataMarket
|
attributes: MetadataMarket
|
||||||
}
|
}
|
||||||
|
@ -150,41 +150,41 @@ function Title({ row }: { row: TransactionHistoryPoolTransactions }) {
|
|||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
function getColumns(minimal?: boolean) {
|
const columns = [
|
||||||
return [
|
{
|
||||||
{
|
name: 'Title',
|
||||||
name: 'Title',
|
selector: function getTitleRow(row: TransactionHistoryPoolTransactions) {
|
||||||
selector: function getTitleRow(row: TransactionHistoryPoolTransactions) {
|
return <Title row={row} />
|
||||||
return <Title row={row} />
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Data Set',
|
|
||||||
selector: function getAssetRow(row: TransactionHistoryPoolTransactions) {
|
|
||||||
const did = web3.utils
|
|
||||||
.toChecksumAddress(row.poolAddress.datatokenAddress)
|
|
||||||
.replace('0x', 'did:op:')
|
|
||||||
|
|
||||||
return <AssetTitle did={did} />
|
|
||||||
},
|
|
||||||
omit: minimal
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Time',
|
|
||||||
selector: function getTimeRow(row: TransactionHistoryPoolTransactions) {
|
|
||||||
return (
|
|
||||||
<Time
|
|
||||||
className={styles.time}
|
|
||||||
date={row.timestamp.toString()}
|
|
||||||
relative
|
|
||||||
isUnix
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
maxWidth: '10rem'
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
}
|
{
|
||||||
|
name: 'Data Set',
|
||||||
|
selector: function getAssetRow(row: TransactionHistoryPoolTransactions) {
|
||||||
|
const did = web3.utils
|
||||||
|
.toChecksumAddress(row.poolAddress.datatokenAddress)
|
||||||
|
.replace('0x', 'did:op:')
|
||||||
|
|
||||||
|
return <AssetTitle did={did} />
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Time',
|
||||||
|
selector: function getTimeRow(row: TransactionHistoryPoolTransactions) {
|
||||||
|
return (
|
||||||
|
<Time
|
||||||
|
className={styles.time}
|
||||||
|
date={row.timestamp.toString()}
|
||||||
|
relative
|
||||||
|
isUnix
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
maxWidth: '10rem'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// hack! if we use a function to omit one field this will display a strange refresh to the enduser for each row
|
||||||
|
const columnsMinimal = [columns[0], columns[2]]
|
||||||
|
|
||||||
export default function PoolTransactions({
|
export default function PoolTransactions({
|
||||||
poolAddress,
|
poolAddress,
|
||||||
@ -214,7 +214,7 @@ export default function PoolTransactions({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
columns={getColumns(minimal)}
|
columns={minimal ? columnsMinimal : columns}
|
||||||
data={logs}
|
data={logs}
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
noTableHead={minimal}
|
noTableHead={minimal}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useOcean } from '@oceanprotocol/react'
|
import { useOcean } from '@oceanprotocol/react'
|
||||||
import { Formik } from 'formik'
|
import { Formik } from 'formik'
|
||||||
import React, { ReactElement, useState } from 'react'
|
import React, { ReactElement, useState } from 'react'
|
||||||
import { MetadataPublishFormDataset } from '../../../../@types/MetaData'
|
import { MetadataEditForm } from '../../../../@types/MetaData'
|
||||||
import {
|
import {
|
||||||
validationSchema,
|
validationSchema,
|
||||||
getInitialValues
|
getInitialValues
|
||||||
@ -66,14 +66,15 @@ export default function Edit({
|
|||||||
const hasFeedback = error || success
|
const hasFeedback = error || success
|
||||||
|
|
||||||
async function handleSubmit(
|
async function handleSubmit(
|
||||||
values: Partial<MetadataPublishFormDataset>,
|
values: Partial<MetadataEditForm>,
|
||||||
resetForm: () => void
|
resetForm: () => void
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
// Construct new DDO with new values
|
// Construct new DDO with new values
|
||||||
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 : []
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!ddoEditedMetdata) {
|
if (!ddoEditedMetdata) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { MetadataMarket, MetadataPublishFormDataset } from '../@types/MetaData'
|
import { MetadataMarket, MetadataPublishFormDataset } from '../@types/MetaData'
|
||||||
import { secondsToString } from '../utils/metadata'
|
import { secondsToString } from '../utils/metadata'
|
||||||
|
import { EditableMetadataLinks } from '@oceanprotocol/lib'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
export const validationSchema = Yup.object().shape({
|
export const validationSchema = Yup.object().shape({
|
||||||
@ -7,6 +8,7 @@ export const validationSchema = Yup.object().shape({
|
|||||||
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
||||||
.required('Required'),
|
.required('Required'),
|
||||||
description: Yup.string().required('Required').min(10),
|
description: Yup.string().required('Required').min(10),
|
||||||
|
links: Yup.array<EditableMetadataLinks[]>().nullable(),
|
||||||
timeout: Yup.string().required('Required')
|
timeout: Yup.string().required('Required')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -17,6 +19,7 @@ export function getInitialValues(
|
|||||||
return {
|
return {
|
||||||
name: metadata.main.name,
|
name: metadata.main.name,
|
||||||
description: metadata.additionalInformation.description,
|
description: metadata.additionalInformation.description,
|
||||||
|
links: metadata.additionalInformation.links,
|
||||||
timeout: secondsToString(timeout)
|
timeout: secondsToString(timeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user