diff --git a/src/Components/ImagesTable/ImagesTable.tsx b/src/Components/ImagesTable/ImagesTable.tsx index 32782d3a..09e4b8d7 100644 --- a/src/Components/ImagesTable/ImagesTable.tsx +++ b/src/Components/ImagesTable/ImagesTable.tsx @@ -26,6 +26,7 @@ import { } from '@patternfly/react-table'; import useChrome from '@redhat-cloud-services/frontend-components/useChrome'; import { ChromeUser } from '@redhat-cloud-services/types'; +import { useFlag } from '@unleash/proxy-client-react'; import { useDispatch } from 'react-redux'; import { NavigateFunction, useNavigate } from 'react-router-dom'; @@ -87,6 +88,7 @@ import { timestampToDisplayString, timestampToDisplayStringDetailed, } from '../../Utilities/time'; +import { OciLaunchModal } from '../Launch/OciLaunchModal'; const ImagesTable = () => { const [page, setPage] = useState(1); @@ -403,13 +405,18 @@ type OciRowPropTypes = { }; const OciRow = ({ compose, rowIndex }: OciRowPropTypes) => { + const launchEofFlag = useFlag('image-builder.launcheof'); const daysToExpiration = Math.floor( computeHoursToExpiration(compose.created_at) / 24, ); const isExpired = daysToExpiration >= OCI_STORAGE_EXPIRATION_TIME_IN_DAYS; const details = ; - const instance = ; + const instance = launchEofFlag ? ( + + ) : ( + + ); const status = ( { + const [isModalOpen, setIsModalOpen] = useState(false); + const { data, isSuccess, isFetching } = useGetComposeStatusQuery({ + composeId: compose.id, + }); + + const navigate = useNavigate(); + if (!isSuccess) { + return ; + } + + const options = data?.image_status.upload_status?.options; + + if (options && !isOciUploadStatus(options)) { + throw TypeError( + `Error: options must be of type OciUploadStatus, not ${typeof options}.`, + ); + } + + if (isExpired) { + return ( + + ); + } + + const handleModalToggle = () => { + setIsModalOpen(!isModalOpen); + }; + + return ( + + + + + + + + Navigate to the{' '} + {' '} + page. + + + Select{' '} + Import image, + and enter the Object Storage URL of the image. + {!isFetching && ( + + {options?.url || ''} + + )} + {isFetching && } + + + After the image is available, click on{' '} + Create instance. + + + + + + + + + ); +};