|
@@ -5499,8 +5499,10 @@ async function loadRoutes() {
|
|
|
|
|
|
|
|
const bRoutes = document.getElementById('routes-badge-routes');
|
|
const bRoutes = document.getElementById('routes-badge-routes');
|
|
|
if (bRoutes) bRoutes.innerText = (state.routes || []).length;
|
|
if (bRoutes) bRoutes.innerText = (state.routes || []).length;
|
|
|
|
|
+ const showSystem = document.getElementById('prule-show-system')?.checked;
|
|
|
|
|
+ const userRules = (state.policyRules || []).filter(pr => showSystem || (!pr.is_default && !pr.is_system));
|
|
|
const bRules = document.getElementById('routes-badge-rules');
|
|
const bRules = document.getElementById('routes-badge-rules');
|
|
|
- if (bRules) bRules.innerText = (state.policyRules || []).length;
|
|
|
|
|
|
|
+ if (bRules) bRules.innerText = userRules.length;
|
|
|
const bTables = document.getElementById('routes-badge-tables');
|
|
const bTables = document.getElementById('routes-badge-tables');
|
|
|
if (bTables) bTables.innerText = (state.routingTables || []).length;
|
|
if (bTables) bTables.innerText = (state.routingTables || []).length;
|
|
|
const bRoutesCount = document.getElementById('badge-routes-count');
|
|
const bRoutesCount = document.getElementById('badge-routes-count');
|
|
@@ -5794,18 +5796,24 @@ function renderPolicyRules() {
|
|
|
if (!tbody) return;
|
|
if (!tbody) return;
|
|
|
tbody.innerHTML = '';
|
|
tbody.innerHTML = '';
|
|
|
|
|
|
|
|
- const rules = state.policyRules || [];
|
|
|
|
|
- document.getElementById('rules-count-badge').innerText = `${rules.length} Rules`;
|
|
|
|
|
|
|
+ const showSystem = document.getElementById('prule-show-system')?.checked;
|
|
|
|
|
+ const filtered = (state.policyRules || []).filter(pr => showSystem || (!pr.is_default && !pr.is_system));
|
|
|
|
|
|
|
|
- if (rules.length === 0) {
|
|
|
|
|
|
|
+ const countBadge = document.getElementById('rules-count-badge');
|
|
|
|
|
+ if (countBadge) countBadge.innerText = `${filtered.length} Rules`;
|
|
|
|
|
+ const bRules = document.getElementById('routes-badge-rules');
|
|
|
|
|
+ if (bRules) bRules.innerText = filtered.length;
|
|
|
|
|
+
|
|
|
|
|
+ if (filtered.length === 0) {
|
|
|
empty?.classList.remove('hidden');
|
|
empty?.classList.remove('hidden');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
empty?.classList.add('hidden');
|
|
empty?.classList.add('hidden');
|
|
|
|
|
|
|
|
- rules.forEach(pr => {
|
|
|
|
|
|
|
+ filtered.forEach(pr => {
|
|
|
|
|
+ const isSys = pr.is_default || pr.is_system;
|
|
|
const tr = document.createElement('tr');
|
|
const tr = document.createElement('tr');
|
|
|
- tr.className = 'hover:bg-slate-800/40 transition text-xs';
|
|
|
|
|
|
|
+ tr.className = `hover:bg-slate-800/40 transition text-xs ${isSys ? 'opacity-70 bg-slate-950/20' : ''}`;
|
|
|
tr.innerHTML = `
|
|
tr.innerHTML = `
|
|
|
<td class="py-2.5 px-3 font-mono text-cyan-400 font-bold">${pr.priority}</td>
|
|
<td class="py-2.5 px-3 font-mono text-cyan-400 font-bold">${pr.priority}</td>
|
|
|
<td class="py-2.5 px-3 font-mono text-white">${pr.src_address || '<span class="text-slate-600">all</span>'}</td>
|
|
<td class="py-2.5 px-3 font-mono text-white">${pr.src_address || '<span class="text-slate-600">all</span>'}</td>
|
|
@@ -5814,7 +5822,7 @@ function renderPolicyRules() {
|
|
|
<td class="py-2.5 px-3 font-mono font-bold text-amber-300">${pr.table}</td>
|
|
<td class="py-2.5 px-3 font-mono font-bold text-amber-300">${pr.table}</td>
|
|
|
<td class="py-2.5 px-3 font-mono text-slate-300">${pr.action}</td>
|
|
<td class="py-2.5 px-3 font-mono text-slate-300">${pr.action}</td>
|
|
|
<td class="py-2.5 px-3 text-right font-sans">
|
|
<td class="py-2.5 px-3 text-right font-sans">
|
|
|
- ${pr.priority < 32766 && pr.priority > 0 ? `
|
|
|
|
|
|
|
+ ${!pr.is_default ? `
|
|
|
<button onclick="deletePolicyRule('${pr.id}')" class="text-xs text-slate-500 hover:text-rose-400">Delete</button>
|
|
<button onclick="deletePolicyRule('${pr.id}')" class="text-xs text-slate-500 hover:text-rose-400">Delete</button>
|
|
|
` : `<span class="text-slate-600 text-[10px]">Default</span>`}
|
|
` : `<span class="text-slate-600 text-[10px]">Default</span>`}
|
|
|
</td>
|
|
</td>
|
|
@@ -5824,7 +5832,8 @@ function renderPolicyRules() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function openAddPolicyRuleModal() {
|
|
function openAddPolicyRuleModal() {
|
|
|
- document.getElementById('prule-modal-pref').value = (state.policyRules || []).length * 10 + 1000;
|
|
|
|
|
|
|
+ const userRules = (state.policyRules || []).filter(pr => !pr.is_default && !pr.is_system);
|
|
|
|
|
+ document.getElementById('prule-modal-pref').value = userRules.length * 10 + 1000;
|
|
|
document.getElementById('prule-modal-mark').value = '';
|
|
document.getElementById('prule-modal-mark').value = '';
|
|
|
document.getElementById('prule-modal-src').value = '';
|
|
document.getElementById('prule-modal-src').value = '';
|
|
|
document.getElementById('prule-modal-dst').value = '';
|
|
document.getElementById('prule-modal-dst').value = '';
|