import { FormikErrors } from 'formik'; import { FeatureId } from '@/react/portainer/feature-flags/enums'; import { type AutoUpdateModel } from '@/react/portainer/gitops/types'; import { ButtonSelector } from '@@/form-components/ButtonSelector/ButtonSelector'; import { FormControl } from '@@/form-components/FormControl'; import { SwitchField } from '@@/form-components/SwitchField'; import { TextTip } from '@@/Tip/TextTip'; import { ForceDeploymentSwitch } from './ForceDeploymentSwitch'; import { IntervalField } from './IntervalField'; import { WebhookSettings } from './WebhookSettings'; export function AutoUpdateSettings({ value, onChange, environmentType, showForcePullImage, errors, baseWebhookUrl, webhookId, webhookDocs, }: { value: AutoUpdateModel; onChange: (value: Partial) => void; environmentType?: 'DOCKER' | 'KUBERNETES'; showForcePullImage: boolean; errors?: FormikErrors; baseWebhookUrl: string; webhookId: string; webhookDocs?: string; }) { return ( <> Any changes to this stack or application that have been made locally via Portainer or directly in the cluster will be overwritten by the git repository content, which may cause service interruption. onChange({ RepositoryMechanism: value })} /> {value.RepositoryMechanism === 'Webhook' && ( )} {value.RepositoryMechanism === 'Interval' && ( onChange({ RepositoryFetchInterval: value })} errors={errors?.RepositoryFetchInterval} /> )} {showForcePullImage && (
onChange({ ForcePullImage: value })} />
)} onChange({ RepositoryAutomaticUpdatesForce: value }) } label={ environmentType === 'KUBERNETES' ? 'Always apply manifest' : undefined } tooltip={ environmentType === 'KUBERNETES' ? ( <>

If enabled, then when redeploy is triggered via the webhook or polling, kubectl apply is always performed, even if Portainer detects no difference between the git repo and what was stored locally on last git pull.

This is useful if you want your git repo to be the source of truth and are fine with changes made directly to resources in the cluster being overwritten.

) : (

If enabled, then when redeploy is triggered via the webhook or polling, the stack will be always redeployed, even if Portainer detects no difference between the git repo and what was stored locally on last git pull.

) } /> ); }