Add initial server health check and update 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 18:49:45 +03:00
parent d551d41b71
commit 5874df2fce
4 changed files with 79 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState } from 'react';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { api } from '../api.js';
import {
autoServer,
@@ -89,6 +89,7 @@ export function ServerPicker({
const [collapsed, setCollapsed] = useState([]);
const [pings, setPings] = useState({});
const [checking, setChecking] = useState(false);
const initialCheckStarted = useRef(false);
const serverKey = servers.map(({ id }) => id).join('|');
useEffect(() => {
@@ -156,14 +157,26 @@ export function ServerPicker({
}
}
useEffect(() => {
if (initialCheckStarted.current || !servers.length) return;
initialCheckStarted.current = true;
checkVisible();
}, [serverKey]);
if (servers.length === 1) {
return <section className="client-servers" aria-label="Выберите сервер">
{prompt && <span className="client-server-prompt">Выберите сервер</span>}
<div className="client-server-toolbar is-single">
<button className="client-server-check" type="button" disabled={checking} onClick={checkVisible}>
{checking ? 'Проверяем…' : 'Проверить TCP'}
</button>
</div>
<div className="client-server-grid">
<ServerRow
server={servers[0]}
selected={servers[0].id === selectedServerId}
favorite={false}
ping={pings[servers[0].id]}
disabled={disabled}
index={0}
onSelect={onSelect}
@@ -193,16 +206,21 @@ export function ServerPicker({
return <section className="client-servers is-scalable" aria-label="Выберите сервер">
{prompt && <span className="client-server-prompt">Выберите сервер</span>}
<button
className={`client-server-mode-toggle${advanced ? ' is-open' : ''}`}
type="button"
aria-expanded={advanced}
aria-label={advanced ? 'Скрыть поиск и фильтры' : 'Показать поиск и фильтры'}
onClick={() => setAdvanced((current) => !current)}
>
<span>Поиск и фильтры</span>
<svg viewBox="0 0 12 8" aria-hidden="true"><path d="m1 1 5 5 5-5" /></svg>
</button>
<div className="client-server-toolbar">
<button
className={`client-server-mode-toggle${advanced ? ' is-open' : ''}`}
type="button"
aria-expanded={advanced}
aria-label={advanced ? 'Скрыть поиск и фильтры' : 'Показать поиск и фильтры'}
onClick={() => setAdvanced((current) => !current)}
>
<span>Поиск и фильтры</span>
<svg viewBox="0 0 12 8" aria-hidden="true"><path d="m1 1 5 5 5-5" /></svg>
</button>
<button className="client-server-check" type="button" disabled={checking || !servers.length} onClick={checkVisible}>
{checking ? 'Проверяем…' : 'Проверить TCP'}
</button>
</div>
<div className="client-server-mode-panels">
<div
@@ -256,9 +274,6 @@ export function ServerPicker({
key={id}
onClick={() => setView(id)}
>{label}</button>)}
<button type="button" disabled={checking || (!selectedServerId && !visible.length)} onClick={checkVisible}>
{checking ? 'Проверяем…' : 'Проверить TCP'}
</button>
</div>
</div>