mirror of https://github.com/portainer/portainer
fix(edgestack): broken parallel setting in create view [EE-7245] (#11945)
parent
e3364457c4
commit
6486a5d971
|
@ -124,7 +124,15 @@ export function InnerForm({
|
||||||
<StaggerFieldset
|
<StaggerFieldset
|
||||||
isEdit={false}
|
isEdit={false}
|
||||||
values={values.staggerConfig}
|
values={values.staggerConfig}
|
||||||
onChange={(value) => setFieldValue('staggerConfig', value)}
|
onChange={(newStaggerValues) =>
|
||||||
|
setValues((values) => ({
|
||||||
|
...values,
|
||||||
|
staggerConfig: {
|
||||||
|
...values.staggerConfig,
|
||||||
|
...newStaggerValues,
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormActions
|
<FormActions
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
|
|
||||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||||
import { mutationOptions, withError } from '@/react-tools/react-query';
|
import {
|
||||||
|
mutationOptions,
|
||||||
|
withError,
|
||||||
|
withInvalidate,
|
||||||
|
} from '@/react-tools/react-query';
|
||||||
import {
|
import {
|
||||||
AutoUpdateResponse,
|
AutoUpdateResponse,
|
||||||
GitAuthenticationResponse,
|
GitAuthenticationResponse,
|
||||||
|
@ -11,6 +15,8 @@ import { DeploymentType, EdgeStack } from '@/react/edge/edge-stacks/types';
|
||||||
import { EdgeGroup } from '@/react/edge/edge-groups/types';
|
import { EdgeGroup } from '@/react/edge/edge-groups/types';
|
||||||
import { Registry } from '@/react/portainer/registries/types/registry';
|
import { Registry } from '@/react/portainer/registries/types/registry';
|
||||||
|
|
||||||
|
import { queryKeys } from '../../../queries/query-keys';
|
||||||
|
|
||||||
export interface UpdateEdgeStackGitPayload {
|
export interface UpdateEdgeStackGitPayload {
|
||||||
id: EdgeStack['Id'];
|
id: EdgeStack['Id'];
|
||||||
autoUpdate: AutoUpdateResponse | null;
|
autoUpdate: AutoUpdateResponse | null;
|
||||||
|
@ -23,9 +29,14 @@ export interface UpdateEdgeStackGitPayload {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useUpdateEdgeStackGitMutation() {
|
export function useUpdateEdgeStackGitMutation() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation(
|
return useMutation(
|
||||||
updateEdgeStackGit,
|
updateEdgeStackGit,
|
||||||
mutationOptions(withError('Failed updating stack'))
|
mutationOptions(
|
||||||
|
withError('Failed updating stack'),
|
||||||
|
withInvalidate(queryClient, [queryKeys.base()])
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,7 @@ function InnerForm({
|
||||||
setFieldValue,
|
setFieldValue,
|
||||||
isValid,
|
isValid,
|
||||||
errors,
|
errors,
|
||||||
|
setValues,
|
||||||
setFieldError,
|
setFieldError,
|
||||||
initialValues,
|
initialValues,
|
||||||
} = useFormikContext<FormValues>();
|
} = useFormikContext<FormValues>();
|
||||||
|
@ -327,10 +328,14 @@ function InnerForm({
|
||||||
|
|
||||||
<StaggerFieldset
|
<StaggerFieldset
|
||||||
values={values.staggerConfig}
|
values={values.staggerConfig}
|
||||||
onChange={(value) =>
|
onChange={(newStaggerValues) =>
|
||||||
Object.entries(value).forEach(([key, value]) =>
|
setValues((values) => ({
|
||||||
setFieldValue(`staggerConfig.${key}`, value)
|
...values,
|
||||||
)
|
staggerConfig: {
|
||||||
|
...values.staggerConfig,
|
||||||
|
...newStaggerValues,
|
||||||
|
},
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
errors={errors.staggerConfig}
|
errors={errors.staggerConfig}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue