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.
This commit is contained in:
parent
1fcb1cb4b5
commit
e8a40e27dc
1 changed files with 35 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
Divider,
|
||||||
Popover,
|
Popover,
|
||||||
Text,
|
Text,
|
||||||
TextContent,
|
TextContent,
|
||||||
|
|
@ -16,6 +17,7 @@ import { RegionsPopover } from './RegionsPopover';
|
||||||
|
|
||||||
import { selectImageById } from '../../store/composesSlice';
|
import { selectImageById } from '../../store/composesSlice';
|
||||||
import { resolveRelPath } from '../../Utilities/path';
|
import { resolveRelPath } from '../../Utilities/path';
|
||||||
|
import BetaLabel from '../sharedComponents/BetaLabel';
|
||||||
|
|
||||||
const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => {
|
const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
@ -51,6 +53,7 @@ const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => {
|
||||||
return <RegionsPopover composeId={image.id} />;
|
return <RegionsPopover composeId={image.id} />;
|
||||||
}
|
}
|
||||||
} else if (uploadStatus.type === 'azure') {
|
} else if (uploadStatus.type === 'azure') {
|
||||||
|
const createdInPreview = image?.uploadOptions?.source_id;
|
||||||
const url =
|
const url =
|
||||||
'https://portal.azure.com/#@' +
|
'https://portal.azure.com/#@' +
|
||||||
image.uploadOptions.tenant_id +
|
image.uploadOptions.tenant_id +
|
||||||
|
|
@ -60,7 +63,38 @@ const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => {
|
||||||
image.uploadOptions.resource_group +
|
image.uploadOptions.resource_group +
|
||||||
'/providers/Microsoft.Compute/images/' +
|
'/providers/Microsoft.Compute/images/' +
|
||||||
uploadStatus.options.image_name;
|
uploadStatus.options.image_name;
|
||||||
return (
|
return createdInPreview ? (
|
||||||
|
<Popover
|
||||||
|
/* popovers aren't rendered inside of the main page section, make sure our prefixed css still
|
||||||
|
* applies */
|
||||||
|
className="imageBuilder"
|
||||||
|
aria-label="Launch instance"
|
||||||
|
headerContent={<div>Launch instance</div>}
|
||||||
|
bodyContent={
|
||||||
|
<>
|
||||||
|
<>
|
||||||
|
<p>
|
||||||
|
This image was created using features only available in Preview.
|
||||||
|
</p>
|
||||||
|
<Divider className="pf-u-mt-sm pf-u-mb-sm" />
|
||||||
|
<Button
|
||||||
|
isInline
|
||||||
|
component="a"
|
||||||
|
variant="link"
|
||||||
|
href="/preview/insights/image-builder/landing"
|
||||||
|
>
|
||||||
|
<BetaLabel />
|
||||||
|
Launch from Preview
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button variant="link" isInline>
|
||||||
|
Launch
|
||||||
|
</Button>
|
||||||
|
</Popover>
|
||||||
|
) : (
|
||||||
<Button
|
<Button
|
||||||
component="a"
|
component="a"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue