From 1beb33d3e1f519ca3fde544f22a9403c36e07f9b Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Wed, 14 Apr 2021 20:11:29 +0300 Subject: [PATCH 1/4] check ddo provider for algo list in start compute --- .../organisms/AssetActions/Compute/index.tsx | 2 ++ src/utils/aquarius.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index ec1375ee3..e055e9233 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -195,7 +195,9 @@ export default function Compute({ source.token ) setDdoAlgorithmList(gueryResults.results) + const datasetComputeService = ddo.findServiceByType('compute') algorithmSelectionList = await transformDDOToAssetSelection( + datasetComputeService.serviceEndpoint, gueryResults.results, config.metadataCacheUri, [] diff --git a/src/utils/aquarius.ts b/src/utils/aquarius.ts index a642be1df..025c1aa17 100644 --- a/src/utils/aquarius.ts +++ b/src/utils/aquarius.ts @@ -107,6 +107,7 @@ export async function getAssetsNames( } export async function transformDDOToAssetSelection( + datasetProviderEndpoint: string, ddoList: DDO[], metadataCacheUri: string, selectedAlgorithms?: PublisherTrustedAlgorithm[] @@ -115,14 +116,22 @@ export async function transformDDOToAssetSelection( const didList: string[] = [] const priceList: PriceList = await getAssetPrices(ddoList) const symbolList: any = {} + const didProviderEndpointMap: any = {} for (const ddo of ddoList) { didList.push(ddo.id) 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 algorithmList: AssetSelectionAsset[] = [] didList?.forEach((did: string) => { - if (priceList[did]) { + if ( + priceList[did] && + (!didProviderEndpointMap[did] || + didProviderEndpointMap[did] === datasetProviderEndpoint) + ) { let selected = false selectedAlgorithms?.forEach((algorithm: PublisherTrustedAlgorithm) => { if (algorithm.did === did) { From 0d1534db70bd06f6c94d2c5d6b22c1855a58429b Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Thu, 15 Apr 2021 10:55:58 +0300 Subject: [PATCH 2/4] check ddo provider for assets in edit compute --- src/components/organisms/AssetActions/Compute/index.tsx | 2 +- .../organisms/AssetActions/Edit/FormEditComputeDataset.tsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index e055e9233..802c11db5 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -197,7 +197,7 @@ export default function Compute({ setDdoAlgorithmList(gueryResults.results) const datasetComputeService = ddo.findServiceByType('compute') algorithmSelectionList = await transformDDOToAssetSelection( - datasetComputeService.serviceEndpoint, + datasetComputeService?.serviceEndpoint, gueryResults.results, config.metadataCacheUri, [] diff --git a/src/components/organisms/AssetActions/Edit/FormEditComputeDataset.tsx b/src/components/organisms/AssetActions/Edit/FormEditComputeDataset.tsx index b85b52854..91be1264c 100644 --- a/src/components/organisms/AssetActions/Edit/FormEditComputeDataset.tsx +++ b/src/components/organisms/AssetActions/Edit/FormEditComputeDataset.tsx @@ -57,7 +57,9 @@ export default function FormEditComputeDataset({ config.metadataCacheUri, source.token ) + const datasetComputeService = ddo.findServiceByType('compute') const algorithmSelectionList = await transformDDOToAssetSelection( + datasetComputeService?.serviceEndpoint, querryResult.results, config.metadataCacheUri, publisherTrustedAlgorithms From 127d31d729fa1409f215acbdaa4b86c4af500eb1 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Tue, 29 Jun 2021 09:20:35 +0300 Subject: [PATCH 3/4] fixed issues after merge of main branch --- src/components/organisms/AssetActions/Compute/index.tsx | 5 ++++- src/components/organisms/AssetActions/Consume.tsx | 2 +- .../AssetContent/AlgorithmDatasetsListForCompute.tsx | 8 +++++++- src/utils/aquarius.ts | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index 102b2a045..47c45cc60 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -387,7 +387,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!" state="info" /> - + ) : ( {type === 'algorithm' && ( - + )}