From acc79e149c3e236d28e391b0a448ec91e9efa64f Mon Sep 17 00:00:00 2001 From: Michal Gold Date: Sun, 3 Aug 2025 12:34:01 +0300 Subject: [PATCH] Wizard: Add FIPS state management infrastructure - Add fips field to wizardState type with enabled boolean property - Add fips configuration to initialState with default value false - Add selectFips selector to access FIPS state from store - Add changeFips reducer action to update FIPS enabled state This provides the Redux state management foundation for FIPS mode configuration. UI components and wizard steps will be added separately. --- .../utilities/requestMapper.ts | 18 +++++++++++++++++- src/store/wizardSlice.ts | 14 ++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/Components/CreateImageWizard/utilities/requestMapper.ts b/src/Components/CreateImageWizard/utilities/requestMapper.ts index 9ae2c772..ec165c69 100644 --- a/src/Components/CreateImageWizard/utilities/requestMapper.ts +++ b/src/Components/CreateImageWizard/utilities/requestMapper.ts @@ -70,6 +70,7 @@ import { selectCustomRepositories, selectDistribution, selectFileSystemConfigurationType, + selectFips, selectFirewall, selectFirstBootScript, selectGcpAccountType, @@ -364,6 +365,9 @@ function commonRequestToState( disabled: request.customizations.firewall?.services?.disabled || [], }, }, + fips: { + enabled: request.customizations.fips?.enabled || false, + }, }; } @@ -631,7 +635,7 @@ const getCustomizations = (state: RootState, orgID: string): Customizations => { fdo: undefined, ignition: undefined, partitioning_mode: undefined, - fips: undefined, + fips: getFips(state), cacerts: satCert && selectRegistrationType(state) === 'register-satellite' ? { @@ -869,6 +873,18 @@ const getPayloadRepositories = (state: RootState) => { return payloadAndRecommendedRepositories; }; +const getFips = (state: RootState) => { + const fips = selectFips(state); + + if (!fips.enabled) { + return undefined; + } + + return { + enabled: fips.enabled, + }; +}; + const getKernel = (state: RootState) => { const kernel = selectKernel(state); const kernelAppendString = selectKernel(state).append.join(' '); diff --git a/src/store/wizardSlice.ts b/src/store/wizardSlice.ts index 9f1b7733..36d9af71 100644 --- a/src/store/wizardSlice.ts +++ b/src/store/wizardSlice.ts @@ -170,6 +170,9 @@ export type wizardState = { disabled: string[]; }; }; + fips: { + enabled: boolean; + }; metadata?: { parent_id: string | null; exported_at: string; @@ -270,6 +273,9 @@ export const initialState: wizardState = { disabled: [], }, }, + fips: { + enabled: false, + }, firstBoot: { script: '' }, users: [], }; @@ -494,6 +500,10 @@ export const selectFirewall = (state: RootState) => { return state.wizard.firewall; }; +export const selectFips = (state: RootState) => { + return state.wizard.fips; +}; + export const wizardSlice = createSlice({ name: 'wizard', initialState, @@ -1131,6 +1141,9 @@ export const wizardSlice = createSlice({ state.users[action.payload.index].groups.splice(groupIndex, 1); } }, + changeFips: (state, action: PayloadAction) => { + state.fips.enabled = action.payload; + }, }, }); @@ -1231,5 +1244,6 @@ export const { addUserGroupByIndex, removeUserGroupByIndex, changeRedHatRepositories, + changeFips, } = wizardSlice.actions; export default wizardSlice.reducer;