mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
added keep algorith private checkbox
This commit is contained in:
parent
4088a790fb
commit
7d25bc07ce
@ -36,6 +36,13 @@
|
|||||||
"options": ["NodeJS", "Python 3.7"],
|
"options": ["NodeJS", "Python 3.7"],
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "algorithmPrivacy",
|
||||||
|
"label": "Algorithm Privacy",
|
||||||
|
"type": "checkbox",
|
||||||
|
"options": ["Keep my algorithm private"],
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "author",
|
"name": "author",
|
||||||
"label": "Author",
|
"label": "Author",
|
||||||
|
1
src/@types/MetaData.d.ts
vendored
1
src/@types/MetaData.d.ts
vendored
@ -46,6 +46,7 @@ export interface AlgorithmPublishForm {
|
|||||||
files: string | File[]
|
files: string | File[]
|
||||||
author: string
|
author: string
|
||||||
dockerImage: string
|
dockerImage: string
|
||||||
|
algorithmPrivacy: boolean
|
||||||
termsAndConditions: boolean
|
termsAndConditions: boolean
|
||||||
// ---- optional fields ----
|
// ---- optional fields ----
|
||||||
tags?: string
|
tags?: string
|
||||||
|
@ -13,6 +13,13 @@
|
|||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.metaAlgorithm {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--spacer);
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
margin-bottom: var(--spacer/2);
|
||||||
|
}
|
||||||
|
|
||||||
.previewTitle {
|
.previewTitle {
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
@ -59,6 +59,8 @@ function MetaFull({ values }: { values: Partial<MetadataPublishForm> }) {
|
|||||||
key.includes('links') ||
|
key.includes('links') ||
|
||||||
key.includes('termsAndConditions') ||
|
key.includes('termsAndConditions') ||
|
||||||
key.includes('dataTokenOptions') ||
|
key.includes('dataTokenOptions') ||
|
||||||
|
key.includes('dockerImage') ||
|
||||||
|
key.includes('algorithmPrivacy') ||
|
||||||
value === undefined ||
|
value === undefined ||
|
||||||
value === ''
|
value === ''
|
||||||
)
|
)
|
||||||
@ -146,7 +148,18 @@ export function MetadataAlgorithmPreview({
|
|||||||
</div>
|
</div>
|
||||||
{values.tags && <Tags items={transformTags(values.tags)} />}
|
{values.tags && <Tags items={transformTags(values.tags)} />}
|
||||||
</header>
|
</header>
|
||||||
|
<div className={styles.metaAlgorithm}>
|
||||||
|
{values.dockerImage && (
|
||||||
|
<MetaItem
|
||||||
|
key="dockerImage"
|
||||||
|
title="Docker Image"
|
||||||
|
content={values.dockerImage}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{values.algorithmPrivacy && (
|
||||||
|
<MetaItem key="dockerImage" title="Private Algorithm" content="Yes" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<MetaFull values={values} />
|
<MetaFull values={values} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -39,8 +39,12 @@ export default function FormPublish({
|
|||||||
e: ChangeEvent<HTMLInputElement>,
|
e: ChangeEvent<HTMLInputElement>,
|
||||||
field: FormFieldProps
|
field: FormFieldProps
|
||||||
) {
|
) {
|
||||||
|
const value =
|
||||||
|
field.type === 'checkbox'
|
||||||
|
? !Boolean(JSON.parse(e.target.value))
|
||||||
|
: e.target.value
|
||||||
validateField(field.name)
|
validateField(field.name)
|
||||||
setFieldValue(field.name, e.target.value)
|
setFieldValue(field.name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetFormAndClearStorage = (e: FormEvent<Element>) => {
|
const resetFormAndClearStorage = (e: FormEvent<Element>) => {
|
||||||
|
@ -112,7 +112,10 @@ export default function PublishPage({
|
|||||||
try {
|
try {
|
||||||
Logger.log('Publish Algorithm with ', metadata)
|
Logger.log('Publish Algorithm with ', metadata)
|
||||||
|
|
||||||
const ddo = await publish((metadata as unknown) as Metadata, 'access')
|
const ddo = await publish(
|
||||||
|
(metadata as unknown) as Metadata,
|
||||||
|
values.algorithmPrivacy === true ? 'compute' : 'access'
|
||||||
|
)
|
||||||
|
|
||||||
// Publish failed
|
// Publish failed
|
||||||
if (!ddo || publishError) {
|
if (!ddo || publishError) {
|
||||||
|
@ -16,6 +16,7 @@ export const validationSchema: Yup.SchemaOf<AlgorithmPublishForm> = Yup.object()
|
|||||||
author: Yup.string().required('Required'),
|
author: Yup.string().required('Required'),
|
||||||
termsAndConditions: Yup.boolean().required('Required'),
|
termsAndConditions: Yup.boolean().required('Required'),
|
||||||
// ---- optional fields ----
|
// ---- optional fields ----
|
||||||
|
algorithmPrivacy: Yup.boolean().nullable(),
|
||||||
tags: Yup.string().nullable(),
|
tags: Yup.string().nullable(),
|
||||||
links: Yup.array<FileMetadata[]>().nullable()
|
links: Yup.array<FileMetadata[]>().nullable()
|
||||||
})
|
})
|
||||||
@ -27,6 +28,7 @@ export const initialValues: Partial<AlgorithmPublishForm> = {
|
|||||||
dockerImage: '',
|
dockerImage: '',
|
||||||
files: '',
|
files: '',
|
||||||
description: '',
|
description: '',
|
||||||
|
algorithmPrivacy: false,
|
||||||
termsAndConditions: false,
|
termsAndConditions: false,
|
||||||
tags: ''
|
tags: ''
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user