cloudConfigSlice: add new slice
This commit is contained in:
parent
719ee1a024
commit
1e545af0c7
3 changed files with 43 additions and 2 deletions
|
|
@ -387,7 +387,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
id="step-target-environment"
|
||||
isHidden={
|
||||
!targetEnvironments.find(
|
||||
(target) =>
|
||||
(target: string) =>
|
||||
target === 'aws' || target === 'gcp' || target === 'azure'
|
||||
)
|
||||
}
|
||||
|
|
|
|||
38
src/store/cloudProviderConfigSlice.ts
Normal file
38
src/store/cloudProviderConfigSlice.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { PayloadAction, createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
import type { RootState } from '.';
|
||||
|
||||
export type cloudProviderConfigState = {
|
||||
aws: {
|
||||
bucket?: string;
|
||||
credentials?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export const initialState: cloudProviderConfigState = {
|
||||
aws: {},
|
||||
};
|
||||
|
||||
export const selectAWSBucketName = (state: RootState) => {
|
||||
return state.cloudConfig.aws.bucket;
|
||||
};
|
||||
|
||||
export const selectAWSCredsPath = (state: RootState) => {
|
||||
return state.cloudConfig.aws.credentials;
|
||||
};
|
||||
|
||||
export const cloudProviderConfigSlice = createSlice({
|
||||
name: 'cloudConfig',
|
||||
initialState,
|
||||
reducers: {
|
||||
changeAWSBucketName: (state, action: PayloadAction<string>) => {
|
||||
state.aws.bucket = action.payload;
|
||||
},
|
||||
changeAWSCredsPath: (state, action: PayloadAction<string>) => {
|
||||
state.aws.credentials = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { changeAWSBucketName, changeAWSCredsPath } =
|
||||
cloudProviderConfigSlice.actions;
|
||||
|
|
@ -2,6 +2,7 @@ import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|||
import promiseMiddleware from 'redux-promise-middleware';
|
||||
|
||||
import { blueprintsSlice } from './BlueprintSlice';
|
||||
import { cloudProviderConfigSlice } from './cloudProviderConfigSlice';
|
||||
import { cockpitApi } from './cockpit/cockpitApi';
|
||||
import { complianceApi } from './complianceApi';
|
||||
import { contentSourcesApi } from './contentSourcesApi';
|
||||
|
|
@ -28,6 +29,7 @@ export const serviceReducer = combineReducers({
|
|||
[complianceApi.reducerPath]: complianceApi.reducer,
|
||||
wizard: wizardSlice,
|
||||
blueprints: blueprintsSlice.reducer,
|
||||
cloudConfig: cloudProviderConfigSlice.reducer,
|
||||
});
|
||||
|
||||
export const onPremReducer = combineReducers({
|
||||
|
|
@ -41,6 +43,7 @@ export const onPremReducer = combineReducers({
|
|||
[imageBuilderApi.reducerPath]: imageBuilderApi.reducer,
|
||||
wizard: wizardSlice,
|
||||
blueprints: blueprintsSlice.reducer,
|
||||
cloudConfig: cloudProviderConfigSlice.reducer,
|
||||
});
|
||||
|
||||
startAppListening({
|
||||
|
|
@ -95,7 +98,7 @@ startAppListening({
|
|||
(elem) => elem.arch === architecture
|
||||
)?.image_types;
|
||||
|
||||
const filteredImageTypes = imageTypes.filter((imageType) =>
|
||||
const filteredImageTypes = imageTypes.filter((imageType: string) =>
|
||||
allowedImageTypes?.includes(imageType)
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue