mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
fix get jobs
This commit is contained in:
parent
e7cd6105bf
commit
3f7e8f9f18
@ -7,6 +7,7 @@ import Dotdotdot from 'react-dotdotdot'
|
||||
export default function JobTeaser({ job }: { job: any }) {
|
||||
const { ocean } = useContext(User)
|
||||
const [assetName, setAssetName] = useState()
|
||||
const [assetUrl, setAssetUrl] = useState()
|
||||
useEffect(() => {
|
||||
async function getAsset() {
|
||||
try {
|
||||
@ -18,7 +19,9 @@ export default function JobTeaser({ job }: { job: any }) {
|
||||
const asset = await (ocean as any).assets.resolve(did)
|
||||
const { attributes } = asset.findServiceByType('metadata')
|
||||
const { main } = attributes
|
||||
const link = "/asset/did:op:" + did
|
||||
setAssetName(main.name)
|
||||
setAssetUrl(link as any)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
@ -30,7 +33,7 @@ export default function JobTeaser({ job }: { job: any }) {
|
||||
return (
|
||||
<article className={styles.assetList}>
|
||||
<div className={styles.listRow}>
|
||||
<h1>{assetName}</h1>
|
||||
<h1><a href={assetUrl}>{assetName}</a></h1>
|
||||
<div
|
||||
className={styles.date}
|
||||
title={`Created on ${job.dateCreated}`}
|
||||
|
@ -1,47 +1,17 @@
|
||||
const tempList =
|
||||
[{
|
||||
"agreementId": "a40d4fbddf7c45fb988b3f47e7fb8d50386ee8c968c94a0db6909cd96582e6cd",
|
||||
"algorithmLogUrl": null,
|
||||
"dateCreated": 1585581794.73346,
|
||||
"dateFinished": null,
|
||||
"jobId": "5e67cdffc2224907b10cdb802820033ee",
|
||||
"owner": "0x4D156A2ef69ffdDC55838176C6712C90f60a2285",
|
||||
"removed": 0,
|
||||
"resultsDid": "",
|
||||
"resultsUrl": "",
|
||||
"status": 10,
|
||||
"statusText": "Job started",
|
||||
"stopreq": 0
|
||||
},
|
||||
{
|
||||
"agreementId": "a40d4fbddf7c45fb988b3f47e7fb8d50386ee8c968c94a0db6909cd96582e6cd",
|
||||
"algorithmLogUrl": null,
|
||||
"dateCreated": 1585581794.73346,
|
||||
"dateFinished": null,
|
||||
"jobId": "5e67cdffc2224907b10cdb80820033ee",
|
||||
"owner": "0x4D156A2ef69ffdDC55838176C6712C90f60a2285",
|
||||
"removed": 0,
|
||||
"resultsDid": "",
|
||||
"resultsUrl": "",
|
||||
"status": 10,
|
||||
"statusText": "Job started",
|
||||
"stopreq": 0
|
||||
}
|
||||
]
|
||||
|
||||
import { Account } from '@oceanprotocol/squid'
|
||||
|
||||
|
||||
export async function getUserJobs(ocean: any, account: string) {
|
||||
try {
|
||||
const accounts = await ocean.accounts.list()
|
||||
//const jobList = await ocean.compute.status(account)
|
||||
// const jobList = await ocean.compute.status(accounts[0])
|
||||
|
||||
return tempList;
|
||||
let account: Account
|
||||
;[account] = await ocean.accounts.list()
|
||||
|
||||
await account.authenticate()
|
||||
const jobList = await ocean.compute.status(account)
|
||||
return jobList;
|
||||
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user