import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { translate as __ } from 'foremanReact/common/I18n'; import InputField from '../common/FormInputs'; import ProxmoxComputeSelectors from '../ProxmoxComputeSelectors'; const ProxmoxServerOptions = ({ options }) => { const [opts, setOpts] = useState(options); const handleChange = e => { const { name, type, checked, value: targetValue } = e.target; let value; if (type === 'checkbox') { value = checked ? '1' : '0'; } else { value = targetValue; } const updatedKey = Object.keys(opts).find(key => opts[key].name === name); setOpts(prevOpts => ({ ...prevOpts, [updatedKey]: { ...prevOpts[updatedKey], value }, })); }; return (
); }; ProxmoxServerOptions.propTypes = { options: PropTypes.object, }; ProxmoxServerOptions.defaultProps = { options: {}, }; export default ProxmoxServerOptions;