Wizard: Update the code after comments

This reverts Customer portal -> Activation keys page and ensures all the boxes are checked when the "Automatically register" option is checked again.
This commit is contained in:
regexowl 2024-08-14 10:57:52 +02:00 committed by Ondřej Ezr
parent a48fbb97b7
commit a5f9339d27
2 changed files with 37 additions and 37 deletions

View file

@ -95,7 +95,7 @@ const ManageKeysButton = () => {
isInline
href={isProd() ? ACTIVATION_KEYS_PROD_URL : ACTIVATION_KEYS_STAGE_URL}
>
Customer portal
Activation keys page
</Button>
);
};
@ -152,41 +152,41 @@ const ActivationKeysList = () => {
setIsOpen(!isOpen);
};
const handleCreateActivationKey = async () => {
try {
await createActivationKey({
body: {
name: defaultActivationKeyName,
serviceLevel: 'Self-Support',
},
});
window.localStorage.setItem(
'imageBuilder.recentActivationKey',
defaultActivationKeyName
);
refetch();
dispatch(changeActivationKey(defaultActivationKeyName));
} catch (error) {
dispatch(
addNotification({
variant: 'danger',
title: 'Error creating activation key',
description: error?.data?.error?.message,
})
);
}
};
const isActivationKeysEmpty =
isSuccessActivationKeys &&
!isLoadingActivationKey &&
activationKeys.body?.length === 0;
if (isActivationKeysEmpty) {
handleCreateActivationKey();
}
useEffect(() => {
const isActivationKeysEmpty =
isSuccessActivationKeys &&
!isLoadingActivationKey &&
activationKeys.body?.length === 0;
const handleCreateActivationKey = async () => {
try {
await createActivationKey({
body: {
name: defaultActivationKeyName,
serviceLevel: 'Self-Support',
},
});
window.localStorage.setItem(
'imageBuilder.recentActivationKey',
defaultActivationKeyName
);
refetch();
dispatch(changeActivationKey(defaultActivationKeyName));
} catch (error) {
dispatch(
addNotification({
variant: 'danger',
title: 'Error creating activation key',
description: error?.data?.error?.message,
})
);
}
};
if (isActivationKeysEmpty) {
handleCreateActivationKey();
}
if (!activationKey && isSuccessActivationKeys) {
if (
recentActivationKey &&
@ -252,7 +252,7 @@ const ActivationKeysList = () => {
</Select>
<TextContent>
<Text>
Create and manage activation keys in the <ManageKeysButton />
Create and manage activation keys on the <ManageKeysButton />
</Text>
</TextContent>
</FormGroup>

View file

@ -116,7 +116,7 @@ const Registration = () => {
}
onChange={(_event, checked) => {
if (checked) {
dispatch(changeRegistrationType('register-now'));
dispatch(changeRegistrationType('register-now-rhc'));
} else {
dispatch(changeRegistrationType('register-later'));
setShowOptions(false);