mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
integrate compute options into form data, expose default option
This commit is contained in:
parent
8a60aaf3f5
commit
9bd9156553
@ -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
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -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' && (
|
||||
<Field
|
||||
{...getFieldContent('computeOptions', content.services.fields)}
|
||||
component={Input}
|
||||
name="services[0].computeOptions"
|
||||
options={computeEnvironmentOptions}
|
||||
disabled
|
||||
/>
|
||||
)}
|
||||
<Field
|
||||
{...getFieldContent('files', content.services.fields)}
|
||||
component={Input}
|
||||
|
@ -36,6 +36,19 @@ export const wizardSteps: StepContent[] = [
|
||||
}
|
||||
]
|
||||
|
||||
export const computeEnvironmentDefaults: ServiceComputeOptions = {
|
||||
namespace: 'ocean-compute',
|
||||
cpu: 1,
|
||||
gpu: 0,
|
||||
gpuType: '',
|
||||
memory: '1Gb',
|
||||
volumeSize: '1Gb',
|
||||
allowRawAlgorithm: false,
|
||||
allowNetworkAccess: true,
|
||||
publisherTrustedAlgorithmPublishers: null,
|
||||
publisherTrustedAlgorithms: null
|
||||
}
|
||||
|
||||
export const initialValues: FormPublishData = {
|
||||
user: {
|
||||
stepCurrent: 1,
|
||||
@ -65,7 +78,8 @@ export const initialValues: FormPublishData = {
|
||||
providerUrl: {
|
||||
url: 'https://provider.mainnet.oceanprotocol.com',
|
||||
valid: true
|
||||
}
|
||||
},
|
||||
computeOptions: computeEnvironmentDefaults
|
||||
}
|
||||
],
|
||||
pricing: {
|
||||
@ -98,16 +112,3 @@ export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
|
||||
checksum: ''
|
||||
}
|
||||
]
|
||||
|
||||
export const computeEnvironmentDefaults: ServiceComputeOptions = {
|
||||
namespace: 'ocean-compute',
|
||||
cpu: 1,
|
||||
gpu: 0,
|
||||
gpuType: '',
|
||||
memory: '1Gb',
|
||||
volumeSize: '1Gb',
|
||||
allowRawAlgorithm: false,
|
||||
allowNetworkAccess: true,
|
||||
publisherTrustedAlgorithmPublishers: null,
|
||||
publisherTrustedAlgorithms: null
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ export interface FormPublishService {
|
||||
access: 'Download' | 'Compute' | string
|
||||
providerUrl?: { url: string; valid: boolean }
|
||||
algorithmPrivacy?: boolean
|
||||
computeOptions?: ServiceComputeOptions
|
||||
}
|
||||
|
||||
export interface FormPublishData {
|
||||
|
Loading…
Reference in New Issue
Block a user