Improve server picker health state handling and bump Harbor versions
All checks were successful
Build and Deploy Gateway / build-and-push (push) Successful in 14s
Build and Deploy Gateway / deploy (push) Successful in 7s

This commit is contained in:
2026-07-12 15:31:41 +03:00
parent 0480e617cd
commit 9a539409f0
3 changed files with 21 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
export const HARBOR_VERSIONS = Object.freeze({
macClient: '0.7.19',
gatewayClient: '0.7.19',
macClient: '0.7.20',
gatewayClient: '0.7.20',
gatewayBackend: '0.7.1',
});

View File

@@ -36,11 +36,15 @@ function readAuto() {
}
}
function serverHealthText(ping) {
if (ping?.checking) return 'Проверяем TCP…';
if (ping?.error) return 'Проверка недоступна';
if (ping?.ok) return `TCP ${ping.latency} мс`;
return ping ? 'TCP недоступен' : 'Не проверен';
}
function ServerRow({ server, selected, favorite, ping, disabled, index, onSelect, onFavorite }) {
const health = ping?.checking
? 'Проверяем TCP…'
: ping?.error ? 'Проверка недоступна'
: ping?.ok ? `TCP ${ping.latency} мс` : ping ? 'TCP недоступен' : 'Не проверен';
const health = serverHealthText(ping);
return <div className={`client-server-row${selected ? ' is-selected' : ''}${onFavorite ? ' has-favorite' : ''}`}>
<button
@@ -212,6 +216,7 @@ export function ServerPicker({
key={server.id}
server={server}
selected={server.id === selectedServerId}
ping={pings[server.id]}
disabled={disabled}
index={index}
onSelect={select}
@@ -250,7 +255,7 @@ export function ServerPicker({
key={id}
onClick={() => setView(id)}
>{label}</button>)}
<button type="button" disabled={checking || !visible.length} onClick={checkVisible}>
<button type="button" disabled={checking || (!selectedServerId && !visible.length)} onClick={checkVisible}>
{checking ? 'Проверяем…' : 'Проверить TCP'}
</button>
</div>
@@ -265,7 +270,9 @@ export function ServerPicker({
onClick={() => select(autoServer(servers)?.id, true)}
>
<strong>Auto</strong>
<small>Первый стабильный сервер</small>
<small title={pings[selectedServerId]?.checkedAt || undefined}>
{autoActive ? serverHealthText(pings[selectedServerId]) : 'Первый стабильный сервер'}
</small>
</button>
{selected && !autoActive && <ServerRow
server={selected}

View File

@@ -48,6 +48,12 @@ test('server picker keeps health manual and the rendered result window bounded',
assert.match(picker, /aria-expanded={!isCollapsed}/);
});
test('manual health remains visible for Auto and simple rows', () => {
assert.match(picker, /autoActive \? serverHealthText\(pings\[selectedServerId\]\)/);
assert.match(picker, /disabled={checking \|\| \(!selectedServerId && !visible\.length\)}/);
assert.match(picker, /simpleServers\.map[\s\S]*?ping={pings\[server\.id\]}/);
});
test('server picker starts simple and reveals advanced controls on demand', () => {
assert.match(picker, /const \[advanced, setAdvanced\] = useState\(false\)/);
assert.match(picker, /aria-expanded={advanced}/);