import { set } from 'lodash'; import * as React from 'react'; import { HelpField, NumberInput } from '@spinnaker/core'; import type { IUpsertScalingPolicyCommand } from '../ScalingPolicyWriter'; import './ScalingPolicyAdditionalSettings.less'; export interface IScalingPolicyAdditionalSettingsProps { command: IUpsertScalingPolicyCommand; isInstanceType: boolean; isNew: boolean; operator: string; updateCommand: (command: IUpsertScalingPolicyCommand) => void; } export const ScalingPolicyAdditionalSettings = ({ command, isInstanceType, isNew, operator, updateCommand, }: IScalingPolicyAdditionalSettingsProps) => { const setCommandField = (path: string, value: number) => { const newCommand = { ...command }; set(newCommand, path, value); updateCommand(newCommand); }; return (

Additional Settings

{!isNew && (
Policy Name
{command.name}
)} {!isInstanceType && (
Adjustment Step
{`${operator} instances in increments of at least `} setCommandField('minAdjustmentMagnitude', Number.parseInt(e.target.value))} inputClassName="sp-margin-xs-xaxis input-sm number-input-sm" /> instance(s)
)} {Boolean(command.simple) && (
Cooldown
Wait at least setCommandField('simple.cooldown', Number.parseInt(e.target.value))} inputClassName="sp-margin-xs-xaxis input-sm number-input-sm" /> seconds before another scaling event
)} {Boolean(command.step?.estimatedInstanceWarmup) && operator !== 'Remove' && (
Warmup
Instances need setCommandField('step.estimatedInstanceWarmup', Number.parseInt(e.target.value))} inputClassName="sp-margin-xs-xaxis input-sm number-input-sm" /> seconds to warm up after each step
)} {Boolean(command.step?.cooldown) && operator !== 'Remove' && (
Cooldown
setCommandField('step.cooldown', Number.parseInt(e.target.value))} inputClassName="sp-margin-xs-xaxis input-sm number-input-sm" /> seconds
)}
); };