// 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')} onStrategyTypeChange('RollingUpdate')} className="accent-blue-500" /> RollingUpdate(滚动更新) onStrategyTypeChange('Recreate')} className="accent-blue-500" /> Recreate(重建) {strategyType === 'RollingUpdate' && ( maxSurge(整数或百分比,超出期望副本数) onMaxSurgeChange(e.target.value)} placeholder="25%" className="h-8 mt-1 dg-input text-sm font-mono" /> maxUnavailable(整数或百分比,不可用上限) onMaxUnavailableChange(e.target.value)} placeholder="25%" className="h-8 mt-1 dg-input text-sm font-mono" /> )} {/* 历史版本 / 进度 */} {i18n.t("common.historyVersion")} revisionHistoryLimit(保留 RS 历史) onRevisionHistoryLimitChange(e.target.value)} className="h-8 mt-1 dg-input text-sm font-mono" /> progressDeadlineSeconds(升级超时秒数) onProgressDeadlineSecondsChange(e.target.value)} className="h-8 mt-1 dg-input text-sm font-mono" /> > ); }