diff --git a/src/Components/ImagesTable/ImageLink.js b/src/Components/ImagesTable/ImageLink.js index b18379cd..364c7127 100644 --- a/src/Components/ImagesTable/ImageLink.js +++ b/src/Components/ImagesTable/ImageLink.js @@ -2,9 +2,15 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Button, TextContent, Text, TextVariants, Popover } from '@patternfly/react-core'; -import { ExternalLinkAltIcon } from '@patternfly/react-icons'; +import { DownloadIcon, ExternalLinkAltIcon } from '@patternfly/react-icons'; const ImageLink = (props) => { + const fileExtensions = { + vsphere: '.vmdk', + 'guest-image': '.qcow2', + 'image-installer': '.iso', + }; + const uploadStatus = props.imageStatus ? props.imageStatus.upload_status : undefined; if (uploadStatus) { if (uploadStatus.type === 'aws') { @@ -78,6 +84,19 @@ const ImageLink = (props) => { ); + } else if (uploadStatus.type === 'aws.s3') { + return ( + + ); } } @@ -86,6 +105,7 @@ const ImageLink = (props) => { ImageLink.propTypes = { imageStatus: PropTypes.object, + imageType: PropTypes.string, uploadOptions: PropTypes.object, }; diff --git a/src/Components/ImagesTable/ImagesTable.js b/src/Components/ImagesTable/ImagesTable.js index 5d702c61..c9997803 100644 --- a/src/Components/ImagesTable/ImagesTable.js +++ b/src/Components/ImagesTable/ImagesTable.js @@ -114,6 +114,7 @@ class ImagesTable extends Component { { title: }, { title: }, ] }; diff --git a/src/test/Components/ImagesTable/ImagesTable.test.js b/src/test/Components/ImagesTable/ImagesTable.test.js index 754e6bd9..9025a094 100644 --- a/src/test/Components/ImagesTable/ImagesTable.test.js +++ b/src/test/Components/ImagesTable/ImagesTable.test.js @@ -262,7 +262,88 @@ const store = { type: 'azure' } }, - } + }, + 'b7193673-8dcc-4a5f-ac30-e9f4940d8346': { + created_at: '2022-01-11 13:33:33.767002 +0000 UTC', + id: 'b7193673-8dcc-4a5f-ac30-e9f4940d8346', + request: { + distribution: RHEL_8, + image_requests: [ + { + architecture: 'x86_64', + image_type: 'vsphere', + upload_request: { + options: {}, + type: 'aws.s3' + } + } + ] + }, + image_status: { + status: 'success', + upload_status: { + options: { + url: 'https://s3.amazonaws.com/b7193673-8dcc-4a5f-ac30-e9f4940d8346-disk.vmdk' + }, + status: 'success', + type: 'aws.s3' + } + } + }, + '4873fd0f-1851-4b9f-b4fe-4639fce90794': { + created_at: '2022-01-11 13:33:33.767002 +0000 UTC', + id: '4873fd0f-1851-4b9f-b4fe-4639fce90793', + request: { + distribution: RHEL_8, + image_requests: [ + { + architecture: 'x86_64', + image_type: 'image-installer', + upload_request: { + options: {}, + type: 'aws.s3' + } + } + ] + }, + image_status: { + status: 'success', + upload_status: { + options: { + url: 'https://s3.amazonaws.com/4873fd0f-1851-4b9f-b4fe-4639fce90794-installer.iso' + }, + status: 'success', + type: 'aws.s3' + } + } + }, + '7b7d0d51-7106-42ab-98f2-f89872a9d599': { + created_at: '2022-01-11 13:33:33.767002 +0000 UTC', + id: '7b7d0d51-7106-42ab-98f2-f89872a9d599', + request: { + distribution: RHEL_8, + image_requests: [ + { + architecture: 'x86_64', + image_type: 'guest-image', + upload_request: { + options: {}, + type: 'aws.s3' + } + } + ] + }, + image_status: { + status: 'success', + upload_status: { + options: { + url: 'https://s3.amazonaws.com/7b7d0d51-7106-42ab-98f2-f89872a9d599-disk.qcow2' + }, + status: 'success', + type: 'aws.s3' + } + } + }, } } }; @@ -301,7 +382,9 @@ describe('Images Table', () => { // render the expected and compare the text content let testElement = document.createElement('testElement'); - render(, { container: testElement }); + render(, { container: testElement }); expect(row.cells[3]).toHaveTextContent(testElement.textContent); // render the expected and compare the text content