-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(cf): make SG inputs reusable components
Co-Authored-By: Stu Pollock <spollock@pivotal.io>
- Loading branch information
1 parent
2ac29ea
commit c9e93df
Showing
15 changed files
with
282 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/scripts/modules/cloudfoundry/src/presentation/forms/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './inputs'; | ||
export * from './serverGroup'; |
1 change: 1 addition & 0 deletions
1
app/scripts/modules/cloudfoundry/src/presentation/forms/inputs/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './CloudFoundryRadioButtonInput'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/scripts/modules/cloudfoundry/src/presentation/forms/serverGroup/HealthCheck.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as React from 'react'; | ||
|
||
import { FormikFormField, TextInput } from '@spinnaker/core'; | ||
|
||
import { CloudFoundryRadioButtonInput } from 'cloudfoundry/presentation/forms/inputs/CloudFoundryRadioButtonInput'; | ||
|
||
export interface IHealthCheckProps { | ||
healthCheckHttpEndpointFieldName: string; | ||
healthCheckType: string; | ||
healthCheckTypeFieldName: string; | ||
onHealthCheckHttpEndpointChange?: (value: string) => void; | ||
onHealthCheckTypeChange?: (value: string) => void; | ||
} | ||
|
||
export class HealthCheck extends React.Component<IHealthCheckProps> { | ||
private HEALTH_CHECK_TYPE_OPTIONS = [ | ||
{ label: 'port', value: 'port' }, | ||
{ label: 'HTTP', value: 'http' }, | ||
{ label: 'process', value: 'process' }, | ||
]; | ||
|
||
public render() { | ||
const { | ||
healthCheckTypeFieldName, | ||
healthCheckType, | ||
healthCheckHttpEndpointFieldName, | ||
onHealthCheckTypeChange, | ||
onHealthCheckHttpEndpointChange, | ||
} = this.props; | ||
|
||
return ( | ||
<div className="col-md-9"> | ||
<div className="sp-margin-m-bottom"> | ||
<FormikFormField | ||
name={healthCheckTypeFieldName} | ||
label="Health Check Type" | ||
fastField={false} | ||
input={props => <CloudFoundryRadioButtonInput {...props} options={this.HEALTH_CHECK_TYPE_OPTIONS} />} | ||
onChange={value => { | ||
onHealthCheckTypeChange && onHealthCheckTypeChange(value); | ||
}} | ||
/> | ||
</div> | ||
{healthCheckType === 'http' && ( | ||
<div className="sp-margin-m-bottom"> | ||
<FormikFormField | ||
name={healthCheckHttpEndpointFieldName} | ||
label="Endpoint" | ||
input={props => <TextInput {...props} required={true} />} | ||
onChange={value => { | ||
onHealthCheckHttpEndpointChange && onHealthCheckHttpEndpointChange(value); | ||
}} | ||
required={true} | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
app/scripts/modules/cloudfoundry/src/presentation/forms/serverGroup/InstanceParameters.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import * as React from 'react'; | ||
|
||
import { FormikFormField, TextInput } from '@spinnaker/core'; | ||
|
||
export interface IInstanceParametersProps { | ||
diskQuotaFieldName: string; | ||
instancesFieldName: string; | ||
memoryFieldName: string; | ||
onDiskQuotaChange?: (value: string) => void; | ||
onInstancesChange?: (value: string) => void; | ||
onMemoryChange?: (value: string) => void; | ||
} | ||
|
||
export class InstanceParameters extends React.Component<IInstanceParametersProps> { | ||
public render() { | ||
const { | ||
diskQuotaFieldName, | ||
instancesFieldName, | ||
memoryFieldName, | ||
onDiskQuotaChange, | ||
onInstancesChange, | ||
onMemoryChange, | ||
} = this.props; | ||
|
||
return ( | ||
<div> | ||
<div className="col-md-9"> | ||
<div className="sp-margin-m-bottom"> | ||
<FormikFormField | ||
name={memoryFieldName} | ||
fastField={false} | ||
input={props => <TextInput {...props} />} | ||
label="Memory" | ||
onChange={value => { | ||
onMemoryChange && onMemoryChange(value); | ||
}} | ||
/> | ||
</div> | ||
<div className="sp-margin-m-bottom"> | ||
<FormikFormField | ||
name={diskQuotaFieldName} | ||
fastField={false} | ||
input={props => <TextInput {...props} />} | ||
label="Disk Quota" | ||
onChange={value => { | ||
onDiskQuotaChange && onDiskQuotaChange(value); | ||
}} | ||
/> | ||
</div> | ||
<div className="sp-margin-m-bottom"> | ||
<FormikFormField | ||
name={instancesFieldName} | ||
fastField={false} | ||
input={props => <TextInput type="number" {...props} />} | ||
label="Instances" | ||
onChange={value => { | ||
onInstancesChange && onInstancesChange(value); | ||
}} | ||
required={true} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
app/scripts/modules/cloudfoundry/src/presentation/forms/serverGroup/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from './Buildpacks'; | ||
export * from './EnvironmentVariables'; | ||
export * from './HealthCheck'; | ||
export * from './InstanceParameters'; | ||
export * from './Routes'; | ||
export * from './Services'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './widgets'; | ||
export * from './forms'; |
Oops, something went wrong.