// UpdateStrategyCard.tsx — 更新策略 + 历史版本/进度 卡片 (Q21 提取) // 受控展示组件,接收 state 片段 + setter 回调。 import { RefreshCw, Clock } from 'lucide-react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import i18n from '@/i18n'; interface UpdateStrategyCardProps { strategyType: 'RollingUpdate' | 'Recreate'; onStrategyTypeChange: (t: 'RollingUpdate' | 'Recreate') => void; maxSurge: string; onMaxSurgeChange: (v: string) => void; maxUnavailable: string; onMaxUnavailableChange: (v: string) => void; revisionHistoryLimit: string; onRevisionHistoryLimitChange: (v: string) => void; progressDeadlineSeconds: string; onProgressDeadlineSecondsChange: (v: string) => void; } export function UpdateStrategyCard({ strategyType, onStrategyTypeChange, maxSurge, onMaxSurgeChange, maxUnavailable, onMaxUnavailableChange, revisionHistoryLimit, onRevisionHistoryLimitChange, progressDeadlineSeconds, onProgressDeadlineSecondsChange, }: UpdateStrategyCardProps) { return ( <> {/* 更新策略 */} {i18n.t('k8s.editAdvanced.updateStrategy')}
{strategyType === 'RollingUpdate' && (
onMaxSurgeChange(e.target.value)} placeholder="25%" className="h-8 mt-1 dg-input text-sm font-mono" />
onMaxUnavailableChange(e.target.value)} placeholder="25%" className="h-8 mt-1 dg-input text-sm font-mono" />
)}
{/* 历史版本 / 进度 */} {i18n.t("common.historyVersion")}
onRevisionHistoryLimitChange(e.target.value)} className="h-8 mt-1 dg-input text-sm font-mono" />
onProgressDeadlineSecondsChange(e.target.value)} className="h-8 mt-1 dg-input text-sm font-mono" />
); }