CreateImageWizard: RHEL 9

Expose rhel-90, it has reached GA.
This commit is contained in:
Sanne Raymaekers 2022-05-18 11:36:06 +02:00
parent 40f7be170c
commit cfaa8a463d
7 changed files with 31 additions and 9 deletions

View file

@ -6,7 +6,8 @@ import DocumentationButton from '../sharedComponents/DocumentationButton';
import './CreateImageWizard.scss';
import { useDispatch } from 'react-redux';
import api from '../../api';
import { RHEL_8, UNIT_KIB, UNIT_MIB, UNIT_GIB } from '../../constants';
import { UNIT_KIB, UNIT_MIB, UNIT_GIB } from '../../constants';
import isRhel from '../../Utilities/isRhel';
import { composeAdded } from '../../store/actions/actions';
import { addNotification } from '@redhat-cloud-services/frontend-components-notifications/redux';
@ -375,7 +376,7 @@ const formStepHistory = (composeRequest) => {
steps.push('google-cloud-target-env');
}
if (composeRequest?.distribution === RHEL_8) {
if (isRhel(composeRequest?.distribution)) {
steps.push('registration');
}

View file

@ -4,6 +4,7 @@ import { FormGroup, Select, SelectOption, SelectVariant } from '@patternfly/reac
import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api';
import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api';
import { RELEASES } from '../../../constants';
import isRhel from '../../../Utilities/isRhel';
const ImageOutputReleaseSelect = ({ label, isRequired, ...props }) => {
const { change, getState } = useFormApi();
@ -32,11 +33,11 @@ const ImageOutputReleaseSelect = ({ label, isRequired, ...props }) => {
Object.entries(RELEASES)
.filter(([ key ]) => {
// Only show non-RHEL distros in beta
if (!(insights.chrome.isBeta() || key.includes('rhel'))) {
return false;
if (insights.chrome.isBeta()) {
return true;
}
return true;
return isRhel(key);
})
.map(([ key, release ], index) => {
return <SelectOption key={ index } value={ key }>

View file

@ -21,6 +21,7 @@ import { HelpIcon } from '@patternfly/react-icons';
import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api';
import { googleAccType } from '../steps/googleCloud';
import { RELEASES, UNIT_GIB, UNIT_MIB } from '../../../constants';
import isRhel from '../../../Utilities/isRhel';
const FSReviewTable = ({ ...props }) => {
return (
@ -203,7 +204,7 @@ const ReviewStep = () => {
}
</List>
</Tab>
{getState()?.values?.release.includes('rhel') &&
{isRhel(getState()?.values?.release) &&
<Tab eventKey={ 1 } title={ <TabTitleText>Registration</TabTitleText> } data-testid='tab-registration'>
{getState()?.values?.['register-system'] === 'register-later' &&
<TextContent>

View file

@ -1,4 +1,4 @@
import { RHEL_8 } from '../../../constants.js';
import isRhel from '../../../Utilities/isRhel.js';
export default ({ 'target-environment': targetEnv, release } = {}, { skipAws, skipGoogle, skipAzure } = {}) => {
if (!skipAws && targetEnv?.aws) {
@ -13,5 +13,5 @@ export default ({ 'target-environment': targetEnv, release } = {}, { skipAws, sk
return 'ms-azure-target-env';
}
return release === RHEL_8 ? 'registration' : 'File system configuration';
return isRhel(release) ? 'registration' : 'File system configuration';
};

View file

@ -2,11 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Label } from '@patternfly/react-core';
import { RHEL_8 } from '../../constants.js';
import { RHEL_8, RHEL_9 } from '../../constants.js';
const Release = (props) => {
const releaseOptions = {
[RHEL_8]: 'RHEL 8',
[RHEL_9]: 'RHEL 9',
'centos-8': 'CentOS Stream 8',
'centos-9': 'CentOS Stream 9',
};

16
src/Utilities/isRhel.js Normal file
View file

@ -0,0 +1,16 @@
import {
RHEL_8,
RHEL_9,
} from '../constants';
function isRhel(distro) {
switch (distro) {
case RHEL_8:
case RHEL_9:
return true;
default:
return false;
}
}
export default isRhel;

View file

@ -1,6 +1,7 @@
export const IMAGE_BUILDER_API = '/api/image-builder/v1';
export const RHSM_API = '/api/rhsm/v2';
export const RHEL_8 = 'rhel-86';
export const RHEL_9 = 'rhel-90';
export const UNIT_KIB = 1024 ** 1;
export const UNIT_MIB = 1024 ** 2;
@ -8,6 +9,7 @@ export const UNIT_GIB = 1024 ** 3;
export const RELEASES = {
[RHEL_8]: 'Red Hat Enterprise Linux (RHEL) 8',
[RHEL_9]: 'Red Hat Enterprise Linux (RHEL) 9',
'centos-8': 'CentOS Stream 8',
'centos-9': 'CentOS Stream 9',
};