From 9bd9156553f5fca7a5735b0f6f5f3ea8afabf061 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 29 Nov 2021 16:49:38 +0000 Subject: [PATCH] integrate compute options into form data, expose default option --- content/publish/form.json | 9 +++++++ src/components/Publish/Services/index.tsx | 15 +++++++++++- src/components/Publish/_constants.tsx | 29 ++++++++++++----------- src/components/Publish/_types.ts | 1 + 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/content/publish/form.json b/content/publish/form.json index a1ecef957..7ddc0c78f 100644 --- a/content/publish/form.json +++ b/content/publish/form.json @@ -141,6 +141,15 @@ "options": ["Forever", "1 day", "1 week", "1 month", "1 year"], "sortOptions": false, "required": true + }, + { + "name": "computeOptions", + "label": "Compute Environment", + "type": "radio", + "options": [ + "populated from computeEnvironmentDefaults in Publish/_constants & computeEnvironmentOptions in Publish/Services/" + ], + "required": true } ] }, diff --git a/src/components/Publish/Services/index.tsx b/src/components/Publish/Services/index.tsx index 28153f229..2b3738d62 100644 --- a/src/components/Publish/Services/index.tsx +++ b/src/components/Publish/Services/index.tsx @@ -6,8 +6,8 @@ import IconCompute from '@images/compute.svg' import content from '../../../../content/publish/form.json' import { getFieldContent } from '../_utils' import { FormPublishData } from '../_types' -import { useWeb3 } from '@context/Web3' import { getOceanConfig } from '@utils/ocean' +import { computeEnvironmentDefaults } from '../_constants' const accessTypeOptionsTitles = getFieldContent( 'access', @@ -38,6 +38,10 @@ export default function ServicesFields(): ReactElement { } ] + const computeEnvironmentOptions = [ + `Default: ${computeEnvironmentDefaults.cpu} CPU, ${computeEnvironmentDefaults.memory} memory, ${computeEnvironmentDefaults.volumeSize} disk` + ] + // Auto-change access type based on algo privacy boolean. // Could be also done later in transformPublishFormToDdo(). useEffect(() => { @@ -84,6 +88,15 @@ export default function ServicesFields(): ReactElement { component={Input} name="services[0].providerUrl" /> + {values.services[0].access === 'compute' && ( + + )}