ImagesTable: Add expiring/expired status to OCI images
Pre-authenticated requests for the OCI images expire 7 days after creation. This adds "Expires in <x> days" and "Expired" as possible statuses for the OCI images.
This commit is contained in:
parent
7ec87dfa58
commit
1fd8deec1a
4 changed files with 129 additions and 85 deletions
|
|
@ -180,9 +180,11 @@ const getImageProvider = (compose: ComposesResponseItem) => {
|
|||
|
||||
type OciInstancePropTypes = {
|
||||
compose: ComposesResponseItem;
|
||||
isExpired: boolean;
|
||||
};
|
||||
|
||||
export const OciInstance = ({ compose }: OciInstancePropTypes) => {
|
||||
export const OciInstance = ({ compose, isExpired }: OciInstancePropTypes) => {
|
||||
const navigate = useNavigate();
|
||||
const { data, isSuccess, isFetching, isError } = useGetComposeStatusQuery({
|
||||
composeId: compose.id,
|
||||
});
|
||||
|
|
@ -199,79 +201,93 @@ export const OciInstance = ({ compose }: OciInstancePropTypes) => {
|
|||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Popover
|
||||
position="bottom"
|
||||
headerContent={<div>Launch an OCI image</div>}
|
||||
minWidth="30rem"
|
||||
bodyContent={
|
||||
<>
|
||||
<p>
|
||||
To run the image copy the link below and follow the steps below:
|
||||
</p>
|
||||
<List component={ListComponent.ol} type={OrderType.number}>
|
||||
<ListItem>
|
||||
Go to "Compute" in Oracle Cloud and choose "Custom
|
||||
Images".
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
Click on "Import image", choose "Import from an
|
||||
object storage URL".
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
Choose "Import from an object storage URL" and paste the
|
||||
URL in the "Object Storage URL" field. The image type
|
||||
has to be set to QCOW2 and the launch mode should be
|
||||
paravirtualized.
|
||||
</ListItem>
|
||||
</List>
|
||||
<br />
|
||||
{isSuccess && (
|
||||
<ClipboardCopy
|
||||
hoverTip="Copy"
|
||||
clickTip="Copied"
|
||||
variant="inline-compact"
|
||||
ouiaId="oci-link"
|
||||
isBlock
|
||||
>
|
||||
{options?.url}
|
||||
</ClipboardCopy>
|
||||
)}
|
||||
{isFetching && <Skeleton />}
|
||||
{isError && (
|
||||
<Alert
|
||||
title="The link to launch the image could not be loaded. Please refresh
|
||||
the page and try again."
|
||||
variant="danger"
|
||||
isPlain
|
||||
isInline
|
||||
/>
|
||||
)}
|
||||
<br />
|
||||
<Button
|
||||
component="a"
|
||||
target="_blank"
|
||||
variant="link"
|
||||
icon={<ExternalLinkAltIcon />}
|
||||
iconPosition="right"
|
||||
// TO DO update the link after documentation is up
|
||||
href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/creating_customized_images_by_using_insights_image_builder/customizing-file-systems-during-the-image-creation"
|
||||
className="pf-u-pl-0"
|
||||
>
|
||||
Read more about launching OCI images
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
if (isExpired) {
|
||||
return (
|
||||
<Button
|
||||
component="a"
|
||||
target="_blank"
|
||||
variant="link"
|
||||
className="pf-u-p-0 pf-u-font-size-sm"
|
||||
isDisabled={data?.image_status.status === 'success' ? false : true}
|
||||
onClick={() => navigate(resolveRelPath(`imagewizard/${compose.id}`))}
|
||||
isInline
|
||||
>
|
||||
Image link
|
||||
Recreate image
|
||||
</Button>
|
||||
</Popover>
|
||||
);
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Popover
|
||||
position="bottom"
|
||||
headerContent={<div>Launch an OCI image</div>}
|
||||
minWidth="30rem"
|
||||
bodyContent={
|
||||
<>
|
||||
<p>
|
||||
To run the image copy the link below and follow the steps below:
|
||||
</p>
|
||||
<List component={ListComponent.ol} type={OrderType.number}>
|
||||
<ListItem>
|
||||
Go to "Compute" in Oracle Cloud and choose "
|
||||
Custom Images".
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
Click on "Import image", choose "Import from an
|
||||
object storage URL".
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
Choose "Import from an object storage URL" and paste
|
||||
the URL in the "Object Storage URL" field. The image
|
||||
type has to be set to QCOW2 and the launch mode should be
|
||||
paravirtualized.
|
||||
</ListItem>
|
||||
</List>
|
||||
<br />
|
||||
{isSuccess && (
|
||||
<ClipboardCopy
|
||||
hoverTip="Copy"
|
||||
clickTip="Copied"
|
||||
variant="inline-compact"
|
||||
ouiaId="oci-link"
|
||||
isBlock
|
||||
>
|
||||
{options?.url}
|
||||
</ClipboardCopy>
|
||||
)}
|
||||
{isFetching && <Skeleton />}
|
||||
{isError && (
|
||||
<Alert
|
||||
title="The link to launch the image could not be loaded. Please refresh
|
||||
the page and try again."
|
||||
variant="danger"
|
||||
isPlain
|
||||
isInline
|
||||
/>
|
||||
)}
|
||||
<br />
|
||||
<Button
|
||||
component="a"
|
||||
target="_blank"
|
||||
variant="link"
|
||||
icon={<ExternalLinkAltIcon />}
|
||||
iconPosition="right"
|
||||
// TO DO update the link after documentation is up
|
||||
href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/creating_customized_images_by_using_insights_image_builder/customizing-file-systems-during-the-image-creation"
|
||||
className="pf-u-pl-0"
|
||||
>
|
||||
Read more about launching OCI images
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<Button
|
||||
variant="link"
|
||||
className="pf-u-p-0 pf-u-font-size-sm"
|
||||
isDisabled={data?.image_status.status === 'success' ? false : true}
|
||||
>
|
||||
Image link
|
||||
</Button>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
type AwsS3InstancePropTypes = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue