feat(network-config-manager): add function to identify unknown OSPF interface names and display active status in templates
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m54s

This commit is contained in:
2026-03-05 16:26:01 +07:00
parent 5d66f04286
commit 114d7b2731
+16 -1
View File
@@ -127,6 +127,14 @@ const GATEWAY_TEMPLATES = [
const OSPF_COST_STEP = 10;
function isUnknownOspfInterfaceName(name) {
const value = String(name || '').trim();
if (!value) return true;
if (value.startsWith('*')) return true; // служебные ссылки RouterOS вида *50
if (value.toLowerCase() === 'unknown') return true;
return false;
}
function buildOspfTemplatesFromRouterResults(routerResults = [], servers = []) {
const serverById = new Map((servers || []).map((s) => [String(s.id || s.ip || s.dns || ''), s]));
const byComposite = new Map();
@@ -144,10 +152,10 @@ function buildOspfTemplatesFromRouterResults(routerResults = [], servers = []) {
templates.forEach((tpl) => {
const interfaceName = String(tpl?.interfaceName || '').trim();
if (isUnknownOspfInterfaceName(interfaceName)) return;
const area = String(tpl?.area || '').trim() || 'backbone';
const numericCost = Number(tpl?.cost);
const cost = Number.isFinite(numericCost) && numericCost >= 0 ? numericCost : OSPF_COST_STEP;
if (!interfaceName) return;
const compositeKey = `${identity.key}::${area.toLowerCase()}::${interfaceName.toUpperCase()}`;
if (byComposite.has(compositeKey)) return;
@@ -161,6 +169,7 @@ function buildOspfTemplatesFromRouterResults(routerResults = [], servers = []) {
interfaceName,
area,
cost,
active: !Boolean(tpl?.disabled),
});
});
});
@@ -4006,6 +4015,12 @@ function NetworkConfigManager() {
<div className="d-flex align-items-center gap-2">
<span className="text-muted small">::</span>
<code>{template.interfaceName}</code>
<span
className={`badge ${template.active ? 'bg-green-lt text-green' : 'bg-secondary-lt text-secondary'}`}
title={template.active ? 'Интерфейс активен в OSPF template' : 'Интерфейс отключен в OSPF template'}
>
{template.active ? 'Активен' : 'Неактивен'}
</span>
</div>
<span className="badge bg-primary-lt text-primary">
cost {template.cost}