Skip to content

Commit 1cd58fe

Browse files
ksiekllucasgarfield
authored andcommittedMar 19, 2025
Wizard: race condition with activation key
Fixes osbuild#2961 The "Create blueprint" button is disabled if an activation key was not created in the Review step of the wizard. Wizard: load activation key in the review step Fixes osbuild#2961 Activation key loads in background even if a user skips to the review step. Wizard: leave Save button in review step enabled Wizard: disable Save button in review step for Rhel distro only Wizard: enable "Create blueprint" button on prem.
1 parent 94206fc commit 1cd58fe

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed
 

‎src/Components/CreateImageWizard/steps/Registration/ActivationKeysList.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ const ActivationKeysList = () => {
164164
name: defaultActivationKeyName,
165165
serviceLevel: 'Self-Support',
166166
},
167-
});
167+
}).unwrap();
168+
168169
window.localStorage.setItem(
169170
'imageBuilder.recentActivationKey',
170171
defaultActivationKeyName
171172
);
172-
refetch();
173173
dispatch(changeActivationKey(defaultActivationKeyName));
174174
} catch (error) {
175175
dispatch(

‎src/Components/CreateImageWizard/steps/Review/Footer/Footer.tsx

+15-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ import {
1919
useCreateBlueprintMutation,
2020
useUpdateBlueprintMutation,
2121
} from '../../../../../store/backendApi';
22+
import { useAppSelector } from '../../../../../store/hooks';
23+
import {
24+
selectActivationKey,
25+
selectDistribution,
26+
} from '../../../../../store/wizardSlice';
27+
import isRhel from '../../../../../Utilities/isRhel';
2228
import { resolveRelPath } from '../../../../../Utilities/path';
2329
import { mapRequestFromState } from '../../../utilities/requestMapper';
2430
import { useIsBlueprintValid } from '../../../utilities/useValidation';
@@ -62,6 +68,9 @@ const ReviewWizardFooter = () => {
6268
return mapRequestFromState(store, '');
6369
};
6470

71+
const activationKey = useAppSelector(selectActivationKey);
72+
const distribution = useAppSelector(selectDistribution);
73+
6574
return (
6675
<WizardFooterWrapper>
6776
<div data-testid="wizard-save-button-div">
@@ -92,7 +101,12 @@ const ReviewWizardFooter = () => {
92101
key="wizard-create-save-btn"
93102
getBlueprintPayload={getBlueprintPayload}
94103
setIsOpen={setIsOpen}
95-
isDisabled={!isValid}
104+
isDisabled={
105+
!isValid ||
106+
(!activationKey &&
107+
isRhel(distribution) &&
108+
!process.env.IS_ON_PREMISE)
109+
}
96110
/>,
97111
],
98112
}}

0 commit comments

Comments
 (0)
Please sign in to comment.