import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import PropTypes from 'prop-types'; import { translate as __ } from 'foremanReact/common/I18n'; import { ActionGroup, Button, Form, FormGroup, Modal, ModalVariant, TextArea, TextInput } from '@patternfly/react-core'; import { editACS, getACSDetails } from '../../ACSActions'; const ACSEditDetails = ({ onClose, acsId, acsDetails }) => { const { name, description } = acsDetails; const dispatch = useDispatch(); const [acsName, setACSName] = useState(name); const [acsDescription, setAcsDescription] = useState(description || ''); const [saving, setSaving] = useState(false); const onSubmit = () => { setSaving(true); dispatch(editACS( acsId, { acsId, name: acsName, description: acsDescription }, () => { dispatch(getACSDetails(acsId)); onClose(); }, () => { setSaving(false); }, )); }; return (
{ e.preventDefault(); onSubmit(); }} > { setACSName(value); }} />