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

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
This commit is contained in:
Bogdan Fazakas 2021-06-14 15:10:12 +03:00 committed by GitHub
parent 4fc5862654
commit e8033687fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 18 deletions

View File

@ -2,7 +2,8 @@ module.exports = {
client: { client: {
service: { service: {
name: 'ocean', 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 // optional disable SSL validation check
skipSSLValidation: true skipSSLValidation: true
} }

2
package-lock.json generated
View File

@ -43525,7 +43525,6 @@
"node-abort-controller": "^2.0.0", "node-abort-controller": "^2.0.0",
"save-file": "^2.3.1", "save-file": "^2.3.1",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"web3": "^1.3.5",
"web3-eth-contract": "^1.3.6" "web3-eth-contract": "^1.3.6"
} }
}, },
@ -43600,7 +43599,6 @@
"integrity": "sha512-5vwpq6kbvwkQwKqAoOU3L72GZ3Ta8RRrewKj9OJRolx28KLJJ8Dg9Rf7obRwt5jQA9bkYd8gqzMTrI7H3xLfaw==", "integrity": "sha512-5vwpq6kbvwkQwKqAoOU3L72GZ3Ta8RRrewKj9OJRolx28KLJJ8Dg9Rf7obRwt5jQA9bkYd8gqzMTrI7H3xLfaw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@oclif/config": "^1.15.1",
"@oclif/errors": "^1.3.3", "@oclif/errors": "^1.3.3",
"@oclif/parser": "^3.8.3", "@oclif/parser": "^3.8.3",
"@oclif/plugin-help": "^3", "@oclif/plugin-help": "^3",

View File

@ -27,5 +27,5 @@
} }
.loaderWrap { .loaderWrap {
margin-right: calc(var(--spacer)/6); margin-right: calc(var(--spacer) / 6);
} }

View File

@ -159,6 +159,8 @@ export default function PublishPage({
values: initialValues as MetadataPublishFormDataset, values: initialValues as MetadataPublishFormDataset,
status: 'empty' status: 'empty'
}) })
// move user's focus to top of screen
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
} catch (error) { } catch (error) {
setError(error.message) setError(error.message)
Logger.error(error.message) Logger.error(error.message)
@ -173,14 +175,10 @@ export default function PublishPage({
): Promise<void> { ): Promise<void> {
const metadata = transformPublishAlgorithmFormToMetadata(values) const metadata = transformPublishAlgorithmFormToMetadata(values)
const timeout = mapTimeoutStringToSeconds(values.timeout) const timeout = mapTimeoutStringToSeconds(values.timeout)
const validDockerImage =
// TODO: put back check once #572 is resolved values.dockerImage === 'custom image'
// https://github.com/oceanprotocol/market/issues/572 ? await validateDockerImage(values.image, values.containerTag)
const validDockerImage = true : true
// const validDockerImage =
// values.dockerImage === 'custom image'
// ? await validateDockerImage(values.image, values.containerTag)
// : true
try { try {
if (validDockerImage) { if (validDockerImage) {
Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions) Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions)
@ -208,6 +206,10 @@ export default function PublishPage({
values: initialValuesAlgorithm as MetadataPublishFormAlgorithm, values: initialValuesAlgorithm as MetadataPublishFormAlgorithm,
status: 'empty' 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) { } catch (error) {
setError(error.message) setError(error.message)
@ -228,8 +230,6 @@ export default function PublishPage({
: validationSchemaAlgorithm : validationSchemaAlgorithm
} }
onSubmit={async (values, { resetForm }) => { onSubmit={async (values, { resetForm }) => {
// move user's focus to top of screen
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
// kick off publishing // kick off publishing
publishType === 'dataset' publishType === 'dataset'
? await handleSubmit(values, resetForm) ? await handleSubmit(values, resetForm)

View File

@ -136,10 +136,18 @@ async function isDockerHubImageValid(
tag: string tag: string
): Promise<boolean> { ): Promise<boolean> {
try { try {
const response = await axios.get( const response = await axios.post(
`https://hub.docker.com/v2/repositories/${image}/tags/${tag}` `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( toast.error(
'Could not fetch docker hub image info. Please check image name and tag and try again' 'Could not fetch docker hub image info. Please check image name and tag and try again'
) )