From e163c56108f5e0dd6b21a52343721552718eec49 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 22 Oct 2020 12:29:19 +0200 Subject: [PATCH] remove signing mechanism --- src/components/pages/History/ComputeJobs.tsx | 81 +++++++++----------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/src/components/pages/History/ComputeJobs.tsx b/src/components/pages/History/ComputeJobs.tsx index 77a573c1e..68bd24652 100644 --- a/src/components/pages/History/ComputeJobs.tsx +++ b/src/components/pages/History/ComputeJobs.tsx @@ -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() 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 ? ( ) : account && ocean ? ( - userAgreed ? ( - <> - = 9} - paginationPerPage={10} - noDataComponent={} - /> - - ) : ( -
- -
- ) + = 9} + paginationPerPage={10} + noDataComponent={} + /> ) : (
Connect your wallet to see your compute jobs.
)