import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { useDispatch, useSelector } from 'react-redux'; import { FormattedMessage } from 'react-intl'; import { ActionGroup, Button, Form, } from '@patternfly/react-core'; import { translate as __ } from 'foremanReact/common/I18n'; import { noop } from 'foremanReact/common/helpers'; import { AIRGAPPED } from './CdnConfigurationConstants'; import { updateCdnConfiguration } from '../../../Organizations/OrganizationActions'; import { selectUpdatingCdnConfiguration, } from '../../../Organizations/OrganizationSelectors'; import './CdnConfigurationForm.scss'; const AirGappedTypeForm = ({ showUpdate, onUpdate }) => { const [updateEnabled, setUpdateEnabled] = useState(showUpdate); const updatingCdnConfiguration = useSelector(state => selectUpdatingCdnConfiguration(state)); const dispatch = useDispatch(); const performUpdate = () => { setUpdateEnabled(false); dispatch(updateCdnConfiguration({ type: AIRGAPPED, }, onUpdate)); }; return (

{__('Import/Export')}, }} />
{showUpdate && {__('Update')}, }} /> }

); }; AirGappedTypeForm.propTypes = { showUpdate: PropTypes.bool.isRequired, onUpdate: PropTypes.func, }; AirGappedTypeForm.defaultProps = { onUpdate: noop, }; export default AirGappedTypeForm;