1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Showing algorithms from all chains on the asset detail page

This commit is contained in:
Jamie Hewitt 2022-12-08 18:25:25 +03:00
parent 6b8486cde9
commit 7f79b86b5b
3 changed files with 12 additions and 4 deletions

View File

@ -6,11 +6,14 @@ export async function transformAssetToAssetSelection(
assets: Asset[],
selectedAlgorithms?: PublisherTrustedAlgorithm[]
): Promise<AssetSelectionAsset[]> {
console.log(`assets: ${JSON.stringify(assets)}`)
console.log(`selectedAlgorithms: ${JSON.stringify(selectedAlgorithms)}`)
const extendedAssets: AssetExtended[] = await getAccessDetailsForAssets(
assets
)
const algorithmList: AssetSelectionAsset[] = []
console.log(`extendedAssets: ${JSON.stringify(extendedAssets)}`)
for (const asset of extendedAssets) {
if (asset?.accessDetails?.price) {
let selected = false

View File

@ -26,6 +26,7 @@ import { AssetSelectionAsset } from '@shared/FormInput/InputElement/AssetSelecti
import { transformAssetToAssetSelection } from './assetConvertor'
import { ComputeEditForm } from '../components/Asset/Edit/_types'
import { getFileDidInfo } from './provider'
import { chainIdsSupported } from 'app.config'
const getComputeOrders = gql`
query ComputeOrders($user: String!) {
@ -158,7 +159,7 @@ export function getQueryString(
const algorithmDidList = trustedAlgorithmList?.map((x) => x.did)
const baseParams = {
chainIds: [chainId],
chainIds: chainId ? [chainId] : chainIdsSupported,
sort: { sortBy: SortTermOptions.Created },
filters: [getFilterTerm('metadata.type', 'algorithm')]
} as BaseQueryParams
@ -174,6 +175,7 @@ export async function getAlgorithmsForAsset(
asset: Asset,
token: CancelToken
): Promise<Asset[]> {
console.log(`getAlgorithmsForAsset`, asset)
const computeService: Service = getServiceByName(asset, 'compute')
if (
@ -191,8 +193,9 @@ export async function getAlgorithmsForAsset(
),
token
)
console.log('gueryResults', gueryResults)
const algorithms: Asset[] = gueryResults?.results
console.log('algorithms', algorithms)
return algorithms
}
@ -205,6 +208,7 @@ export async function getAlgorithmAssetSelectionList(
if (!computeService.compute) {
algorithmSelectionList = []
} else {
console.log('1 algorithms', algorithms)
algorithmSelectionList = await transformAssetToAssetSelection(
algorithms,
[]

View File

@ -247,9 +247,10 @@ export default function Compute({
useEffect(() => {
if (!asset?.accessDetails || isUnsupportedPricing) return
console.log('asset', asset)
getAlgorithmsForAsset(asset, newCancelToken()).then((algorithmsAssets) => {
setDdoAlgorithmList(algorithmsAssets)
console.log('algorithmsAssets', algorithmsAssets)
getAlgorithmAssetSelectionList(asset, algorithmsAssets).then(
(algorithmSelectionList) => {
setAlgorithmList(algorithmSelectionList)