Improve failover status feedback and controls
Build and Deploy Gateway / build-and-push (push) Successful in 26s
Build and Deploy Gateway / deploy (push) Successful in 7s

This commit is contained in:
2026-08-20 01:32:03 +03:00
parent 9055934e92
commit 74227ae38c
7 changed files with 174 additions and 87 deletions
+89 -41
View File
@@ -67,10 +67,6 @@ export function FailoverToggle({ feature, open, onToggle }: {
}
const seconds = (milliseconds: number) => Math.round(milliseconds / 1000);
const milliseconds = (value: string, fallback: number) => {
const parsed = Number(value);
return Number.isFinite(parsed) ? Math.round(parsed * 1000) : fallback;
};
function pulseNumber(event: FormEvent<HTMLInputElement>) {
if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
@@ -80,9 +76,46 @@ function pulseNumber(event: FormEvent<HTMLInputElement>) {
], { duration: 320, easing: 'cubic-bezier(0.16, 1, 0.3, 1)' });
}
function FailoverNumberSetting({ before, after, value, min, max, step = 10, disabled, ariaLabel, onChange, compact = false }: {
before: string;
after: string;
value: number;
min: number;
max: number;
step?: number;
disabled?: boolean;
ariaLabel: string;
onChange: (value: number) => void;
compact?: boolean;
}) {
const set = (next: number) => onChange(Math.min(max, Math.max(min, next)));
return <div className={`client-failover-number-setting${compact ? ' is-compact' : ''}`}>
<span>{before}</span>
<input
type="number"
min={min}
max={max}
aria-label={ariaLabel}
value={value}
disabled={disabled}
onInput={pulseNumber}
onChange={(event) => {
const next = Number(event.target.value);
if (Number.isFinite(next)) onChange(next);
}}
/>
<span>{after}</span>
<span className="client-failover-number-steps">
<button type="button" aria-label={`${ariaLabel}: уменьшить на ${step}`} disabled={disabled || value <= min} onClick={() => set(value - step)}>{step}</button>
<button type="button" aria-label={`${ariaLabel}: увеличить на ${step}`} disabled={disabled || value >= max} onClick={() => set(value + step)}>+{step}</button>
</span>
</div>;
}
const reasonLabel = (reason: string | null) => ({
'primary-healthy': 'Основной канал работает',
'health-unknown': 'Ожидаем результаты проверки',
'checking-channels': 'Проверяем основной и резервный каналы',
'failure-window': 'Подтверждаем сбой основного канала',
'reserve-not-healthy': 'Резервный канал ещё не подтверждён',
'both-unhealthy': 'Оба канала недоступны',
@@ -90,7 +123,7 @@ const reasonLabel = (reason: string | null) => ({
'recovery-hold': 'Проверяем стабильность основного канала',
'activity-unknown': 'Не удалось определить активность',
'active-traffic': 'Ждём завершения активной работы',
'quiet-window': 'Проверяем тишину перед переключением',
'quiet-window': 'Ждём паузу в передаче данных',
'primary-failed': 'Основной канал недоступен',
'primary-recovered': 'Основной канал восстановился',
'pending-activation': 'Изменения ожидают следующего запуска VPN',
@@ -107,9 +140,13 @@ const reasonLabel = (reason: string | null) => ({
function targetLabel(profiles: ProfileSnapshot[], target: { profileId: string; serverId: string }) {
const profile = profiles.find(({ id }) => id === target.profileId);
const server = profile?.servers.find(({ id }) => id === target.serverId);
return profile && server ? `${profile.label} · ${server.label}` : 'Не выбран';
return profile && server ? channelLabel(profile.label, server.label) : 'Не выбран';
}
const channelLabel = (profile: string, server: string) => profile.trim() === server.trim()
? server
: `${profile} · ${server}`;
function HarborSwitch({ checked, label, disabled, onChange }: {
checked: boolean;
label: string;
@@ -280,6 +317,7 @@ export function FailoverPanel({
const [removingCheckId, setRemovingCheckId] = useState('');
const [advancedOpen, setAdvancedOpen] = useState(false);
const [advancedClosing, setAdvancedClosing] = useState(false);
const [manualChecking, setManualChecking] = useState(false);
useEffect(() => {
if (!dirty) setDraft(snapshot.policy);
}, [snapshot.policy, dirty]);
@@ -305,7 +343,7 @@ export function FailoverPanel({
], [diagnostics.customServices]);
const channelOptions = useMemo(() => profiles.flatMap((profile) => profile.servers.map((server) => ({
id: `${profile.id}\u001f${server.id}`,
label: `${profile.label} · ${server.label}`,
label: channelLabel(profile.label, server.label),
target: { profileId: profile.id, serverId: server.id },
}))), [profiles]);
const channelPickerOptions = useMemo(() => ({
@@ -419,12 +457,17 @@ export function FailoverPanel({
/>
</div>
<p>Переключает только новые соединения. Уже открытые соединения Harbor не закрывает.</p>
{snapshot.enabled && <div className="client-failover-global-actions">
<button type="button" disabled={blocked} onClick={() => void onPause(!snapshot.paused)}>{snapshot.paused ? 'Продолжить автоматику' : 'Приостановить автоматику'}</button>
<small>{snapshot.paused ? 'VPN продолжает работать через текущий канал.' : 'Harbor сам проверяет оба канала.'}</small>
</div>}
</header>
<form className="client-failover-form" onSubmit={(event) => {
event.preventDefault();
void onSave(draft).then((result) => { if (result !== false) setDirty(false); });
}}>
<section className="client-failover-channels" aria-label="Основной и резервный каналы">
{(['primary', 'reserve'] as const).map((channel) => {
const health = snapshot[channel].health;
const missing = Boolean(snapshot[channel].target.profileId) && !targetExists(snapshot[channel].target);
@@ -444,9 +487,9 @@ export function FailoverPanel({
: channel === 'primary' && snapshot.currentRole === 'reserve' && health === 'healthy' && snapshot.reason === 'recovery-hold'
? 'Восстанавливается'
: health === 'healthy' ? 'Работает' : health === 'unhealthy' ? 'Недоступен' : health === 'not-monitoring' ? 'Не проверяется' : 'Ещё не проверен';
return <section className="client-failover-channel" data-channel={channel} key={channel}>
return <article className="client-failover-channel" data-channel={channel} key={channel}>
<div className="client-failover-channel-title">
<span><b>{channel === 'primary' ? 'Основной' : 'Резервный'}</b><i aria-hidden="true">=</i></span>
<h3>{channel === 'primary' ? 'Основной' : 'Резервный'}</h3>
<strong className={health === 'healthy' ? 'is-healthy' : health === 'unhealthy' || missing ? 'is-unhealthy' : ''}>{healthLabel}</strong>
</div>
<FailoverPicker
@@ -459,8 +502,12 @@ export function FailoverPanel({
onOpenChange={(open) => setOpenPicker(open ? channel : '')}
onChange={(optionId) => updateTarget(channel, optionId)}
/>
</section>;
</article>;
})}
<div className="client-failover-checking" role="status" aria-live="polite">
{(manualChecking || snapshot.reason === 'checking-channels' ? ['primary', 'reserve'] as const : []).map((checkingRole) => <span key={checkingRole}>Проверяется {checkingRole === 'primary' ? 'основной' : 'резервный'} канал</span>)}
</div>
</section>
<fieldset className="client-failover-services">
<legend>Что проверять</legend>
@@ -477,21 +524,20 @@ export function FailoverPanel({
}}
>
<span className="client-failover-service-name">{service?.label || 'Сервис недоступен'}</span>
<label className="client-failover-service-timeout">
<span>таймаут, сек</span>
<input
type="number"
min="2"
max="30"
aria-label={`Таймаут проверки: ${service?.label || 'сервис недоступен'}`}
value={seconds(check.timeoutMs)}
disabled={blocked || !draft.enabled}
onInput={pulseNumber}
onChange={(event) => updateChecks((checks) => checks.map((item) => item.serviceId === check.serviceId
? { ...item, timeoutMs: milliseconds(event.target.value, item.timeoutMs) }
: item))}
/>
</label>
<FailoverNumberSetting
compact
before="Ждать ответ не дольше"
after="секунд"
min={2}
max={30}
step={1}
ariaLabel={`Время ожидания ответа: ${service?.label || 'сервис недоступен'}`}
value={seconds(check.timeoutMs)}
disabled={blocked || !draft.enabled}
onChange={(value) => updateChecks((checks) => checks.map((item) => item.serviceId === check.serviceId
? { ...item, timeoutMs: value * 1_000 }
: item))}
/>
<button
className="client-failover-remove-service"
type="button"
@@ -532,20 +578,20 @@ export function FailoverPanel({
</fieldset>
<section className="client-failover-timing" aria-label="Пороги переключения">
<label><span>Проверять каждые, сек</span><input type="number" min="15" max="900" disabled={blocked || !draft.enabled} value={seconds(draft.intervalMs)} onInput={pulseNumber} onChange={(event) => update({ intervalMs: milliseconds(event.target.value, draft.intervalMs) })} /></label>
<label><span>Сбой должен длиться, сек</span><input type="number" min={seconds(draft.intervalMs * 2)} max="1800" disabled={blocked || !draft.enabled} value={seconds(draft.failureWindowMs)} onInput={pulseNumber} onChange={(event) => update({ failureWindowMs: milliseconds(event.target.value, draft.failureWindowMs) })} /></label>
<label><span>Восстановление, сек</span><input type="number" min="60" max="86400" disabled={blocked || !draft.enabled} value={seconds(draft.recoveryWindowMs)} onInput={pulseNumber} onChange={(event) => update({ recoveryWindowMs: milliseconds(event.target.value, draft.recoveryWindowMs) })} /></label>
<FailoverNumberSetting before="Проверять каналы каждые" after="секунд" min={15} max={900} ariaLabel="Интервал проверки каналов" value={seconds(draft.intervalMs)} disabled={blocked || !draft.enabled} onChange={(value) => update({ intervalMs: value * 1_000 })} />
<FailoverNumberSetting before="Считать основной недоступным после" after="секунд непрерывного сбоя" min={seconds(draft.intervalMs * 2)} max={1800} ariaLabel="Длительность сбоя основного канала" value={seconds(draft.failureWindowMs)} disabled={blocked || !draft.enabled} onChange={(value) => update({ failureWindowMs: value * 1_000 })} />
<FailoverNumberSetting before="Вернуться на основной после" after="секунд стабильной работы" min={60} max={86400} ariaLabel="Время стабильной работы основного канала" value={seconds(draft.recoveryWindowMs)} disabled={blocked || !draft.enabled} onChange={(value) => update({ recoveryWindowMs: value * 1_000 })} />
<div className="client-failover-traffic-switch">
<span><strong>Переключение во время работы</strong><small>{draft.trafficGuard.enabled ? 'Ждать тишины перед автоматическим переключением' : 'Переключать сразу после подтверждённого сбоя'}</small></span>
<span><strong>Не переключать во время активной работы</strong><small>{draft.trafficGuard.enabled ? 'Harbor дождётся снижения трафика, чтобы не мешать новым подключениям.' : 'Новые соединения переключатся сразу после подтверждённого сбоя.'}</small></span>
<HarborSwitch
checked={draft.trafficGuard.enabled}
label={draft.trafficGuard.enabled ? 'Не ждать завершения активной работы' : 'Ждать завершения активной работы'}
label={draft.trafficGuard.enabled ? 'Разрешить переключение во время активной работы' : 'Не переключать во время активной работы'}
disabled={blocked || !draft.enabled}
onChange={(enabled) => update({ trafficGuard: { ...draft.trafficGuard, enabled } })}
/>
</div>
<label><span>Тишина перед переключением, сек</span><input type="number" min="5" max="600" disabled={blocked || !draft.enabled || !draft.trafficGuard.enabled} value={seconds(draft.trafficGuard.quietWindowMs)} onInput={pulseNumber} onChange={(event) => update({ trafficGuard: { ...draft.trafficGuard, quietWindowMs: milliseconds(event.target.value, draft.trafficGuard.quietWindowMs) } })} /></label>
<label><span>Активный трафик, КБ/с</span><input type="number" min="1" max="102400" disabled={blocked || !draft.enabled || !draft.trafficGuard.enabled} value={Math.round(draft.trafficGuard.thresholdBytesPerSecond / 1024)} onInput={pulseNumber} onChange={(event) => update({ trafficGuard: { ...draft.trafficGuard, thresholdBytesPerSecond: Number(event.target.value) * 1024 } })} /></label>
<FailoverNumberSetting before="Переключать после" after="секунд без активной передачи данных" min={5} max={600} ariaLabel="Время без активной передачи данных" value={seconds(draft.trafficGuard.quietWindowMs)} disabled={blocked || !draft.enabled || !draft.trafficGuard.enabled} onChange={(value) => update({ trafficGuard: { ...draft.trafficGuard, quietWindowMs: value * 1_000 } })} />
<FailoverNumberSetting before="Считать работу активной при скорости от" after="КБ/с" min={1} max={102400} ariaLabel="Скорость активной работы" value={Math.round(draft.trafficGuard.thresholdBytesPerSecond / 1024)} disabled={blocked || !draft.enabled || !draft.trafficGuard.enabled} onChange={(value) => update({ trafficGuard: { ...draft.trafficGuard, thresholdBytesPerSecond: value * 1024 } })} />
</section>
<section className={`client-failover-advanced${advancedOpen ? ' is-open' : ''}${advancedClosing ? ' is-closing' : ''}`}>
@@ -563,10 +609,10 @@ export function FailoverPanel({
setAdvancedOpen(false);
}}
>
<label><span>Минимум на резерве, сек</span><input type="number" min="60" max="86400" disabled={blocked || !draft.enabled} value={seconds(draft.minimumReserveMs)} onInput={pulseNumber} onChange={(event) => update({ minimumReserveMs: milliseconds(event.target.value, draft.minimumReserveMs) })} /></label>
<label><span>Падений до карантина</span><input type="number" min="2" max="10" disabled={blocked || !draft.enabled} value={draft.flapProtection.count} onInput={pulseNumber} onChange={(event) => update({ flapProtection: { ...draft.flapProtection, count: Number(event.target.value) } })} /></label>
<label><span>Окно повторных сбоев, ч</span><input type="number" min="1" max="72" disabled={blocked || !draft.enabled} value={Math.round(draft.flapProtection.windowMs / 3_600_000)} onInput={pulseNumber} onChange={(event) => update({ flapProtection: { ...draft.flapProtection, windowMs: Number(event.target.value) * 3_600_000 } })} /></label>
<label><span>Карантин основного, мин</span><input type="number" min="10" max="10080" disabled={blocked || !draft.enabled} value={Math.round(draft.flapProtection.quarantineMs / 60_000)} onInput={pulseNumber} onChange={(event) => update({ flapProtection: { ...draft.flapProtection, quarantineMs: Number(event.target.value) * 60_000 } })} /></label>
<FailoverNumberSetting before="Оставаться на резервном не меньше" after="секунд" min={60} max={86400} ariaLabel="Минимальное время на резервном канале" value={seconds(draft.minimumReserveMs)} disabled={blocked || !draft.enabled} onChange={(value) => update({ minimumReserveMs: value * 1_000 })} />
<FailoverNumberSetting before="Отправлять основной в карантин после" after="повторных сбоев" min={2} max={10} step={1} ariaLabel="Количество повторных сбоев" value={draft.flapProtection.count} disabled={blocked || !draft.enabled} onChange={(value) => update({ flapProtection: { ...draft.flapProtection, count: value } })} />
<FailoverNumberSetting before="Считать повторными сбои за последние" after="часов" min={1} max={72} step={1} ariaLabel="Период повторных сбоев" value={Math.round(draft.flapProtection.windowMs / 3_600_000)} disabled={blocked || !draft.enabled} onChange={(value) => update({ flapProtection: { ...draft.flapProtection, windowMs: value * 3_600_000 } })} />
<FailoverNumberSetting before="Не возвращаться на основной после карантина" after="минут" min={10} max={10080} ariaLabel="Длительность карантина основного канала" value={Math.round(draft.flapProtection.quarantineMs / 60_000)} disabled={blocked || !draft.enabled} onChange={(value) => update({ flapProtection: { ...draft.flapProtection, quarantineMs: value * 60_000 } })} />
</div>}
</section>
@@ -578,7 +624,7 @@ export function FailoverPanel({
? `При запуске VPN: ${targetLabel(profiles, draft.primary)}`
: `После перезапуска VPN: ${targetLabel(profiles, draft.primary)}`}</span>
{snapshot.nextDecisionAt && <span>Следующее решение не раньше чем через {seconds(Math.max(0, Date.parse(snapshot.nextDecisionAt) - Date.now()))} с</span>}
{activity && <span>{activity.state === 'active' ? `Активный трафик · ${Math.round(activity.totalBytesPerSecond / 1024)} КБ/с · соединений: ${activity.transmittingConnections}` : activity.state === 'quiet' ? `Проверяем тишину · ${Math.min(seconds(quietElapsed), seconds(draft.trafficGuard.quietWindowMs))} из ${seconds(draft.trafficGuard.quietWindowMs)} с` : 'Не удалось определить активность · автоматическое переключение остановлено'}</span>}
{activity && <span>{activity.state === 'active' ? `Активный трафик · ${Math.round(activity.totalBytesPerSecond / 1024)} КБ/с · соединений: ${activity.transmittingConnections}` : activity.state === 'quiet' ? `Без активной передачи данных · ${Math.min(seconds(quietElapsed), seconds(draft.trafficGuard.quietWindowMs))} из ${seconds(draft.trafficGuard.quietWindowMs)} с` : 'Не удалось определить активность · автоматическое переключение остановлено'}</span>}
{activity?.blockers.slice(0, 2).map((blocker) => <small key={`${blocker.device}:${blocker.service}`}>{blocker.device} · {blocker.service} · {Math.round((blocker.uploadBytesPerSecond + blocker.downloadBytesPerSecond) / 1024)} КБ/с</small>)}
{activity && activity.blockers.length > 2 && <small>Ещё {activity.blockers.length - 2}</small>}
</div>
@@ -591,11 +637,13 @@ export function FailoverPanel({
</div>}
<div className="client-failover-actions">
<button type="button" disabled={blocked || !snapshot.enabled || snapshot.activation !== 'active'} onClick={() => void onCheck()}>Проверить оба канала</button>
<button type="button" disabled={blocked || manualChecking || !snapshot.enabled || snapshot.activation !== 'active'} onClick={() => {
setManualChecking(true);
void onCheck().finally(() => setManualChecking(false));
}}>Проверить основной и резервный</button>
<button type="submit" disabled={blocked || !dirty || !draftValid}>Сохранить</button>
{snapshot.enabled && <button type="button" disabled={blocked} onClick={() => void onPause(!snapshot.paused)}>{snapshot.paused ? 'Возобновить' : 'Пауза'}</button>}
{switchRole && snapshot.enabled && snapshot.activation === 'active' && <button type="button" disabled={blocked} aria-label={`Переключить новые соединения на ${switchRole === 'reserve' ? 'резервный' : 'основной'} сейчас`} onClick={() => void onSwitch(switchRole)}>Переключить новые сейчас</button>}
{(snapshot.currentRole === 'primary' || snapshot.currentRole === 'reserve') && <small>Текущие соединения Harbor не закроет</small>}
{switchRole && snapshot.enabled && snapshot.activation === 'active' && <button type="button" disabled={blocked} onClick={() => void onSwitch(switchRole)}>Переключить новые соединения на {switchRole === 'reserve' ? 'резервный' : 'основной'}</button>}
{(snapshot.currentRole === 'primary' || snapshot.currentRole === 'reserve') && <small>Открытые соединения продолжат работать через прежний канал.</small>}
</div>
</form>
</Drawer>;
+24 -19
View File
@@ -1,28 +1,30 @@
.client-failover-header { display: grid; gap: 8px; margin: 0 8px 30px; }
.client-failover-header > span, .client-failover-channel-title > span, .client-failover-services legend { color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-header > span, .client-failover-services legend { color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-heading { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-right: 52px; }
.client-failover-header h2 { margin: 0; font: var(--type-drawer-title); letter-spacing: var(--type-drawer-title-tracking); text-transform: var(--type-drawer-title-transform); }
.client-failover-header p { margin: 0; color: var(--client-muted); font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); }
.client-failover-global-actions { min-height: 30px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 16px; }
.client-failover-global-actions > button { padding: 6px 0; border: 0; background: transparent; color: var(--client-accent); font: var(--type-control); letter-spacing: var(--type-control-tracking); text-transform: var(--type-control-transform); cursor: pointer; }
.client-failover-global-actions > small { color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-form { display: grid; gap: 24px; margin: 0 8px; }
.client-failover-switch { position: relative; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--client-muted); cursor: pointer; }
.client-failover-switch::before { content: ''; position: absolute; inset: 11px 1px; border-radius: 999px; background: color-mix(in oklch, var(--client-muted) 24%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--client-muted) 24%, transparent); transition: background 240ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1); }
.client-failover-switch > span { position: absolute; top: 13px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: color-mix(in oklch, var(--client-text) 88%, var(--client-bg)); box-shadow: 0 2px 8px color-mix(in oklch, black 30%, transparent); transform: translateX(0); transition: background 240ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1), transform 240ms cubic-bezier(0.16, 1, 0.3, 1); }
.client-failover-switch[aria-checked='true']::before { background: color-mix(in oklch, var(--client-accent) 72%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--client-accent) 58%, transparent), 0 0 14px color-mix(in oklch, var(--client-accent) 28%, transparent); }
.client-failover-switch[aria-checked='true'] > span { background: var(--client-text); box-shadow: 0 0 10px color-mix(in oklch, var(--client-accent) 46%, transparent); transform: translateX(20px); }
.client-failover-switch[aria-checked='true'] > span { background: var(--client-text); box-shadow: 0 0 10px color-mix(in oklch, var(--client-accent) 46%, transparent); transform: translateX(22px); }
.client-failover-switch:disabled { cursor: default; opacity: .42; }
.client-failover-switch:focus-visible { outline: 2px solid var(--client-accent); outline-offset: 0; border-radius: 999px; }
.client-failover-channel { position: relative; display: grid; grid-template-columns: 142px minmax(0, 1fr) 126px; align-items: center; gap: 14px; min-height: 52px; }
.client-failover-channel-title { display: contents; }
.client-failover-channel-title > span { grid-column: 1; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); }
.client-failover-channel-title > span b { font: inherit; }
.client-failover-channel-title > span i { color: var(--client-muted); font-style: normal; }
.client-failover-channel[data-channel='primary'] .client-failover-channel-title > span b { color: var(--harbor-connect); text-shadow: 0 0 9px color-mix(in oklch, var(--harbor-connect) 30%, transparent); }
.client-failover-channel[data-channel='reserve'] .client-failover-channel-title > span b { color: var(--harbor-gateway); text-shadow: 0 0 9px color-mix(in oklch, var(--harbor-gateway) 30%, transparent); }
.client-failover-channel-title strong { grid-column: 3; grid-row: 1; min-width: 0; color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); text-align: right; white-space: nowrap; transition: color 600ms ease, filter 600ms ease; }
.client-failover-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.client-failover-channel { position: relative; display: grid; align-content: start; gap: 7px; min-width: 0; }
.client-failover-channel-title { min-height: 24px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.client-failover-channel-title h3 { margin: 0; font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); }
.client-failover-channel[data-channel='primary'] .client-failover-channel-title h3 { color: var(--harbor-connect); text-shadow: 0 0 9px color-mix(in oklch, var(--harbor-connect) 30%, transparent); }
.client-failover-channel[data-channel='reserve'] .client-failover-channel-title h3 { color: var(--harbor-gateway); text-shadow: 0 0 9px color-mix(in oklch, var(--harbor-gateway) 30%, transparent); }
.client-failover-channel-title strong { min-width: 0; color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); text-align: right; white-space: nowrap; transition: color 600ms ease, filter 600ms ease; }
.client-failover-channel-title strong.is-healthy { color: var(--client-accent); }
.client-failover-channel-title strong.is-unhealthy { color: oklch(0.68 0.15 28); }
.client-failover-picker { position: relative; min-width: 0; z-index: 1; }
.client-failover-channel > .client-failover-picker { grid-column: 2; grid-row: 1; }
.client-failover-checking { grid-column: 1 / -1; min-height: 22px; display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-picker.is-open { z-index: 6; }
.client-failover-picker-trigger { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--client-border); background: transparent; color: var(--client-text); font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); text-align: left; box-shadow: 0 1px 0 transparent; cursor: pointer; transition: color 220ms ease, box-shadow 300ms ease, text-shadow 300ms ease; }
.client-failover-picker-trigger span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -37,16 +39,19 @@
.client-failover-picker.is-open .client-failover-picker-list button { opacity: 1; filter: blur(0); transform: translateY(0); transition-delay: calc(var(--picker-index) * 30ms); }
.client-failover-picker-list button:hover, .client-failover-picker-list button:focus-visible, .client-failover-picker-list button[aria-selected='true'] { outline: 0; color: var(--client-accent); text-shadow: 0 0 9px color-mix(in oklch, var(--client-accent) 38%, transparent); }
.client-failover-picker-list button[aria-disabled='true'] { color: color-mix(in oklch, var(--client-muted) 58%, transparent); cursor: default; text-shadow: none; }
.client-failover-timing label, .client-failover-advanced label { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 48%); align-items: center; gap: 16px; min-height: 38px; color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-timing input, .client-failover-advanced input { min-width: 0; min-height: 38px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--client-border); border-radius: 0; background: transparent; color: var(--client-text); font: var(--type-item-title); font-variant-numeric: var(--numeric-tabular); letter-spacing: var(--type-item-title-tracking); text-align: center; text-transform: var(--type-item-title-transform); appearance: textfield; transition: color 220ms ease, border-color 220ms ease, box-shadow 220ms ease, text-shadow 220ms ease; }
.client-failover-timing input:disabled, .client-failover-advanced input:disabled { color: var(--client-muted); opacity: .45; }
.client-failover-number-setting { display: grid; grid-template-columns: minmax(0, 1fr) 68px max-content auto; align-items: center; gap: 8px; min-height: 42px; color: var(--client-muted); font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); }
.client-failover-number-setting input { width: 68px; min-height: 34px; padding: 0 3px; border: 0; border-bottom: 1px solid var(--client-border); border-radius: 0; background: transparent; color: var(--client-text); font: var(--type-item-title); font-variant-numeric: var(--numeric-tabular); letter-spacing: var(--type-item-title-tracking); text-align: center; text-transform: var(--type-item-title-transform); appearance: textfield; transition: color 220ms ease, border-color 220ms ease, box-shadow 220ms ease, text-shadow 220ms ease; }
.client-failover-number-setting input:disabled { color: var(--client-muted); opacity: .45; }
.client-failover-number-steps { justify-self: end; display: flex; align-items: center; gap: 10px; }
.client-failover-number-steps button { min-width: 34px; padding: 5px 0; border: 0; background: transparent; color: var(--client-accent); font: var(--type-control); font-variant-numeric: var(--numeric-tabular); letter-spacing: var(--type-control-tracking); text-transform: var(--type-control-transform); cursor: pointer; }
.client-failover-number-steps button:disabled, .client-failover-global-actions > button:disabled { color: var(--client-muted); cursor: default; opacity: .42; }
.client-failover-services { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.client-failover-services legend { margin-bottom: 10px; }
.client-failover-service { display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; align-items: center; gap: 12px; min-height: 38px; animation: failover-service-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.client-failover-service { display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr) 32px; align-items: center; gap: 12px; min-height: 42px; animation: failover-service-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.client-failover-service.is-removing { animation: failover-service-out 300ms ease both; pointer-events: none; }
.client-failover-service-name { min-width: 0; overflow: hidden; color: var(--client-text); font: var(--type-body); letter-spacing: var(--type-body-tracking); text-overflow: ellipsis; text-transform: var(--type-body-transform); white-space: nowrap; }
.client-failover-service-timeout { display: flex; align-items: center; gap: 8px; color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-service-timeout input { width: 58px; min-height: 34px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--client-border); border-radius: 0; background: transparent; color: var(--client-text); font: var(--type-item-title); font-variant-numeric: var(--numeric-tabular); letter-spacing: var(--type-item-title-tracking); text-align: center; text-transform: var(--type-item-title-transform); appearance: textfield; transition: color 220ms ease, border-color 220ms ease, box-shadow 220ms ease, text-shadow 220ms ease; }
.client-failover-number-setting.is-compact { grid-template-columns: minmax(0, 1fr) 52px max-content auto; min-height: 38px; font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-number-setting.is-compact input { width: 52px; min-height: 32px; }
.client-failover-remove-service { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: oklch(0.62 0.16 28); cursor: pointer; transition: color 180ms ease, filter 240ms ease; }
.client-failover-remove-service svg { width: 19px; height: 19px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.client-failover-remove-lid { transform-origin: center 7px; transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1); }
@@ -89,11 +94,11 @@
.client-failover-actions button { padding: 7px 0; border: 0; background: transparent; color: var(--client-accent); font: var(--type-control); letter-spacing: var(--type-control-tracking); text-transform: var(--type-control-transform); cursor: pointer; }
.client-failover-actions small { flex-basis: 100%; margin-top: -14px; color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-actions button:disabled { color: var(--client-muted); cursor: default; opacity: .45; }
.client-failover-actions button:focus-visible, .client-failover-service-editor button:focus-visible, .client-failover-discard button:focus-visible { outline: 2px solid var(--client-accent); outline-offset: 2px; }
.client-failover-actions button:focus-visible, .client-failover-service-editor button:focus-visible, .client-failover-discard button:focus-visible, .client-failover-number-steps button:focus-visible, .client-failover-global-actions > button:focus-visible { outline: 2px solid var(--client-accent); outline-offset: 2px; }
.client-failover-form input:focus-visible { outline: 0; border-bottom-color: var(--client-accent); box-shadow: 0 1px 0 color-mix(in oklch, var(--client-accent) 60%, transparent); text-shadow: 0 0 9px color-mix(in oklch, var(--client-accent) 34%, transparent); }
@keyframes failover-service-in { from { opacity: 0; filter: blur(5px); transform: translateY(-4px); } to { opacity: 1; filter: blur(0); transform: translateY(0); } }
@keyframes failover-service-out { from { opacity: 1; filter: blur(0); transform: translateX(0) scale(1); } to { opacity: 0; filter: blur(6px); transform: translateX(16px) scale(.96); } }
@keyframes failover-advanced-in { from { opacity: 0; filter: blur(5px); transform: translateY(-5px); } to { opacity: 1; filter: blur(0); transform: translateY(0); } }
@keyframes failover-advanced-out { from { opacity: 1; filter: blur(0); transform: translateY(0); } to { opacity: 0; filter: blur(5px); transform: translateY(-5px); } }
@media (max-width: 560px) { .client-failover-heading { padding-right: 44px; } .client-failover-channel { grid-template-columns: 112px minmax(0, 1fr); gap: 5px 10px; } .client-failover-channel-title strong { grid-column: 2; grid-row: 2; text-align: left; } .client-failover-channel > .client-failover-picker { grid-column: 2; grid-row: 1; } .client-failover-timing label, .client-failover-advanced label { grid-template-columns: 1fr; gap: 4px; } .client-failover-service { grid-template-columns: minmax(0, 1fr) 32px; gap: 6px 10px; } .client-failover-service-timeout { grid-column: 1; grid-row: 2; justify-self: start; } .client-failover-remove-service { grid-column: 2; grid-row: 1 / span 2; } .client-failover-service-editor { grid-template-columns: 1fr; gap: 2px; } }
@media (max-width: 560px) { .client-failover-heading { padding-right: 44px; } .client-failover-channels { grid-template-columns: minmax(0, 1fr); gap: 18px; } .client-failover-checking { grid-column: 1; margin-top: -6px; } .client-failover-number-setting { grid-template-columns: minmax(0, 1fr) 58px auto; gap: 5px 7px; } .client-failover-number-setting > span:first-child { grid-column: 1 / -1; } .client-failover-number-setting input { grid-column: 1; grid-row: 2; width: 58px; } .client-failover-number-setting > span:nth-child(3) { grid-column: 2; grid-row: 2; } .client-failover-number-steps { grid-column: 3; grid-row: 2; } .client-failover-service { grid-template-columns: minmax(0, 1fr) 32px; gap: 6px 10px; } .client-failover-service > .client-failover-number-setting { grid-column: 1; grid-row: 2; } .client-failover-remove-service { grid-column: 2; grid-row: 1 / span 2; } .client-failover-service-editor { grid-template-columns: 1fr; gap: 2px; } }
@media (prefers-reduced-motion: reduce) { .client-failover-channel-title strong, .client-failover-switch::before, .client-failover-switch > span, .client-failover-picker-trigger, .client-failover-picker-trigger::before, .client-failover-picker-trigger svg, .client-failover-picker-list, .client-failover-picker-list button, .client-failover-remove-service, .client-failover-remove-lid, .client-failover-advanced > button i::before, .client-failover-advanced > button i::after { transition: none; } .client-failover-service, .client-failover-service-editor, .client-failover-advanced-options { animation: none; } }