feat(NetworkConfigManager, GatewayAutocompleteInput): add serverId handling for gateway filtering, enhancing configuration accuracy and user experience
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m2s

This commit is contained in:
2026-01-25 21:06:15 +07:00
parent d583757882
commit c7ebe0943b
2 changed files with 38 additions and 8 deletions
+10 -4
View File
@@ -583,6 +583,7 @@ function NetworkConfigManager() {
ip: ip,
description: gw.description || '',
country: gw.country || '',
serverId: templateServerId, // Сохраняем serverId для фильтрации
parentGateways: gw.parentGateways ? [...gw.parentGateways] : [],
};
});
@@ -595,11 +596,14 @@ function NetworkConfigManager() {
const updatedGateways = templateGateways.map((gw, index) => {
const originalTemplate = selectedTemplate.gateways[index];
// Обновляем serverId для всех gateways при изменении сервера
const updatedGateway = { ...gw, serverId: templateServerId };
// Для прямых gateways используем IP сервера
if (gw.type === 'direct' && templateServerId) {
const server = getServerInfo(templateServerId);
if (server && server.ip) {
return { ...gw, ip: server.ip };
return { ...updatedGateway, ip: server.ip };
}
}
// Для рекурсивных gateways генерируем из базового IP
@@ -614,14 +618,14 @@ function NetworkConfigManager() {
// Если IP пустой или последний октет совпадает с шаблоном, обновляем
if (!gw.ip || (currentIpParts.length === 4 && templateIpParts.length === 4 &&
currentIpParts[3] === templateIpParts[3])) {
return { ...gw, ip: templateIp };
return { ...updatedGateway, ip: templateIp };
}
}
}
return gw;
return updatedGateway;
});
// Обновляем только если есть изменения
const hasChanges = updatedGateways.some((gw, i) => gw.ip !== templateGateways[i]?.ip);
const hasChanges = updatedGateways.some((gw, i) => gw.ip !== templateGateways[i]?.ip || gw.serverId !== templateGateways[i]?.serverId);
if (hasChanges) {
setTemplateGateways(updatedGateways);
}
@@ -3886,6 +3890,7 @@ function NetworkConfigManager() {
}}
gateways={config.gateways}
interfaces={config.tunnelInterfaces}
serverId={editingGateway.serverId}
excludeGatewayId={editingGateway.id}
placeholder="Выберите родительский gateway или интерфейс..."
/>
@@ -5318,6 +5323,7 @@ function NetworkConfigManager() {
gateways={config.gateways}
interfaces={config.tunnelInterfaces}
templateGateways={templateGateways}
serverId={templateServerId}
excludeGatewayId={gw.id}
placeholder="Выберите родительский gateway или интерфейс..."
/>