Wizard: register-later for non-RHEL images

This sets registration type to `register-later` when a non-RHEL distribution is selected.
This commit is contained in:
regexowl 2025-02-17 11:42:14 +01:00 committed by Klara Simickova
parent 03294389b1
commit 609397d411
5 changed files with 37 additions and 9 deletions

View file

@ -78,6 +78,7 @@ import {
selectImageTypes,
addImageType,
} from '../../store/wizardSlice';
import isRhel from '../../Utilities/isRhel';
import { resolveRelPath } from '../../Utilities/path';
import { useFlag } from '../../Utilities/useGetEnvironment';
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
@ -379,7 +380,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
name="Register"
id="step-register"
key="step-register"
isHidden={!!process.env.IS_ON_PREMISE}
isHidden={!!process.env.IS_ON_PREMISE || !isRhel(distribution)}
navItem={customStatusNavItem}
status={
registrationValidation.disabledNext ? 'error' : 'default'

View file

@ -23,6 +23,7 @@ import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
import { Distributions } from '../../../../store/imageBuilderApi';
import {
changeDistribution,
changeRegistrationType,
selectDistribution,
} from '../../../../store/wizardSlice';
import isRhel from '../../../../Utilities/isRhel';
@ -44,6 +45,11 @@ const ReleaseSelect = () => {
const releases = process.env.IS_ON_PREMISE ? ON_PREM_RELEASES : RELEASES;
const handleSelect = (_event: React.MouseEvent, selection: Distributions) => {
if (!isRhel(selection)) {
dispatch(changeRegistrationType('register-later'));
} else {
dispatch(changeRegistrationType('register-now-rhc'));
}
dispatch(changeDistribution(selection));
setIsOpen(false);
};

View file

@ -85,6 +85,7 @@ import {
selectMetadata,
selectFirewall,
} from '../../../store/wizardSlice';
import isRhel from '../../../Utilities/isRhel';
import { FileSystemConfigurationType } from '../steps/FileSystem';
import {
getConversionFactor,
@ -364,12 +365,15 @@ export const mapRequestToState = (request: BlueprintResponse): wizardState => {
baseUrl: request.customizations.subscription?.['base-url'] || '',
},
registration: {
registrationType: request.customizations?.subscription
? request.customizations.subscription.rhc
? 'register-now-rhc'
: 'register-now-insights'
: 'register-later',
activationKey: request.customizations.subscription?.['activation-key'],
registrationType:
request.customizations?.subscription && isRhel(request.distribution)
? request.customizations.subscription.rhc
? 'register-now-rhc'
: 'register-now-insights'
: 'register-later',
activationKey: isRhel(request.distribution)
? request.customizations.subscription?.['activation-key']
: undefined,
},
...commonRequestToState(request),
};