Skip to content

Commit fae04a1

Browse files
cloudConfigPage: save the aws configs
Save the AWS config modifications to the `osbuild-worker.toml` file.
1 parent 6078fa3 commit fae04a1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/Components/CloudProviderConfig/CloudProviderConfig.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@ import { useNavigate } from 'react-router-dom';
66
import { AWSConfig } from './AWSConfig';
77
import { useIsAwsStepValid } from './validators';
88

9-
import { changeAWSConfig } from '../../store/cloudProviderConfigSlice';
10-
import { useGetWorkerConfigQuery } from '../../store/cockpit/cockpitApi';
11-
import { useAppDispatch } from '../../store/hooks';
9+
import {
10+
changeAWSConfig,
11+
selectAWSConfig,
12+
} from '../../store/cloudProviderConfigSlice';
13+
import {
14+
useGetWorkerConfigQuery,
15+
useUpdateWorkerConfigMutation,
16+
} from '../../store/cockpit/cockpitApi';
17+
import { useAppDispatch, useAppSelector } from '../../store/hooks';
1218
import { resolveRelPath } from '../../Utilities/path';
1319
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
1420

1521
export const CloudProviderConfig = () => {
1622
const navigate = useNavigate();
1723
const dispatch = useAppDispatch();
24+
const config = useAppSelector(selectAWSConfig);
1825
const handleClose = () => navigate(resolveRelPath(''));
1926

27+
const [updateConfig] = useUpdateWorkerConfigMutation();
2028
const { data, error, refetch } = useGetWorkerConfigQuery({});
2129
const isAwsStepValid = useIsAwsStepValid();
2230

@@ -47,6 +55,10 @@ export const CloudProviderConfig = () => {
4755
isNextDisabled: !isAwsStepValid,
4856
isBackDisabled: false,
4957
onBack: () => navigate(resolveRelPath('')),
58+
onNext: () => {
59+
updateConfig({ updateWorkerConfigRequest: { aws: config } });
60+
navigate(resolveRelPath(''));
61+
},
5062
}}
5163
>
5264
<AWSConfig refetch={refetch} />

0 commit comments

Comments
 (0)