fix(ping): return ping data directly in JSON format for frontend compatibility
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m6s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m6s
This commit is contained in:
@@ -364,7 +364,9 @@ async function pingViaInterface(req, res) {
|
||||
? Number(String(summary['packet-loss']).replace('%', ''))
|
||||
: null;
|
||||
|
||||
return sendOk(res, {
|
||||
// ВАЖНО: возвращаем данные напрямую, без sendOk,
|
||||
// чтобы фронтенд (EasySwitch) мог читать поля avgMs/minMs/maxMs/loss
|
||||
return res.json({
|
||||
ok: true,
|
||||
avgMs,
|
||||
minMs,
|
||||
|
||||
@@ -214,6 +214,12 @@ function EasySwitchManager() {
|
||||
setServers(serversWithGateways);
|
||||
// Предзагружаем пинги для всех комбинаций server+gateway
|
||||
prefetchPings(serversWithGateways, inventory);
|
||||
|
||||
// Отладочная информация
|
||||
try {
|
||||
console.log('[EasySwitch] serversWithGateways:', serversWithGateways);
|
||||
console.log('[EasySwitch] communitiesDirectory:', communities);
|
||||
} catch (_) {}
|
||||
|
||||
// Автоматически разворачиваем первый сервер
|
||||
if (serversWithGateways.length > 0 && expandedServers.size === 0) {
|
||||
@@ -235,6 +241,10 @@ function EasySwitchManager() {
|
||||
});
|
||||
setActiveGateways(initialActive);
|
||||
setInitialGateways({ ...initialActive }); // Сохраняем исходное состояние
|
||||
|
||||
try {
|
||||
console.log('[EasySwitch] initialActiveGateways:', initialActive);
|
||||
} catch (_) {}
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error loading data:', err);
|
||||
@@ -299,6 +309,11 @@ function EasySwitchManager() {
|
||||
});
|
||||
return next;
|
||||
});
|
||||
|
||||
try {
|
||||
console.log('[EasySwitch] ping tasks count:', tasks.length);
|
||||
console.log('[EasySwitch] ping results sample:', results.slice(0, 10));
|
||||
} catch (_) {}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('prefetchPings error:', e?.message || e);
|
||||
|
||||
Reference in New Issue
Block a user