diff --git a/client/src/components/atoms/CategoryImage.module.scss b/client/src/components/atoms/CategoryImage.module.scss index d28f8f6..a19c59d 100644 --- a/client/src/components/atoms/CategoryImage.module.scss +++ b/client/src/components/atoms/CategoryImage.module.scss @@ -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; } diff --git a/client/src/components/molecules/AccountStatus/Indicator.module.scss b/client/src/components/molecules/AccountStatus/Indicator.module.scss index b8c8cbc..55ee748 100644 --- a/client/src/components/molecules/AccountStatus/Indicator.module.scss +++ b/client/src/components/molecules/AccountStatus/Indicator.module.scss @@ -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; diff --git a/client/src/components/molecules/JobTeaser.tsx b/client/src/components/molecules/JobTeaser.tsx new file mode 100644 index 0000000..e19a726 --- /dev/null +++ b/client/src/components/molecules/JobTeaser.tsx @@ -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 ( +
Job teaser
+ ) +} \ No newline at end of file diff --git a/client/src/components/organisms/AssetsLatest.module.scss b/client/src/components/organisms/AssetsLatest.module.scss index 7d332be..bba896b 100644 --- a/client/src/components/organisms/AssetsLatest.module.scss +++ b/client/src/components/organisms/AssetsLatest.module.scss @@ -2,7 +2,7 @@ .latestAssetsWrap { // full width break out of container - margin-right: calc(-50vw + 50%); + // margin-right: calc(-50vw + 50%); } .latestAssets { diff --git a/client/src/components/organisms/JobsUser.tsx b/client/src/components/organisms/JobsUser.tsx new file mode 100644 index 0000000..691bb17 --- /dev/null +++ b/client/src/components/organisms/JobsUser.tsx @@ -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([]) + 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 ? + + : jobList.length ? + jobList.map((job: any) => + ( + + + ) + ) : '' + } + + ) + +} \ No newline at end of file diff --git a/client/src/components/templates/Asset/AssetFilesDetails.tsx b/client/src/components/templates/Asset/AssetFilesDetails.tsx index a16308e..498cbb0 100644 --- a/client/src/components/templates/Asset/AssetFilesDetails.tsx +++ b/client/src/components/templates/Asset/AssetFilesDetails.tsx @@ -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<{ diff --git a/client/src/components/templates/Asset/index.tsx b/client/src/components/templates/Asset/index.tsx index 4292f7e..a4a0569 100644 --- a/client/src/components/templates/Asset/index.tsx +++ b/client/src/components/templates/Asset/index.tsx @@ -68,7 +68,6 @@ class Asset extends Component { ddo, error, isLoading, - computeMetadata, ocean } = this.state const { main, additionalInformation } = metadata diff --git a/client/src/routes/History.tsx b/client/src/routes/History.tsx index 680742f..213e242 100644 --- a/client/src/routes/History.tsx +++ b/client/src/routes/History.tsx @@ -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 ( {!this.context.isLogged && } +
Assets
+
Jobs
+
) diff --git a/client/src/utils/createComputeService.tsx b/client/src/utils/createComputeService.ts similarity index 100% rename from client/src/utils/createComputeService.tsx rename to client/src/utils/createComputeService.ts diff --git a/client/src/utils/getUserJobs.ts b/client/src/utils/getUserJobs.ts new file mode 100644 index 0000000..c3aa6e9 --- /dev/null +++ b/client/src/utils/getUserJobs.ts @@ -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) + } + +} \ No newline at end of file