Files
2026-07-13 12:08:39 +08:00

85 lines
2.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { FormikErrors } from 'formik';
import { AutoUpdateModel } from '@/react/portainer/gitops/types';
import { SwitchField } from '@@/form-components/SwitchField';
import { InsightsBox } from '@@/InsightsBox';
import { AutoUpdateSettings } from './AutoUpdateSettings';
export function AutoUpdateFieldset({
value,
onChange,
environmentType,
isForcePullVisible = true,
errors,
baseWebhookUrl,
webhookId,
webhooksDocs,
}: {
value: AutoUpdateModel;
onChange: (value: AutoUpdateModel) => void;
environmentType?: 'DOCKER' | 'KUBERNETES';
isForcePullVisible?: boolean;
errors?: FormikErrors<AutoUpdateModel>;
baseWebhookUrl: string;
webhookId: string;
webhooksDocs?: string;
}) {
return (
<>
<div className="form-group">
<div className="col-sm-12">
<SwitchField
name="autoUpdate"
data-cy="gitops-auto-update-switch"
checked={value.RepositoryAutomaticUpdates}
label="GitOps updates"
tooltip="When enabled, at each polling interval or webhook invocation, if the
git repo differs from what was stored locally on the last git pull,
the changes are deployed."
labelClass="col-sm-3 col-lg-2"
onChange={(value) =>
handleChange({ RepositoryAutomaticUpdates: value })
}
/>
</div>
</div>
<InsightsBox
content={
<p>
We&#39;ve renamed &quot;Automatic updates&quot; to better align with
industry terminology and clarify its purpose for all users.
Originally chosen during the early emergence of GitOps, the name has
changed, but the functionality remains unchanged. GitOps has rapidly
emerged as a revolutionary approach to managing infrastructure and
application changes, and we want to ensure our platform reflects the
latest advancements in the industry.
</p>
}
header="Meet GitOps updates : Formerly known as Automatic updates"
insightCloseId="rename-gitops-updates"
className="mb-3"
/>
{value.RepositoryAutomaticUpdates && (
<AutoUpdateSettings
webhookId={webhookId}
baseWebhookUrl={baseWebhookUrl}
value={value}
onChange={handleChange}
environmentType={environmentType}
showForcePullImage={isForcePullVisible}
errors={errors}
webhookDocs={webhooksDocs}
/>
)}
</>
);
function handleChange(newValues: Partial<AutoUpdateModel>) {
onChange({ ...value, ...newValues });
}
}