import React, { useState } from 'react'; import { NumberInput, StageConfigField } from '@spinnaker/core'; export interface IScaleCommand { manifestName: string; location: string; account: string; reason: string; replicas: number; } export interface IScaleSettingsFormProps { options: IScaleCommand; onChange(options: IScaleCommand): void; } export interface IScaleSettingsFormState { options: IScaleCommand; } export function ScaleSettingsForm({ options, onChange }: IScaleSettingsFormProps) { const [state, setState] = useState({ options: options, }); const updateReplicas = (newReplicas: number) => { state.options.replicas = newReplicas; if (onChange) { onChange(state.options); } setState({ options: state.options }); }; return (
) => { updateReplicas(e.target.valueAsNumber); }} value={options.replicas} min={0} />
); }