mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
remove signing mechanism
This commit is contained in:
parent
9c0209c11d
commit
e163c56108
@ -1,12 +1,13 @@
|
||||
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/ComputeJob'
|
||||
import { useOcean } from '@oceanprotocol/react'
|
||||
import React, { ReactElement, useState } from 'react'
|
||||
import React, { ReactElement, useEffect, useState } from 'react'
|
||||
import DataTable from 'react-data-table-component'
|
||||
import Time from '../../atoms/Time'
|
||||
import styles from './PoolTransactions.module.css'
|
||||
import Loader from '../../atoms/Loader'
|
||||
import Button from '../../atoms/Button'
|
||||
import ComputeDetailsModal from './ComputeDetailsModal'
|
||||
import { Logger } from '@oceanprotocol/lib'
|
||||
|
||||
// function AssetTitle({ row }: { row: ComputeJob }): ReactElement {
|
||||
// const { ocean } = useOcean()
|
||||
@ -87,57 +88,49 @@ export default function ComputeJobs(): ReactElement {
|
||||
const { ocean, account } = useOcean()
|
||||
const [jobs, setJobs] = useState<ComputeJob[]>()
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [userAgreed, setUserAgreed] = useState(false)
|
||||
|
||||
const getJobs = async () => {
|
||||
useEffect(() => {
|
||||
if (!ocean || !account) return
|
||||
setIsLoading(true)
|
||||
try {
|
||||
const orderHistory = await ocean.assets.getOrderHistory(
|
||||
account,
|
||||
'compute',
|
||||
100
|
||||
)
|
||||
console.log('orders', orderHistory)
|
||||
const userJobs = await ocean.compute.status(account)
|
||||
|
||||
setJobs(
|
||||
userJobs.sort((a, b) => {
|
||||
if (a.dateCreated > b.dateCreated) return -1
|
||||
if (a.dateCreated < b.dateCreated) return 1
|
||||
return 0
|
||||
})
|
||||
)
|
||||
setUserAgreed(true)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
async function getJobs() {
|
||||
setIsLoading(true)
|
||||
try {
|
||||
const orderHistory = await ocean.assets.getOrderHistory(
|
||||
account,
|
||||
'compute',
|
||||
100
|
||||
)
|
||||
Logger.log('orders', orderHistory)
|
||||
const userJobs = await ocean.compute.status(account)
|
||||
|
||||
setJobs(
|
||||
userJobs.sort((a, b) => {
|
||||
if (a.dateCreated > b.dateCreated) return -1
|
||||
if (a.dateCreated < b.dateCreated) return 1
|
||||
return 0
|
||||
})
|
||||
)
|
||||
} catch (e) {
|
||||
Logger.error(e.message)
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
getJobs()
|
||||
}, [ocean, account])
|
||||
|
||||
return isLoading ? (
|
||||
<Loader />
|
||||
) : account && ocean ? (
|
||||
userAgreed ? (
|
||||
<>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={jobs}
|
||||
className={styles.table}
|
||||
noHeader
|
||||
pagination={jobs?.length >= 9}
|
||||
paginationPerPage={10}
|
||||
noDataComponent={<Empty />}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<div>
|
||||
<Button onClick={getJobs} name="Get jobs">
|
||||
Sign to retrieve jobs
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={jobs}
|
||||
className={styles.table}
|
||||
noHeader
|
||||
pagination={jobs?.length >= 9}
|
||||
paginationPerPage={10}
|
||||
noDataComponent={<Empty />}
|
||||
/>
|
||||
) : (
|
||||
<div>Connect your wallet to see your compute jobs.</div>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user