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 Loader from '../../atoms/Loader'
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 Time from '../../atoms/Time'
import shortid from 'shortid'
@ -32,9 +30,9 @@ export default function ComputeDetailsModal({
computeJob.did,
computeJob.jobId
)
console.log(job[0])
if (job && job.length > 0) {
computeJob.algorithmLogUrl = job[0].algorithmLogUrl
//hack because ComputeJob returns resultsUrl instead of resultsUrls, issue created already
computeJob.resultsUrls =
(job[0] as any).resultsUrl !== '' ? (job[0] as any).resultsUrl : []
}
@ -45,7 +43,7 @@ export default function ComputeDetailsModal({
}
}
getDetails()
}, [ocean, status, account, open])
}, [ocean, status, account, isOpen])
return (
<Modal

View File

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