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

history working withough signature

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2020-10-22 13:37:56 +03:00
parent 946a80ed82
commit 7c228a57c0
No known key found for this signature in database
GPG Key ID: 4FB0C2329B4C6E29
5 changed files with 37 additions and 10 deletions

6
package-lock.json generated
View File

@ -4462,9 +4462,9 @@
"integrity": "sha512-LING+GvW37I0L40rZdPCZ1SvcZurDSGGhT0WOVPNO8oyh2C3bXModDBNE4+gCFa8pTbQBOc4ot1/Zoj9PfT/zA=="
},
"@oceanprotocol/lib": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.7.1.tgz",
"integrity": "sha512-vwwyFrygmH08gWA3OQESG7ZggEX0wfgnAYK9s9xWKhwi0IiRbNu3a25joCebXlENoEUIF7QRChBFeAlqV2OW0w==",
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.7.3.tgz",
"integrity": "sha512-P+ImSOtNz2iDmYXVWutviBwxfFSY/zql362K+FZz3NQt4wYaMrCIiPALR2IF3/9v2FA2g9itTC7eGvWO7bfxqw==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/contracts": "^0.5.6",

View File

@ -22,7 +22,7 @@
"@coingecko/cryptoformat": "^0.4.2",
"@loadable/component": "5.13.1",
"@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.7.1",
"@oceanprotocol/lib": "^0.7.3",
"@oceanprotocol/react": "^0.3.2",
"@oceanprotocol/typographies": "^0.1.0",
"@sindresorhus/slugify": "^1.0.0",

View File

@ -1,4 +1,5 @@
export interface ComputeJobMetaData {
jobId: string
did: string
dateCreated: string
dateFinished: string

View File

@ -7,6 +7,7 @@ import BaseDialog from '../../atoms/BaseDialog'
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/ComputeJob'
import { ComputeJobMetaData } from '@types/ComputeJobMetaData'
import Time from '../../atoms/Time'
import shortid from 'shortid'
export default function ComputeDetailsModal({
computeJob,
@ -17,13 +18,28 @@ export default function ComputeDetailsModal({
open: boolean
onClose: () => void
}): ReactElement {
const { ocean, status, accountId } = useOcean()
const { ocean, status, account } = useOcean()
const [isLoading, setIsLoading] = useState(false)
useEffect(() => {
async function getDetails() {
if (!accountId || !ocean || !computeJob) return
console.log('open', open)
if (!account || !ocean || !computeJob || !open) return
console.log('open', open)
try {
setIsLoading(true)
const job = await ocean.compute.status(
account,
computeJob.did,
computeJob.jobId
)
console.log(job[0])
if (job && job.length > 0) {
computeJob.algorithmLogUrl = job[0].algorithmLogUrl
computeJob.resultsUrls =
(job[0] as any).resultsUrl !== '' ? (job[0] as any).resultsUrl : []
}
} catch (error) {
Logger.error(error.message)
} finally {
@ -31,7 +47,7 @@ export default function ComputeDetailsModal({
}
}
getDetails()
}, [ocean, status, accountId])
}, [ocean, status, account, open])
return (
<BaseDialog open={open} onClose={onClose} title="Compute job details">
@ -50,7 +66,7 @@ export default function ComputeDetailsModal({
<p>{computeJob.algorithmLogUrl}</p>
<p>
{computeJob.resultsUrls?.map((url) => {
return <span>{url}</span>
return <span key={shortid.generate()}>{url}</span>
})}{' '}
</p>
</>

View File

@ -98,12 +98,15 @@ export default function ComputeJobs(): ReactElement {
const assetName = await getTitle(orderHistory[i].did)
const computeJob = await ocean.compute.status(
account,
orderHistory[i].did
orderHistory[i].did,
undefined,
false
)
console.log(computeJob)
computeJob.forEach((item) => {
jobs.push({
did: orderHistory[i].did,
jobId: item.jobId,
dateCreated: item.dateCreated,
dateFinished: item.dateFinished,
assetName: assetName,
@ -116,7 +119,14 @@ export default function ComputeJobs(): ReactElement {
})
}
console.log(jobs)
setJobs(jobs)
jobs
setJobs(
jobs.sort((a, b) => {
if (a.dateCreated > b.dateCreated) return -1
if (a.dateCreated < b.dateCreated) return 1
return 0
})
)
setUserAgreed(true)
} catch (e) {