import PropTypes from 'prop-types'; import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { TextList, TextContent, TextListVariants, Card, CardBody, CardHeader, CardActions, CardTitle, Level, LabelGroup, Button, Tooltip, } from '@patternfly/react-core'; import UserIcon from '@patternfly/react-icons/dist/esm/icons/user-icon'; import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon'; import ClusterIcon from '@patternfly/react-icons/dist/esm/icons/cluster-icon'; import SyncAltIcon from '@patternfly/react-icons/dist/esm/icons/sync-alt-icon'; import { translate as __ } from 'foremanReact/common/I18n'; import dispatchAPICallbackToast from '../../../../api_helper'; import './Properties.scss'; import StatusPropertiesLabel from './StatusPropertiesLabel'; import TextInputField from './TextInputField'; import { RESOURCE_IDENTIFIER_NAME, RESOURCE_IDENTIFIER_DESCRIPTION, RESOURCE_IDENTIFIER_STATUS_NUM_HOSTS, RESOURCE_IDENTIFIER_STATUS_NUM_USERS, RESOURCE_IDENTIFIER_STATUS_NUM_USERGROUPS, } from '../../ResourceQuotaFormConstants'; const Properties = ({ isNewQuota, initialName, initialDescription, initialStatus, handleInputValidation, onChange, onApply, onFetch, }) => { const dispatch = useDispatch(); const tooltipRefFetchButton = React.useRef(); const [isFetchLoading, setIsFetchLoading] = useState(false); const [statusProperties] = useState(initialStatus); const onClickFetch = () => { onFetch(callbackFetch); setIsFetchLoading(true); }; const callbackFetch = (success, response) => { setIsFetchLoading(false); dispatchAPICallbackToast( dispatch, success, response, `Sucessfully fetched latest data.`, `An error occurred fetching quota information.` ); }; return ( {!isNewQuota && (