import React, { useEffect, useState, } from 'react'; import { useDispatch, useSelector, } from 'react-redux'; import { translate as __ } from 'foremanReact/common/I18n'; import PropTypes from 'prop-types'; import { propsToCamelCase } from 'foremanReact/common/helpers'; import { selectAPIResponse } from 'foremanReact/redux/API/APISelectors'; import { Title, TextContent, Text, TextVariants, Breadcrumb, BreadcrumbItem, Grid, GridItem, Label, Split, SplitItem, Flex, FlexItem, Panel, PageSection, } from '@patternfly/react-core'; import './ActivationKeyDetails.scss'; import EditModal from './components/EditModal'; import DeleteMenu from './components/DeleteMenu'; import { getActivationKey } from './ActivationKeyActions'; import DeleteModal from './components/DeleteModal'; import InactiveText from '../../ContentViews/components/InactiveText'; import SystemPurposeCard from '../../../components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard'; const ActivationKeyDetails = ({ match }) => { const dispatch = useDispatch(); const akId = match?.params?.id; const akDetailsResponse = useSelector(state => selectAPIResponse(state, `ACTIVATION_KEY_${akId}`)); const akDetails = propsToCamelCase(akDetailsResponse); const [isModalOpen, setModalOpen] = useState(false); useEffect(() => { if (akId) { dispatch(getActivationKey(akId)); } }, [akId, dispatch]); const handleModalToggle = () => { setModalOpen(!isModalOpen); }; return (