1
0
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:
Matthias Kretschmann 2021-03-09 19:16:42 +01:00
commit e180ab0085
Signed by: m
GPG Key ID: 606EEEF3C479A91F
7 changed files with 7712 additions and 8971 deletions

View File

@ -20,6 +20,13 @@
"rows": 10,
"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",
"label": "Timeout",

16583
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,8 +27,8 @@
"@coingecko/cryptoformat": "^0.4.2",
"@loadable/component": "^5.14.1",
"@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.10.1",
"@oceanprotocol/react": "^0.5.1",
"@oceanprotocol/lib": "^0.11.4",
"@oceanprotocol/react": "^0.5.5",
"@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^3.0.3",
"@sindresorhus/slugify": "^1.0.0",

View File

@ -36,7 +36,7 @@ export interface MetadataPublishFormDataset {
termsAndConditions: boolean
// ---- optional fields ----
tags?: string
links?: string | File[]
links?: string | EditableMetadataLinks[]
}
export interface MetadataPublishFormAlgorithm {
@ -55,6 +55,13 @@ export interface MetadataPublishFormAlgorithm {
tags?: string
}
export interface MetadataEditForm {
name: string
description: string
timeout: string
links?: string | EditableMetadataLinks[]
}
export interface ServiceMetadataMarket extends ServiceMetadata {
attributes: MetadataMarket
}

View File

@ -150,41 +150,41 @@ function Title({ row }: { row: TransactionHistoryPoolTransactions }) {
) : null
}
function getColumns(minimal?: boolean) {
return [
{
name: 'Title',
selector: function getTitleRow(row: TransactionHistoryPoolTransactions) {
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'
const columns = [
{
name: 'Title',
selector: function getTitleRow(row: TransactionHistoryPoolTransactions) {
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} />
}
},
{
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({
poolAddress,
@ -214,7 +214,7 @@ export default function PoolTransactions({
return (
<Table
columns={getColumns(minimal)}
columns={minimal ? columnsMinimal : columns}
data={logs}
isLoading={loading}
noTableHead={minimal}

View File

@ -1,7 +1,7 @@
import { useOcean } from '@oceanprotocol/react'
import { Formik } from 'formik'
import React, { ReactElement, useState } from 'react'
import { MetadataPublishFormDataset } from '../../../../@types/MetaData'
import { MetadataEditForm } from '../../../../@types/MetaData'
import {
validationSchema,
getInitialValues
@ -66,14 +66,15 @@ export default function Edit({
const hasFeedback = error || success
async function handleSubmit(
values: Partial<MetadataPublishFormDataset>,
values: Partial<MetadataEditForm>,
resetForm: () => void
) {
try {
// Construct new DDO with new values
const ddoEditedMetdata = await ocean.assets.editMetadata(ddo, {
title: values.name,
description: values.description
description: values.description,
links: typeof values.links !== 'string' ? values.links : []
})
if (!ddoEditedMetdata) {

View File

@ -1,5 +1,6 @@
import { MetadataMarket, MetadataPublishFormDataset } from '../@types/MetaData'
import { secondsToString } from '../utils/metadata'
import { EditableMetadataLinks } from '@oceanprotocol/lib'
import * as Yup from 'yup'
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`)
.required('Required'),
description: Yup.string().required('Required').min(10),
links: Yup.array<EditableMetadataLinks[]>().nullable(),
timeout: Yup.string().required('Required')
})
@ -17,6 +19,7 @@ export function getInitialValues(
return {
name: metadata.main.name,
description: metadata.additionalInformation.description,
links: metadata.additionalInformation.links,
timeout: secondsToString(timeout)
}
}