From e8033687fbe31f2191cdcb9456d35335d8030043 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Mon, 14 Jun 2021 15:10:12 +0300 Subject: [PATCH] Put back in place removed docker hub image check (#642) * Put back removed docker hub image check using proxy * fixed lint errors * update scroll so in case of docker image validation error the input fields are in viewport --- apollo.config.js | 3 ++- package-lock.json | 2 -- src/components/atoms/File.module.css | 4 ++-- src/components/pages/Publish/index.tsx | 20 ++++++++++---------- src/utils/metadata.ts | 14 +++++++++++--- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/apollo.config.js b/apollo.config.js index 3ca33ccad..8c4500450 100644 --- a/apollo.config.js +++ b/apollo.config.js @@ -2,7 +2,8 @@ module.exports = { client: { service: { name: 'ocean', - url: 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph', + url: + 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph', // optional disable SSL validation check skipSSLValidation: true } diff --git a/package-lock.json b/package-lock.json index 5b1b1b9f0..6be48043e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43525,7 +43525,6 @@ "node-abort-controller": "^2.0.0", "save-file": "^2.3.1", "uuid": "^8.3.2", - "web3": "^1.3.5", "web3-eth-contract": "^1.3.6" } }, @@ -43600,7 +43599,6 @@ "integrity": "sha512-5vwpq6kbvwkQwKqAoOU3L72GZ3Ta8RRrewKj9OJRolx28KLJJ8Dg9Rf7obRwt5jQA9bkYd8gqzMTrI7H3xLfaw==", "dev": true, "requires": { - "@oclif/config": "^1.15.1", "@oclif/errors": "^1.3.3", "@oclif/parser": "^3.8.3", "@oclif/plugin-help": "^3", diff --git a/src/components/atoms/File.module.css b/src/components/atoms/File.module.css index 2036412a0..658d1d407 100644 --- a/src/components/atoms/File.module.css +++ b/src/components/atoms/File.module.css @@ -27,5 +27,5 @@ } .loaderWrap { - margin-right: calc(var(--spacer)/6); -} \ No newline at end of file + margin-right: calc(var(--spacer) / 6); +} diff --git a/src/components/pages/Publish/index.tsx b/src/components/pages/Publish/index.tsx index aaaaca3f4..c27dcd3b6 100644 --- a/src/components/pages/Publish/index.tsx +++ b/src/components/pages/Publish/index.tsx @@ -159,6 +159,8 @@ export default function PublishPage({ values: initialValues as MetadataPublishFormDataset, status: 'empty' }) + // move user's focus to top of screen + window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }) } catch (error) { setError(error.message) Logger.error(error.message) @@ -173,14 +175,10 @@ export default function PublishPage({ ): Promise { const metadata = transformPublishAlgorithmFormToMetadata(values) const timeout = mapTimeoutStringToSeconds(values.timeout) - - // TODO: put back check once #572 is resolved - // https://github.com/oceanprotocol/market/issues/572 - const validDockerImage = true - // const validDockerImage = - // values.dockerImage === 'custom image' - // ? await validateDockerImage(values.image, values.containerTag) - // : true + const validDockerImage = + values.dockerImage === 'custom image' + ? await validateDockerImage(values.image, values.containerTag) + : true try { if (validDockerImage) { Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions) @@ -208,6 +206,10 @@ export default function PublishPage({ values: initialValuesAlgorithm as MetadataPublishFormAlgorithm, status: 'empty' }) + // move user's focus to top of screen + window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }) + } else { + document.getElementById('image').scrollIntoView({ behavior: 'smooth' }) } } catch (error) { setError(error.message) @@ -228,8 +230,6 @@ export default function PublishPage({ : validationSchemaAlgorithm } onSubmit={async (values, { resetForm }) => { - // move user's focus to top of screen - window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }) // kick off publishing publishType === 'dataset' ? await handleSubmit(values, resetForm) diff --git a/src/utils/metadata.ts b/src/utils/metadata.ts index f6a47c728..d29e3d6e2 100644 --- a/src/utils/metadata.ts +++ b/src/utils/metadata.ts @@ -136,10 +136,18 @@ async function isDockerHubImageValid( tag: string ): Promise { try { - const response = await axios.get( - `https://hub.docker.com/v2/repositories/${image}/tags/${tag}` + const response = await axios.post( + `https://dockerhub-proxy.oceanprotocol.com`, + { + image, + tag + } ) - if (!response || response.status !== 200 || !response.data) { + if ( + !response || + response.status !== 200 || + response.data.status !== 'success' + ) { toast.error( 'Could not fetch docker hub image info. Please check image name and tag and try again' )