Wizard: Add locale structure to store and mapper
This creates structure and actions for the locale customization in the wizardSlice and requestMapper.
This commit is contained in:
parent
cbe04c5f9a
commit
e4e83d4417
2 changed files with 61 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import type {
|
|||
Distributions,
|
||||
ImageRequest,
|
||||
ImageTypes,
|
||||
Locale,
|
||||
Repository,
|
||||
} from './imageBuilderApi';
|
||||
import type { ActivationKeys } from './rhsmApi';
|
||||
|
|
@ -106,6 +107,7 @@ export type wizardState = {
|
|||
kernel: {
|
||||
append: string;
|
||||
};
|
||||
locale: Locale;
|
||||
details: {
|
||||
blueprintName: string;
|
||||
blueprintDescription: string;
|
||||
|
|
@ -177,6 +179,10 @@ export const initialState: wizardState = {
|
|||
kernel: {
|
||||
append: '',
|
||||
},
|
||||
locale: {
|
||||
languages: [],
|
||||
keyboard: '',
|
||||
},
|
||||
details: {
|
||||
blueprintName: '',
|
||||
blueprintDescription: '',
|
||||
|
|
@ -327,6 +333,14 @@ export const selectKernel = (state: RootState) => {
|
|||
return state.wizard.kernel;
|
||||
};
|
||||
|
||||
export const selectLanguages = (state: RootState) => {
|
||||
return state.wizard.locale.languages;
|
||||
};
|
||||
|
||||
export const selectKeyboard = (state: RootState) => {
|
||||
return state.wizard.locale.keyboard;
|
||||
};
|
||||
|
||||
export const selectBlueprintName = (state: RootState) => {
|
||||
return state.wizard.details.blueprintName;
|
||||
};
|
||||
|
|
@ -660,6 +674,28 @@ export const wizardSlice = createSlice({
|
|||
1
|
||||
);
|
||||
},
|
||||
addLanguage: (state, action: PayloadAction<string>) => {
|
||||
if (
|
||||
state.locale.languages &&
|
||||
!state.locale.languages.some((lang) => lang === action.payload)
|
||||
) {
|
||||
state.locale.languages.push(action.payload);
|
||||
}
|
||||
},
|
||||
removeLanguage: (state, action: PayloadAction<string>) => {
|
||||
if (state.locale.languages) {
|
||||
state.locale.languages.splice(
|
||||
state.locale.languages.findIndex((lang) => lang === action.payload),
|
||||
1
|
||||
);
|
||||
}
|
||||
},
|
||||
clearLanguages: (state) => {
|
||||
state.locale.languages = [];
|
||||
},
|
||||
changeKeyboard: (state, action: PayloadAction<string>) => {
|
||||
state.locale.keyboard = action.payload;
|
||||
},
|
||||
changeBlueprintName: (state, action: PayloadAction<string>) => {
|
||||
state.details.blueprintName = action.payload;
|
||||
},
|
||||
|
|
@ -732,6 +768,10 @@ export const {
|
|||
removePackage,
|
||||
addGroup,
|
||||
removeGroup,
|
||||
addLanguage,
|
||||
removeLanguage,
|
||||
clearLanguages,
|
||||
changeKeyboard,
|
||||
changeBlueprintName,
|
||||
changeBlueprintDescription,
|
||||
loadWizardState,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue