mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
remove compute job lists for now
This commit is contained in:
parent
46d7fa2ea1
commit
69ecfd71eb
@ -1,14 +0,0 @@
|
||||
.metaGrid {
|
||||
border-radius: var(--border-radius);
|
||||
display: grid;
|
||||
gap: calc(var(--spacer) / 2);
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.metaRow {
|
||||
padding-top: calc(var(--spacer) / 2);
|
||||
border-radius: var(--border-radius);
|
||||
display: grid;
|
||||
gap: calc(var(--spacer) / 2);
|
||||
grid-template-columns: auto;
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
import React, { ReactElement } from 'react'
|
||||
import { ComputeItem } from '@oceanprotocol/react'
|
||||
import BaseDialog from '../../atoms/BaseDialog'
|
||||
import styles from './JobDetailsDialog.module.css'
|
||||
import MetaItem from '../../organisms/AssetContent/MetaItem'
|
||||
import Time from '../../atoms/Time'
|
||||
import shortid from 'shortid'
|
||||
import { Link } from 'gatsby'
|
||||
|
||||
export default function JobDetailsDialog({
|
||||
computeItem,
|
||||
isOpen,
|
||||
onClose
|
||||
}: {
|
||||
computeItem: ComputeItem | undefined
|
||||
isOpen: boolean
|
||||
onClose: () => void
|
||||
}): ReactElement {
|
||||
if (!computeItem) return null
|
||||
|
||||
const { attributes } = computeItem.ddo.findServiceByType('metadata')
|
||||
const { name } = attributes.main
|
||||
const {
|
||||
dateCreated,
|
||||
dateFinished,
|
||||
statusText,
|
||||
jobId,
|
||||
resultsUrls,
|
||||
algorithmLogUrl
|
||||
} = computeItem.job
|
||||
|
||||
return (
|
||||
<BaseDialog title={name} open={isOpen} onClose={onClose}>
|
||||
<div className={styles.metaGrid}>
|
||||
<MetaItem title="Date Created" content={<Time date={dateCreated} />} />
|
||||
<MetaItem title="Status" content={statusText} />
|
||||
<MetaItem
|
||||
title="Date Finished"
|
||||
content={<Time date={dateFinished} />}
|
||||
/>
|
||||
<MetaItem title="Job Id" content={jobId} />
|
||||
</div>
|
||||
<div className={styles.metaRow}>
|
||||
{resultsUrls && (
|
||||
<MetaItem
|
||||
title="Results"
|
||||
content={resultsUrls.map((url: string) => (
|
||||
<Link to={url} key={shortid.generate()}>
|
||||
{url}
|
||||
</Link>
|
||||
))}
|
||||
/>
|
||||
)}
|
||||
{algorithmLogUrl && (
|
||||
<MetaItem
|
||||
title="Algorithm Log"
|
||||
content={<Link to={algorithmLogUrl}>{algorithmLogUrl}</Link>}
|
||||
/>
|
||||
)}
|
||||
<MetaItem
|
||||
title="Data Set"
|
||||
content={<Link to={`/asset/${computeItem.ddo.id}`}>{name}</Link>}
|
||||
/>
|
||||
</div>
|
||||
</BaseDialog>
|
||||
)
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
import React, { useState, ReactElement } from 'react'
|
||||
import Loader from '../../atoms/Loader'
|
||||
import { useOcean } from '@oceanprotocol/react'
|
||||
|
||||
import Price from '../../atoms/Price'
|
||||
import { fromWei } from 'web3-utils'
|
||||
import Table from '../../atoms/Table'
|
||||
import Button from '../../atoms/Button'
|
||||
import { MetadataMain, Logger } from '@oceanprotocol/lib'
|
||||
import DateCell from '../../atoms/Table/DateCell'
|
||||
import DdoLinkCell from '../../atoms/Table/DdoLinkCell'
|
||||
import shortid from 'shortid'
|
||||
import ActionsCell from '../../atoms/Table/ActionsCell'
|
||||
import JobDetailsDialog from './JobDetailsDialog'
|
||||
|
||||
const columns = [
|
||||
{
|
||||
name: 'Created',
|
||||
selector: 'dateCreated',
|
||||
sortable: true,
|
||||
cell: function getCell(row: any) {
|
||||
return <DateCell date={row.dateCreated} />
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Finished',
|
||||
selector: 'dateFinished',
|
||||
sortable: true,
|
||||
cell: function getCell(row: any) {
|
||||
return <DateCell date={row.dateFinished} />
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
selector: 'name',
|
||||
sortable: true,
|
||||
cell: function getCell(row: any) {
|
||||
return <DdoLinkCell id={row.id} name={row.name} />
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Price',
|
||||
selector: 'price',
|
||||
sortable: true,
|
||||
cell: function getCell(row: any) {
|
||||
return <Price price={fromWei(row.price)} small />
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
selector: 'status'
|
||||
},
|
||||
{
|
||||
name: 'Actions',
|
||||
selector: 'actions',
|
||||
cell: function getCell(row: any) {
|
||||
return (
|
||||
<ActionsCell handleOnClickViewJobDetails={row.onClickViewJobDetails} />
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
export default function JobsList(): ReactElement {
|
||||
const { ocean, status, accountId } = useOcean()
|
||||
|
||||
const [jobList, setJobList] = useState<any[]>([])
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [userAgreed, setUserAgreed] = useState(false)
|
||||
const { getComputeItems } = useSearch()
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
const [detailsComputeItem, setDetailsComputeItem] = useState<ComputeItem>()
|
||||
|
||||
const onClickViewJobDetails = (compute: ComputeItem) => {
|
||||
setDetailsComputeItem(compute)
|
||||
setIsOpen(true)
|
||||
}
|
||||
const dialogClose = () => {
|
||||
setIsOpen(false)
|
||||
}
|
||||
|
||||
const getJobs = async () => {
|
||||
if (!accountId || !ocean || status !== OceanConnectionStatus.CONNECTED)
|
||||
return
|
||||
setIsLoading(true)
|
||||
setUserAgreed(true)
|
||||
try {
|
||||
const computeItems = await getComputeItems()
|
||||
if (!computeItems) return
|
||||
const data = computeItems.map((item) => {
|
||||
const { attributes } = item.ddo.findServiceByType('metadata')
|
||||
const { name, price } = attributes.main as MetadataMain
|
||||
return {
|
||||
dateCreated: item.job.dateCreated,
|
||||
dateFinished: item.job.dateFinished,
|
||||
status: item.job.statusText,
|
||||
name: name,
|
||||
price: price,
|
||||
did: item.ddo.id,
|
||||
id: shortid.generate(),
|
||||
onClickViewJobDetails: () => onClickViewJobDetails(item)
|
||||
}
|
||||
})
|
||||
|
||||
setJobList(data)
|
||||
setIsLoading(false)
|
||||
} catch (err) {
|
||||
Logger.error(err)
|
||||
// TODO: no error handling
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
return isLoading ? (
|
||||
<Loader />
|
||||
) : accountId && ocean ? (
|
||||
userAgreed ? (
|
||||
<>
|
||||
<JobDetailsDialog
|
||||
computeItem={detailsComputeItem}
|
||||
isOpen={isOpen}
|
||||
onClose={dialogClose}
|
||||
/>
|
||||
<Table data={jobList} columns={columns} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div>
|
||||
<Button style="primary" onClick={getJobs}>
|
||||
Sign to retrieve jobs
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
<div>Connect your wallet to see your compute jobs.</div>
|
||||
)
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
import React, { ReactElement, ReactNode } from 'react'
|
||||
import styles from './index.module.css'
|
||||
import PublishedList from './PublishedList'
|
||||
import JobsList from './JobsList'
|
||||
|
||||
const sections = [
|
||||
{
|
||||
|
@ -1,20 +0,0 @@
|
||||
import { ComputeJob } from '@oceanprotocol/lib'
|
||||
|
||||
// ComputeJob need to be updated in squid
|
||||
const job: Partial<ComputeJob> = {
|
||||
agreementId:
|
||||
'ccc60b8d33ae4986b224551b69f521761171159994474debbb5353f45286e206',
|
||||
algorithmLogUrl:
|
||||
'https://compute-publish.s3.amazonaws.com/605fb38b076844b7a2ee912b229a3f73/data/logs/algorithm.log',
|
||||
dateCreated: '1585828421.03217',
|
||||
dateFinished: '1585828541.73514',
|
||||
jobId: '605fb38b076844b7a2ee912b229a3f7333',
|
||||
owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285',
|
||||
resultsUrls: [
|
||||
'https://compute-publish.s3.amazonaws.com/605fb38b076844b7a2ee912b229a3f73/data/outputs/output.log'
|
||||
],
|
||||
status: 70,
|
||||
statusText: 'Job finished'
|
||||
}
|
||||
|
||||
export default job
|
@ -1,5 +1,4 @@
|
||||
import ddo from '../../__fixtures__/ddo'
|
||||
import job from '../../__fixtures__/job'
|
||||
|
||||
const metadataStore = {
|
||||
queryMetadata: () => {
|
||||
@ -19,11 +18,11 @@ const libMock = {
|
||||
list: () => ['xxx', 'xxx']
|
||||
},
|
||||
metadataStore,
|
||||
compute: {
|
||||
status: (account: string) => {
|
||||
return [job]
|
||||
}
|
||||
},
|
||||
// compute: {
|
||||
// status: (account: string) => {
|
||||
// return [job]
|
||||
// }
|
||||
// },
|
||||
assets: {
|
||||
query: () => {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user