From e8a40e27dc5c008ae06d565ebff5696b3109cd32 Mon Sep 17 00:00:00 2001 From: lucasgarfield Date: Fri, 5 May 2023 13:22:00 +0200 Subject: [PATCH] Wizard: Add Azure launch link for images created in preview If an image does not contain a subscription_id property, the link to view the image in Azure will be malformed. This happens when a user creates an Azure image in beta/preview using sources, and then clicks the 'View uploaded image' link in stable. Now, if an Azure image was created using sources (as evidenced by presence of a source_id in request's upload options), the Launch button appears and its popover has a link to Preview. --- src/Components/ImagesTable/ImageLinkDirect.js | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Components/ImagesTable/ImageLinkDirect.js b/src/Components/ImagesTable/ImageLinkDirect.js index 627aba0f..d48a53fd 100644 --- a/src/Components/ImagesTable/ImageLinkDirect.js +++ b/src/Components/ImagesTable/ImageLinkDirect.js @@ -2,6 +2,7 @@ import React from 'react'; import { Button, + Divider, Popover, Text, TextContent, @@ -16,6 +17,7 @@ import { RegionsPopover } from './RegionsPopover'; import { selectImageById } from '../../store/composesSlice'; import { resolveRelPath } from '../../Utilities/path'; +import BetaLabel from '../sharedComponents/BetaLabel'; const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => { const navigate = useNavigate(); @@ -51,6 +53,7 @@ const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => { return ; } } else if (uploadStatus.type === 'azure') { + const createdInPreview = image?.uploadOptions?.source_id; const url = 'https://portal.azure.com/#@' + image.uploadOptions.tenant_id + @@ -60,7 +63,38 @@ const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => { image.uploadOptions.resource_group + '/providers/Microsoft.Compute/images/' + uploadStatus.options.image_name; - return ( + return createdInPreview ? ( + Launch instance} + bodyContent={ + <> + <> +

+ This image was created using features only available in Preview. +

+ + + + + } + > + +
+ ) : (