Skip to content

Commit 6bb2130

Browse files
cloudConfig: save the aws configs
Save the AWS config modifications to the `osbuild-worker.toml` file.
1 parent 8c24c29 commit 6bb2130

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
@@ -19,9 +19,15 @@ import { useNavigate } from 'react-router-dom';
1919
import { AWSConfig } from './AWSConfig';
2020
import { useIsAwsStepValid } from './validators';
2121

22-
import { changeAWSConfig } from '../../store/cloudProviderConfigSlice';
23-
import { useGetWorkerConfigQuery } from '../../store/cockpit/cockpitApi';
24-
import { useAppDispatch } from '../../store/hooks';
22+
import {
23+
changeAWSConfig,
24+
selectAWSConfig,
25+
} from '../../store/cloudProviderConfigSlice';
26+
import {
27+
useGetWorkerConfigQuery,
28+
useUpdateWorkerConfigMutation,
29+
} from '../../store/cockpit/cockpitApi';
30+
import { useAppDispatch, useAppSelector } from '../../store/hooks';
2531
import { resolveRelPath } from '../../Utilities/path';
2632
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
2733

@@ -54,8 +60,10 @@ const ConfigError = ({
5460
export const CloudProviderConfig = () => {
5561
const navigate = useNavigate();
5662
const dispatch = useAppDispatch();
63+
const config = useAppSelector(selectAWSConfig);
5764
const handleClose = () => navigate(resolveRelPath(''));
5865

66+
const [updateConfig] = useUpdateWorkerConfigMutation();
5967
const { data, error, refetch } = useGetWorkerConfigQuery({});
6068
const isAwsStepValid = useIsAwsStepValid();
6169

@@ -80,6 +88,10 @@ export const CloudProviderConfig = () => {
8088
isNextDisabled: !isAwsStepValid,
8189
isBackDisabled: false,
8290
onBack: () => navigate(resolveRelPath('')),
91+
onNext: () => {
92+
updateConfig({ updateWorkerConfigRequest: { aws: config } });
93+
navigate(resolveRelPath(''));
94+
},
8395
}}
8496
>
8597
<AWSConfig refetch={refetch} />

0 commit comments

Comments
 (0)