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:
parent
946a80ed82
commit
7c228a57c0
6
package-lock.json
generated
6
package-lock.json
generated
@ -4462,9 +4462,9 @@
|
|||||||
"integrity": "sha512-LING+GvW37I0L40rZdPCZ1SvcZurDSGGhT0WOVPNO8oyh2C3bXModDBNE4+gCFa8pTbQBOc4ot1/Zoj9PfT/zA=="
|
"integrity": "sha512-LING+GvW37I0L40rZdPCZ1SvcZurDSGGhT0WOVPNO8oyh2C3bXModDBNE4+gCFa8pTbQBOc4ot1/Zoj9PfT/zA=="
|
||||||
},
|
},
|
||||||
"@oceanprotocol/lib": {
|
"@oceanprotocol/lib": {
|
||||||
"version": "0.7.1",
|
"version": "0.7.3",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.7.3.tgz",
|
||||||
"integrity": "sha512-vwwyFrygmH08gWA3OQESG7ZggEX0wfgnAYK9s9xWKhwi0IiRbNu3a25joCebXlENoEUIF7QRChBFeAlqV2OW0w==",
|
"integrity": "sha512-P+ImSOtNz2iDmYXVWutviBwxfFSY/zql362K+FZz3NQt4wYaMrCIiPALR2IF3/9v2FA2g9itTC7eGvWO7bfxqw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ethereum-navigator/navigator": "^0.5.0",
|
"@ethereum-navigator/navigator": "^0.5.0",
|
||||||
"@oceanprotocol/contracts": "^0.5.6",
|
"@oceanprotocol/contracts": "^0.5.6",
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"@coingecko/cryptoformat": "^0.4.2",
|
"@coingecko/cryptoformat": "^0.4.2",
|
||||||
"@loadable/component": "5.13.1",
|
"@loadable/component": "5.13.1",
|
||||||
"@oceanprotocol/art": "^3.0.0",
|
"@oceanprotocol/art": "^3.0.0",
|
||||||
"@oceanprotocol/lib": "^0.7.1",
|
"@oceanprotocol/lib": "^0.7.3",
|
||||||
"@oceanprotocol/react": "^0.3.2",
|
"@oceanprotocol/react": "^0.3.2",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@sindresorhus/slugify": "^1.0.0",
|
"@sindresorhus/slugify": "^1.0.0",
|
||||||
|
1
src/@types/ComputeJobMetaData.d.ts
vendored
1
src/@types/ComputeJobMetaData.d.ts
vendored
@ -1,4 +1,5 @@
|
|||||||
export interface ComputeJobMetaData {
|
export interface ComputeJobMetaData {
|
||||||
|
jobId: string
|
||||||
did: string
|
did: string
|
||||||
dateCreated: string
|
dateCreated: string
|
||||||
dateFinished: string
|
dateFinished: string
|
||||||
|
@ -7,6 +7,7 @@ import BaseDialog from '../../atoms/BaseDialog'
|
|||||||
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/ComputeJob'
|
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'
|
||||||
|
|
||||||
export default function ComputeDetailsModal({
|
export default function ComputeDetailsModal({
|
||||||
computeJob,
|
computeJob,
|
||||||
@ -17,13 +18,28 @@ export default function ComputeDetailsModal({
|
|||||||
open: boolean
|
open: boolean
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { ocean, status, accountId } = useOcean()
|
const { ocean, status, account } = useOcean()
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getDetails() {
|
async function getDetails() {
|
||||||
if (!accountId || !ocean || !computeJob) return
|
console.log('open', open)
|
||||||
|
if (!account || !ocean || !computeJob || !open) return
|
||||||
|
|
||||||
|
console.log('open', open)
|
||||||
try {
|
try {
|
||||||
setIsLoading(true)
|
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) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
Logger.error(error.message)
|
||||||
} finally {
|
} finally {
|
||||||
@ -31,7 +47,7 @@ export default function ComputeDetailsModal({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getDetails()
|
getDetails()
|
||||||
}, [ocean, status, accountId])
|
}, [ocean, status, account, open])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseDialog open={open} onClose={onClose} title="Compute job details">
|
<BaseDialog open={open} onClose={onClose} title="Compute job details">
|
||||||
@ -50,7 +66,7 @@ export default function ComputeDetailsModal({
|
|||||||
<p>{computeJob.algorithmLogUrl}</p>
|
<p>{computeJob.algorithmLogUrl}</p>
|
||||||
<p>
|
<p>
|
||||||
{computeJob.resultsUrls?.map((url) => {
|
{computeJob.resultsUrls?.map((url) => {
|
||||||
return <span>{url}</span>
|
return <span key={shortid.generate()}>{url}</span>
|
||||||
})}{' '}
|
})}{' '}
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
|
@ -98,12 +98,15 @@ export default function ComputeJobs(): ReactElement {
|
|||||||
const assetName = await getTitle(orderHistory[i].did)
|
const assetName = await getTitle(orderHistory[i].did)
|
||||||
const computeJob = await ocean.compute.status(
|
const computeJob = await ocean.compute.status(
|
||||||
account,
|
account,
|
||||||
orderHistory[i].did
|
orderHistory[i].did,
|
||||||
|
undefined,
|
||||||
|
false
|
||||||
)
|
)
|
||||||
console.log(computeJob)
|
console.log(computeJob)
|
||||||
computeJob.forEach((item) => {
|
computeJob.forEach((item) => {
|
||||||
jobs.push({
|
jobs.push({
|
||||||
did: orderHistory[i].did,
|
did: orderHistory[i].did,
|
||||||
|
jobId: item.jobId,
|
||||||
dateCreated: item.dateCreated,
|
dateCreated: item.dateCreated,
|
||||||
dateFinished: item.dateFinished,
|
dateFinished: item.dateFinished,
|
||||||
assetName: assetName,
|
assetName: assetName,
|
||||||
@ -116,7 +119,14 @@ export default function ComputeJobs(): ReactElement {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log(jobs)
|
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)
|
setUserAgreed(true)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user