import React, { useEffect, useState } from 'react'; import { DescriptionList, DescriptionListTerm, DescriptionListGroup, DescriptionListDescription, List, ListItem, Spinner, Tabs, Tab, TabTitleText, Text, TextContent, TextVariants, TextList, TextListVariants, TextListItem, TextListItemVariants } from '@patternfly/react-core'; import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; import { releaseValues } from '../steps/imageOutput'; import { googleAccType } from '../steps/googleCloud'; const ReviewStep = () => { const [ activeTabKey, setActiveTabKey ] = useState(0); const [ orgId, setOrgId ] = useState(); const { change, getState } = useFormApi(); useEffect(() => { const registerSystem = getState()?.values?.['register-system']; if (registerSystem === 'register-now' || registerSystem === 'register-now-insights') { (async () => { const userData = await insights?.chrome?.auth?.getUser(); const id = userData?.identity?.internal?.org_id; setOrgId(id); change('subscription-organization-id', id); })(); } }); const handleTabClick = (event, tabIndex) => { setActiveTabKey(tabIndex); }; return ( <> Review the information and click "Create image" to create the image using the following criteria. Release {releaseValues?.[getState()?.values?.release]} Target environment } data-testid='tab-target'> {getState()?.values?.['target-environment']?.aws && }> Amazon Web Services Account ID {getState()?.values?.['aws-account-id']} } {getState()?.values?.['target-environment']?.google && }> Google Cloud Platform {googleAccType?.[getState()?.values?.['google-account-type']]} {getState()?.values?.['google-email'] || getState()?.values?.['google-domain']} } {getState()?.values?.['target-environment']?.azure && }> Microsoft Azure Subscription ID {getState()?.values?.['azure-subscription-id']} Tenant ID {getState()?.values?.['azure-tenant-id']} Resource group {getState()?.values?.['azure-resource-group']} } {getState()?.values?.['target-environment']?.vsphere && VMWare } {getState()?.values?.['target-environment']?.['guest-image'] && Virtualization - Guest image } {getState()?.values?.['target-environment']?.['image-installer'] && Bare metal - Installer } {getState()?.values?.release.includes('rhel') && Registration } data-testid='tab-registration'> {getState()?.values?.['register-system'] === 'register-later' && Subscription Register the system later } {(getState()?.values?.['register-system'] === 'register-now' || getState()?.values?.['register-system'] === 'register-now-insights') && Subscription {getState()?.values?.['register-system'] === 'register-now-insights' && 'Register with Subscriptions and Red Hat Insights' } {getState()?.values?.['register-system'] === 'register-now' && 'Register with Subscriptions' } Activation key {getState()?.values?.['subscription-activation-key']} Organization ID {orgId !== undefined ? ( {orgId} ) : ( )} } } System configuration } data-testid='tab-system'> Packages Chosen {getState()?.values?.['selected-packages']?.length || 0} ); }; export default ReviewStep;