diff --git a/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/artifactSettings.cf.tsx b/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/artifactSettings.cf.tsx index 7e205f5d3c5..f200d5859d9 100644 --- a/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/artifactSettings.cf.tsx +++ b/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/artifactSettings.cf.tsx @@ -24,6 +24,7 @@ import { } from '../../serverGroupConfigurationModel.cf'; import { CloudFoundryImageReader } from 'cloudfoundry/image/image.reader.cf'; import { ICloudFoundryCluster, ICloudFoundryServerGroup } from 'cloudfoundry/domain'; +import { Field } from 'formik'; export interface ICloudFoundryCreateServerGroupArtifactSettingsProps extends IWizardPageProps { @@ -179,24 +180,6 @@ class ArtifactSettingsImpl extends React.Component< } }; - private artifactReferenceUpdated = (event: React.ChangeEvent): void => { - const reference = event.target.value; - const { artifact } = this.props.formik.values; - if (isArtifactSource(artifact)) { - artifact.reference = reference; - this.props.formik.setFieldValue('artifact.reference', reference); - } - }; - - private artifactPatternUpdater = (event: React.ChangeEvent): void => { - const pattern = event.target.value; - const { artifact } = this.props.formik.values; - if (isTriggerSource(artifact)) { - artifact.pattern = pattern; - this.props.formik.setFieldValue('artifact.pattern', pattern); - } - }; - private getArtifactInput = (): JSX.Element => { const { artifactAccounts } = this.props; const { values, errors: _errors } = this.props.formik; @@ -225,13 +208,7 @@ class ArtifactSettingsImpl extends React.Component<
Reference
- +
{errors.artifact && @@ -343,11 +320,7 @@ class ArtifactSettingsImpl extends React.Component<
Artifact Pattern
- +
diff --git a/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/basicSettings.cf.tsx b/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/basicSettings.cf.tsx index 566d4ac2d91..7eb90bf99df 100644 --- a/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/basicSettings.cf.tsx +++ b/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/basicSettings.cf.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { FormikErrors } from 'formik'; +import { Field, FormikErrors } from 'formik'; import Select, { Option } from 'react-select'; import { @@ -91,18 +91,6 @@ class BasicSettingsImpl extends React.Component< this.props.formik.setFieldValue('region', region); }; - private stackUpdated = (event: React.ChangeEvent): void => { - const stack = event.target.value; - this.props.formik.values.stack = stack; - this.props.formik.setFieldValue('stack', stack); - }; - - private detailUpdated = (event: React.ChangeEvent): void => { - const freeFormDetails = event.target.value; - this.props.formik.values.freeFormDetails = freeFormDetails; - this.props.formik.setFieldValue('freeFormDetails', freeFormDetails); - }; - private deploymentStrategyUpdated = (option: Option): void => { this.props.formik.values.strategy = option.value; this.props.formik.setFieldValue('strategy', option.value); @@ -138,7 +126,7 @@ class BasicSettingsImpl extends React.Component< Stack
- +
@@ -146,12 +134,7 @@ class BasicSettingsImpl extends React.Component< Detail
- +
diff --git a/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/configurationSettings.cf.tsx b/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/configurationSettings.cf.tsx index 86e9d7546db..cc9821ece60 100644 --- a/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/configurationSettings.cf.tsx +++ b/app/scripts/modules/cloudfoundry/src/serverGroup/configure/wizard/sections/configurationSettings.cf.tsx @@ -41,39 +41,6 @@ function isManifestTriggerSource( class ConfigurationSettingsImpl extends React.Component { public static LABEL = 'Configuration'; - private memoryUpdated = (event: React.ChangeEvent): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.memory = event.target.value; - this.props.formik.setFieldValue('manifest.memory', event.target.value); - } - }; - - private diskQuotaUpdated = (event: React.ChangeEvent): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.diskQuota = event.target.value; - this.props.formik.setFieldValue('manifest.diskQuota', event.target.value); - } - }; - - private instancesUpdated = (event: React.ChangeEvent): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.instances = Number(event.target.value); - this.props.formik.setFieldValue('manifest.instances', event.target.value); - this.capacityUpdated(event.target.value); - } - }; - - private buildpackUpdated = (event: React.ChangeEvent): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.buildpack = event.target.value; - this.props.formik.setFieldValue('manifest.buildpack', event.target.value); - } - }; - private manifestTypeUpdated = (type: string): void => { switch (type) { case 'artifact': @@ -100,68 +67,6 @@ class ConfigurationSettingsImpl extends React.Component { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - if (manifest.environment === undefined) { - manifest.environment = []; - } - manifest.environment.push({ key: '', value: '' }); - this.props.formik.setFieldValue('manifest.env', manifest.environment); - } - }; - - private removeEnvironmentVariable = (index: number): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.environment.splice(index, 1); - this.props.formik.setFieldValue('manifest.env', manifest.environment); - } - }; - - private environmentKeyUpdated = (index: number, event: React.ChangeEvent): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.environment[index].key = event.target.value; - this.props.formik.setFieldValue('manifest.env', manifest.environment); - } - }; - - private environmentValueUpdated = (index: number, event: React.ChangeEvent): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.environment[index].value = event.target.value; - this.props.formik.setFieldValue('manifest.env', manifest.environment); - } - }; - - private serviceUpdated = (index: number, event: React.ChangeEvent): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.services[index] = event.target.value; - this.props.formik.setFieldValue('manifest.services', manifest.services); - } - }; - - private addServicesVariable = (): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - if (manifest.services === undefined) { - manifest.services = []; - } - manifest.services.push(''); - this.props.formik.setFieldValue('manifest.services', manifest.services); - } - }; - - private removeServicesVariable = (index: number): void => { - const { manifest } = this.props.formik.values; - if (isManifestDirectSource(manifest)) { - manifest.services.splice(index, 1); - this.props.formik.setFieldValue('manifest.services', manifest.services); - } - }; - private artifactAccountUpdated = (option: Option): void => { const { manifest } = this.props.formik.values; if (isManifestArtifactSource(manifest) || isManifestTriggerSource(manifest)) { @@ -170,24 +75,6 @@ class ConfigurationSettingsImpl extends React.Component): void => { - const reference = event.target.value; - const { manifest } = this.props.formik.values; - if (isManifestArtifactSource(manifest)) { - manifest.reference = reference; - this.props.formik.setFieldValue('manifest.reference', reference); - } - }; - - private manifestPatternUpdater = (event: React.ChangeEvent): void => { - const pattern = event.target.value; - const { manifest } = this.props.formik.values; - if (isManifestTriggerSource(manifest)) { - manifest.pattern = pattern; - this.props.formik.setFieldValue('manifest.pattern', pattern); - } - }; - private capacityUpdated = (capacity: string): void => { this.props.formik.setFieldValue('capacity.min', capacity); this.props.formik.setFieldValue('capacity.max', capacity); @@ -195,15 +82,6 @@ class ConfigurationSettingsImpl extends React.Component { - const { - addEnvironmentVariable, - removeEnvironmentVariable, - environmentKeyUpdated, - environmentValueUpdated, - serviceUpdated, - addServicesVariable, - removeServicesVariable, - } = this; const { errors } = this.props.formik as any; if (isManifestDirectSource(manifest)) { return ( @@ -211,25 +89,25 @@ class ConfigurationSettingsImpl extends React.Component
Memory
- +
Disk Quota
- +
Instances
- +
Buildpack
- +
@@ -280,99 +158,109 @@ class ConfigurationSettingsImpl extends React.Component
Environment Variables - - - - - - - - - {manifest.environment && - manifest.environment.map(function(environment, index) { - return ( - - - - - - ); - })} - - - - - - -
NameValue
- environmentKeyUpdated(index, event)} - /> - - environmentValueUpdated(index, event)} - /> - - - removeEnvironmentVariable(index)} - /> - -
- -
+ ( + + + + + + + + + {manifest.environment && + manifest.environment.map(function(_, index) { + return ( + + + + + + ); + })} + + + + + + +
NameValue
+ + + + + + arrayHelpers.remove(index)} + /> + +
+ +
+ )} + />
Bind Services - - - {manifest.services && - manifest.services.map(function(service, index) { - return ( - - - - - ); - })} - - - - - - -
- serviceUpdated(index, event)} - /> - - removeServicesVariable(index)}> - - -
- -
+ ( + + + {manifest.services && + manifest.services.map(function(_, index) { + return ( + + + + + ); + })} + + + + + + +
+ + + arrayHelpers.remove(index)}> + + +
+ +
+ )} + />
{errors.manifest && @@ -395,17 +283,19 @@ class ConfigurationSettingsImpl extends React.Component ))} {errors.manifest && - errors.manifest.env && ( + errors.manifest.environment && + errors.manifest.environment.map((environmentError: string) => (
- +
- )} + ))} {errors.manifest && - errors.manifest.services && ( + errors.manifest.services && + errors.manifest.services.map((servicesError: string) => (
- +
- )} + ))} ); } else { @@ -422,11 +312,7 @@ class ConfigurationSettingsImpl extends React.Component
Manifest Pattern
- +
@@ -492,13 +378,7 @@ class ConfigurationSettingsImpl extends React.Component
Reference
- +
{errors.manifest && @@ -601,7 +481,7 @@ class ConfigurationSettingsImpl extends React.Component