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"],
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "algorithmPrivacy",
|
||||
"label": "Algorithm Privacy",
|
||||
"type": "checkbox",
|
||||
"options": ["Keep my algorithm private"],
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"name": "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[]
|
||||
author: string
|
||||
dockerImage: string
|
||||
algorithmPrivacy: boolean
|
||||
termsAndConditions: boolean
|
||||
// ---- optional fields ----
|
||||
tags?: string
|
||||
|
@ -13,6 +13,13 @@
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.metaAlgorithm {
|
||||
display: grid;
|
||||
gap: var(--spacer);
|
||||
grid-template-columns: 1fr 1fr;
|
||||
margin-bottom: var(--spacer/2);
|
||||
}
|
||||
|
||||
.previewTitle {
|
||||
font-size: var(--font-size-small);
|
||||
text-transform: uppercase;
|
||||
|
@ -59,6 +59,8 @@ function MetaFull({ values }: { values: Partial<MetadataPublishForm> }) {
|
||||
key.includes('links') ||
|
||||
key.includes('termsAndConditions') ||
|
||||
key.includes('dataTokenOptions') ||
|
||||
key.includes('dockerImage') ||
|
||||
key.includes('algorithmPrivacy') ||
|
||||
value === undefined ||
|
||||
value === ''
|
||||
)
|
||||
@ -146,7 +148,18 @@ export function MetadataAlgorithmPreview({
|
||||
</div>
|
||||
{values.tags && <Tags items={transformTags(values.tags)} />}
|
||||
</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} />
|
||||
</div>
|
||||
)
|
||||
|
@ -39,8 +39,12 @@ export default function FormPublish({
|
||||
e: ChangeEvent<HTMLInputElement>,
|
||||
field: FormFieldProps
|
||||
) {
|
||||
const value =
|
||||
field.type === 'checkbox'
|
||||
? !Boolean(JSON.parse(e.target.value))
|
||||
: e.target.value
|
||||
validateField(field.name)
|
||||
setFieldValue(field.name, e.target.value)
|
||||
setFieldValue(field.name, value)
|
||||
}
|
||||
|
||||
const resetFormAndClearStorage = (e: FormEvent<Element>) => {
|
||||
|
@ -112,7 +112,10 @@ export default function PublishPage({
|
||||
try {
|
||||
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
|
||||
if (!ddo || publishError) {
|
||||
|
@ -16,6 +16,7 @@ export const validationSchema: Yup.SchemaOf<AlgorithmPublishForm> = Yup.object()
|
||||
author: Yup.string().required('Required'),
|
||||
termsAndConditions: Yup.boolean().required('Required'),
|
||||
// ---- optional fields ----
|
||||
algorithmPrivacy: Yup.boolean().nullable(),
|
||||
tags: Yup.string().nullable(),
|
||||
links: Yup.array<FileMetadata[]>().nullable()
|
||||
})
|
||||
@ -27,6 +28,7 @@ export const initialValues: Partial<AlgorithmPublishForm> = {
|
||||
dockerImage: '',
|
||||
files: '',
|
||||
description: '',
|
||||
algorithmPrivacy: false,
|
||||
termsAndConditions: false,
|
||||
tags: ''
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user