From e61cb99f1bc96ce3e3af1f0f9abc756c5a287f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20V=C3=ADtov=C3=A1?= Date: Mon, 11 Aug 2025 16:06:21 +0200 Subject: [PATCH 1/7] Launch: implement guidance for Azure (HMS-9003) This commit adds launch modal for guiding users through launching an Azure instance from their image. As the launch service will be decommissioned, the flag shall be turned on, the code will later be cleaned up and the Provisioning wizard removed. --- src/Components/ImagesTable/ImagesTable.tsx | 9 +- src/Components/Launch/AzureLaunchModal.tsx | 116 +++++++++++++++++++++ src/Components/Launch/OciLaunchModal.tsx | 2 +- 3 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 src/Components/Launch/AzureLaunchModal.tsx diff --git a/src/Components/ImagesTable/ImagesTable.tsx b/src/Components/ImagesTable/ImagesTable.tsx index 09e4b8d7..8c9118a1 100644 --- a/src/Components/ImagesTable/ImagesTable.tsx +++ b/src/Components/ImagesTable/ImagesTable.tsx @@ -88,6 +88,7 @@ import { timestampToDisplayString, timestampToDisplayStringDetailed, } from '../../Utilities/time'; +import { AzureLaunchModal } from '../Launch/AzureLaunchModal'; import { OciLaunchModal } from '../Launch/OciLaunchModal'; const ImagesTable = () => { @@ -384,8 +385,14 @@ type AzureRowPropTypes = { }; const AzureRow = ({ compose, rowIndex }: AzureRowPropTypes) => { + const launchEofFlag = useFlag('image-builder.launcheof'); + const details = ; - const instance = ; + const instance = launchEofFlag ? ( + + ) : ( + + ); const status = ; return ( diff --git a/src/Components/Launch/AzureLaunchModal.tsx b/src/Components/Launch/AzureLaunchModal.tsx new file mode 100644 index 00000000..8cfba072 --- /dev/null +++ b/src/Components/Launch/AzureLaunchModal.tsx @@ -0,0 +1,116 @@ +import React, { Fragment, useState } from 'react'; + +import { + Button, + List, + ListComponent, + ListItem, + Modal, + ModalBody, + ModalFooter, + ModalHeader, + ModalVariant, + OrderType, + Skeleton, +} from '@patternfly/react-core'; +import { ExternalLinkAltIcon } from '@patternfly/react-icons'; + +import { + ComposesResponseItem, + useGetComposeStatusQuery, +} from '../../store/imageBuilderApi'; +import { isAzureUploadStatus } from '../../store/typeGuards'; + +type LaunchProps = { + compose: ComposesResponseItem; +}; + +export const AzureLaunchModal = ({ compose }: LaunchProps) => { + const [isModalOpen, setIsModalOpen] = useState(false); + const { data, isSuccess, isFetching } = useGetComposeStatusQuery({ + composeId: compose.id, + }); + + if (!isSuccess) { + return ; + } + + const options = data?.image_status.upload_status?.options; + + if (options && !isAzureUploadStatus(options)) { + throw TypeError( + `Error: options must be of type AzureUploadStatus, not ${typeof options}.`, + ); + } + + const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => { + setIsModalOpen(!isModalOpen); + }; + + return ( + + + + + + + + + Locate{' '} + {!isFetching && ( + + {options?.image_name}{' '} + + )} + {isFetching && } + in the{' '} + + . + + + Create a Virtual Machine (VM) by using the image. +
+ Note: Review the{' '} + + Availability Zone + {' '} + and the Size to + meet your requirements. Adjust these settings as needed. +
+
+
+ + + +
+
+ ); +}; diff --git a/src/Components/Launch/OciLaunchModal.tsx b/src/Components/Launch/OciLaunchModal.tsx index 8d9f93d6..fa129be3 100644 --- a/src/Components/Launch/OciLaunchModal.tsx +++ b/src/Components/Launch/OciLaunchModal.tsx @@ -72,7 +72,7 @@ export const OciLaunchModal = ({ isExpired, compose }: LaunchProps) => {