From 433af0147a9c03bbbb30ce816519d9f890f1b70a Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 25 Feb 2021 15:00:42 +0100 Subject: [PATCH 1/8] switch IPFS gateway (#404) * switch to dweb.link for loading 3Box profile images * ipfs.oceanprotocol.com has been deprecated --- src/utils/profile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/profile.ts b/src/utils/profile.ts index ccc368cad..f78d2c71b 100644 --- a/src/utils/profile.ts +++ b/src/utils/profile.ts @@ -5,7 +5,7 @@ import { Logger } from '@oceanprotocol/lib' // https://docs.3box.io/api/rest-api const apiUri = 'https://3box.oceanprotocol.com' -const ipfsUrl = 'https://ipfs.oceanprotocol.com' +const ipfsUrl = 'https://dweb.link' function decodeProof(proofJWT: string) { if (!proofJWT) return From 0b942de217b6f6090b34ffa6f5bf457a89e05338 Mon Sep 17 00:00:00 2001 From: Norbi Date: Mon, 1 Mar 2021 11:51:24 +0200 Subject: [PATCH 2/8] added function to get only the name of the asset --- src/components/molecules/AssetListTitle.tsx | 16 +++++++------- src/utils/aquarius.ts | 24 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/components/molecules/AssetListTitle.tsx b/src/components/molecules/AssetListTitle.tsx index 3eec652ed..935c7e0d4 100644 --- a/src/components/molecules/AssetListTitle.tsx +++ b/src/components/molecules/AssetListTitle.tsx @@ -2,7 +2,7 @@ import { DDO } from '@oceanprotocol/lib' import { useOcean } from '@oceanprotocol/react' import { Link } from 'gatsby' import React, { ReactElement, useEffect, useState } from 'react' -import { retrieveDDO } from '../../utils/aquarius' +import { retrieveDDO, getAssetsNames } from '../../utils/aquarius' import styles from './AssetListTitle.module.css' import axios from 'axios' @@ -28,15 +28,15 @@ export default function AssetListTitle({ const source = axios.CancelToken.source() - async function getDDO() { - const ddo = await retrieveDDO(did, config.metadataCacheUri, source.token) - - if (!ddo) return - const { attributes } = ddo.findServiceByType('metadata') - setAssetTitle(attributes.main.name) + async function getAssetName() { + getAssetsNames([did], config.metadataCacheUri, source.token).then( + (resp) => { + setAssetTitle(resp[did]) + } + ) } - !ddo && did && getDDO() + !ddo && did && getAssetName() return () => { console.log('canceled?') diff --git a/src/utils/aquarius.ts b/src/utils/aquarius.ts index a11657a7e..0e88a7949 100644 --- a/src/utils/aquarius.ts +++ b/src/utils/aquarius.ts @@ -73,3 +73,27 @@ export async function retrieveDDO( } } } + +export async function getAssetsNames( + didList: string[] | DID[], + metadataCacheUri: string, + cancelToken: CancelToken +): Promise> { + try { + const response: AxiosResponse> = await axios.post( + `${metadataCacheUri}/api/v1/aquarius/assets/names`, + { + didList, + cancelToken + } + ) + if (!response || response.status !== 200 || !response.data) return + return response.data + } catch (error) { + if (axios.isCancel(error)) { + Logger.log(error.message) + } else { + Logger.error(error.message) + } + } +} From 939c57748378ed8bdfe0526d1b4c9d947d87754e Mon Sep 17 00:00:00 2001 From: KatunaNorbert Date: Mon, 1 Mar 2021 15:34:31 +0200 Subject: [PATCH 3/8] Retrigger checks From f2e906e79062a2e414f2a97b8ea1829fdc4d5f63 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Mon, 1 Mar 2021 15:35:29 +0200 Subject: [PATCH 4/8] Fix/ Search query with price filter and no text (#408) * fixed querry with price filter and no text entered * retrigger checks --- src/components/templates/Search/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/templates/Search/utils.ts b/src/components/templates/Search/utils.ts index 914000913..641b7189a 100644 --- a/src/components/templates/Search/utils.ts +++ b/src/components/templates/Search/utils.ts @@ -33,9 +33,9 @@ type FilterByPriceOptions = typeof FilterByPriceOptions[keyof typeof FilterByPri function addPriceFilterToQuerry(sortTerm: string, priceFilter: string): string { sortTerm = priceFilter - ? sortTerm === '' - ? `price.type:${priceFilter}` - : `${sortTerm} AND price.type:${priceFilter}` + ? /\S/.test(sortTerm) + ? `${sortTerm} AND price.type:${priceFilter}` + : `price.type:${priceFilter}` : sortTerm return sortTerm } From 4b4cda490605af41fc67c66b389742fb4965ee45 Mon Sep 17 00:00:00 2001 From: Norbi Date: Mon, 1 Mar 2021 16:54:43 +0200 Subject: [PATCH 5/8] resolve promise using async/await --- src/components/molecules/AssetListTitle.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/molecules/AssetListTitle.tsx b/src/components/molecules/AssetListTitle.tsx index 935c7e0d4..9a778c65b 100644 --- a/src/components/molecules/AssetListTitle.tsx +++ b/src/components/molecules/AssetListTitle.tsx @@ -29,11 +29,12 @@ export default function AssetListTitle({ const source = axios.CancelToken.source() async function getAssetName() { - getAssetsNames([did], config.metadataCacheUri, source.token).then( - (resp) => { - setAssetTitle(resp[did]) - } + const title = await getAssetsNames( + [did], + config.metadataCacheUri, + source.token ) + setAssetTitle(title[did]) } !ddo && did && getAssetName() From f6f6c6842857fe12bf5b9fb61797554e24ae4f4d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 1 Mar 2021 16:08:50 +0100 Subject: [PATCH 6/8] more fine grained price issues display --- src/components/atoms/Price/index.tsx | 9 +++++++-- src/components/organisms/AssetActions/Consume.tsx | 8 +------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/atoms/Price/index.tsx b/src/components/atoms/Price/index.tsx index 28c1b22c2..caa09d8c5 100644 --- a/src/components/atoms/Price/index.tsx +++ b/src/components/atoms/Price/index.tsx @@ -28,11 +28,16 @@ export default function Price({ conversion={conversion} type={price.type} /> - ) : !price || price?.value === 0 ? ( + ) : !price || !price.address ? (
- No price found{' '} + No price set{' '}
+ ) : price.isConsumable !== 'true' ? ( +
+ Not enough liquidity{' '} + +
) : ( ) diff --git a/src/components/organisms/AssetActions/Consume.tsx b/src/components/organisms/AssetActions/Consume.tsx index 42b4b4bdb..adfbb5edd 100644 --- a/src/components/organisms/AssetActions/Consume.tsx +++ b/src/components/organisms/AssetActions/Consume.tsx @@ -158,13 +158,7 @@ export default function Consume({
- {isConsumable ? ( - - ) : ( -
- There is not enough liquidity in the pool to buy this data set. -
- )} + {!isInPurgatory && }
From 0303c52f3e4d47206bb3c65101f0b9d604afcf5b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 1 Mar 2021 16:17:44 +0100 Subject: [PATCH 7/8] copy --- src/components/atoms/Price/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/atoms/Price/index.tsx b/src/components/atoms/Price/index.tsx index caa09d8c5..781e0ac22 100644 --- a/src/components/atoms/Price/index.tsx +++ b/src/components/atoms/Price/index.tsx @@ -28,10 +28,10 @@ export default function Price({ conversion={conversion} type={price.type} /> - ) : !price || !price.address ? ( + ) : !price || !price.address || price.address === '' ? (
No price set{' '} - +
) : price.isConsumable !== 'true' ? (
From 3607084efc7b59850ec448aecfcae96b8890d5e0 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 1 Mar 2021 16:24:55 +0100 Subject: [PATCH 8/8] copy --- src/components/atoms/Price/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/atoms/Price/index.tsx b/src/components/atoms/Price/index.tsx index 781e0ac22..324620d1e 100644 --- a/src/components/atoms/Price/index.tsx +++ b/src/components/atoms/Price/index.tsx @@ -31,12 +31,12 @@ export default function Price({ ) : !price || !price.address || price.address === '' ? (
No price set{' '} - +
) : price.isConsumable !== 'true' ? (
- Not enough liquidity{' '} - + Low liquidity{' '} +
) : (