Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions earthgrid-core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions earthgrid-core/assets/beacon.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ <h2>🛰️ Spatial Coverage</h2>
shape.on('click', () => showCoverageDetail(colId, cell));

shape.bindTooltip(
sensorLabel(colId) + (cell.tile_id ? ' · Tile ' + cell.tile_id : '') + '<br>' +
sensorLabel(colId) + (cell.tile_id ? ' · Tile ' + esc(cell.tile_id) : '') + '<br>' +
pct.toFixed(1) + '% of archive · ' + cell.date_count + ' dates',
{className:'', sticky:true}
);
Expand Down Expand Up @@ -306,7 +306,7 @@ <h2>🛰️ Spatial Coverage</h2>
for (const m of allMonths) {
const h = m.count > 0 ? Math.max(4, (m.count / maxCount) * 56) : 0;
const color = m.count > 0 ? covColor(m.count * 3) : 'var(--border)';
const qLabel = m.month + ' (Q' + (Math.ceil(parseInt(m.month.split('-')[1]) / 3)) + ')';
const qLabel = esc(m.month) + ' (Q' + (Math.ceil(parseInt(m.month.split('-')[1]) / 3)) + ')';
barsHtml += '<div class="bar" style="height:' + (h || 2) + 'px;background:' + color +
';opacity:' + (m.count > 0 ? '0.8' : '0.2') + '" title="' + qLabel + ': ' + m.count + ' acquisitions"></div>';
}
Expand All @@ -331,7 +331,7 @@ <h2>🛰️ Spatial Coverage</h2>

const bands = cell.bands || [];
const bandsHtml = bands.length > 0
? bands.map(b => '<code style="margin:0 3px;font-size:0.8rem">' + b + '</code>').join('')
? bands.map(b => '<code style="margin:0 3px;font-size:0.8rem">' + esc(b) + '</code>').join('')
: '<em style="color:var(--dim)">unknown</em>';

// Compute bbox from polygon if needed
Expand All @@ -345,22 +345,22 @@ <h2>🛰️ Spatial Coverage</h2>
panel.innerHTML =
'<div style="display:flex;justify-content:space-between;align-items:start">' +
'<div><h3 style="margin:0 0 4px;font-size:1.1rem">' + sensorLabel(colId) +
(cell.tile_id ? ' · ' + cell.tile_id : '') + '</h3>' +
(cell.tile_id ? ' · ' + esc(cell.tile_id) : '') + '</h3>' +
'<div style="font-size:0.8rem;color:var(--dim)">' +
coordsInfo.map(v => v.toFixed(1) + '°').join(', ') + '</div></div>' +
'<button onclick="document.getElementById(\'coverageDetail\').style.display=\'none\'" ' +
'style="background:none;border:none;color:var(--dim);font-size:1.2rem;cursor:pointer">✕</button></div>' +
'<div style="display:flex;gap:2rem;margin:1rem 0;flex-wrap:wrap">' +
'<div><div style="font-size:1.8rem;font-weight:700;color:' + covColor(cell.date_count, colId) + '">' + pct.toFixed(1) + '%</div>' +
'<div style="font-size:0.8rem;color:var(--dim)">of archive</div></div>' +
(cell.tile_id ? '<div style="font-size:0.8rem;color:var(--muted);margin-bottom:4px">Tile: <strong>' + cell.tile_id + '</strong></div>' : '') +
(cell.tile_id ? '<div style="font-size:0.8rem;color:var(--muted);margin-bottom:4px">Tile: <strong>' + esc(cell.tile_id) + '</strong></div>' : '') +
'<div><div style="font-size:1.8rem;font-weight:700;color:var(--text)">' + cell.date_count + '</div>' +
'<div style="font-size:0.8rem;color:var(--dim)">dates</div></div>' +
'<div><div style="font-size:1.8rem;font-weight:700;color:var(--accent)">' + (cell.item_count || (cell.date_count * Math.max((cell.bands||[]).length, 1))) + '</div>' +
'<div style="font-size:0.8rem;color:var(--dim)">items (bands)</div></div>' +
'<div><div style="font-size:0.85rem;color:var(--text)">' + meta.start + '</div>' +
'<div style="font-size:0.8rem;color:var(--dim)">sensor start</div></div>' +
'<div><div style="font-size:0.85rem;color:var(--text)">' + lastDate + '</div>' +
'<div><div style="font-size:0.85rem;color:var(--text)">' + esc(lastDate) + '</div>' +
'<div style="font-size:0.8rem;color:var(--dim)">last ingested</div></div></div>' +
'<div style="font-size:0.85rem;margin-bottom:6px"><strong>Temporal Coverage</strong></div>' +
barsHtml +
Expand Down
24 changes: 14 additions & 10 deletions earthgrid-core/assets/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@
return r.json();
}

function safeHref(u) { return /^https?:\/\//i.test(String(u)) ? esc(u) : '#'; }

function esc(s) { return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;'); }

function setHtml(id, html) {
const el = document.getElementById(id);
if (el) el.innerHTML = html;
Expand Down Expand Up @@ -667,7 +671,7 @@
html = `
<div class="status-row" style="margin-bottom:10px">
<div class="dot green"></div>
<span>Beacon: <a href="${info.beacon_url}" target="_blank" style="color:var(--accent)">${info.beacon_url}</a></span>
<span>Beacon: <a href="${safeHref(info.beacon_url)}" target="_blank" style="color:var(--accent)">${esc(info.beacon_url)}</a></span>
</div>`;
} else {
html = `
Expand Down Expand Up @@ -1163,17 +1167,17 @@
const sc = statusColor(j.status);
html += '<tr style="border-bottom:1px solid #1f2937">';
html += '<td style="padding:3px 6px;font-weight:600">#' + j.id + '</td>';
html += '<td style="padding:3px 6px;font-family:monospace;font-size:11px">' + j.collection + '</td>';
html += '<td style="padding:3px 6px;font-size:11px;color:var(--muted)">' + j.bbox + '</td>';
html += '<td style="padding:3px 6px"><span style="color:' + sc + '">' + j.status + '</span></td>';
html += '<td style="padding:3px 6px;font-family:monospace;font-size:11px">' + esc(j.collection) + '</td>';
html += '<td style="padding:3px 6px;font-size:11px;color:var(--muted)">' + esc(j.bbox) + '</td>';
html += '<td style="padding:3px 6px"><span style="color:' + sc + '">' + esc(j.status) + '</span></td>';
html += '<td style="padding:3px 6px;min-width:120px">';
if (j.status === 'running' || j.status === 'completed') {
html += '<div style="background:var(--bg);border-radius:3px;height:4px;overflow:hidden;margin-bottom:2px">'
+ '<div style="background:' + sc + ';height:100%;width:' + Math.min(pct,100) + '%"></div></div>';
html += '<span style="font-size:10px;color:var(--muted)">' + j.progress_done + '/' + j.progress_total + '</span>';
if (j.stage) html += ' <span style="font-size:10px;color:var(--accent)">' + j.stage + '</span>';
if (j.stage) html += ' <span style="font-size:10px;color:var(--accent)">' + esc(j.stage) + '</span>';
} else if (j.error) {
html += '<span style="font-size:10px;color:var(--red)" title="' + j.error.replace(/"/g,"'") + '">' + j.error.substring(0,40) + (j.error.length > 40 ? '…' : '') + '</span>';
html += '<span style="font-size:10px;color:var(--red)" title="' + esc(j.error) + '">' + esc(j.error.substring(0,40)) + (j.error.length > 40 ? '…' : '') + '</span>';
} else {
html += '<span style="font-size:10px;color:var(--muted)">—</span>';
}
Expand Down Expand Up @@ -1306,8 +1310,8 @@
html += `<div class="node-card" style="${isMe ? 'border-color:var(--accent)' : ''}">
<div class="node-card-header">
<div>
<div class="node-name">${n.node_name || n.url || 'Unknown'} ${isMe ? '<span class="tag" style="font-size:10px">This node</span>' : ''}</div>
<div class="node-id">${n.node_id || '—'}</div>
<div class="node-name">${esc(n.node_name || n.url || 'Unknown')} ${isMe ? '<span class="tag" style="font-size:10px">This node</span>' : ''}</div>
<div class="node-id">${esc(n.node_id || '—')}</div>
</div>
<div style="display:flex;gap:6px;align-items:center;flex-shrink:0">
${isAlive ? '<span class="dot green"></span>' : '<span class="dot red"></span>'}
Expand All @@ -1318,10 +1322,10 @@
<div class="node-stat">Items: <span>${fmt_num(n.item_count)}</span></div>
<div class="node-stat">Chunks: <span>${fmt_num(n.chunk_count || n.chunks)}</span></div>
<div class="node-stat">Storage: <span>${fmt_bytes(n.chunks_bytes)}</span></div>
${n.url ? `<div class="node-stat">URL: <span><a href="${n.url}" target="_blank">${n.url}</a></span></div>` : ''}
${n.url ? `<div class="node-stat">URL: <span><a href="${safeHref(n.url)}" target="_blank">${esc(n.url)}</a></span></div>` : ''}
</div>
${collections.length ? `<div style="display:flex;gap:4px;flex-wrap:wrap">
${collections.map(c => `<span class="tag">${c}</span>`).join('')}
${collections.map(c => `<span class="tag">${esc(c)}</span>`).join('')}
${extraCols > 0 ? `<span class="tag">+${extraCols} more</span>` : ''}
</div>` : ''}
</div>`;
Expand Down
Loading