import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { translate as __ } from 'foremanReact/common/I18n'; import { createStoragesMap, imagesByStorage } from '../ProxmoxStoragesUtils'; import ProxmoxComputeSelectors from '../ProxmoxComputeSelectors'; import InputField from '../common/FormInputs'; const ProxmoxContainerOptions = ({ options, storages, nodeId }) => { const [opts, setOpts] = useState(options); const storagesMap = createStoragesMap(storages, 'vztmpl', nodeId); const volumesMap = imagesByStorage(storages, nodeId, 'local', 'vztmpl'); 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 (