import React from 'react'; import { Button, Popover, Text, TextContent, TextVariants, } from '@patternfly/react-core'; import { ExternalLinkAltIcon } from '@patternfly/react-icons'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; import { RegionsPopover } from './RegionsPopover'; import { selectImageById } from '../../store/composesSlice'; import { resolveRelPath } from '../../Utilities/path'; const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => { const navigate = useNavigate(); const image = useSelector((state) => selectImageById(state, imageId)); const uploadStatus = image.uploadStatus; const fileExtensions = { vsphere: '.vmdk', 'guest-image': '.qcow2', 'image-installer': '.iso', }; if (uploadStatus.type === 'aws') { const url = 'https://console.aws.amazon.com/ec2/v2/home?region=' + uploadStatus.options.region + '#LaunchInstanceWizard:ami=' + uploadStatus.options.ami; if (isInClonesTable) { return ( ); } else { return ; } } else if (uploadStatus.type === 'azure') { const url = 'https://portal.azure.com/#@' + image.uploadOptions.tenant_id + '/resource/subscriptions/' + image.uploadOptions.subscription_id + '/resourceGroups/' + image.uploadOptions.resource_group + '/providers/Microsoft.Compute/images/' + uploadStatus.options.image_name; return ( ); } else if (uploadStatus.type === 'gcp') { return ( To use an Image Builder created Google Cloud Platform (GCP) image in your project, specify the project ID and image name in your templates and configurations. Project ID
{uploadStatus.options.project_id}
Image Name
{uploadStatus.options.image_name}
Shared with
{/* the account the image is shared with is stored in the form type:account so this extracts the account */} {image.uploadOptions.share_with_accounts[0].split(':')[1]}
} >
); } else if (uploadStatus.type === 'aws.s3') { if (!isExpired) { return ( ); } else { return ( ); } } return null; }; ImageLinkDirect.propTypes = { imageId: PropTypes.string, isExpired: PropTypes.bool, isInClonesTable: PropTypes.bool, }; export default ImageLinkDirect;