diff --git a/src/Components/ImagesTable/ImageDetails.tsx b/src/Components/ImagesTable/ImageDetails.tsx index 1faae7ee..87eb3a6b 100644 --- a/src/Components/ImagesTable/ImageDetails.tsx +++ b/src/Components/ImagesTable/ImageDetails.tsx @@ -91,9 +91,9 @@ const AzureSourceName = ({ id }: AzureSourceNamePropTypes) => { const sourcename = sources?.find((source) => source.id === id); if (sourcename) { return

{sourcename.name}

; - } else { - return ; } + + return ; }; type AwsSourceNamePropTypes = { @@ -114,9 +114,9 @@ const AwsSourceName = ({ id }: AwsSourceNamePropTypes) => { const sourcename = sources?.find((source) => source.id === id); if (sourcename) { return

{sourcename.name}

; - } else { - return ; } + + return ; }; const parseGcpSharedWith = ( diff --git a/src/Components/ImagesTable/Instance.tsx b/src/Components/ImagesTable/Instance.tsx index 61dbcd96..333920c0 100644 --- a/src/Components/ImagesTable/Instance.tsx +++ b/src/Components/ImagesTable/Instance.tsx @@ -73,9 +73,9 @@ export const CloudInstance = ({ compose }: CloudInstancePropTypes) => { if (hasProvisioning) { return ; - } else { - return ; } + + return ; }; const DisabledProvisioningLink = () => { @@ -142,97 +142,95 @@ const ProvisioningLink = ({ composeStatus?.image_status.status !== 'success' ) { return ; - } else { - const ProvisioningWizard = exposedScalprumModule.default; - const provider = getImageProvider(compose); - - const options = compose.request.image_requests[0].upload_request.options; - - let sourceIds = undefined; - let accountIds = undefined; - - if (isGcpUploadRequestOptions(options)) { - accountIds = options.share_with_accounts; - } - - if (isAwsUploadRequestOptions(options)) { - accountIds = options.share_with_accounts; - sourceIds = options.share_with_sources; - } - - const btn = ( - - ); - const buttonWithTooltip = ( - A newer version is available} - bodyContent={ -
- This image can be launched, but it is not the latest version. -
- } - > - {btn} -
- ); - - return ( - <> - - {selectedBlueprintVersion && - compose.blueprint_version !== selectedBlueprintVersion - ? buttonWithTooltip - : btn} - {wizardOpen && ( - - setWizardOpen(false)} - image={{ - name: compose.image_name || compose.id, - id: compose.id, - architecture: compose.request.image_requests[0].architecture, - provider: provider, - sourceIDs: sourceIds, - accountIDs: accountIds, - uploadOptions: - compose.request.image_requests[0].upload_request.options, - uploadStatus: composeStatus.image_status.upload_status, - }} - /> - - )} - - - ); } + + const ProvisioningWizard = exposedScalprumModule.default; + const provider = getImageProvider(compose); + + const options = compose.request.image_requests[0].upload_request.options; + + let sourceIds = undefined; + let accountIds = undefined; + + if (isGcpUploadRequestOptions(options)) { + accountIds = options.share_with_accounts; + } + + if (isAwsUploadRequestOptions(options)) { + accountIds = options.share_with_accounts; + sourceIds = options.share_with_sources; + } + + const btn = ( + + ); + const buttonWithTooltip = ( + A newer version is available} + bodyContent={ +
This image can be launched, but it is not the latest version.
+ } + > + {btn} +
+ ); + + return ( + <> + + {selectedBlueprintVersion && + compose.blueprint_version !== selectedBlueprintVersion + ? buttonWithTooltip + : btn} + {wizardOpen && ( + + setWizardOpen(false)} + image={{ + name: compose.image_name || compose.id, + id: compose.id, + architecture: compose.request.image_requests[0].architecture, + provider: provider, + sourceIDs: sourceIds, + accountIDs: accountIds, + uploadOptions: + compose.request.image_requests[0].upload_request.options, + uploadStatus: composeStatus.image_status.upload_status, + }} + /> + + )} + + + ); }; const getImageProvider = (compose: ComposesResponseItem) => { @@ -283,80 +281,80 @@ export const OciInstance = ({ compose, isExpired }: OciInstancePropTypes) => { Recreate image ); - } else { - return ( - Launch an OCI image} - minWidth="30rem" - bodyContent={ - <> -

- To run the image copy the link below and follow the steps below: -

- - - Go to "Compute" in Oracle Cloud and choose " - Custom Images". - - - Click on "Import image", choose "Import from an - object storage URL". - - - 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. - - -
- {isSuccess && ( - - {options?.url || ''} - - )} - {isFetching && } - {isError && ( - - )} -
- - - } - > - -
- ); } + + return ( + Launch an OCI image} + minWidth="30rem" + bodyContent={ + <> +

+ To run the image copy the link below and follow the steps below: +

+ + + Go to "Compute" in Oracle Cloud and choose " Custom + Images". + + + Click on "Import image", choose "Import from an + object storage URL". + + + 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. + + +
+ {isSuccess && ( + + {options?.url || ''} + + )} + {isFetching && } + {isError && ( + + )} +
+ + + } + > + +
+ ); }; type AwsS3InstancePropTypes = { @@ -410,21 +408,20 @@ export const AwsS3Instance = ({ ) ); - } else { - return ( - - ); } + + return ( + + ); }; type LocalInstancePropTypes = { diff --git a/src/Components/ImagesTable/Status.tsx b/src/Components/ImagesTable/Status.tsx index a6d25e3b..d96fb9e4 100644 --- a/src/Components/ImagesTable/Status.tsx +++ b/src/Components/ImagesTable/Status.tsx @@ -222,7 +222,9 @@ export const ExpiringStatus = ({ return ( ); - } else if (imageType === 'aws.s3' && status === 'success') { + } + + if (imageType === 'aws.s3' && status === 'success') { const text = `Expires in ${remainingHours} ${ remainingHours > 1 ? 'hours' : 'hour' }`; @@ -236,7 +238,9 @@ export const ExpiringStatus = ({ } /> ); - } else if (imageType === 'oci.objectstorage' && status === 'success') { + } + + if (imageType === 'oci.objectstorage' && status === 'success') { const text = `Expires in ${remainingDays} ${ remainingDays > 1 ? 'days' : 'day' }`; @@ -250,7 +254,9 @@ export const ExpiringStatus = ({ } /> ); - } else if (status === 'failure') { + } + + if (status === 'failure') { return ( ); - } else { - return ; } + + return ; }; type LocalStatusPropTypes = {