From b79dced147bab8615e1b8675489e31034ddbc38a Mon Sep 17 00:00:00 2001 From: shats Date: Thu, 22 Jan 2026 14:43:43 +0700 Subject: [PATCH] refactor(NetworkConfigManager): improve layout and styling of gateway and interface cards; enhance indicator display and text formatting for better clarity --- frontend/src/NetworkConfigManager.jsx | 237 +++++++++++++++----------- 1 file changed, 142 insertions(+), 95 deletions(-) diff --git a/frontend/src/NetworkConfigManager.jsx b/frontend/src/NetworkConfigManager.jsx index ae4889e..4d675f1 100644 --- a/frontend/src/NetworkConfigManager.jsx +++ b/frontend/src/NetworkConfigManager.jsx @@ -24,7 +24,8 @@ import { IconCircleFilled, IconLayoutGrid, IconList, - IconCode + IconCode, + IconArrowsRightLeft } from '@tabler/icons-react'; /** @@ -922,72 +923,99 @@ function NetworkConfigManager() { ? getParentGateway(gateway.parentGatewayId) : null; - // Определяем тип индикатора + // Определяем тип индикатора (как в ServerCard) const indicatorType = gateway.type === 'recursive' ? 'EXIT' : 'JUMP'; const indicatorColor = gateway.type === 'recursive' ? 'red' : 'blue'; - const indicatorIcon = gateway.type === 'recursive' ? IconRouter : IconWorld; + const IndicatorIcon = gateway.type === 'recursive' ? IconArrowsRightLeft : IconRouter; - // Определяем отображаемый IP/домен для зеленого блока - const displayIp = parentGateway - ? (parentGateway.parentType === 'interface' - ? (parentGateway.name || parentGateway.interfaceType || 'interface') - : parentGateway.ip) - : gateway.ip; + // Формируем текст для зеленого блока + let displayText = ''; + if (gateway.type === 'direct') { + // Для прямого gateway: 0.0.0.0/0 -> IP адрес + displayText = gateway.ip ? `0.0.0.0/0 → ${gateway.ip}` : ''; + } else if (gateway.type === 'recursive' && parentGateway) { + // Для рекурсивного: IP адрес -> IP адрес родительского gateway + const parentIp = parentGateway.parentType === 'interface' + ? parentGateway.remoteIp + : parentGateway.ip; + displayText = gateway.ip && parentIp ? `${gateway.ip} → ${parentIp}` : ''; + } return ( -
-
-
- {/* Индикатор типа */} -
-
- {indicatorType === 'EXIT' ? ( - - ) : ( - - )} +
+
+
+ {/* Левая часть: тип индикатора (как в ServerCard) */} +
+
+
+ +
+
+ {indicatorType} +
- {indicatorType}
- {/* Флаг и название */} -
- {displayCountry && ( - {countryToFlag(displayCountry)} - )} -
-
{gateway.description || provider || gateway.ip || '—'}
+ {/* Центральная часть: информация */} +
+ {/* Верхняя строка: флаг, название, провайдер */} +
+
+ {displayCountry && ( + {countryToFlag(displayCountry)} + )} +
+ {gateway.description || provider || gateway.ip || '—'} + {provider && ( + <> + + {provider} + + )} +
+
+ + {/* Зеленый блок с маршрутом */} + {displayText && ( + + {displayText} + + )} +
+ + {/* Нижняя строка: DNS + badges */} +
{server && ( -
{server.dns || server.ip || gateway.serverId}
+ + {server.dns || server.ip || gateway.serverId} + + )} + + {gatewayType.label} + + {gateway.ip && ( + )}
- {/* Теги */} -
- - {gatewayType.label} - -
- - {/* Зеленый блок с IP/доменом */} - {displayIp && ( -
- - {displayIp} - -
- )} - - {/* Кнопки действий */} -
+ {/* Правая часть: действия */} +
)}
- {/* Теги */} -
- - {iface.type} - -
- - {/* Зеленый блок с IP/доменом */} - {displayIp && displayIp !== '—' && ( -
- - {displayIp} - -
- )} - - {/* Кнопки действий */} -
+ {/* Правая часть: действия */} +