V2Wizard: Move targets to a constant
This moves mapping between target short and full names to the const to make it reusable.
This commit is contained in:
parent
b09e82f492
commit
388069ec11
4 changed files with 38 additions and 32 deletions
|
|
@ -27,6 +27,7 @@ import {
|
|||
} from './ReviewStepTextLists';
|
||||
|
||||
import isRhel from '../../../../../src/Utilities/isRhel';
|
||||
import { targetOptions } from '../../../../constants';
|
||||
import { useAppSelector } from '../../../../store/hooks';
|
||||
import {
|
||||
selectBlueprintDescription,
|
||||
|
|
@ -143,20 +144,24 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
|
|||
{environments.includes('oci') && <TargetEnvOciList />}
|
||||
{environments.includes('vsphere') && (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>VMware vSphere (.vmdk)</Text>
|
||||
<Text component={TextVariants.h3}>
|
||||
{targetOptions.vsphere} (.vmdk)
|
||||
</Text>
|
||||
<TargetEnvOtherList />
|
||||
</TextContent>
|
||||
)}
|
||||
{environments.includes('vsphere-ova') && (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>VMware vSphere (.ova)</Text>
|
||||
<Text component={TextVariants.h3}>
|
||||
{targetOptions['vsphere-ova']} (.ova)
|
||||
</Text>
|
||||
<TargetEnvOtherList />
|
||||
</TextContent>
|
||||
)}
|
||||
{environments.includes('guest-image') && (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>
|
||||
Virtualization - Guest image (.qcow2)
|
||||
{targetOptions['guest-image']} (.qcow2)
|
||||
</Text>
|
||||
<TargetEnvOtherList />
|
||||
</TextContent>
|
||||
|
|
@ -164,7 +169,7 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
|
|||
{environments.includes('image-installer') && (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>
|
||||
Bare metal - Installer (.iso)
|
||||
{targetOptions['image-installer']} (.iso)
|
||||
</Text>
|
||||
<TargetEnvOtherList />
|
||||
</TextContent>
|
||||
|
|
@ -172,7 +177,7 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
|
|||
{environments.includes('wsl') && (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>
|
||||
WSL - Windows Subsystem for Linux (.tar.gz)
|
||||
WSL - {targetOptions.wsl} (.tar.gz)
|
||||
</Text>
|
||||
<TargetEnvOtherList />
|
||||
</TextContent>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import {
|
|||
RHEL_8_FULL_SUPPORT,
|
||||
RHEL_8_MAINTENANCE_SUPPORT,
|
||||
RHEL_9,
|
||||
targetOptions,
|
||||
UNIT_GIB,
|
||||
} from '../../../../constants';
|
||||
import { useListSnapshotsByDateMutation } from '../../../../store/contentSourcesApi';
|
||||
|
|
@ -221,7 +222,7 @@ export const TargetEnvAWSList = () => {
|
|||
|
||||
return (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>AWS</Text>
|
||||
<Text component={TextVariants.h3}>{targetOptions.aws}</Text>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
|
|
@ -263,7 +264,7 @@ export const TargetEnvGCPList = () => {
|
|||
const email = useAppSelector(selectGcpEmail);
|
||||
return (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>GCP</Text>
|
||||
<Text component={TextVariants.h3}>{targetOptions.gcp}</Text>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
|
|
@ -326,7 +327,7 @@ export const TargetEnvAzureList = () => {
|
|||
|
||||
return (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>Microsoft Azure</Text>
|
||||
<Text component={TextVariants.h3}>{targetOptions.azure}</Text>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
|
|
@ -383,7 +384,7 @@ export const TargetEnvAzureList = () => {
|
|||
export const TargetEnvOciList = () => {
|
||||
return (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>Oracle Cloud Infrastructure</Text>
|
||||
<Text component={TextVariants.h3}>{targetOptions.oci}</Text>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
|
|
|
|||
|
|
@ -2,30 +2,10 @@ import React from 'react';
|
|||
|
||||
import { Skeleton } from '@patternfly/react-core';
|
||||
|
||||
import {
|
||||
ImageTypes,
|
||||
useGetComposeClonesQuery,
|
||||
} from '../../store/imageBuilderApi';
|
||||
import { targetOptions } from '../../constants';
|
||||
import { useGetComposeClonesQuery } from '../../store/imageBuilderApi';
|
||||
import { ComposesResponseItem } from '../../store/imageBuilderApi';
|
||||
|
||||
const targetOptions: { [key in ImageTypes]: string } = {
|
||||
aws: 'Amazon Web Services',
|
||||
azure: 'Microsoft Azure',
|
||||
'edge-commit': 'Edge Commit',
|
||||
'edge-installer': 'Edge Installer',
|
||||
gcp: 'Google Cloud Platform',
|
||||
'guest-image': 'Virtualization - Guest image',
|
||||
'image-installer': 'Bare metal - Installer',
|
||||
vsphere: 'VMware vSphere',
|
||||
'vsphere-ova': 'VMware vSphere',
|
||||
wsl: 'Windows Subsystem for Linux',
|
||||
ami: 'Amazon Web Services',
|
||||
'rhel-edge-commit': 'RHEL Edge Commit',
|
||||
'rhel-edge-installer': 'RHEL Edge Installer',
|
||||
vhd: '',
|
||||
oci: 'Oracle Cloud Infrastructure',
|
||||
};
|
||||
|
||||
type TargetPropTypes = {
|
||||
compose: ComposesResponseItem;
|
||||
};
|
||||
|
|
@ -47,6 +27,6 @@ export const AwsTarget = ({ compose }: AwsTargetPropTypes) => {
|
|||
return <Skeleton />;
|
||||
}
|
||||
|
||||
const text = `Amazon Web Services (${data.data.length + 1})`;
|
||||
const text = `${targetOptions.aws} (${data.data.length + 1})`;
|
||||
return <>{text}</>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { ImageTypes } from './store/imageBuilderApi';
|
||||
|
||||
export const IMAGE_BUILDER_API = '/api/image-builder/v1';
|
||||
export const RHSM_API = '/api/rhsm/v2';
|
||||
export const EDGE_API = '/api/edge/v1';
|
||||
|
|
@ -46,6 +48,24 @@ export const CENTOS_9 = 'centos-9';
|
|||
export const X86_64 = 'x86_64';
|
||||
export const AARCH64 = 'aarch64';
|
||||
|
||||
export const targetOptions: { [key in ImageTypes]: string } = {
|
||||
aws: 'Amazon Web Services',
|
||||
azure: 'Microsoft Azure',
|
||||
'edge-commit': 'Edge Commit',
|
||||
'edge-installer': 'Edge Installer',
|
||||
gcp: 'Google Cloud Platform',
|
||||
'guest-image': 'Virtualization - Guest image',
|
||||
'image-installer': 'Bare metal - Installer',
|
||||
vsphere: 'VMware vSphere',
|
||||
'vsphere-ova': 'VMware vSphere',
|
||||
wsl: 'Windows Subsystem for Linux',
|
||||
ami: 'Amazon Web Services',
|
||||
'rhel-edge-commit': 'RHEL Edge Commit',
|
||||
'rhel-edge-installer': 'RHEL Edge Installer',
|
||||
vhd: '',
|
||||
oci: 'Oracle Cloud Infrastructure',
|
||||
};
|
||||
|
||||
export const UNIT_KIB = 1024 ** 1;
|
||||
export const UNIT_MIB = 1024 ** 2;
|
||||
export const UNIT_GIB = 1024 ** 3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue