feat(NetworkConfigManager): normalize interface names and descriptions to uppercase for consistency; enhance data handling during interface creation and updates
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m39s

This commit is contained in:
2026-01-22 22:14:19 +07:00
parent ded2116b43
commit 0cfeaec417
+22 -14
View File
@@ -415,9 +415,10 @@ function NetworkConfigManager() {
return; return;
} }
// Очищаем пустые parentGateways и удаляем старое поле parentGatewayId // Преобразуем description в верхний регистр
const cleanedData = { const cleanedData = {
...gatewayData, ...gatewayData,
description: gatewayData.description ? gatewayData.description.toUpperCase() : '',
parentGateways: gatewayData.type === 'recursive' parentGateways: gatewayData.type === 'recursive'
? (gatewayData.parentGateways || []).filter(p => p && p.id) ? (gatewayData.parentGateways || []).filter(p => p && p.id)
: [], : [],
@@ -505,7 +506,7 @@ function NetworkConfigManager() {
} }
const prefixPart = prefix ? `${prefix}-` : ''; const prefixPart = prefix ? `${prefix}-` : '';
return `${prefixPart}${name}`; return `${prefixPart}${name}`.toUpperCase();
}; };
// === Создание интерфейса из шаблона === // === Создание интерфейса из шаблона ===
@@ -551,8 +552,8 @@ function NetworkConfigManager() {
// Генерируем имена интерфейсов // Генерируем имена интерфейсов
const baseName1 = generateInterfaceName(server1, server2, templateType, templateNamePrefix); const baseName1 = generateInterfaceName(server1, server2, templateType, templateNamePrefix);
const baseName2 = generateInterfaceName(server2, server1, templateType, templateNamePrefix); const baseName2 = generateInterfaceName(server2, server1, templateType, templateNamePrefix);
const name1 = pair.name1?.trim() || baseName1; const name1 = (pair.name1?.trim() || baseName1).toUpperCase();
const name2 = pair.name2?.trim() || baseName2; const name2 = (pair.name2?.trim() || baseName2).toUpperCase();
// Используем настройки из пары или глобальные // Используем настройки из пары или глобальные
const pairIpsecPasswordId = pair.ipsecPasswordId || templateIpsecPasswordId; const pairIpsecPasswordId = pair.ipsecPasswordId || templateIpsecPasswordId;
@@ -657,8 +658,8 @@ function NetworkConfigManager() {
} }
// Генерируем имена интерфейсов (используем опциональные имена если указаны) // Генерируем имена интерфейсов (используем опциональные имена если указаны)
const name1 = templateName1.trim() || generateInterfaceName(server1, server2, templateType, templateNamePrefix); const name1 = (templateName1.trim() || generateInterfaceName(server1, server2, templateType, templateNamePrefix)).toUpperCase();
const name2 = templateName2.trim() || generateInterfaceName(server2, server1, templateType, templateNamePrefix); const name2 = (templateName2.trim() || generateInterfaceName(server2, server1, templateType, templateNamePrefix)).toUpperCase();
// Генерируем IP адреса // Генерируем IP адреса
const localIp = generateFreePrivateIp(null, false, null, templateIpPoolId || null); const localIp = generateFreePrivateIp(null, false, null, templateIpPoolId || null);
@@ -1116,10 +1117,17 @@ function NetworkConfigManager() {
}, [ipRegistry, ipRegistrySearch]); }, [ipRegistry, ipRegistrySearch]);
const handleSaveInterface = (ifaceData) => { const handleSaveInterface = (ifaceData) => {
// Преобразуем имена интерфейсов в верхний регистр
const normalizedData = {
...ifaceData,
name: ifaceData.name ? ifaceData.name.toUpperCase() : '',
name2: ifaceData.name2 ? ifaceData.name2.toUpperCase() : '',
};
// Валидация: проверка пересечений IP адресов // Валидация: проверка пересечений IP адресов
const conflicts = checkInterfaceIpConflict( const conflicts = checkInterfaceIpConflict(
ifaceData, normalizedData,
interfaceModalMode === 'edit' ? ifaceData.id : null interfaceModalMode === 'edit' ? normalizedData.id : null
); );
if (conflicts.length > 0) { if (conflicts.length > 0) {
@@ -1134,13 +1142,13 @@ function NetworkConfigManager() {
if (interfaceModalMode === 'add') { if (interfaceModalMode === 'add') {
setConfig(prev => ({ setConfig(prev => ({
...prev, ...prev,
tunnelInterfaces: [...prev.tunnelInterfaces, ifaceData], tunnelInterfaces: [...prev.tunnelInterfaces, normalizedData],
})); }));
notify.success('Интерфейс добавлен'); notify.success('Интерфейс добавлен');
} else { } else {
setConfig(prev => ({ setConfig(prev => ({
...prev, ...prev,
tunnelInterfaces: prev.tunnelInterfaces.map(i => i.id === ifaceData.id ? ifaceData : i), tunnelInterfaces: prev.tunnelInterfaces.map(i => i.id === normalizedData.id ? normalizedData : i),
})); }));
notify.success('Интерфейс обновлён'); notify.success('Интерфейс обновлён');
} }
@@ -3643,8 +3651,8 @@ function NetworkConfigManager() {
const autoName1 = generateInterfaceName(server1, server2, templateType, templateNamePrefix); const autoName1 = generateInterfaceName(server1, server2, templateType, templateNamePrefix);
const autoName2 = generateInterfaceName(server2, server1, templateType, templateNamePrefix); const autoName2 = generateInterfaceName(server2, server1, templateType, templateNamePrefix);
const previewName1 = templateName1.trim() || autoName1; const previewName1 = (templateName1.trim() || autoName1).toUpperCase();
const previewName2 = templateName2.trim() || autoName2; const previewName2 = (templateName2.trim() || autoName2).toUpperCase();
const previewLocalIp = generateFreePrivateIp(null, false, null, templateIpPoolId || null); const previewLocalIp = generateFreePrivateIp(null, false, null, templateIpPoolId || null);
const previewRemoteIp = previewLocalIp ? generateFreePrivateIp(null, true, previewLocalIp, templateIpPoolId || null) : null; const previewRemoteIp = previewLocalIp ? generateFreePrivateIp(null, true, previewLocalIp, templateIpPoolId || null) : null;
@@ -3701,8 +3709,8 @@ function NetworkConfigManager() {
const baseName1 = generateInterfaceName(server1, server2, templateType, templateNamePrefix); const baseName1 = generateInterfaceName(server1, server2, templateType, templateNamePrefix);
const baseName2 = generateInterfaceName(server2, server1, templateType, templateNamePrefix); const baseName2 = generateInterfaceName(server2, server1, templateType, templateNamePrefix);
const previewName1 = pair.name1?.trim() || baseName1; const previewName1 = (pair.name1?.trim() || baseName1).toUpperCase();
const previewName2 = pair.name2?.trim() || baseName2; const previewName2 = (pair.name2?.trim() || baseName2).toUpperCase();
// Используем настройки из пары или глобальные для предпросмотра // Используем настройки из пары или глобальные для предпросмотра
const pairIpPoolId = pair.ipPoolId || templateIpPoolId; const pairIpPoolId = pair.ipPoolId || templateIpPoolId;