forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core/deployment): Update redblack fields without force updat…
…ing (spinnaker#8840) * refactor(core/deployment): Update redblack fields without force updating * refactor(cloudfoundry): Remove duplicate redblack additional fields component
- Loading branch information
1 parent
ad7608d
commit 95eacfb
Showing
4 changed files
with
71 additions
and
154 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
68 changes: 0 additions & 68 deletions
68
...ipts/modules/cloudfoundry/src/deploymentStrategy/strategies/redblack/AdditionalFields.tsx
This file was deleted.
Oops, something went wrong.
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,2 +1,3 @@ | ||
export * from './DeploymentStrategySelector'; | ||
export * from './deploymentStrategy.registry'; | ||
export { AdditionalFields as CoreRedBlackAdditionalFields } from './strategies/redblack/AdditionalFields'; |
152 changes: 68 additions & 84 deletions
152
app/scripts/modules/core/src/deploymentStrategy/strategies/redblack/AdditionalFields.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 |
---|---|---|
@@ -1,95 +1,79 @@ | ||
import React from 'react'; | ||
import { set } from 'lodash'; | ||
|
||
import { IDeploymentStrategyAdditionalFieldsProps } from '../../deploymentStrategy.registry'; | ||
import { HelpField } from 'core/help/HelpField'; | ||
|
||
import { IRedBlackCommand } from './redblack.strategy'; | ||
|
||
export interface IRedBlackStrategyAdditionalFieldsProps extends IDeploymentStrategyAdditionalFieldsProps { | ||
command: IRedBlackCommand; | ||
} | ||
|
||
export class AdditionalFields extends React.Component<IRedBlackStrategyAdditionalFieldsProps> { | ||
private handleChange = (key: string, value: any) => { | ||
set(this.props.command, key, value); | ||
this.forceUpdate(); | ||
}; | ||
|
||
public render() { | ||
const { command } = this.props; | ||
return ( | ||
<div className="form-group"> | ||
<div className="col-md-12 checkbox"> | ||
<label> | ||
<input | ||
type="checkbox" | ||
checked={command.rollback?.onFailure ?? false} | ||
onChange={(e) => this.handleChange('rollback.onFailure', e.target.checked)} | ||
/> | ||
Rollback to previous server group if deployment fails <HelpField id="strategy.redblack.rollback" /> | ||
</label> | ||
</div> | ||
<div className="col-md-12 checkbox"> | ||
<label> | ||
<input | ||
type="checkbox" | ||
checked={command.scaleDown} | ||
onChange={(e) => this.handleChange('scaleDown', e.target.checked)} | ||
/> | ||
Scale down replaced server groups to zero instances | ||
<HelpField id="strategy.redblack.scaleDown" /> | ||
</label> | ||
</div> | ||
<div className="col-md-12 form-inline"> | ||
<label> | ||
Maximum number of server groups to leave | ||
<HelpField id="strategy.redblack.maxRemainingAsgs" /> | ||
</label> | ||
<input | ||
className="form-control input-sm" | ||
style={{ width: '50px' }} | ||
type="number" | ||
value={command.maxRemainingAsgs} | ||
onChange={(e) => this.handleChange('maxRemainingAsgs', e.target.value)} | ||
min="2" | ||
/> | ||
</div> | ||
<div className="col-md-12 form-inline"> | ||
<label> | ||
Wait Before Disable | ||
<HelpField content="Time to wait before disabling all old server groups in this cluster" /> | ||
</label> | ||
<input | ||
className="form-control input-sm" | ||
style={{ width: '60px' }} | ||
min="0" | ||
type="number" | ||
value={command.delayBeforeDisableSec} | ||
onChange={(e) => this.handleChange('delayBeforeDisableSec', e.target.value)} | ||
placeholder="0" | ||
/> | ||
seconds | ||
</div> | ||
{command.scaleDown && ( | ||
<div className="col-md-12 form-inline" style={{ marginTop: '5px' }}> | ||
<label> | ||
Wait Before Scale Down | ||
<HelpField content="Time to wait before scaling down all old server groups in this cluster" /> | ||
</label> | ||
<input | ||
className="form-control input-sm" | ||
style={{ width: '60px' }} | ||
min="0" | ||
type="number" | ||
value={command.delayBeforeScaleDownSec} | ||
onChange={(e) => this.handleChange('delayBeforeScaleDownSec', e.target.value)} | ||
placeholder="0" | ||
/> | ||
seconds | ||
</div> | ||
)} | ||
export const AdditionalFields = ({ command, onChange }: IRedBlackStrategyAdditionalFieldsProps) => ( | ||
<div className="form-group"> | ||
<div className="col-md-12 checkbox"> | ||
<label> | ||
<input | ||
type="checkbox" | ||
checked={command.rollback?.onFailure ?? false} | ||
onChange={(e) => onChange('rollback.onFailure', e.target.checked)} | ||
/> | ||
Rollback to previous server group if deployment fails <HelpField id="strategy.redblack.rollback" /> | ||
</label> | ||
</div> | ||
<div className="col-md-12 checkbox"> | ||
<label> | ||
<input type="checkbox" checked={command.scaleDown} onChange={(e) => onChange('scaleDown', e.target.checked)} /> | ||
Scale down replaced server groups to zero instances | ||
<HelpField id="strategy.redblack.scaleDown" /> | ||
</label> | ||
</div> | ||
<div className="col-md-12 form-inline"> | ||
<label> | ||
Maximum number of server groups to leave | ||
<HelpField id="strategy.redblack.maxRemainingAsgs" /> | ||
</label> | ||
<input | ||
className="form-control input-sm" | ||
style={{ width: '50px' }} | ||
type="number" | ||
value={command.maxRemainingAsgs} | ||
onChange={(e) => onChange('maxRemainingAsgs', e.target.value)} | ||
min="2" | ||
/> | ||
</div> | ||
<div className="col-md-12 form-inline"> | ||
<label> | ||
Wait Before Disable | ||
<HelpField content="Time to wait before disabling all old server groups in this cluster" /> | ||
</label> | ||
<input | ||
className="form-control input-sm" | ||
style={{ width: '60px' }} | ||
min="0" | ||
type="number" | ||
value={command.delayBeforeDisableSec} | ||
onChange={(e) => onChange('delayBeforeDisableSec', e.target.value)} | ||
placeholder="0" | ||
/> | ||
seconds | ||
</div> | ||
{command.scaleDown && ( | ||
<div className="col-md-12 form-inline" style={{ marginTop: '5px' }}> | ||
<label> | ||
Wait Before Scale Down | ||
<HelpField content="Time to wait before scaling down all old server groups in this cluster" /> | ||
</label> | ||
<input | ||
className="form-control input-sm" | ||
style={{ width: '60px' }} | ||
min="0" | ||
type="number" | ||
value={command.delayBeforeScaleDownSec} | ||
onChange={(e) => onChange('delayBeforeScaleDownSec', e.target.value)} | ||
placeholder="0" | ||
/> | ||
seconds | ||
</div> | ||
); | ||
} | ||
} | ||
)} | ||
</div> | ||
); |