Skip to content

Commit 02313ca

Browse files
committed
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 c73e124 commit 02313ca

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
@@ -166,12 +166,12 @@ const ActivationKeysList = () => {
166166
name: defaultActivationKeyName,
167167
serviceLevel: 'Self-Support',
168168
},
169-
});
169+
}).unwrap();
170+
170171
window.localStorage.setItem(
171172
'imageBuilder.recentActivationKey',
172173
defaultActivationKeyName
173174
);
174-
refetch();
175175
dispatch(changeActivationKey(defaultActivationKeyName));
176176
} catch (error) {
177177
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)