update: remove flags

This commit is contained in:
nate 2026-03-19 16:06:05 +04:00
parent d89f5f45ee
commit 63b83e77dc
2 changed files with 10 additions and 16 deletions

View File

@ -117,10 +117,6 @@
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table class="w-full text-sm"> <table class="w-full text-sm">
<% <%
const regionFlag = {
'eu-central': '🇩🇪',
'us-west': '🇺🇸',
};
%> %>
<thead> <thead>
<tr class="text-gray-500 text-xs"> <tr class="text-gray-500 text-xs">
@ -139,7 +135,7 @@
<td class="px-4 py-2"><%~ c.up ? '<span class="text-green-400">Up</span>' : '<span class="text-red-400">Down</span>' %></td> <td class="px-4 py-2"><%~ c.up ? '<span class="text-green-400">Up</span>' : '<span class="text-red-400">Down</span>' %></td>
<td class="px-4 py-2 text-gray-300"><%= c.status_code != null ? c.status_code : '—' %></td> <td class="px-4 py-2 text-gray-300"><%= c.status_code != null ? c.status_code : '—' %></td>
<td class="px-4 py-2 text-gray-300"><%= c.latency_ms != null ? c.latency_ms + 'ms' : '—' %></td> <td class="px-4 py-2 text-gray-300"><%= c.latency_ms != null ? c.latency_ms + 'ms' : '—' %></td>
<td class="px-4 py-2 text-gray-500 text-sm" title="<%= c.region || '' %>"><%= c.region ? (regionFlag[c.region] || '🌐') + ' ' + c.region : '—' %></td> <td class="px-4 py-2 text-gray-500 text-sm"><%= c.region || '—' %></td>
<td class="px-4 py-2 text-gray-600 font-mono text-xs"><%= c.run_id || '—' %></td> <td class="px-4 py-2 text-gray-600 font-mono text-xs"><%= c.run_id || '—' %></td>
<td class="px-4 py-2 text-gray-500"><%~ it.timeAgoSSR(c.checked_at) %><% if (c.jitter_ms != null) { %> <span class="text-gray-600 text-xs">(+<%= c.jitter_ms %>ms)</span><% } %></td> <td class="px-4 py-2 text-gray-500"><%~ it.timeAgoSSR(c.checked_at) %><% if (c.jitter_ms != null) { %> <span class="text-gray-600 text-xs">(+<%= c.jitter_ms %>ms)</span><% } %></td>
<td class="px-4 py-2 text-red-400/70 text-xs truncate max-w-[200px]"><%= c.error ? c.error : '' %></td> <td class="px-4 py-2 text-red-400/70 text-xs truncate max-w-[200px]"><%= c.error ? c.error : '' %></td>
@ -200,9 +196,9 @@
'eu-central': '#3b82f6', 'eu-central': '#3b82f6',
'us-west': '#f59e0b', '__none__': '#6b7280' 'us-west': '#f59e0b', '__none__': '#6b7280'
}; };
const REGION_FLAGS = { const REGION_LABELS = {
'eu-central': '🇩🇪 EU Central', 'eu-central': 'EU Central',
'us-west': '🇺🇸 US West' 'us-west': 'US West'
}; };
const MAX_RUNS = 100; const MAX_RUNS = 100;
@ -360,7 +356,7 @@
if (regions.length > 1) { if (regions.length > 1) {
legendEl.innerHTML = regions.map(r => { legendEl.innerHTML = regions.map(r => {
const c = REGION_COLORS[r] || '#6b7280'; const c = REGION_COLORS[r] || '#6b7280';
const l = REGION_FLAGS[r] || r; const l = REGION_LABELS[r] || r;
return `<span class="flex items-center gap-1"><span style="background:${c}" class="inline-block w-2 h-2 rounded-full"></span>${l}</span>`; return `<span class="flex items-center gap-1"><span style="background:${c}" class="inline-block w-2 h-2 rounded-full"></span>${l}</span>`;
}).join(''); }).join('');
} else { } else {
@ -433,7 +429,7 @@
result.group.sort((a, b) => (a.ping.latency_ms || 0) - (b.ping.latency_ms || 0)); result.group.sort((a, b) => (a.ping.latency_ms || 0) - (b.ping.latency_ms || 0));
for (const pt of result.group) { for (const pt of result.group) {
const c = REGION_COLORS[pt.region] || '#6b7280'; const c = REGION_COLORS[pt.region] || '#6b7280';
const label = REGION_FLAGS[pt.region] || pt.region; const label = REGION_LABELS[pt.region] || pt.region;
const status = pt.ping.up ? '' : ' <span class="text-red-400">DOWN</span>'; const status = pt.ping.up ? '' : ' <span class="text-red-400">DOWN</span>';
html += `<div class="flex items-center justify-between gap-3"> html += `<div class="flex items-center justify-between gap-3">
<span class="flex items-center gap-1.5"><span style="background:${c}" class="inline-block w-1.5 h-1.5 rounded-full"></span>${label}</span> <span class="flex items-center gap-1.5"><span style="background:${c}" class="inline-block w-1.5 h-1.5 rounded-full"></span>${label}</span>
@ -510,11 +506,10 @@
if (regions.length > 0) { if (regions.length > 0) {
html += '<div class="mt-1.5 pt-1.5 border-t border-gray-700/50">'; html += '<div class="mt-1.5 pt-1.5 border-t border-gray-700/50">';
for (const r of regions) { for (const r of regions) {
const flag = {'eu-central':'🇩🇪','us-west':'🇺🇸'}[r.region] || '🌐'; const rLabel = {'eu-central':'EU Central','us-west':'US West'}[r.region] || r.region || 'unknown';
const rLabel = r.region || 'unknown';
const status = r.up ? '<span class="text-green-400">Up</span>' : '<span class="text-red-400">Down</span>'; const status = r.up ? '<span class="text-green-400">Up</span>' : '<span class="text-red-400">Down</span>';
const lat = r.latency_ms != null ? `<span class="text-gray-400 font-mono">${r.latency_ms}ms</span>` : ''; const lat = r.latency_ms != null ? `<span class="text-gray-400 font-mono">${r.latency_ms}ms</span>` : '';
html += `<div class="flex items-center justify-between gap-3"><span>${flag} ${rLabel}</span><span>${lat} ${status}</span></div>`; html += `<div class="flex items-center justify-between gap-3"><span>${rLabel}</span><span>${lat} ${status}</span></div>`;
} }
html += '</div>'; html += '</div>';
} }
@ -616,8 +611,7 @@
if (tbody) { if (tbody) {
const tr = document.createElement('tr'); const tr = document.createElement('tr');
tr.className = 'table-row-alt'; tr.className = 'table-row-alt';
const regionFlags = {'eu-central':'🇩🇪','us-west':'🇺🇸'}; const regionDisplay = ping.region || '—';
const regionDisplay = ping.region ? `${regionFlags[ping.region] || '🌐'} ${ping.region}` : '—';
tr.innerHTML = ` tr.innerHTML = `
<td class="px-4 py-2">${ping.up ? '<span class="text-green-400">Up</span>' : '<span class="text-red-400">Down</span>'}</td> <td class="px-4 py-2">${ping.up ? '<span class="text-green-400">Up</span>' : '<span class="text-red-400">Down</span>'}</td>
<td class="px-4 py-2 text-gray-300">${ping.status_code ?? '—'}</td> <td class="px-4 py-2 text-gray-300">${ping.status_code ?? '—'}</td>

View File

@ -12,7 +12,7 @@
const allIntervals = [['2','2 seconds'],['5','5 seconds'],['10','10 seconds'],['20','20 seconds'],['30','30 seconds'],['60','1 minute'],['300','5 minutes'],['600','10 minutes'],['1800','30 minutes'],['3600','1 hour']]; const allIntervals = [['2','2 seconds'],['5','5 seconds'],['10','10 seconds'],['20','20 seconds'],['30','30 seconds'],['60','1 minute'],['300','5 minutes'],['600','10 minutes'],['1800','30 minutes'],['3600','1 hour']];
const intervals = allIntervals.filter(([val]) => Number(val) >= minInterval); const intervals = allIntervals.filter(([val]) => Number(val) >= minInterval);
const timeouts = [['5000','5 seconds'],['10000','10 seconds'],['20000','20 seconds'],['30000','30 seconds'],['40000','40 seconds'],['50000','50 seconds'],['60000','60 seconds']]; const timeouts = [['5000','5 seconds'],['10000','10 seconds'],['20000','20 seconds'],['30000','30 seconds'],['40000','40 seconds'],['50000','50 seconds'],['60000','60 seconds']];
const regions = [['eu-central','🇩🇪 EU Central'],['us-west','🇺🇸 US West']]; const regions = [['eu-central','EU Central'],['us-west','US West']];
const curMethod = monitor.method || 'GET'; const curMethod = monitor.method || 'GET';
const bodyHidden = ['GET','HEAD','OPTIONS'].includes(curMethod); const bodyHidden = ['GET','HEAD','OPTIONS'].includes(curMethod);
%> %>