ADD: remove architecture , fix sites
This commit is contained in:
@@ -75,6 +75,9 @@
|
||||
.site-url-link:hover { text-decoration: underline; }
|
||||
.domain-set { color: var(--green); }
|
||||
.domain-unset { color: var(--text3); font-style: italic; }
|
||||
.ssl-set { color: var(--green); }
|
||||
.ssl-unset { color: var(--yellow); }
|
||||
.health-slot { min-width: 88px; min-height: 26px; display: flex; align-items: center; justify-content: flex-end; }
|
||||
.health-pill {
|
||||
display: inline-flex; align-items: center; gap: 6px;
|
||||
padding: 4px 10px; border-radius: 20px;
|
||||
@@ -125,6 +128,14 @@
|
||||
<div>
|
||||
<div style="font-size:13px;font-weight:600;">This platform</div>
|
||||
<a class="site-url-link" href="{{ platform_url }}" target="_blank" rel="noopener">{{ platform_url }}</a>
|
||||
<div style="font-size:11px;margin-top:4px;">
|
||||
<span class="site-row-label" style="min-width:auto;margin-right:6px;">SSL</span>
|
||||
{% if platform_ssl %}
|
||||
<span class="ssl-set"><i class="fas fa-lock"></i> Configured</span>
|
||||
{% else %}
|
||||
<span class="ssl-unset"><i class="fas fa-lock-open"></i> Not configured</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-ghost btn-sm" href="{{ platform_url }}" target="_blank" rel="noopener">
|
||||
@@ -179,17 +190,22 @@ function esc(s) {
|
||||
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
||||
}
|
||||
|
||||
function healthPill(health, containerRunning) {
|
||||
if (!health) {
|
||||
return containerRunning
|
||||
? '<span class="health-pill checking"><span class="dot"></span>Unchecked</span>'
|
||||
: '<span class="health-pill offline"><span class="dot"></span>Offline</span>';
|
||||
}
|
||||
function healthPill(health) {
|
||||
if (!health) return '';
|
||||
const st = health.status || 'down';
|
||||
const labels = { up: 'Active', down: 'Unreachable', offline: 'Offline', checking: 'Checking…' };
|
||||
if (st === 'checking') {
|
||||
return '<span class="health-pill checking"><span class="dot"></span>Checking…</span>';
|
||||
}
|
||||
const labels = { up: 'Healthy', down: 'Unhealthy', offline: 'Offline' };
|
||||
const extra = health.latency_ms != null ? ` · ${health.latency_ms}ms` : '';
|
||||
const code = health.http_code ? ` · HTTP ${health.http_code}` : '';
|
||||
return `<span class="health-pill ${st}"><span class="dot"></span>${labels[st] || st}${extra}${code}</span>`;
|
||||
return `<span class="health-pill ${st === 'up' ? 'up' : (st === 'offline' ? 'offline' : 'down')}"><span class="dot"></span>${labels[st] || st}${extra}${code}</span>`;
|
||||
}
|
||||
|
||||
function sslHtml(configured) {
|
||||
return configured
|
||||
? '<span class="ssl-set"><i class="fas fa-lock"></i> Configured</span>'
|
||||
: '<span class="ssl-unset"><i class="fas fa-lock-open"></i> Not configured</span>';
|
||||
}
|
||||
|
||||
function renderSiteCard(site) {
|
||||
@@ -209,13 +225,17 @@ function renderSiteCard(site) {
|
||||
<h3>${esc(site.name)} <span class="site-category">${esc(site.category)}</span></h3>
|
||||
<p class="site-tagline">${esc(site.tagline)}</p>
|
||||
</div>
|
||||
<div id="health-${esc(site.id)}">${healthPill(site.health, site.container_running)}</div>
|
||||
<div class="health-slot" id="health-${esc(site.id)}">${healthPill(site.health)}</div>
|
||||
</div>
|
||||
<div class="site-card-body">
|
||||
<div class="site-row">
|
||||
<span class="site-row-label">DOMAIN</span>
|
||||
<span class="site-row-value">${domainHtml}</span>
|
||||
</div>
|
||||
<div class="site-row">
|
||||
<span class="site-row-label">SSL</span>
|
||||
<span class="site-row-value">${sslHtml(site.ssl_configured)}</span>
|
||||
</div>
|
||||
<div class="site-row">
|
||||
<span class="site-row-label">URL</span>
|
||||
<span class="site-row-value">
|
||||
@@ -254,10 +274,11 @@ function renderSiteCard(site) {
|
||||
}
|
||||
|
||||
function updateSummary(sites) {
|
||||
const up = sites.filter(s => s.health && s.health.status === 'up').length;
|
||||
const checked = sites.filter(s => s.health && s.health.status !== 'checking');
|
||||
const up = checked.filter(s => s.health.status === 'up').length;
|
||||
const running = sites.reduce((n, s) => n + (s.containers_running || 0), 0);
|
||||
const domains = sites.filter(s => s.has_domain).length;
|
||||
document.getElementById('ss-up').textContent = up;
|
||||
document.getElementById('ss-up').textContent = checked.length ? up : '—';
|
||||
document.getElementById('ss-running').textContent = running;
|
||||
document.getElementById('ss-domains').textContent = domains;
|
||||
}
|
||||
@@ -283,16 +304,17 @@ async function loadSites(withHealth = false) {
|
||||
|
||||
async function pingSite(siteId) {
|
||||
const el = document.getElementById('health-' + siteId);
|
||||
if (el) el.innerHTML = healthPill({ status: 'checking' }, true);
|
||||
if (el) el.innerHTML = healthPill({ status: 'checking' });
|
||||
try {
|
||||
const res = await fetch('/api/sites/' + siteId + '/health');
|
||||
const health = await res.json();
|
||||
const site = sitesData.find(s => s.id === siteId);
|
||||
if (site) site.health = health;
|
||||
if (el) el.innerHTML = healthPill(health, site?.container_running);
|
||||
if (el) el.innerHTML = healthPill(health);
|
||||
updateSummary(sitesData);
|
||||
} catch (e) {
|
||||
if (el) el.innerHTML = healthPill({ status: 'down', error: String(e) }, true);
|
||||
if (el) el.innerHTML = healthPill({ status: 'down', error: String(e) });
|
||||
updateSummary(sitesData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,6 +343,7 @@ function openSiteDetails(siteId) {
|
||||
<div class="site-detail-item"><div class="lbl">PORT MAPPING</div><div class="val">${esc(site.port_mapping || site.port + '→' + site.internal_port)}</div></div>
|
||||
<div class="site-detail-item"><div class="lbl">ACCESS URL</div><div class="val"><a class="site-url-link" href="${esc(site.access_url)}" target="_blank">${esc(site.access_url)}</a></div></div>
|
||||
<div class="site-detail-item"><div class="lbl">DOMAIN</div><div class="val">${site.has_domain ? esc(site.domain) : '— (IP only)'}</div></div>
|
||||
<div class="site-detail-item"><div class="lbl">SSL</div><div class="val">${site.ssl_configured ? 'Configured' : 'Not configured'}</div></div>
|
||||
<div class="site-detail-item"><div class="lbl">IP FALLBACK</div><div class="val">${esc(site.ip_url)}</div></div>
|
||||
<div class="site-detail-item"><div class="lbl">HEALTH ENDPOINT</div><div class="val">${esc(site.health_url)}</div></div>
|
||||
</div>
|
||||
@@ -358,7 +381,7 @@ window.closeSiteModal = closeSiteModal;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
loadSites(true);
|
||||
setInterval(() => loadSites(false), 30000);
|
||||
setInterval(() => loadSites(true), 60000);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user