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

displayed Docker Image, used MetadataMain type interface for asset type

This commit is contained in:
Norbi 2021-02-25 20:15:42 +02:00
parent bee7c1ecbf
commit 042e40eeb6
2 changed files with 15 additions and 4 deletions

View File

@ -6,7 +6,15 @@ import Publisher from '../../atoms/Publisher'
import { useAsset } from '../../../providers/Asset'
export default function MetaFull(): ReactElement {
const { ddo, metadata, isInPurgatory } = useAsset()
const { ddo, metadata, isInPurgatory, type } = useAsset()
function DockerImage() {
const algorithmContainer = ddo.findServiceByType('metadata').attributes.main
.algorithm.container
const { image } = algorithmContainer
const { tag } = algorithmContainer
return <span>{`${image}:${tag}`}</span>
}
return (
<div className={styles.metaFull}>
@ -17,6 +25,9 @@ export default function MetaFull(): ReactElement {
title="Owner"
content={<Publisher account={ddo?.publicKey[0].owner} />}
/>
{type === 'algorithm' && (
<MetaItem title="Docker Image" content={<DockerImage />} />
)}
{/* <MetaItem
title="Data Created"
content={<Time date={metadata?.main.dateCreated} />}

View File

@ -7,7 +7,7 @@ import React, {
useCallback,
ReactNode
} from 'react'
import { Logger, DDO, BestPrice } from '@oceanprotocol/lib'
import { Logger, DDO, BestPrice, MetadataMain } from '@oceanprotocol/lib'
import { PurgatoryData } from '@oceanprotocol/lib/dist/node/ddo/interfaces/PurgatoryData'
import { getDataTokenPrice, useOcean } from '@oceanprotocol/react'
import getAssetPurgatoryData from '../utils/purgatory'
@ -25,7 +25,7 @@ interface AssetProviderValue {
title: string | undefined
owner: string | undefined
price: BestPrice | undefined
type: 'dataset' | 'algorithm' | undefined
type: MetadataMain['type'] | undefined
error?: string
refreshInterval: number
refreshDdo: (token?: CancelToken) => Promise<void>
@ -53,7 +53,7 @@ function AssetProvider({
const [price, setPrice] = useState<BestPrice>()
const [owner, setOwner] = useState<string>()
const [error, setError] = useState<string>()
const [type, setType] = useState<string>()
const [type, setType] = useState<MetadataMain['type']>()
const refreshPrice = useCallback(async () => {
if (