1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00
Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2020-10-22 13:52:50 +03:00
parent 47857f0383
commit fbb46aaade
No known key found for this signature in database
GPG Key ID: 4FB0C2329B4C6E29
2 changed files with 8 additions and 15 deletions

View File

@ -3,8 +3,6 @@ import { useOcean } from '@oceanprotocol/react'
import React, { ReactElement, useEffect, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import Loader from '../../atoms/Loader' import Loader from '../../atoms/Loader'
import Modal from '../../atoms/Modal' import Modal from '../../atoms/Modal'
import AssetList from '../../organisms/AssetList'
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/ComputeJob'
import { ComputeJobMetaData } from '@types/ComputeJobMetaData' import { ComputeJobMetaData } from '@types/ComputeJobMetaData'
import Time from '../../atoms/Time' import Time from '../../atoms/Time'
import shortid from 'shortid' import shortid from 'shortid'
@ -32,9 +30,9 @@ export default function ComputeDetailsModal({
computeJob.did, computeJob.did,
computeJob.jobId computeJob.jobId
) )
console.log(job[0])
if (job && job.length > 0) { if (job && job.length > 0) {
computeJob.algorithmLogUrl = job[0].algorithmLogUrl computeJob.algorithmLogUrl = job[0].algorithmLogUrl
//hack because ComputeJob returns resultsUrl instead of resultsUrls, issue created already
computeJob.resultsUrls = computeJob.resultsUrls =
(job[0] as any).resultsUrl !== '' ? (job[0] as any).resultsUrl : [] (job[0] as any).resultsUrl !== '' ? (job[0] as any).resultsUrl : []
} }
@ -45,7 +43,7 @@ export default function ComputeDetailsModal({
} }
} }
getDetails() getDetails()
}, [ocean, status, account, open]) }, [ocean, status, account, isOpen])
return ( return (
<Modal <Modal

View File

@ -9,6 +9,7 @@ import Button from '../../atoms/Button'
import ComputeDetailsModal from './ComputeDetailsModal' import ComputeDetailsModal from './ComputeDetailsModal'
import { ComputeJobMetaData } from '@types/ComputeJobMetaData' import { ComputeJobMetaData } from '@types/ComputeJobMetaData'
import { Link } from 'gatsby' import { Link } from 'gatsby'
import { Logger } from '@oceanprotocol/lib'
function DetailsButton({ row }: { row: ComputeJobMetaData }): ReactElement { function DetailsButton({ row }: { row: ComputeJobMetaData }): ReactElement {
const [isDialogOpen, setIsDialogOpen] = useState(false) const [isDialogOpen, setIsDialogOpen] = useState(false)
@ -84,13 +85,12 @@ export default function ComputeJobs(): ReactElement {
if (!ocean || !account) return if (!ocean || !account) return
setIsLoading(true) setIsLoading(true)
try { try {
console.log('get jobs')
const orderHistory = await ocean.assets.getOrderHistory( const orderHistory = await ocean.assets.getOrderHistory(
account, account,
'compute', 'compute',
100 100
) )
console.log('orders', orderHistory)
let jobs: ComputeJobMetaData[] = [] let jobs: ComputeJobMetaData[] = []
for (let i = 0; i < orderHistory.length; i++) { for (let i = 0; i < orderHistory.length; i++) {
@ -101,7 +101,6 @@ export default function ComputeJobs(): ReactElement {
undefined, undefined,
false false
) )
console.log(computeJob)
computeJob.forEach((item) => { computeJob.forEach((item) => {
jobs.push({ jobs.push({
did: orderHistory[i].did, did: orderHistory[i].did,
@ -111,14 +110,11 @@ export default function ComputeJobs(): ReactElement {
assetName: assetName, assetName: assetName,
status: item.status, status: item.status,
statusText: item.statusText, statusText: item.statusText,
algorithmLogUrl: item.algorithmLogUrl, algorithmLogUrl: "",
resultsUrls: resultsUrls: []
(item as any).resultsUrl !== '' ? (item as any).resultsUrl : []
}) })
}) })
} }
console.log(jobs)
jobs
setJobs( setJobs(
jobs.sort((a, b) => { jobs.sort((a, b) => {
if (a.dateCreated > b.dateCreated) return -1 if (a.dateCreated > b.dateCreated) return -1
@ -127,9 +123,8 @@ export default function ComputeJobs(): ReactElement {
}) })
) )
setUserAgreed(true) } catch (error) {
} catch (e) { Logger.log(error.message)
console.log(e)
} finally { } finally {
setIsLoading(false) setIsLoading(false)
} }