Clarify failover UI messaging and controls
Build and Deploy Gateway / build-and-push (push) Successful in 25s
Build and Deploy Gateway / deploy (push) Successful in 7s

This commit is contained in:
2026-08-21 01:01:34 +03:00
parent 1ee453b3b6
commit 12f2f30212
5 changed files with 109 additions and 101 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
export const HARBOR_VERSIONS = Object.freeze({
macClient: '0.30.2',
gatewayClient: '0.31.2',
macClient: '0.30.3',
gatewayClient: '0.31.3',
gatewayBackend: '0.31.0',
});
+67 -65
View File
@@ -90,53 +90,55 @@ function FailoverNumberSetting({ before, after, value, min, max, step = 10, disa
const set = (next: number) => onChange(Math.min(max, Math.max(min, next)));
return <div className="client-failover-number-setting">
<span>{before}</span>
<input
className="client-failover-number-input"
type="number"
min={min}
max={max}
aria-label={ariaLabel}
value={value}
style={{ width: `${Math.max(2, String(value).length + 0.6)}ch` }}
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 className="client-failover-number-control">
<input
className="client-failover-number-input"
type="number"
min={min}
max={max}
aria-label={ariaLabel}
value={value}
style={{ width: `${Math.max(2, String(value).length + 0.6)}ch` }}
disabled={disabled}
onInput={pulseNumber}
onChange={(event) => {
const next = Number(event.target.value);
if (Number.isFinite(next)) onChange(next);
}}
/>
<span className="client-failover-number-steps">
<button type="button" aria-label={`${ariaLabel}: уменьшить на ${step}`} disabled={disabled || value <= min} onClick={() => set(value - step)}></button>
<button type="button" aria-label={`${ariaLabel}: увеличить на ${step}`} disabled={disabled || value >= max} onClick={() => set(value + step)}>+</button>
</span>
</span>
<span>{after}</span>
</div>;
}
const reasonLabel = (reason: string | null) => ({
'primary-healthy': 'Основной канал работает',
'health-unknown': 'Ожидаем результаты проверки',
'checking-channels': 'Проверяем основной и резервный каналы',
'failure-window': 'Подтверждаем сбой основного канала',
'reserve-not-healthy': 'Резервный канал ещё не подтверждён',
'health-unknown': 'Ждём первую проверку',
'checking-channels': 'Проверяем оба канала',
'failure-window': 'Убеждаемся, что основной не работает',
'reserve-not-healthy': 'Проверяем резервный канал',
'both-unhealthy': 'Оба канала недоступны',
'primary-not-recovered': 'Основной канал восстанавливается',
'recovery-hold': 'Проверяем стабильность основного канала',
'activity-unknown': 'Не удалось определить активность',
'active-traffic': 'Ждём завершения активной работы',
'quiet-window': 'Ждём паузу в передаче данных',
'primary-not-recovered': 'Основной ещё не восстановился',
'recovery-hold': 'Убеждаемся, что основной работает без сбоев',
'activity-unknown': 'Не удалось проверить передачу данных',
'active-traffic': 'Ждём паузу в передаче данных',
'quiet-window': 'Проверяем, что передача данных остановилась',
'primary-failed': 'Основной канал недоступен',
'primary-recovered': 'Основной канал восстановился',
'pending-activation': 'Изменения ожидают следующего запуска VPN',
'pending-activation': 'Настройка применится при запуске VPN',
'vpn-stopped': 'VPN выключен',
paused: 'Автоматика на паузе',
disabled: 'Резерв выключен',
paused: 'Автоматическое переключение приостановлено',
disabled: 'Резервный канал выключен',
'switch-failed': 'Не удалось переключить канал',
'selector-unknown': 'Не удалось подтвердить текущий канал',
'reconcile-failed': 'Настройки сохранены, мониторинг временно недоступен',
'revalidation-required': 'Условия переключения проверяются заново',
'selector-unknown': 'Не удалось проверить выбранный канал',
'reconcile-failed': 'Настройки сохранены. Повторим проверку позже',
'revalidation-required': 'Проверяем условия ещё раз',
'manual-check': 'Оба канала проверены',
}[reason || ''] || 'Наблюдаем за каналами');
}[reason || ''] || 'Следим за каналами');
function targetLabel(profiles: ProfileSnapshot[], target: { profileId: string; serverId: string }) {
const profile = profiles.find(({ id }) => id === target.profileId);
@@ -446,10 +448,10 @@ export function FailoverPanel({
}}
/>
</div>
<p>Переключает только новые соединения. Уже открытые соединения Harbor не закрывает.</p>
<p>Если основной канал перестанет работать, новые подключения пойдут через резервный. Уже открытые подключения продолжат работать.</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>
<small>{snapshot.paused ? 'Новые подключения остаются на текущем канале.' : 'Harbor следит, работают ли оба канала.'}</small>
</div>}
</header>
@@ -465,18 +467,18 @@ export function FailoverPanel({
target.profileId === draft[channel].profileId && target.serverId === draft[channel].serverId
))?.id || '';
const healthLabel = missing
? 'Цель недоступна'
? 'Сервер не найден'
: !draft.enabled
? 'Выключен'
: snapshot.reason === 'vpn-stopped' || snapshot.activation === 'inactive'
? 'VPN выключен'
: snapshot.activation === 'pending'
? 'Ожидает запуска VPN'
? 'Запустится вместе с VPN'
: channel === 'primary' && snapshot.reason === 'failure-window'
? `Нестабилен · ${seconds(Math.max(0, Date.now() - Date.parse(snapshot.primary.stateSince || new Date().toISOString())))} из ${seconds(draft.failureWindowMs)} с`
? `Проверяем сбой · ${seconds(Math.max(0, Date.now() - Date.parse(snapshot.primary.stateSince || new Date().toISOString())))} из ${seconds(draft.failureWindowMs)} с`
: channel === 'primary' && snapshot.currentRole === 'reserve' && health === 'healthy' && snapshot.reason === 'recovery-hold'
? 'Восстанавливается'
: health === 'healthy' ? 'Работает' : health === 'unhealthy' ? 'Недоступен' : health === 'not-monitoring' ? 'Не проверяется' : 'Ещё не проверен';
? 'Проверяем восстановление'
: health === 'healthy' ? 'Работает' : health === 'unhealthy' ? 'Недоступен' : health === 'not-monitoring' ? 'Проверка выключена' : 'Ждёт проверки';
return <article className="client-failover-channel" data-channel={channel} key={channel}>
<div className="client-failover-channel-title">
<h3>{channel === 'primary' ? 'Основной' : 'Резервный'}</h3>
@@ -484,7 +486,7 @@ export function FailoverPanel({
</div>
<FailoverPicker
id={`client-failover-${channel}-options`}
label={draft[channel].profileId ? 'Цель недоступна' : 'Выбрать канал'}
label={draft[channel].profileId ? 'Сервер не найден' : 'Выбрать канал'}
value={selectedId}
options={channelPickerOptions[channel]}
open={openPicker === channel && !blocked && draft.enabled}
@@ -495,12 +497,12 @@ export function FailoverPanel({
</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>)}
{(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><span className="client-failover-section-header"><strong>Проверка доступности</strong><small>Harbor открывает эти адреса через оба канала и сравнивает результат.</small></span></legend>
<legend><span className="client-failover-section-header"><strong>Что проверять</strong><small>По этим сайтам Harbor понимает, работает канал или нет.</small></span></legend>
{draft.checks.map((check) => {
const service = services.find(({ id }) => check.serviceId === id);
const removing = removingCheckId === check.serviceId;
@@ -513,14 +515,14 @@ export function FailoverPanel({
if (removing && event.target === event.currentTarget) finishRemoveCheck(check.serviceId);
}}
>
<span className="client-failover-service-name">{service?.label || 'Сервис недоступен'}</span>
<span className="client-failover-service-name">{service?.label || 'Сайт не найден'}</span>
<FailoverNumberSetting
before="Ждать ответ не дольше"
after="секунд"
min={2}
max={30}
step={1}
ariaLabel={`Время ожидания ответа: ${service?.label || 'сервис недоступен'}`}
ariaLabel={`Время ожидания ответа: ${service?.label || 'сайт не найден'}`}
value={seconds(check.timeoutMs)}
disabled={blocked || !draft.enabled}
onChange={(value) => updateChecks((checks) => checks.map((item) => item.serviceId === check.serviceId
@@ -530,7 +532,7 @@ export function FailoverPanel({
<button
className="client-failover-remove-service"
type="button"
aria-label={`Убрать проверку: ${service?.label || 'сервис недоступен'}`}
aria-label={`Убрать проверку: ${service?.label || 'сайт не найден'}`}
disabled={blocked || !draft.enabled || draft.checks.length === 1 || Boolean(removingCheckId)}
onClick={() => removeCheck(check.serviceId)}
>
@@ -568,14 +570,14 @@ export function FailoverPanel({
<section className="client-failover-timing" aria-label="Пороги переключения">
<header className="client-failover-section-header">
<h3>Когда переключать канал</h3>
<p>Harbor сначала подтверждает сбой и только затем переводит новые соединения на рабочий канал.</p>
<h3>Когда включать резервный</h3>
<p>Harbor включит резервный, только если основной не отвечает, а резервный работает.</p>
</header>
<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 })} />
<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 ? 'Harbor дождётся снижения трафика, чтобы не мешать новым подключениям.' : 'Новые соединения переключатся сразу после подтверждённого сбоя.'}</small></span>
<span><strong>Дождаться паузы в передаче данных</strong><small>{draft.trafficGuard.enabled ? 'Harbor подождёт, пока передача данных почти остановится.' : 'Новые подключения переключатся сразу после подтверждённого сбоя.'}</small></span>
<HarborSwitch
checked={draft.trafficGuard.enabled}
label={draft.trafficGuard.enabled ? 'Разрешить переключение во время активной работы' : 'Не переключать во время активной работы'}
@@ -583,20 +585,20 @@ export function FailoverPanel({
onChange={(enabled) => update({ trafficGuard: { ...draft.trafficGuard, enabled } })}
/>
</div>
<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 } })} />
<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-protection" aria-labelledby="client-failover-protection-title">
<header className="client-failover-section-header">
<h3 id="client-failover-protection-title">Защита от частых переключений</h3>
<p>Если основной канал падает снова, Harbor остаётся на резервном и даёт основному время восстановиться.</p>
<h3 id="client-failover-protection-title">Если основной снова не работает</h3>
<p>После нескольких повторных сбоев Harbor дольше использует резервный канал.</p>
</header>
<div className="client-failover-protection-options">
<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 } })} />
<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>
@@ -608,12 +610,12 @@ 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>
{!draftValid && <p className="client-failover-validation">Выберите два разных сервера и хотя бы одну проверку.</p>}
{!draftValid && <p className="client-failover-validation">Выберите разные основной и резервный серверы и хотя бы один сайт для проверки.</p>}
{confirmDiscard && <div className="client-failover-discard" role="alert">
<span>Отменить несохранённые изменения?</span>
<button type="button" onClick={() => { setDraft(snapshot.policy); setDirty(false); setConfirmDiscard(false); feature.beforeCloseRef.current = () => true; feature.close(); }}>Отменить изменения</button>
@@ -624,9 +626,9 @@ export function FailoverPanel({
<button type="button" disabled={blocked || manualChecking || !snapshot.enabled || snapshot.activation !== 'active'} onClick={() => {
setManualChecking(true);
void onCheck().finally(() => setManualChecking(false));
}}>Проверить основной и резервный</button>
}}>Проверить оба канала</button>
<button type="submit" disabled={blocked || !dirty || !draftValid}>Сохранить</button>
{switchRole && snapshot.enabled && snapshot.activation === 'active' && <button type="button" disabled={blocked} onClick={() => void onSwitch(switchRole)}>Переключить новые соединения на {switchRole === 'reserve' ? 'резервный' : 'основной'}</button>}
{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>
+11 -8
View File
@@ -39,19 +39,21 @@
.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-number-setting { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .55ch; min-height: 42px; color: var(--client-muted); font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); cursor: text; }
.client-failover-number-setting { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .45ch; min-height: 38px; color: var(--client-muted); font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); cursor: text; }
.client-failover-number-control { position: relative; flex: 0 0 auto; min-width: 44px; display: inline-grid; justify-items: center; padding-bottom: 18px; }
.client-failover-number-setting input { flex: 0 0 auto; min-width: 2ch; min-height: 1.35em; padding: 0; border: 0; 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, text-shadow 220ms ease; }
.client-failover-number-setting input::-webkit-inner-spin-button, .client-failover-number-setting input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.client-failover-number-setting input:disabled { color: var(--client-muted); opacity: .45; }
.client-failover-number-steps { display: inline-flex; align-items: baseline; gap: 10px; margin-left: .65ch; }
.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 { position: absolute; left: 50%; bottom: 0; width: 44px; display: flex; justify-content: space-between; opacity: 0; filter: blur(3px); transform: translate(-50%, -2px); pointer-events: none; transition: opacity 180ms ease, filter 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1); }
.client-failover-number-control:hover .client-failover-number-steps, .client-failover-number-control:focus-within .client-failover-number-steps { opacity: 1; filter: blur(0); transform: translate(-50%, 0); pointer-events: auto; }
.client-failover-number-steps button { width: 20px; height: 18px; display: grid; place-items: center; padding: 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-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 { display: grid; gap: 5px; margin: 0; padding: 0; border: 0; }
.client-failover-services legend { width: 100%; margin-bottom: 14px; padding: 0; }
.client-failover-section-header { display: grid; gap: 4px; margin-bottom: 12px; }
.client-failover-section-header h3, .client-failover-section-header strong { margin: 0; color: var(--client-text); font: var(--type-item-title); letter-spacing: var(--type-item-title-tracking); text-transform: var(--type-item-title-transform); }
.client-failover-section-header p, .client-failover-section-header small { margin: 0; color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.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 { display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr) 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.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-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; }
@@ -70,12 +72,13 @@
.client-failover-service-editor span { grid-column: 1 / -1; color: oklch(0.68 0.15 28); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-service-editor button { justify-self: start; padding: 4px 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-service-editor button:disabled { color: var(--client-muted); cursor: default; opacity: .45; }
.client-failover-timing { display: grid; gap: 5px; }
.client-failover-timing { display: grid; gap: 0; }
.client-failover-traffic-switch { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 8px 0 4px; }
.client-failover-traffic-switch > span { min-width: 0; display: grid; gap: 3px; }
.client-failover-traffic-switch strong { color: var(--client-text); font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); }
.client-failover-traffic-switch small { color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
.client-failover-protection, .client-failover-protection-options { display: grid; gap: 5px; }
.client-failover-protection { display: grid; gap: 5px; }
.client-failover-protection-options { display: grid; gap: 0; }
.client-failover-runtime { min-height: 132px; display: grid; align-content: center; gap: 5px; padding: 14px 0; border-top: 1px solid color-mix(in oklch, var(--client-border) 48%, transparent); border-bottom: 1px solid color-mix(in oklch, var(--client-border) 48%, transparent); font-variant-numeric: var(--numeric-tabular); }
.client-failover-runtime strong { font: var(--type-body); letter-spacing: var(--type-body-tracking); text-transform: var(--type-body-transform); }
.client-failover-runtime span, .client-failover-runtime small { color: var(--client-muted); font: var(--type-label); letter-spacing: var(--type-label-tracking); text-transform: var(--type-label-transform); }
@@ -93,4 +96,4 @@
@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); } }
@media (max-width: 560px) { .client-failover-channels { grid-template-columns: minmax(0, 1fr); gap: 18px; } .client-failover-checking { grid-column: 1; margin-top: -6px; } .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 { transition: none; } .client-failover-service, .client-failover-service-editor { animation: none; } }
@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-number-steps, .client-failover-remove-service, .client-failover-remove-lid { transition: none; } .client-failover-service, .client-failover-service-editor { animation: none; } }
+15 -12
View File
@@ -13,7 +13,7 @@ test('reserve is a Gateway-only drawer immediately after subscriptions', () => {
assert.match(page, /\{isGateway && hasSubscription && <FailoverPanel/);
assert.match(page, /DRAWER_ORDER = \['subscription', 'failover'/);
assert.match(feature, /label="Резерв"/);
assert.match(feature, /Уже открытые соединения Harbor не закрывает/);
assert.match(feature, /Уже открытые подключения продолжат работать/);
});
test('failover settings use Harbor switches, a two-column channel table and plain-language controls', () => {
@@ -23,16 +23,16 @@ test('failover settings use Harbor switches, a two-column channel table and plai
assert.match(feature, /\['primary', 'reserve'\][\s\S]*client-failover-\$\{channel\}-options[\s\S]*updateTarget\(channel, optionId\)/);
assert.match(feature, /channelLabel[\s\S]*profile\.trim\(\) === server\.trim\(\)[\s\S]*`\$\{profile} · \$\{server}`/);
assert.match(feature, /client-failover-channels[\s\S]*<article className="client-failover-channel"[\s\S]*<h3>\{channel === 'primary' \? 'Основной' : 'Резервный'}/);
assert.match(feature, /snapshot\.reason === 'checking-channels'[\s\S]*Проверяется \{checkingRole === 'primary' \? 'основной' : 'резервный'} канал/);
assert.match(feature, /snapshot\.reason === 'checking-channels'[\s\S]*Проверяем \{checkingRole === 'primary' \? 'основной' : 'резервный'} канал/);
assert.match(feature, /ArrowDown[\s\S]*Home[\s\S]*End[\s\S]*Escape/);
assert.match(feature, /role="listbox"[\s\S]*role="option"/);
assert.match(feature, /Проверка доступности[\s\S]*открывает эти адреса через оба канала/);
assert.match(feature, /Что проверять[\s\S]*По этим сайтам Harbor понимает, работает канал или нет/);
assert.match(feature, /before="Ждать ответ не дольше"[\s\S]*min=\{2}[\s\S]*max=\{30}/);
assert.match(feature, /Проверять каналы каждые[\s\S]*Считать основной недоступным после[\s\S]*Вернуться на основной после/);
assert.match(feature, /Не переключать во время активной работы[\s\S]*Переключать после[\s\S]*без активной передачи данных[\s\S]*Считать работу активной при скорости от/);
assert.match(feature, /Когда переключать канал[\s\S]*сначала подтверждает сбой[\s\S]*Защита от частых переключений[\s\S]*остаётся на резервном/);
assert.match(feature, /Проверять каналы каждые[\s\S]*Считать основной неработающим, если он не отвечает[\s\S]*Вернуться на основной после/);
assert.match(feature, /Дождаться паузы в передаче данных[\s\S]*Переключить после[\s\S]*без передачи данных[\s\S]*Считать передачу активной при скорости выше/);
assert.match(feature, /Когда включать резервный[\s\S]*основной не отвечает, а резервный работает[\s\S]*Если основной снова не работает[\s\S]*дольше использует резервный канал/);
assert.match(feature, /client-failover-number-input[\s\S]*Math\.max\(2, String\(value\)\.length \+ 0\.6\)/);
assert.match(feature, /client-failover-number-steps[\s\S]*уменьшить на[\s\S]*увеличить на/);
assert.match(feature, /client-failover-number-control[\s\S]*client-failover-number-input[\s\S]*client-failover-number-steps[\s\S]*уменьшить на \$\{step\}[\s\S]*><\/button>[\s\S]*увеличить на \$\{step\}[\s\S]*>\+<\/button>/);
assert.match(feature, /before="Ждать ответ не дольше"[\s\S]*step=\{1\}/);
assert.doesNotMatch(feature, /advancedOpen|advancedClosing|toggleAdvanced|aria-controls="client-failover-advanced-options"/);
assert.match(feature, /label="Добавить проверку"/);
@@ -45,7 +45,7 @@ test('failover settings use Harbor switches, a two-column channel table and plai
assert.doesNotMatch(feature, /<details|<summary|Нет данных|текущий канал вне настроенной пары/);
assert.doesNotMatch(page, /Текущий канал вне резервной пары/);
assert.match(page, /Резерв применится после перезапуска VPN/);
assert.match(feature, /Приостановить автоматику[\s\S]*Проверить основной и резервный[\s\S]*Переключить новые соединения на/);
assert.match(feature, /Приостановить автоматику[\s\S]*Проверить оба канала[\s\S]*Направить новые подключения через/);
assert.match(feature, /beforeunload/);
assert.match(styles, /\.client-failover-switch\[aria-checked='true'\][\s\S]*translateX\(22px\)/);
assert.match(styles, /\.client-failover-heading \{[^}]*justify-content:\s*space-between[^}]*}/);
@@ -55,18 +55,21 @@ test('failover settings use Harbor switches, a two-column channel table and plai
assert.match(styles, /\.client-failover-picker-list[\s\S]*opacity:\s*0[\s\S]*\.client-failover-picker\.is-open[\s\S]*opacity:\s*1/);
assert.match(styles, /failover-service-out 300ms[\s\S]*@media \(prefers-reduced-motion: reduce\)/);
assert.match(styles, /\.client-failover-number-setting \{[^}]*display:\s*flex[^}]*flex-wrap:\s*wrap/);
assert.match(styles, /\.client-failover-number-control \{[^}]*position:\s*relative[^}]*min-width:\s*44px[^}]*padding-bottom:\s*18px/);
assert.match(styles, /\.client-failover-number-setting input \{[^}]*border:\s*0[^}]*text-align:\s*center[^}]*appearance:\s*textfield/);
assert.match(styles, /input::\-webkit-inner-spin-button[\s\S]*input::\-webkit-outer-spin-button[^}]*\-webkit-appearance:\s*none/);
assert.match(styles, /\.client-failover-number-steps \{[^}]*display:\s*inline-flex/);
assert.match(styles, /\.client-failover-number-steps \{[^}]*position:\s*absolute[^}]*opacity:\s*0[^}]*pointer-events:\s*none/);
assert.match(styles, /\.client-failover-number-control:hover \.client-failover-number-steps,[^}]*:focus-within[^}]*opacity:\s*1[^}]*pointer-events:\s*auto/);
assert.match(styles, /\.client-failover-timing \{[^}]*gap:\s*0[^}]*\}[\s\S]*\.client-failover-protection-options \{[^}]*gap:\s*0/);
assert.doesNotMatch(styles, /client-failover-advanced|failover-advanced-in|failover-advanced-out/);
});
test('runtime status keeps fixed geometry and explains active traffic without motion dependence', () => {
assert.match(feature, /Ждём завершения активной работы/);
assert.match(feature, /Активный трафик ·[\s\S]*transmittingConnections/);
assert.match(feature, /Ждём паузу в передаче данных/);
assert.match(feature, /Идёт передача данных ·[\s\S]*transmittingConnections/);
assert.match(feature, /activity\?\.blockers\.slice\(0, 2\)\.map/);
assert.match(feature, /Ещё \{activity\.blockers\.length - 2\}/);
assert.match(feature, /Нестабилен ·[\s\S]*Следующее решение не раньше чем через/);
assert.match(feature, /Проверяем сбой ·[\s\S]*Следующее решение не раньше чем через/);
assert.match(feature, /switchRole && snapshot\.enabled && snapshot\.activation === 'active'/);
assert.match(styles, /\.client-failover-runtime \{[^}]*min-height:\s*132px/);
assert.match(styles, /@media \(prefers-reduced-motion: reduce\)[\s\S]*transition:\s*none/);
+14 -14
View File
@@ -39,26 +39,26 @@ const expectedImports = [
const sha256 = (value) => crypto.createHash('sha256').update(value).digest('hex');
const acceptedLedger = {
counts: {
cascadeEdges: 1017,
cascadeEdges: 1022,
customProperties: 106,
declarations: 4079,
declarations: 4100,
important: 0,
keyframes: 50,
media: 17,
rules: 1103,
variableReferences: 1041,
rules: 1106,
variableReferences: 1040,
},
hashes: {
cascadeEdges: 'baefd0b3605b82e516a6b4f76b047a8ec2f4a2e0a96d4cf77dec266f9c601e54',
cascadeEdges: '2ebf5dd14c4a1ae91a4ac550dc5cd5a1796c4a350a74d70b816e6c8cc2bb1298',
customProperties: 'fd6f16069f9fe3526f09d4d574431ddae67150d8e7a8a40e04c9fd2d179ec7ac',
declarations: 'bc841497c24f42e41ba053ac1c6bebd556596031402f0b1709e5bef3dd179358',
declarations: '144956358828e941f82aad0081344417432f00c3908e14ea30579cda3a67a172',
duplicateKeyframes: '4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945',
duplicateSelectors: '8982145dba05b33bf1c93b2d54cfbe76305b276ff3c657aa020144016ada5848',
keyframes: 'af4b9ae18d070fd2462a9b050293f3821bf5017c6e7cc53bbe18dc826f0fe3b9',
ruleDeclarationSequences: 'b1498de2ccc1305f4df4e8a916ea9eacefde930408196fb8a037ea4e8e36fc01',
selectors: 'c1ed45252baf6856f1179b8459cdbc44754bdb412b7738e62df13d2364aa202d',
variableReferences: '41d6e2fdb0e0261bb003ce09b24cbeac54bd75874a4e94864386b6e72987bb22',
witnesses: '835e479222ea1447f21dc95be3d7e1b03c0225e1aa536ad0ab262f60cbd5e13c',
ruleDeclarationSequences: '42bfa78f2f515fa082c36ea606825a617b98c3f8285f940d01fb3bade2a22c1c',
selectors: '24384f274822bfebbe8139f8f32f6986956055d716db493260d4157b38a2f647',
variableReferences: '60e91eac692feccb870fba6b1fc7ed87b918a9d95711ab90cca7e69d5c742875',
witnesses: 'ff6fe62b26aaae6c9171e176b9fd6176e13df145ce30998d83d52d696bb0ad8c',
},
};
@@ -211,7 +211,7 @@ test('client typography uses the shared semantic scale outside the token owner',
test('accepted stylesheet has pinned declaration, selector, keyframe, variable, and cascade ledgers', () => {
const witnesses = readStyleWitnesses(root);
assert.equal(witnesses.length, 1080);
assert.equal(witnesses.length, 1090);
assert.equal(witnesses.filter((witness) => witness.unknown || witness.ancestorUnknown).length, 0);
const ledger = createStyleLedger(readStyleSource(root), { witnesses });
assert.deepEqual(ledger.counts, acceptedLedger.counts);
@@ -408,8 +408,8 @@ test('main owns one public stylesheet and the regrouped production CSS is determ
assert.equal((main.match(/import ['"][^'"]+\.css['"]/g) || []).length, 1);
const assets = fs.readdirSync(path.join(root, 'dist/assets')).filter((file) => file.endsWith('.css'));
assert.deepEqual(assets, ['index-DsxsLlC8.css']);
assert.deepEqual(assets, ['index-CFcqdOjW.css']);
const built = fs.readFileSync(path.join(root, 'dist/assets', assets[0]));
assert.equal(built.byteLength, 154992);
assert.equal(sha256(built), '8e1947e4aa98297130ba9e5f097b8341ecdd89a80faaade55abf907b2796823b');
assert.equal(built.byteLength, 155571);
assert.equal(sha256(built), '5d6d6b76c699ebe17b2487b532b35703ce427051578c3aa86672d2f1fd2edd98');
});