From 47332703cc37e554c8c7a2862eb68fd4f1bb1737 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Thu, 7 Apr 2022 11:34:45 +0300 Subject: [PATCH] update compute details and compute results UI and style --- .../History/ComputeJobs/Details.module.css | 14 +++++ .../Profile/History/ComputeJobs/Details.tsx | 5 +- .../Profile/History/ComputeJobs/Results.tsx | 58 ++++++------------- 3 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/components/Profile/History/ComputeJobs/Details.module.css b/src/components/Profile/History/ComputeJobs/Details.module.css index 53cb32c06..32dc2b800 100644 --- a/src/components/Profile/History/ComputeJobs/Details.module.css +++ b/src/components/Profile/History/ComputeJobs/Details.module.css @@ -62,6 +62,20 @@ .assetMeta code { color: var(--color-secondary); font-size: var(--font-size-small); + overflow: hidden; + width: 100%; + flex: 4; + text-overflow: ellipsis; + white-space: nowrap; +} + +.assetMeta span { + flex: 1; +} + +.assetMeta { + display: flex; + flex-wrap: wrap; } .meta { diff --git a/src/components/Profile/History/ComputeJobs/Details.tsx b/src/components/Profile/History/ComputeJobs/Details.tsx index 3d8261dcd..e90be34e2 100644 --- a/src/components/Profile/History/ComputeJobs/Details.tsx +++ b/src/components/Profile/History/ComputeJobs/Details.tsx @@ -33,7 +33,8 @@ function Asset({

- {symbol} | {did} + {`${symbol} | `} + {did}

) @@ -97,7 +98,7 @@ export default function Details({ /> )} {job.jobId}} /> - {/* {job.resultsDid && ( + {/* {job.results[0]. && ( {job.resultsDid}} diff --git a/src/components/Profile/History/ComputeJobs/Results.tsx b/src/components/Profile/History/ComputeJobs/Results.tsx index 2128f9055..b3bdb0de2 100644 --- a/src/components/Profile/History/ComputeJobs/Results.tsx +++ b/src/components/Profile/History/ComputeJobs/Results.tsx @@ -4,7 +4,6 @@ import { Provider } from '@oceanprotocol/lib' import React, { ReactElement, useState } from 'react' -import Loader from '@shared/atoms/Loader' import { ListItem } from '@shared/atoms/Lists' import Button from '@shared/atoms/Button' import styles from './Results.module.css' @@ -20,74 +19,53 @@ export default function Results({ const providerInstance = new Provider() const { accountId, web3 } = useWeb3() const [isLoading, setIsLoading] = useState(false) - const [hasFetched, setHasFetched] = useState(false) const isFinished = job.dateFinished !== null - async function getResults() { + async function downloadResults(resultIndex: number) { if (!accountId || !job) return try { setIsLoading(true) - console.log(' Job: ', job) const jobResult = await providerInstance.getComputeResultUrl( 'https://v4.provider.rinkeby.oceanprotocol.com/', web3, accountId, job.jobId, - 0 + resultIndex ) await downloadFileBrowser(jobResult) } catch (error) { LoggerInstance.error(error.message) } finally { setIsLoading(false) - setHasFetched(true) } } return (
- {hasFetched ? ( + {isFinished ? (
    - - {/* {job.algorithmLogUrl ? ( - - View Log - - ) : ( - 'No logs found.' - )} */} - - - {/* {job.resultsUrl && - Array.isArray(job.resultsUrl) && - job.resultsUrl.map((url, i) => - url ? ( - - - View Result {i + 1} - + {job.results && + Array.isArray(job.results) && + job.results.map((jobResult, i) => + jobResult.filename ? ( + + ) : ( No results found. ) - )} */} + )}
) : ( - +

Waiting for results...

)} {content.compute.storage}