V2Wizard: Reinitialize AWS/Azure/GCP after deselecting target

Fixes #1555

This reinitializes the state of AWS/Azure/GCP target after it's tile was deselected. This way the state for the target won't be hanging there.
This commit is contained in:
regexowl 2024-04-29 13:35:12 +02:00 committed by Lucas Garfield
parent 6494070a40
commit f2daa9c358
2 changed files with 33 additions and 0 deletions

View file

@ -354,6 +354,11 @@ export const wizardSlice = createSlice({
changeAwsSourceId: (state, action: PayloadAction<string | undefined>) => {
state.aws.sourceId = action.payload;
},
reinitializeAws: (state) => {
state.aws.accountId = '';
state.aws.shareMethod = 'sources';
state.aws.source = undefined;
},
changeAzureTenantId: (state, action: PayloadAction<string>) => {
state.azure.tenantId = action.payload;
},
@ -372,6 +377,13 @@ export const wizardSlice = createSlice({
changeAzureResourceGroup: (state, action: PayloadAction<string>) => {
state.azure.resourceGroup = action.payload;
},
reinitializeAzure: (state) => {
state.azure.shareMethod = 'sources';
state.azure.tenantId = '';
state.azure.subscriptionId = '';
state.azure.source = '';
state.azure.resourceGroup = '';
},
changeGcpShareMethod: (state, action: PayloadAction<GcpShareMethod>) => {
switch (action.payload) {
case 'withInsights':
@ -389,6 +401,11 @@ export const wizardSlice = createSlice({
changeGcpEmail: (state, action: PayloadAction<string>) => {
state.gcp.email = action.payload;
},
reinitializeGcp: (state) => {
state.gcp.shareMethod = 'withGoogle';
state.gcp.accountType = 'user';
state.gcp.email = '';
},
changeRegistrationType: (
state,
action: PayloadAction<RegistrationType>
@ -623,14 +640,17 @@ export const {
changeAwsAccountId,
changeAwsShareMethod,
changeAwsSourceId,
reinitializeAws,
changeAzureTenantId,
changeAzureShareMethod,
changeAzureSubscriptionId,
changeAzureSource,
changeAzureResourceGroup,
reinitializeAzure,
changeGcpShareMethod,
changeGcpAccountType,
changeGcpEmail,
reinitializeGcp,
changeRegistrationType,
changeActivationKey,
changeOscapProfile,