mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge branch 'main' into feature/multinetwork
This commit is contained in:
commit
60addda1cc
@ -157,7 +157,9 @@ export default function Compute({
|
|||||||
source.token
|
source.token
|
||||||
)
|
)
|
||||||
setDdoAlgorithmList(gueryResults.results)
|
setDdoAlgorithmList(gueryResults.results)
|
||||||
|
const datasetComputeService = ddo.findServiceByType('compute')
|
||||||
algorithmSelectionList = await transformDDOToAssetSelection(
|
algorithmSelectionList = await transformDDOToAssetSelection(
|
||||||
|
datasetComputeService?.serviceEndpoint,
|
||||||
gueryResults.results,
|
gueryResults.results,
|
||||||
appConfig.metadataCacheUri,
|
appConfig.metadataCacheUri,
|
||||||
[]
|
[]
|
||||||
@ -384,7 +386,10 @@ export default function Compute({
|
|||||||
text="This algorithm has been set to private by the publisher and can't be downloaded. You can run it against any allowed data sets though!"
|
text="This algorithm has been set to private by the publisher and can't be downloaded. You can run it against any allowed data sets though!"
|
||||||
state="info"
|
state="info"
|
||||||
/>
|
/>
|
||||||
<AlgorithmDatasetsListForCompute algorithmDid={ddo.id} />
|
<AlgorithmDatasetsListForCompute
|
||||||
|
algorithmDid={ddo.id}
|
||||||
|
dataset={ddo}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Formik
|
<Formik
|
||||||
|
@ -177,7 +177,7 @@ export default function Consume({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{type === 'algorithm' && (
|
{type === 'algorithm' && (
|
||||||
<AlgorithmDatasetsListForCompute algorithmDid={ddo.id} />
|
<AlgorithmDatasetsListForCompute algorithmDid={ddo.id} dataset={ddo} />
|
||||||
)}
|
)}
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
|
@ -56,7 +56,9 @@ export default function FormEditComputeDataset({
|
|||||||
appConfig.metadataCacheUri,
|
appConfig.metadataCacheUri,
|
||||||
source.token
|
source.token
|
||||||
)
|
)
|
||||||
|
const datasetComputeService = ddo.findServiceByType('compute')
|
||||||
const algorithmSelectionList = await transformDDOToAssetSelection(
|
const algorithmSelectionList = await transformDDOToAssetSelection(
|
||||||
|
datasetComputeService?.serviceEndpoint,
|
||||||
querryResult.results,
|
querryResult.results,
|
||||||
appConfig.metadataCacheUri,
|
appConfig.metadataCacheUri,
|
||||||
publisherTrustedAlgorithms
|
publisherTrustedAlgorithms
|
||||||
|
@ -5,11 +5,14 @@ import { AssetSelectionAsset } from '../../molecules/FormFields/AssetSelection'
|
|||||||
import AssetComputeList from '../../molecules/AssetComputeList'
|
import AssetComputeList from '../../molecules/AssetComputeList'
|
||||||
import { useOcean } from '../../../providers/Ocean'
|
import { useOcean } from '../../../providers/Ocean'
|
||||||
import { useAsset } from '../../../providers/Asset'
|
import { useAsset } from '../../../providers/Asset'
|
||||||
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function AlgorithmDatasetsListForCompute({
|
export default function AlgorithmDatasetsListForCompute({
|
||||||
algorithmDid
|
algorithmDid,
|
||||||
|
dataset
|
||||||
}: {
|
}: {
|
||||||
algorithmDid: string
|
algorithmDid: string
|
||||||
|
dataset: DDO
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { config } = useOcean()
|
const { config } = useOcean()
|
||||||
const { type } = useAsset()
|
const { type } = useAsset()
|
||||||
@ -18,8 +21,10 @@ export default function AlgorithmDatasetsListForCompute({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getDatasetsAllowedForCompute() {
|
async function getDatasetsAllowedForCompute() {
|
||||||
|
const datasetComputeService = dataset.findServiceByType('compute')
|
||||||
const datasets = await getAlgorithmDatasetsForCompute(
|
const datasets = await getAlgorithmDatasetsForCompute(
|
||||||
algorithmDid,
|
algorithmDid,
|
||||||
|
datasetComputeService?.serviceEndpoint,
|
||||||
config.metadataCacheUri
|
config.metadataCacheUri
|
||||||
)
|
)
|
||||||
setDatasetsForCompute(datasets)
|
setDatasetsForCompute(datasets)
|
||||||
|
@ -121,6 +121,7 @@ export async function getAssetsNames(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function transformDDOToAssetSelection(
|
export async function transformDDOToAssetSelection(
|
||||||
|
datasetProviderEndpoint: string,
|
||||||
ddoList: DDO[],
|
ddoList: DDO[],
|
||||||
metadataCacheUri: string,
|
metadataCacheUri: string,
|
||||||
selectedAlgorithms?: PublisherTrustedAlgorithm[]
|
selectedAlgorithms?: PublisherTrustedAlgorithm[]
|
||||||
@ -129,14 +130,22 @@ export async function transformDDOToAssetSelection(
|
|||||||
const didList: string[] = []
|
const didList: string[] = []
|
||||||
const priceList: PriceList = await getAssetsPriceList(ddoList)
|
const priceList: PriceList = await getAssetsPriceList(ddoList)
|
||||||
const symbolList: any = {}
|
const symbolList: any = {}
|
||||||
|
const didProviderEndpointMap: any = {}
|
||||||
for (const ddo of ddoList) {
|
for (const ddo of ddoList) {
|
||||||
didList.push(ddo.id)
|
didList.push(ddo.id)
|
||||||
symbolList[ddo.id] = ddo.dataTokenInfo.symbol
|
symbolList[ddo.id] = ddo.dataTokenInfo.symbol
|
||||||
|
const algoComputeService = ddo.findServiceByType('compute')
|
||||||
|
algoComputeService?.serviceEndpoint &&
|
||||||
|
(didProviderEndpointMap[ddo.id] = algoComputeService?.serviceEndpoint)
|
||||||
}
|
}
|
||||||
const ddoNames = await getAssetsNames(didList, metadataCacheUri, source.token)
|
const ddoNames = await getAssetsNames(didList, metadataCacheUri, source.token)
|
||||||
const algorithmList: AssetSelectionAsset[] = []
|
const algorithmList: AssetSelectionAsset[] = []
|
||||||
didList?.forEach((did: string) => {
|
didList?.forEach((did: string) => {
|
||||||
if (priceList[did]) {
|
if (
|
||||||
|
priceList[did] &&
|
||||||
|
(!didProviderEndpointMap[did] ||
|
||||||
|
didProviderEndpointMap[did] === datasetProviderEndpoint)
|
||||||
|
) {
|
||||||
let selected = false
|
let selected = false
|
||||||
selectedAlgorithms?.forEach((algorithm: PublisherTrustedAlgorithm) => {
|
selectedAlgorithms?.forEach((algorithm: PublisherTrustedAlgorithm) => {
|
||||||
if (algorithm.did === did) {
|
if (algorithm.did === did) {
|
||||||
@ -165,6 +174,7 @@ export async function transformDDOToAssetSelection(
|
|||||||
|
|
||||||
export async function getAlgorithmDatasetsForCompute(
|
export async function getAlgorithmDatasetsForCompute(
|
||||||
algorithmId: string,
|
algorithmId: string,
|
||||||
|
datasetProviderUri: string,
|
||||||
metadataCacheUri: string
|
metadataCacheUri: string
|
||||||
): Promise<AssetSelectionAsset[]> {
|
): Promise<AssetSelectionAsset[]> {
|
||||||
const source = axios.CancelToken.source()
|
const source = axios.CancelToken.source()
|
||||||
@ -186,6 +196,7 @@ export async function getAlgorithmDatasetsForCompute(
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
const datasets = await transformDDOToAssetSelection(
|
const datasets = await transformDDOToAssetSelection(
|
||||||
|
datasetProviderUri,
|
||||||
computeDatasetsForCurrentAlgorithm,
|
computeDatasetsForCurrentAlgorithm,
|
||||||
metadataCacheUri,
|
metadataCacheUri,
|
||||||
[]
|
[]
|
||||||
|
Loading…
Reference in New Issue
Block a user