+ |
+ {image.status === 'success' && (
+
+ {image.ami}
+
+ )}
+ |
{image.region} |
@@ -58,15 +53,10 @@ const ClonesTable = ({ composeId }) => {
const clones = useSelector((state) => selectClonesById(state, composeId));
return (
-
+
- | UUID |
- Account |
+ AMI |
Region |
Status |
diff --git a/src/Components/ImagesTable/ImageDetails.js b/src/Components/ImagesTable/ImageDetails.js
new file mode 100644
index 00000000..e359b14d
--- /dev/null
+++ b/src/Components/ImagesTable/ImageDetails.js
@@ -0,0 +1,410 @@
+import React from 'react';
+
+import {
+ ClipboardCopy,
+ DescriptionList,
+ DescriptionListGroup,
+ DescriptionListDescription,
+ DescriptionListTerm,
+ Button,
+ Spinner,
+ Popover,
+ Alert,
+} from '@patternfly/react-core';
+import { ExternalLinkAltIcon } from '@patternfly/react-icons';
+import PropTypes from 'prop-types';
+import { useSelector } from 'react-redux';
+
+import ClonesTable from './ClonesTable';
+
+import {
+ useGetAWSSourcesQuery,
+ useGetAzureSourcesQuery,
+} from '../../store/apiSlice';
+
+const sourceNotFoundPopover = () => {
+ return (
+
+
+
+ The information about the source cannot be loaded. Please check the
+ source was not removed and try again later.
+
+
+ }
+ iconPosition="right"
+ isInline
+ href={'settings/sources'}
+ >
+ Manage sources here
+
+ >
+ }
+ >
+
+
+ );
+};
+
+const getAzureSourceName = (id) => {
+ const { data: sources, isSuccess } = useGetAzureSourcesQuery();
+
+ if (isSuccess) {
+ const sourcename = sources.find((source) => source.id === id);
+ if (sourcename) {
+ return sourcename.name;
+ } else {
+ return sourceNotFoundPopover();
+ }
+ } else {
+ return ;
+ }
+};
+
+const getAWSSourceName = (id) => {
+ const { data: sources, isSuccess } = useGetAWSSourcesQuery();
+
+ if (isSuccess) {
+ const sourcename = sources.find((source) => source.id === id);
+ if (sourcename) {
+ return sourcename.name;
+ } else {
+ return sourceNotFoundPopover();
+ }
+ } else {
+ return ;
+ }
+};
+
+const parseGCPSharedWith = (sharedWith) => {
+ const splitGCPSharedWith = sharedWith[0].split(':');
+ return splitGCPSharedWith[1];
+};
+
+const AWSDetails = ({ id }) => {
+ const composes = useSelector((state) => state.composes);
+ const compose = composes.byId[id];
+
+ return (
+
+
+ UUID
+
+
+ {id}
+
+
+
+ {compose.request.image_requests[0].upload_request.options
+ .share_with_sources && (
+
+ Source
+
+ {getAWSSourceName(
+ compose.request.image_requests[0].upload_request.options
+ .share_with_sources?.[0]
+ )}
+
+
+ )}
+ {compose.request.image_requests[0].upload_request.options
+ .share_with_accounts?.[0] && (
+
+ Shared with
+
+ }
+ iconPosition="right"
+ isInline
+ // the format of an account link is taken from
+ // https://docs.aws.amazon.com/signin/latest/userguide/sign-in-urls-defined.html
+ href={`https://${compose.request.image_requests[0].upload_request.options.share_with_accounts[0]}.signin.aws.amazon.com/console/`}
+ >
+ {
+ compose.request.image_requests[0].upload_request.options
+ .share_with_accounts[0]
+ }
+
+
+
+ )}
+
+ );
+};
+
+const AWSIdentifiers = ({ id }) => {
+ return ;
+};
+
+const AzureDetails = ({ id }) => {
+ const composes = useSelector((state) => state.composes);
+ const compose = composes.byId[id];
+
+ return (
+ <>
+
+
+ UUID
+
+
+ {id}
+
+
+
+ {compose.request.image_requests[0].upload_request.options.source_id && (
+
+ Source
+
+ {getAzureSourceName(
+ compose.request.image_requests[0].upload_request.options
+ .source_id
+ )}
+
+
+ )}
+
+ Resource Group
+
+ {
+ compose.request.image_requests[0].upload_request.options
+ .resource_group
+ }
+
+
+
+ >
+ );
+};
+
+const AzureIdentifiers = ({ id }) => {
+ const composes = useSelector((state) => state.composes);
+ const compose = composes.byId[id];
+
+ return (
+ <>
+
+
+ Image name
+
+ {compose?.image_status?.status === 'success' ? (
+
+ {compose.image_status.upload_status.options.image_name}
+
+ ) : (
+
+ )}
+
+
+
+ >
+ );
+};
+
+const GCPDetails = ({ id, sharedWith }) => {
+ const composes = useSelector((state) => state.composes);
+ const compose = composes.byId[id];
+
+ return (
+ <>
+
+
+ UUID
+
+
+ {id}
+
+
+
+ {compose?.image_status?.status === 'success' && (
+
+ Project ID
+
+ {compose.image_status.upload_status.options.project_id}
+
+
+ )}
+ {sharedWith && (
+
+ Shared with
+
+ {parseGCPSharedWith(sharedWith)}
+
+
+ )}
+
+ >
+ );
+};
+
+const GCPIdentifiers = ({ id }) => {
+ const composes = useSelector((state) => state.composes);
+ const compose = composes.byId[id];
+
+ return (
+ <>
+
+
+ Image name
+
+ {compose?.image_status?.status === 'success' ? (
+
+ {compose.image_status.upload_status.options.image_name}
+
+ ) : compose?.image_status?.status === 'failure' ? (
+
+ ) : (
+
+ )}
+
+
+
+ >
+ );
+};
+
+const ImageDetails = ({ id }) => {
+ const composes = useSelector((state) => state.composes);
+ const compose = composes.byId[id];
+
+ return (
+ <>
+ Build Information
+ {
+ // the information about the image's target differs between images
+ // built by api and images built by the service
+ (compose.request.image_requests[0].image_type === 'aws' ||
+ compose?.image_status?.upload_status?.type === 'aws') && (
+
+ )
+ }
+ {(compose.request.image_requests[0].image_type === 'azure' ||
+ compose?.image_status?.upload_status?.type === 'azure') && (
+
+ )}
+ {(compose.request.image_requests[0].image_type === 'gcp' ||
+ compose?.image_status?.upload_status?.type === 'gcp') && (
+
+ )}
+ {(compose.request.image_requests[0].image_type === 'guest-image' ||
+ compose.request.image_requests[0].image_type === 'image-installer' ||
+ compose.request.image_requests[0].image_type === 'vsphere' ||
+ compose.request.image_requests[0].image_type ===
+ 'rhel-edge-installer' ||
+ compose.request.image_requests[0].image_type ===
+ 'rhel-edge-commit') && (
+
+
+ UUID
+
+
+ {id}
+
+
+
+
+ )}
+ {(compose.request.image_requests[0].image_type === 'aws' ||
+ compose?.image_status?.upload_status?.type === 'aws' ||
+ compose.request.image_requests[0].image_type === 'gcp' ||
+ compose?.image_status?.upload_status?.type === 'gcp' ||
+ compose.request.image_requests[0].image_type === 'azure' ||
+ compose?.image_status?.upload_status?.type === 'azure') && (
+ <>
+
+
+ Cloud Provider Identifiers
+
+ >
+ )}
+ {(compose.request.image_requests[0].image_type === 'aws' ||
+ compose?.image_status?.upload_status?.type === 'aws') && (
+
+ )}
+ {(compose.request.image_requests[0].image_type === 'azure' ||
+ compose?.image_status?.upload_status?.type === 'azure') && (
+
+ )}
+ {(compose.request.image_requests[0].image_type === 'gcp' ||
+ compose?.image_status?.upload_status?.type === 'gcp') && (
+
+ )}
+ >
+ );
+};
+
+AWSDetails.propTypes = {
+ id: PropTypes.string,
+};
+
+AWSIdentifiers.propTypes = {
+ id: PropTypes.string,
+};
+
+AzureDetails.propTypes = {
+ id: PropTypes.string,
+};
+
+AzureIdentifiers.propTypes = {
+ id: PropTypes.string,
+};
+
+GCPDetails.propTypes = {
+ id: PropTypes.string,
+ sharedWith: PropTypes.arrayOf(PropTypes.string),
+};
+
+GCPIdentifiers.propTypes = {
+ id: PropTypes.string,
+};
+
+ImageDetails.propTypes = {
+ id: PropTypes.string,
+};
+
+export default ImageDetails;
diff --git a/src/Components/ImagesTable/ImagesTable.js b/src/Components/ImagesTable/ImagesTable.js
index 631ed7cd..78879054 100644
--- a/src/Components/ImagesTable/ImagesTable.js
+++ b/src/Components/ImagesTable/ImagesTable.js
@@ -29,8 +29,8 @@ import { useDispatch, useSelector } from 'react-redux';
import { Link, useNavigate } from 'react-router-dom';
import './ImagesTable.scss';
-import ClonesTable from './ClonesTable';
import { ImageBuildStatus } from './ImageBuildStatus';
+import ImageDetails from './ImageDetails';
import ImageLink from './ImageLink';
import Release from './Release';
import Target from './Target';
@@ -277,15 +277,9 @@ const ImagesTable = () => {
|
- {compose.request.image_requests[0].upload_request
- .type === 'aws' ? (
-
- ) : (
-
- UUID
- {id}
-
- )}
+
+
+
|
|