mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
job history
This commit is contained in:
parent
1b20b12cce
commit
553535c578
@ -15,7 +15,7 @@
|
||||
|
||||
.header {
|
||||
// stylelint-disable value-keyword-case
|
||||
composes: categoryimage;
|
||||
composes: categoryImage;
|
||||
// stylelint-enable value-keyword-case
|
||||
height: 8rem;
|
||||
margin-top: $spacer / $line-height;
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
.dimmed {
|
||||
// stylelint-disable value-keyword-case
|
||||
composes: categoryimage;
|
||||
composes: categoryImage;
|
||||
// stylelint-enable value-keyword-case
|
||||
opacity: .6;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
/* yellow triangle */
|
||||
.statusIndicatorCloseEnough {
|
||||
// stylelint-disable value-keyword-case
|
||||
composes: statusindicator;
|
||||
composes: statusIndicator;
|
||||
// stylelint-enable value-keyword-case
|
||||
background: none;
|
||||
width: 0;
|
||||
@ -31,7 +31,7 @@
|
||||
/* green circle */
|
||||
.statusIndicatorActive {
|
||||
// stylelint-disable value-keyword-case
|
||||
composes: statusindicator;
|
||||
composes: statusIndicator;
|
||||
// stylelint-enable value-keyword-case
|
||||
border-radius: 50%;
|
||||
background: $green;
|
||||
|
13
client/src/components/molecules/JobTeaser.tsx
Normal file
13
client/src/components/molecules/JobTeaser.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { getUserJobs } from '../../utils/getUserJobs'
|
||||
import { User } from '../../context';
|
||||
import Spinner from '../atoms/Spinner'
|
||||
|
||||
|
||||
|
||||
export default function JobTeaser() {
|
||||
|
||||
return (
|
||||
<div>Job teaser</div>
|
||||
)
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
.latestAssetsWrap {
|
||||
// full width break out of container
|
||||
margin-right: calc(-50vw + 50%);
|
||||
// margin-right: calc(-50vw + 50%);
|
||||
}
|
||||
|
||||
.latestAssets {
|
||||
|
41
client/src/components/organisms/JobsUser.tsx
Normal file
41
client/src/components/organisms/JobsUser.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { getUserJobs } from '../../utils/getUserJobs'
|
||||
import { User } from '../../context';
|
||||
import Spinner from '../atoms/Spinner'
|
||||
import JobTeaser from '../molecules/JobTeaser';
|
||||
|
||||
|
||||
|
||||
export default function JobsUser() {
|
||||
const { ocean, account } = React.useContext(User);
|
||||
const [jobList, setJobList] = useState<any[]>([])
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
useEffect(() => {
|
||||
setIsLoading(true)
|
||||
async function getJobs() {
|
||||
console.log(account)
|
||||
const userJobs = await getUserJobs(ocean, account)
|
||||
console.log('user jobs', userJobs)
|
||||
setJobList(userJobs as any)
|
||||
setIsLoading(false)
|
||||
}
|
||||
getJobs()
|
||||
}, [account])
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
{isLoading ?
|
||||
<Spinner />
|
||||
: jobList.length ?
|
||||
jobList.map((job: any) =>
|
||||
(
|
||||
<JobTeaser key={job.agreementId} />
|
||||
|
||||
)
|
||||
) : ''
|
||||
}
|
||||
</>
|
||||
)
|
||||
|
||||
}
|
@ -2,7 +2,6 @@ import React, { PureComponent } from 'react'
|
||||
import { DDO, File } from '@oceanprotocol/squid'
|
||||
import AssetFile from './AssetFile'
|
||||
import { User } from '../../../context'
|
||||
import Web3message from '../../organisms/Web3message'
|
||||
import styles from './AssetFilesDetails.module.scss'
|
||||
|
||||
export default class AssetFilesDetails extends PureComponent<{
|
||||
|
@ -68,7 +68,6 @@ class Asset extends Component<AssetProps, AssetState> {
|
||||
ddo,
|
||||
error,
|
||||
isLoading,
|
||||
computeMetadata,
|
||||
ocean
|
||||
} = this.state
|
||||
const { main, additionalInformation } = metadata
|
||||
|
@ -5,16 +5,20 @@ import Web3message from '../components/organisms/Web3message'
|
||||
import { User } from '../context'
|
||||
import Content from '../components/atoms/Content'
|
||||
import withTracker from '../hoc/withTracker'
|
||||
import JobsUser from '../components/organisms/JobsUser'
|
||||
|
||||
class History extends Component {
|
||||
public static contextType = User
|
||||
|
||||
|
||||
public render() {
|
||||
return (
|
||||
<Route title="History">
|
||||
<Content>
|
||||
{!this.context.isLogged && <Web3message />}
|
||||
<div>Assets</div>
|
||||
<AssetsUser list />
|
||||
<div>Jobs</div>
|
||||
<JobsUser />
|
||||
</Content>
|
||||
</Route>
|
||||
)
|
||||
|
49
client/src/utils/getUserJobs.ts
Normal file
49
client/src/utils/getUserJobs.ts
Normal file
@ -0,0 +1,49 @@
|
||||
const tempList =
|
||||
[{
|
||||
"agreementId": "a40d4fbddf7c45fb988b3f47e7fb8d50386ee8c968c94a0db6909cd96582e6cd",
|
||||
"algorithmLogUrl": null,
|
||||
"dateCreated": 1585581794.73346,
|
||||
"dateFinished": null,
|
||||
"jobId": "5e67cdffc2224907b10cdb80820033ee",
|
||||
"owner": "0x4D156A2ef69ffdDC55838176C6712C90f60a2285",
|
||||
"removed": 0,
|
||||
"resultsDid": "",
|
||||
"resultsUrl": "",
|
||||
"status": 10,
|
||||
"statusText": "Job started",
|
||||
"stopreq": 0
|
||||
},
|
||||
{
|
||||
"agreementId": "a40d4fbdd434c45fb988b3f47e7fb8d50386ee8c968c94a0db6909cd96582e6cd",
|
||||
"algorithmLogUrl": null,
|
||||
"dateCreated": 1585581794.73346,
|
||||
"dateFinished": null,
|
||||
"jobId": "5e67cdffc2224907b10cdb80820033ee",
|
||||
"owner": "0x4D156A2ef69ffdDC55838176C6712C90f60a2285",
|
||||
"removed": 0,
|
||||
"resultsDid": "",
|
||||
"resultsUrl": "",
|
||||
"status": 10,
|
||||
"statusText": "Job started",
|
||||
"stopreq": 0
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user