From 4d783537fb3cfe1176c439a7a7c2f7cbf9875c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20V=C3=ADtov=C3=A1?= Date: Wed, 20 Aug 2025 11:29:17 +0200 Subject: [PATCH] Launch: implement guidance for Oracle (HMS-9004) This commit adds launch modal for guiding users through launching a Oracle instance from their image. It provides a link to Oracle's cloud and a link for importing the image on the user's side. --- src/Components/ImagesTable/ImagesTable.tsx | 9 +- src/Components/Launch/OciLaunchModal.tsx | 139 +++++++++++++++++++++ 2 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 src/Components/Launch/OciLaunchModal.tsx 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. + + + + + + + + + ); +};