diff --git a/src/Compute.js b/src/Compute.js index e387cfe..b0309c0 100644 --- a/src/Compute.js +++ b/src/Compute.js @@ -1,4 +1,5 @@ import React, { useState } from 'react' + import { asset } from './asset' import { algoAsset, createComputeService, rawAlgoMeta } from './compute-asset' @@ -10,6 +11,8 @@ export default function Compute({ ocean, web3 }) { const [ddoAlgorithmId, setDdoAlgorithmId] = useState('') const [divAlgoStyle, setdivAlgoStyle] = useState('') const [textRawAlgo, settextRawAlgo] = useState('') + const [PublishLogState, setPublishLogState] = useState('') + const [PublishOutputState, setPublishOutputState] = useState('') // publish a dataset and an algorithm async function publish() { try { @@ -55,6 +58,21 @@ export default function Compute({ ocean, web3 }) { async function startCompute(algorithmId, algorithmMeta) { try { const accounts = await ocean.accounts.list() + const ComputeOutput = { + publishAlgorithmLog: + PublishLogState === '' || PublishLogState === false ? false : true, + publishOutput: + PublishOutputState === '' || PublishOutputState === false + ? false + : true, + brizoAddress: ocean.config.brizoAddress, + brizoUri: ocean.config.brizoUri, + metadataUri: ocean.config.aquariusUri, + nodeUri: ocean.config.nodeUri, + owner: accounts[0].getId(), + secretStoreUri: ocean.config.secretStoreUri + } + console.log(ComputeOutput) // order the compute service const agreement = await ocean.compute.order(accounts[0], ddoAssetId) @@ -64,7 +82,8 @@ export default function Compute({ ocean, web3 }) { accounts[0], agreement, algorithmId, - JSON.stringify(algorithmMeta) + encodeURIComponent(JSON.stringify(algorithmMeta)), + ComputeOutput ) setJobId(status.jobId) console.log(status) @@ -109,6 +128,13 @@ export default function Compute({ ocean, web3 }) { async function updateDdoAssetId(event) { setDdoAssetId(event.target.value) } + async function handlePublishOutputState(event) { + setPublishOutputState(event.target.checked) + } + async function handlePublishLogState(event) { + setPublishLogState(event.target.checked) + } + if (!web3) { return null } @@ -127,6 +153,18 @@ export default function Compute({ ocean, web3 }) { + + Publish Output into the Marketplace + + Publish Algorithm Logs into the Marketplace