v0.38.5
This commit is contained in:
1 parent
963ec64398
commit
6fe2aa137b
18 files changed
+157
-88
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# RustProxy source and documentation maintenance
|
||||
|
||||
Current source version: **0.38.4**. The Cargo package and binary are named `rust-proxy`.
|
||||
Current source version: **0.38.5**. The Cargo package and binary are named `rust-proxy`.
|
||||
|
||||
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
|
||||
|
||||
|
||||
@@ -2,6 +2,15 @@
|
||||
|
||||
Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release.
|
||||
|
||||
## 0.38.5 — instant panel
|
||||
|
||||
Panel-only release: no configuration, API or proxy behavior changes. Measured on a replay of a production installation with 50 Docker apps (same data before and after): page elements 116 000 → 20 000, tab switches typically 110–310 ms → 12–50 ms, opening **Docker vhosts** about 1.6 s of blocked page → under 100 ms, work per live update 50–135 ms → 10–45 ms.
|
||||
|
||||
- **Docker vhosts render only what you look at:** a service's **Configure vhost** editor is built when it is first opened (or right before a change is saved), not for every service on every refresh; its summary line, search and quick actions use the stored settings until then. Service cards outside the viewport are not laid out, and traffic statistics are redrawn only for open sections on screen.
|
||||
- **Hidden panels stay idle:** live updates no longer rebuild the Overview backend tables, Overview history charts or the Settings forms while another panel is shown; they are brought up to date once when you return. The Overview layout is not re-measured while it is hidden.
|
||||
- **Faster formatting:** numbers, times, dates, chart axis labels and sorted lists reuse cached `Intl` formatters and collators instead of creating new ones for every value.
|
||||
- **Fix:** rebuilding the backend overview table no longer forces a page layout on every live update.
|
||||
|
||||
## 0.38.4 — on/off switches in the panel
|
||||
|
||||
- **Switches for on/off settings:** a setting that turns a feature or a whole section on or off is now a switch instead of a checkbox, with the same rule in every editor: **Enabled** of vhosts, backends, locations, streams, listeners, redirect and 404 hosts, cache rules and PHP profiles; per-host features (WebSockets, Force HTTPS, www redirect, HTTP/2, HTTP/3, keep-alive, client IP forwarding, Cloudflare client IP, diagnostic headers, passive health checks, Content-Type denylist, rate limit, HSTS, User-Agent blocking, cache, transformations, compression, PQC key exchange) in the vhost and Docker app editors alike; the "custom"/"inherit" overrides; and global features (ACL countries, cache and its subsystems, Varnish-compatible policy, Via header, transformations, logging outputs and captured fields, GeoIP, Prometheus, alerts, trusted X-Forwarded-Proto, admin TLS, Web Server directory listing, .htaccess, precompressed files, PHP and hardening, default certificate), plus live refresh, appearance and layout preferences.
|
||||
|
||||
Generated
+1
-1
@@ -1943,7 +1943,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust-proxy"
|
||||
version = "0.38.4"
|
||||
version = "0.38.5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rust-proxy"
|
||||
version = "0.38.4"
|
||||
version = "0.38.5"
|
||||
edition = "2021"
|
||||
rust-version = "1.99.1"
|
||||
description = "RustProxy - independent reverse proxy with local administration"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package main
|
||||
|
||||
var version = "0.38.4" // overridden by the package builder using -ldflags -X main.version
|
||||
var version = "0.38.5" // overridden by the package builder using -ldflags -X main.version
|
||||
|
||||
type config struct {
|
||||
Listen string
|
||||
|
||||
+1
-1
@@ -196,7 +196,7 @@ In a container, mount the file read-only (RustProxy never writes it) and keep `/
|
||||
`GET /healthz` on `--health-listen` answers `200` while every vhost with backends has at least one healthy backend and `503` otherwise:
|
||||
|
||||
```json
|
||||
{"status":"ok","mode":"headless","version":"0.38.4","revision":4,"uptime_seconds":120,
|
||||
{"status":"ok","mode":"headless","version":"0.38.5","revision":4,"uptime_seconds":120,
|
||||
"last_reload":{"ok":true,"at_unix":1794743660,"error":null},
|
||||
"vhosts_without_healthy_backends":[],
|
||||
"pools":[{"vhost":"app","healthy":3,"backends":3}]}
|
||||
|
||||
@@ -77,10 +77,10 @@ ENV_FILE=integrations/routeros-oci-build/.env \
|
||||
bash integrations/routeros-oci-build/build-routeros-oci.sh push
|
||||
```
|
||||
|
||||
For example, with RustProxy version `0.38.4` and the defaults this publishes:
|
||||
For example, with RustProxy version `0.38.5` and the defaults this publishes:
|
||||
|
||||
```text
|
||||
oci.example.net/network/rustproxy:0.38.4
|
||||
oci.example.net/network/rustproxy:0.38.5
|
||||
oci.example.net/network/rustproxy:latest
|
||||
oci.example.net/network/rustproxy:routeros
|
||||
```
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "RustProxy Administration API",
|
||||
"version": "0.38.4",
|
||||
"version": "0.38.5",
|
||||
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
|
||||
},
|
||||
"servers": [
|
||||
|
||||
@@ -38,8 +38,8 @@ window.rustProxyChartScale = (() => {
|
||||
function axisValue(value, unit) {
|
||||
if (value === 0) return "0";
|
||||
const n = Number(value);
|
||||
const format = v => v.toLocaleString(typeof locale === "function" ? locale() : undefined,
|
||||
{ maximumFractionDigits: v < 1 ? 3 : v < 10 ? 2 : 1 });
|
||||
const digits = v => v < 1 ? 3 : v < 10 ? 2 : 1;
|
||||
const format = v => typeof formatNumber === "function" ? formatNumber(v, digits(v)) : v.toLocaleString(undefined, { maximumFractionDigits: digits(v) });
|
||||
if (unit === "bytes" || unit === "bytes/s") {
|
||||
let magnitude = n, suffix = "B";
|
||||
for (const next of ["KiB", "MiB", "GiB", "TiB"]) {
|
||||
|
||||
@@ -29,7 +29,26 @@ let lastApiLatencyMs = null, sessionCheckPromise = null;
|
||||
let adminAuthChannel = null; try { adminAuthChannel = new BroadcastChannel("rustproxy-admin-session"); adminAuthChannel.addEventListener("message", event => { if (event.data === "locked" && authenticated) lock(false); }); } catch { }
|
||||
let languagePacks = new Map(), defaultLanguage = null;
|
||||
function activePack() { return languagePacks.get(language) || languagePacks.get(defaultLanguage); }
|
||||
function locale() { try { return Intl.getCanonicalLocales(activePack()?.meta.locale || "und")[0]; } catch { return "und"; } }
|
||||
let canonicalLocale = { source: null, value: "und" };
|
||||
function locale() {
|
||||
const source = activePack()?.meta.locale || "und";
|
||||
if (canonicalLocale.source !== source) { let value = "und"; try { value = Intl.getCanonicalLocales(source)[0]; } catch { /* invalid tag */ } canonicalLocale = { source, value }; }
|
||||
return canonicalLocale.value;
|
||||
}
|
||||
// Live views format hundreds of numbers and times per update; constructing a
|
||||
// new Intl formatter for each value (toLocaleString with options) dominated
|
||||
// that work. Formatters are cached per language and options.
|
||||
const intlFormatters = new Map();
|
||||
function intlFormatter(kind, key, create) {
|
||||
const cacheKey = `${locale()}|${kind}|${key}`;
|
||||
let formatter = intlFormatters.get(cacheKey);
|
||||
if (!formatter) { formatter = create(locale()); intlFormatters.set(cacheKey, formatter); }
|
||||
return formatter;
|
||||
}
|
||||
function formatNumber(value, maximumFractionDigits = 0) { return intlFormatter("number", maximumFractionDigits, lang => new Intl.NumberFormat(lang, { maximumFractionDigits })).format(Number(value)); }
|
||||
function formatDateParts(date, withDate, hour12) {
|
||||
return intlFormatter(withDate ? "datetime" : "time", hour12, lang => new Intl.DateTimeFormat(lang, withDate ? { year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric", hour12 } : { hour: "numeric", minute: "numeric", second: "numeric", hour12 })).format(date);
|
||||
}
|
||||
// Sorting calls a comparator O(n log n) times; String#localeCompare with a
|
||||
// locale/options argument builds a new collator on every call, which made
|
||||
// periodic table re-renders slow. Collators are cached per language.
|
||||
@@ -179,9 +198,9 @@ function setPanel(name, navigate = true) {
|
||||
$("page-label").textContent = t(name); $("page-title").textContent = t(`${name}Title`); const descriptionKey = `${name}Description`, description = t(descriptionKey); $("page-description").textContent = description === descriptionKey ? "" : description; $("page-description").hidden = description === descriptionKey;
|
||||
if (navigate && typeof location !== "undefined" && ["http:", "https:"].includes(location.protocol) && location.pathname !== PANEL_PATHS[name]) history.pushState({ panel: name }, "", PANEL_PATHS[name]);
|
||||
if (name === "web-server" && latestStatus) window.rustProxyWebServer?.renderLive?.(latestStatus, false);
|
||||
if (name === "settings") window.rustProxySettings?.syncLocation?.();
|
||||
if (name === "settings") { if (previousPanel !== name) window.rustProxySettings?.render?.(); window.rustProxySettings?.syncLocation?.(); }
|
||||
window.rustProxyRefresh?.setPanel(name);
|
||||
if (name === "overview") window.rustProxyVhosts?.flushOverviewViews?.();
|
||||
if (name === "overview") { window.rustProxyVhosts?.flushOverviewViews?.(); if (previousPanel !== name) redrawOverviewHistoryCharts(); }
|
||||
if (name === "overview" && previousPanel !== name && typeof latestStatus !== "undefined" && latestStatus) { window.rustProxyStreamDashboard?.render?.(latestStatus, null, false); window.rustProxyDockerDashboard?.render?.(latestStatus, null, false); window.rustProxyBackendDashboard?.render?.(latestStatus, null, false); window.rustProxyExtraOverview?.render?.(latestStatus, false); window.rustProxyWideOverview?.render?.(latestStatus, false); window.rustProxyWebOverview?.render?.(latestStatus, false); }
|
||||
if (name === "docker-vhosts" && previousPanel !== name && authenticated && envelope) void window.rustProxyRefresh?.manual("docker");
|
||||
if (name === "tls") window.rustProxyAcme?.syncLocation?.();
|
||||
@@ -354,7 +373,7 @@ function renderStatusNow(s, systemSample = false) {
|
||||
listeners: s.listeners ? { ...(latestStatus?.listeners || {}), ...s.listeners } : latestStatus?.listeners,
|
||||
logging: s.logging ? { ...(latestStatus?.logging || {}), ...s.logging } : latestStatus?.logging
|
||||
};
|
||||
s = latestStatus; window.rustProxySettings?.render(); if (firstStatus) renderSettings();
|
||||
s = latestStatus; if (currentPanel === "settings") window.rustProxySettings?.render(); if (firstStatus) renderSettings();
|
||||
connected = true; $("connection-label").textContent = t("connected"); $("signal").classList.remove("status-error"); $("app-health-slot").hidden = false; appHealthUpdatedAt = new Date(); renderAppHealth(s); const m = s.metrics;
|
||||
$("metric-ws").textContent = m.websocket_active || 0;
|
||||
$("metric-ws-h1").textContent = m.websocket_h1_active || 0;
|
||||
@@ -381,7 +400,7 @@ function renderStatusNow(s, systemSample = false) {
|
||||
websocketProtocolSamples.h2.push(Number(m.websocket_h2_active) || 0); websocketProtocolSamples.h2 = websocketProtocolSamples.h2.slice(-window.rustProxyOverviewSamples.getLimit());
|
||||
websocketProtocolSamples.h3.push(Number(m.websocket_h3_active) || 0); websocketProtocolSamples.h3 = websocketProtocolSamples.h3.slice(-window.rustProxyOverviewSamples.getLimit());
|
||||
if (!pausedRate) { transformSamples.push(rates.transform); transformSamples = transformSamples.slice(-window.rustProxyOverviewSamples.getLimit()); }
|
||||
redrawOverviewHistoryCharts();
|
||||
if (currentPanel === "overview") redrawOverviewHistoryCharts();
|
||||
const rateText = key => pausedRate ? "-" : `${rates[key].toFixed(1)}/s`;
|
||||
$("request-rate").textContent = pausedRate ? "- req/s" : `${rates.total.toFixed(1)} req/s`;
|
||||
$("rate-total").textContent = rateText("total"); $("rate-h1").textContent = rateText("h1"); $("rate-h2").textContent = rateText("h2"); $("rate-h3").textContent = rateText("h3"); $("rate-transform").textContent = rateText("transform");
|
||||
|
||||
@@ -51,8 +51,13 @@ window.rustProxyOverviewRows = (() => {
|
||||
if (needed > spanOf(card)) setSpan(node, needed, columns);
|
||||
}
|
||||
}
|
||||
// Measuring forces a layout of the whole document. While Overview is
|
||||
// hidden there is nothing to measure; remember it and re-run once the
|
||||
// grid is shown again (the ResizeObserver below fires on that change).
|
||||
let hiddenPending = false;
|
||||
function apply() {
|
||||
frame = 0;
|
||||
if (grid.closest(".panel")?.hidden) { hiddenPending = true; return; }
|
||||
if (!grid.getClientRects().length || grid.classList.contains("is-overview-sorting") || grid.classList.contains("is-manual-dragging")) return;
|
||||
if (!enabled()) { if (grid.classList.contains("has-row-units")) clear(); return; }
|
||||
lastRun = performance.now();
|
||||
@@ -389,7 +394,7 @@ window.rustProxyOverviewRows = (() => {
|
||||
}
|
||||
if (typeof ResizeObserver === "function") {
|
||||
new ResizeObserver(() => {
|
||||
if (grid.clientWidth && grid.clientWidth !== lastWidth) { shrinkVotes.clear(); schedule(true); }
|
||||
if (grid.clientWidth && (grid.clientWidth !== lastWidth || hiddenPending)) { hiddenPending = false; shrinkVotes.clear(); schedule(true); }
|
||||
}).observe(grid);
|
||||
}
|
||||
document.fonts?.ready?.then(() => schedule(true));
|
||||
|
||||
@@ -317,8 +317,8 @@ function refreshChartStylePalette(active = adminPreferences?.chart_style || "def
|
||||
target.replaceChildren(...buttons);
|
||||
}
|
||||
function refreshAppearanceUi() { refreshChartStylePalette(); renderDashboardWidgetSettings(); renderRefreshPreferences(adminPreferences?.refresh); window.rustProxyDashboardLayout?.refresh?.(); window.rustProxySettings?.refreshSearch?.(); }
|
||||
function formatDateTime(value) { const date = value instanceof Date ? value : new Date(value); return date.toLocaleString(locale(), { hour12: (adminPreferences?.time_format || "24h") === "12h" }); }
|
||||
function formatTime(value) { const date = value instanceof Date ? value : new Date(value); return date.toLocaleTimeString(locale(), { hour12: (adminPreferences?.time_format || "24h") === "12h" }); }
|
||||
function formatDateTime(value) { const date = value instanceof Date ? value : new Date(value); if (Number.isNaN(date.getTime())) return String(date); return formatDateParts(date, true, (adminPreferences?.time_format || "24h") === "12h"); }
|
||||
function formatTime(value) { const date = value instanceof Date ? value : new Date(value); if (Number.isNaN(date.getTime())) return String(date); return formatDateParts(date, false, (adminPreferences?.time_format || "24h") === "12h"); }
|
||||
function applyAdminPreferences(value, cache = true) {
|
||||
if (!value) return value;
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ function syncSettingsDirtyIndicators() {
|
||||
}
|
||||
function setSettingsDirty(id, dirty = true) { if (dirty) settingsDirty.add(id); else settingsDirty.delete(id); syncSettingsDirtyIndicators(); }
|
||||
function clearSettingsDirty() { settingsDirty.clear(); syncSettingsDirtyIndicators(); }
|
||||
const fmt = (value, digits = 0) => value == null ? t("unavailable") : Number(value).toLocaleString(locale(), { maximumFractionDigits: digits });
|
||||
const fmt = (value, digits = 0) => value == null ? t("unavailable") : formatNumber(value, digits);
|
||||
const fmtBytes = value => value == null ? t("unavailable") : bytes(value);
|
||||
function setOptionalMetric(id, supported, text) {
|
||||
const node = $(id); if (!node) return;
|
||||
|
||||
@@ -234,6 +234,10 @@
|
||||
min-width: 0;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
/* Many service cards: skip layout and paint of cards outside the
|
||||
viewport; the browser remembers each card's last rendered size. */
|
||||
content-visibility: auto;
|
||||
contain-intrinsic-size: auto 320px;
|
||||
}
|
||||
|
||||
.docker-service-row.is-unpublished {
|
||||
|
||||
+92
-62
@@ -584,6 +584,14 @@
|
||||
control.disabled = sections.length === 0; control.dataset.i18n = key; control.textContent = t(key);
|
||||
control.setAttribute("aria-expanded", String(allOpen));
|
||||
}
|
||||
// Only statistics sections near the viewport are redrawn on live updates;
|
||||
// a section scrolled into view is refreshed right away.
|
||||
let metricsFrame = 0;
|
||||
const metricsObserver = typeof IntersectionObserver === "function" ? new IntersectionObserver(entries => {
|
||||
let revealed = false;
|
||||
for (const entry of entries) { const wasOut = entry.target.dockerInView === false; entry.target.dockerInView = entry.isIntersecting; if (entry.isIntersecting && wasOut) revealed = true; }
|
||||
if (revealed && !metricsFrame) metricsFrame = requestAnimationFrame(() => { metricsFrame = 0; renderDockerMetrics(); });
|
||||
}, { rootMargin: "300px 0px" }) : null;
|
||||
function statisticsSection(agent, serviceKey) {
|
||||
const section = el("details", undefined, "docker-service-editor docker-service-metrics");
|
||||
section.dataset.viewKey = viewKey(agent.id, serviceKey);
|
||||
@@ -602,11 +610,11 @@
|
||||
svg.setAttribute("viewBox", "0 0 320 54"); svg.setAttribute("preserveAspectRatio", "none"); svg.setAttribute("aria-label", t("vhLifetimeChart"));
|
||||
const line = document.createElementNS("http://www.w3.org/2000/svg", "polyline"); line.setAttribute("class", "vhost-chart-line");
|
||||
svg.append(line); chart.append(svg); section.append(chart);
|
||||
section.dockerMetricView = { fields, chartValue, line };
|
||||
section.dockerMetricView = { fields, chartValue, line }; metricsObserver?.observe(section);
|
||||
section.addEventListener("toggle", () => {
|
||||
if (section.open) collapsedMetrics.delete(section.dataset.viewKey);
|
||||
else collapsedMetrics.add(section.dataset.viewKey);
|
||||
syncMetricsToggle();
|
||||
syncMetricsToggle(); if (section.open) renderDockerMetrics();
|
||||
});
|
||||
return section;
|
||||
}
|
||||
@@ -634,7 +642,11 @@
|
||||
history.snapshot = value; history.metrics = value; metricHistory.set(route.pool_id, history);
|
||||
}
|
||||
}
|
||||
// History is sampled always; the DOM is touched only for open sections of
|
||||
// the visible panel (a section is refreshed when it is opened).
|
||||
if (typeof currentPanel !== "undefined" && currentPanel !== "docker-vhosts") return;
|
||||
for (const section of document.querySelectorAll("#docker-discovery-list .docker-service-metrics")) {
|
||||
if (!section.open || section.dockerInView === false) continue;
|
||||
const [agentId, serviceKey] = [section.dataset.agentId, section.dataset.serviceKey];
|
||||
const route = poolRoutes.find(item => item.agent_id === agentId && item.service_key === serviceKey);
|
||||
const history = route && metricHistory.get(route.pool_id), metrics = history?.metrics;
|
||||
@@ -895,6 +907,7 @@
|
||||
};
|
||||
}
|
||||
async function saveAssignment(agentId, row, publish) {
|
||||
row._ensureEditor?.();
|
||||
const current = structuredClone(cfg()), agent = current.agents.find(item => item.id === agentId); if (!agent) return false;
|
||||
const index = (agent.assignments || []).findIndex(item => item.service_key === row.dataset.key);
|
||||
if (publish) {
|
||||
@@ -988,68 +1001,86 @@
|
||||
const headActions = el("div", undefined, "docker-service-head-actions"); headActions.append(runtimeSummary(runtime, assignment, stale), quickActions, visibility); top.append(publishLabel, meta, headActions); row.append(top);
|
||||
|
||||
const editor = el("details", undefined, "docker-service-editor"), editorSummary = el("summary"), editorTitle = el("span", t("dockerConfigureService")), editorHint = el("small", "", "fine docker-config-hint"); editorSummary.append(editorTitle, editorHint); editor.append(editorSummary);
|
||||
const route = el("div", undefined, "docker-route-grid"), host = input(assignment?.hostname || service?.technical_name || "", "text", "docker-hostname"); host.maxLength = 253; host.placeholder = service?.technical_name || "app1";
|
||||
row.dockerSyncActions = () => syncOpenActions(host.value);
|
||||
let aliases; const aliasChanged = () => { updateHint?.(); row.dispatchEvent(new Event("input", { bubbles: true })); }; aliases = aliasEditor(assignment?.aliases || [], aliasChanged, { domains, master: () => domainSelect.value }); row._readAliases = aliases.read;
|
||||
const hostField = el("label", undefined, "docker-field docker-hostname-field"), hostRow = el("div", undefined, "docker-hostname-row"), hostHelp = el("small", "", "fine");
|
||||
hostRow.append(host, domainSelect); hostField.append(el("span", t("dockerHostname")), hostRow, hostHelp);
|
||||
const syncHostHelp = () => { const full = expandedHost(host.value, domainSelect.value); hostHelp.textContent = `${t("dockerHostnameHelp").replace("{domain}", domainSelect.value || "-")}${full ? ` → ${full}` : ""}`; };
|
||||
domainSelect.addEventListener("change", () => { syncHostHelp(); aliases.refresh(); syncOpenActions(host.value); updateHint(); }); host.addEventListener("input", syncHostHelp);
|
||||
const target = el("select", undefined, "docker-target-ip"), auto = el("option", agent.default_target_ip ? `${t("dockerBackendIpAuto")} (${agent.default_target_ip})` : t("dockerBackendIpAuto")); auto.value = ""; target.append(auto); for (const [ip, label] of targetOptions(inventory, service, assignment, agent)) { const option = el("option", label); option.value = ip; target.append(option); } target.value = assignment?.target_ip || "";
|
||||
const scheme = el("select", undefined, "docker-scheme"); for (const name of ["http", "https"]) { const option = el("option", name.toUpperCase()); option.value = name; scheme.append(option); } scheme.value = assignment?.scheme || "http";
|
||||
const preserve = input("", "checkbox", "docker-preserve-host switch"); preserve.checked = assignment?.preserve_host !== false; const preserveLabel = checkboxField("dockerPreserveHost", preserve); preserveLabel.classList.add("docker-preserve-field");
|
||||
const forceSsl = input("", "checkbox", "docker-force-ssl switch"), forceCapable = canForceSsl(agent); forceSsl.checked = assignment ? assignment.force_ssl === true : forceCapable; forceSsl.disabled = !forceCapable; const forceSslField = checkboxField("dockerForceSsl", forceSsl); if (!forceCapable) forceSslField.append(el("small", t("dockerForceSslUnavailable"), "fine"));
|
||||
const websockets = input("", "checkbox", "docker-websockets switch"); websockets.checked = assignment?.websockets !== false; const websocketField = checkboxField("dockerWebsockets", websockets);
|
||||
const cacheEnabled = input("", "checkbox", "docker-cache-enabled switch"); cacheEnabled.checked = assignment?.cache_enabled === true; const cacheField = checkboxField("dockerCache", cacheEnabled);
|
||||
const transformEnabled = input("", "checkbox", "docker-transform-enabled switch"); transformEnabled.checked = assignment?.transform_enabled === true; const transformField = checkboxField("dockerTransform", transformEnabled);
|
||||
const compressionEnabled = input("", "checkbox", "docker-compression-enabled switch"); compressionEnabled.checked = assignment?.compression_enabled !== false; const compressionField = checkboxField("dockerCompression", compressionEnabled); compressionField.title = t("dockerCompressionHelp");
|
||||
const switches = el("div", undefined, "docker-switch-row"); switches.append(preserveLabel, forceSslField, websocketField, cacheField, compressionField, transformField);
|
||||
const certMismatch = input("", "checkbox", "docker-cert-mismatch"); certMismatch.checked = assignment?.allow_certificate_mismatch === true;
|
||||
certMismatch.disabled = !agentCertificates(agent).length;
|
||||
if (certMismatch.disabled) certMismatch.checked = false;
|
||||
const mismatchLabel = el("label", undefined, "check");
|
||||
mismatchLabel.append(certMismatch, el("span", t("dockerCertMismatchForce")));
|
||||
mismatchLabel.title = t(certMismatch.disabled ? "dockerCertMismatchUnavailable" : "dockerCertMismatchWarning");
|
||||
const certificateBar = el("div", undefined, "docker-service-certificate-bar");
|
||||
const certificateHint = el("small", "", "fine docker-certificate-hint"); certificateBar.append(mismatchLabel, certificateHint);
|
||||
const syncCertificateHint = () => {
|
||||
const ids = agentCertificates(agent), hosts = [expandedHost(host.value.trim() || technical, domainSelect.value), ...aliases.peek().map(alias => expandedHost(alias, domainSelect.value))].filter(Boolean);
|
||||
certificateHint.classList.remove("is-warn");
|
||||
if (!ids.length) {
|
||||
const all = (envelope?.config?.tls?.certificates || []).map(cert => cert.id), uncovered = hosts.filter(name => !pickCertificate(all, [name])), picked = hosts.length ? pickCertificate(all, hosts.slice(0, 1)) : "";
|
||||
if (uncovered.length) { certificateHint.textContent = t("dockerCertificateHintAutoMissing").replace("{hosts}", uncovered.join(", ")); certificateHint.classList.add("is-warn"); }
|
||||
else certificateHint.textContent = picked ? t("dockerCertificateHintAutoMatched").replace("{id}", picked) : t("dockerCertificateHintAuto");
|
||||
return;
|
||||
}
|
||||
const picked = pickCertificate(ids, hosts);
|
||||
certificateHint.textContent = picked ? t("dockerCertificateHintMatched").replace("{id}", picked) : t(certMismatch.checked ? "dockerCertificateHintForced" : "dockerCertificateHintGeneric").replace("{id}", ids[0]);
|
||||
};
|
||||
const backendIpSettings = el("div", undefined, "docker-backend-ip-settings");
|
||||
backendIpSettings.append(labeled("dockerBackendIp", target), certificateBar);
|
||||
// The editor is the largest part of a service card (hundreds of elements
|
||||
// each); build it on first open, or right before saving, instead of for
|
||||
// every service on every render. Until then the summary, search and quick
|
||||
// actions use the stored assignment.
|
||||
const hintFor = ({ hostname, domain, targetLabel, scheme, h2, h3, aliasCount }) => `${expandedHost(hostname || technical, domain) || hostname || technical} → ${String(scheme || "http").toUpperCase()} · ${targetLabel} · H1${h2 ? "/H2" : ""}${h3 ? "/H3" : ""}${aliasCount ? ` · +${aliasCount} ${t("dockerAliasesShort")}` : ""}`;
|
||||
const initialHost = assignment?.hostname || service?.technical_name || "";
|
||||
let host = null, apply = null, editorBuilt = false;
|
||||
const hostValue = () => host ? host.value : initialHost;
|
||||
row.dockerSyncActions = () => syncOpenActions(hostValue());
|
||||
const initialTargetLabel = () => { const ip = assignment?.target_ip || ""; if (!ip) return agent.default_target_ip ? `${t("dockerBackendIpAuto")} (${agent.default_target_ip})` : t("dockerBackendIpAuto"); return targetOptions(inventory, service, assignment, agent).find(([value]) => value === ip)?.[1] || ip; };
|
||||
editorHint.textContent = hintFor({ hostname: initialHost.trim(), domain: masterDomain(agent, assignment), targetLabel: initialTargetLabel(), scheme: assignment?.scheme, h2: assignment?.http2_enabled !== false, h3: assignment ? assignment.http3_enabled !== false : false, aliasCount: (assignment?.aliases || []).length });
|
||||
row.dockerSearchText = [initialHost, ...(assignment?.aliases || []), assignment?.target_ip || "", assignment?.scheme || "http"].join(" ").toLowerCase();
|
||||
const buildEditor = () => {
|
||||
if (editorBuilt) return; editorBuilt = true;
|
||||
const route = el("div", undefined, "docker-route-grid"); host = input(initialHost, "text", "docker-hostname"); host.maxLength = 253; host.placeholder = service?.technical_name || "app1";
|
||||
let aliases; const aliasChanged = () => { updateHint?.(); row.dispatchEvent(new Event("input", { bubbles: true })); }; aliases = aliasEditor(assignment?.aliases || [], aliasChanged, { domains, master: () => domainSelect.value }); row._readAliases = aliases.read;
|
||||
const hostField = el("label", undefined, "docker-field docker-hostname-field"), hostRow = el("div", undefined, "docker-hostname-row"), hostHelp = el("small", "", "fine");
|
||||
hostRow.append(host, domainSelect); hostField.append(el("span", t("dockerHostname")), hostRow, hostHelp);
|
||||
const syncHostHelp = () => { const full = expandedHost(host.value, domainSelect.value); hostHelp.textContent = `${t("dockerHostnameHelp").replace("{domain}", domainSelect.value || "-")}${full ? ` → ${full}` : ""}`; };
|
||||
domainSelect.addEventListener("change", () => { syncHostHelp(); aliases.refresh(); syncOpenActions(host.value); updateHint(); }); host.addEventListener("input", syncHostHelp);
|
||||
const target = el("select", undefined, "docker-target-ip"), auto = el("option", agent.default_target_ip ? `${t("dockerBackendIpAuto")} (${agent.default_target_ip})` : t("dockerBackendIpAuto")); auto.value = ""; target.append(auto); for (const [ip, label] of targetOptions(inventory, service, assignment, agent)) { const option = el("option", label); option.value = ip; target.append(option); } target.value = assignment?.target_ip || "";
|
||||
const scheme = el("select", undefined, "docker-scheme"); for (const name of ["http", "https"]) { const option = el("option", name.toUpperCase()); option.value = name; scheme.append(option); } scheme.value = assignment?.scheme || "http";
|
||||
const preserve = input("", "checkbox", "docker-preserve-host switch"); preserve.checked = assignment?.preserve_host !== false; const preserveLabel = checkboxField("dockerPreserveHost", preserve); preserveLabel.classList.add("docker-preserve-field");
|
||||
const forceSsl = input("", "checkbox", "docker-force-ssl switch"), forceCapable = canForceSsl(agent); forceSsl.checked = assignment ? assignment.force_ssl === true : forceCapable; forceSsl.disabled = !forceCapable; const forceSslField = checkboxField("dockerForceSsl", forceSsl); if (!forceCapable) forceSslField.append(el("small", t("dockerForceSslUnavailable"), "fine"));
|
||||
const websockets = input("", "checkbox", "docker-websockets switch"); websockets.checked = assignment?.websockets !== false; const websocketField = checkboxField("dockerWebsockets", websockets);
|
||||
const cacheEnabled = input("", "checkbox", "docker-cache-enabled switch"); cacheEnabled.checked = assignment?.cache_enabled === true; const cacheField = checkboxField("dockerCache", cacheEnabled);
|
||||
const transformEnabled = input("", "checkbox", "docker-transform-enabled switch"); transformEnabled.checked = assignment?.transform_enabled === true; const transformField = checkboxField("dockerTransform", transformEnabled);
|
||||
const compressionEnabled = input("", "checkbox", "docker-compression-enabled switch"); compressionEnabled.checked = assignment?.compression_enabled !== false; const compressionField = checkboxField("dockerCompression", compressionEnabled); compressionField.title = t("dockerCompressionHelp");
|
||||
const switches = el("div", undefined, "docker-switch-row"); switches.append(preserveLabel, forceSslField, websocketField, cacheField, compressionField, transformField);
|
||||
const certMismatch = input("", "checkbox", "docker-cert-mismatch"); certMismatch.checked = assignment?.allow_certificate_mismatch === true;
|
||||
certMismatch.disabled = !agentCertificates(agent).length;
|
||||
if (certMismatch.disabled) certMismatch.checked = false;
|
||||
const mismatchLabel = el("label", undefined, "check");
|
||||
mismatchLabel.append(certMismatch, el("span", t("dockerCertMismatchForce")));
|
||||
mismatchLabel.title = t(certMismatch.disabled ? "dockerCertMismatchUnavailable" : "dockerCertMismatchWarning");
|
||||
const certificateBar = el("div", undefined, "docker-service-certificate-bar");
|
||||
const certificateHint = el("small", "", "fine docker-certificate-hint"); certificateBar.append(mismatchLabel, certificateHint);
|
||||
const syncCertificateHint = () => {
|
||||
const ids = agentCertificates(agent), hosts = [expandedHost(host.value.trim() || technical, domainSelect.value), ...aliases.peek().map(alias => expandedHost(alias, domainSelect.value))].filter(Boolean);
|
||||
certificateHint.classList.remove("is-warn");
|
||||
if (!ids.length) {
|
||||
const all = (envelope?.config?.tls?.certificates || []).map(cert => cert.id), uncovered = hosts.filter(name => !pickCertificate(all, [name])), picked = hosts.length ? pickCertificate(all, hosts.slice(0, 1)) : "";
|
||||
if (uncovered.length) { certificateHint.textContent = t("dockerCertificateHintAutoMissing").replace("{hosts}", uncovered.join(", ")); certificateHint.classList.add("is-warn"); }
|
||||
else certificateHint.textContent = picked ? t("dockerCertificateHintAutoMatched").replace("{id}", picked) : t("dockerCertificateHintAuto");
|
||||
return;
|
||||
}
|
||||
const picked = pickCertificate(ids, hosts);
|
||||
certificateHint.textContent = picked ? t("dockerCertificateHintMatched").replace("{id}", picked) : t(certMismatch.checked ? "dockerCertificateHintForced" : "dockerCertificateHintGeneric").replace("{id}", ids[0]);
|
||||
};
|
||||
const backendIpSettings = el("div", undefined, "docker-backend-ip-settings");
|
||||
backendIpSettings.append(labeled("dockerBackendIp", target), certificateBar);
|
||||
|
||||
const h2Enabled = input("", "checkbox", "docker-http2-enabled switch"); h2Enabled.checked = assignment?.http2_enabled !== false;
|
||||
const h3Enabled = input("", "checkbox", "docker-http3-enabled switch"); h3Enabled.checked = assignment ? assignment.http3_enabled !== false : false;
|
||||
const protocolBox = el("details", undefined, "docker-protocol-editor"), protocolSummary = el("summary");
|
||||
protocolSummary.append(el("span", t("dockerFrontendProtocols")), el("small", t("dockerFrontendProtocolsHelp"), "fine"));
|
||||
const protocolOptions = el("div", undefined, "docker-protocol-options");
|
||||
const h1 = el("span", undefined, "docker-protocol-fixed");
|
||||
h1.append(el("strong", "HTTP/1.1"), el("small", t("dockerHttp1Always"), "fine"));
|
||||
protocolOptions.append(h1, checkboxField("dockerHttp2Enabled", h2Enabled), checkboxField("dockerHttp3Enabled", h3Enabled));
|
||||
protocolBox.append(protocolSummary, protocolOptions);
|
||||
route.append(hostField, aliases.node, backendIpSettings, labeled("dockerBackendScheme", scheme), switches); syncHostHelp();
|
||||
editor.append(route, protocolBox, aclEditor(assignment, agent), securityEditor(assignment), cacheEditor(assignment, agent, key, cacheEnabled), diagnosticsEditor(assignment), timeoutEditor(assignment), healthEditor(assignment), passiveHealthEditor(assignment));
|
||||
const actions = el("div", undefined, "docker-service-actions"), apply = el("button", t("dockerApplyService"), "outline docker-apply"); apply.type = "button"; apply.disabled = !publish.checked; apply.addEventListener("click", async () => { apply.disabled = true; try { await saveAssignment(agent.id, row, true); } catch (error) { toast(error.message, true); } finally { if (row.isConnected) apply.disabled = !publish.checked; } }); actions.append(apply); editor.append(actions); row.append(editor);
|
||||
const h2Enabled = input("", "checkbox", "docker-http2-enabled switch"); h2Enabled.checked = assignment?.http2_enabled !== false;
|
||||
const h3Enabled = input("", "checkbox", "docker-http3-enabled switch"); h3Enabled.checked = assignment ? assignment.http3_enabled !== false : false;
|
||||
const protocolBox = el("details", undefined, "docker-protocol-editor"), protocolSummary = el("summary");
|
||||
protocolSummary.append(el("span", t("dockerFrontendProtocols")), el("small", t("dockerFrontendProtocolsHelp"), "fine"));
|
||||
const protocolOptions = el("div", undefined, "docker-protocol-options");
|
||||
const h1 = el("span", undefined, "docker-protocol-fixed");
|
||||
h1.append(el("strong", "HTTP/1.1"), el("small", t("dockerHttp1Always"), "fine"));
|
||||
protocolOptions.append(h1, checkboxField("dockerHttp2Enabled", h2Enabled), checkboxField("dockerHttp3Enabled", h3Enabled));
|
||||
protocolBox.append(protocolSummary, protocolOptions);
|
||||
route.append(hostField, aliases.node, backendIpSettings, labeled("dockerBackendScheme", scheme), switches); syncHostHelp();
|
||||
editor.append(route, protocolBox, aclEditor(assignment, agent), securityEditor(assignment), cacheEditor(assignment, agent, key, cacheEnabled), diagnosticsEditor(assignment), timeoutEditor(assignment), healthEditor(assignment), passiveHealthEditor(assignment));
|
||||
const actions = el("div", undefined, "docker-service-actions"); apply = el("button", t("dockerApplyService"), "outline docker-apply"); apply.type = "button"; apply.disabled = !publish.checked; apply.addEventListener("click", async () => { apply.disabled = true; try { await saveAssignment(agent.id, row, true); } catch (error) { toast(error.message, true); } finally { if (row.isConnected) apply.disabled = !publish.checked; } }); actions.append(apply); editor.append(actions);
|
||||
function updateHint() { syncCertificateHint(); editorHint.textContent = hintFor({ hostname: host.value.trim(), domain: domainSelect.value, targetLabel: target.selectedOptions?.[0]?.textContent || t("dockerBackendIpAuto"), scheme: scheme.value, h2: h2Enabled.checked, h3: h3Enabled.checked, aliasCount: aliases.count() }); } updateHint();
|
||||
for (const control of [host, aliases.input, target, scheme]) { control.addEventListener("input", updateHint); control.addEventListener("change", updateHint); }
|
||||
for (const control of [h2Enabled, h3Enabled, certMismatch]) control.addEventListener("change", updateHint);
|
||||
host.addEventListener("input", () => syncOpenActions(host.value));
|
||||
host.addEventListener("input", () => { row.dockerSearchText = ""; });
|
||||
};
|
||||
row._ensureEditor = buildEditor;
|
||||
editor.addEventListener("toggle", () => { if (editor.open) buildEditor(); });
|
||||
row.append(editor);
|
||||
if (agent.enabled !== false && assignment && assignment.enabled !== false) row.append(statisticsSection(agent, key));
|
||||
function updateHint() { syncCertificateHint(); const targetLabel = target.selectedOptions?.[0]?.textContent || t("dockerBackendIpAuto"), aliasCount = aliases.count(); editorHint.textContent = `${expandedHost(host.value.trim() || technical, domainSelect.value) || host.value.trim() || technical} → ${scheme.value.toUpperCase()} · ${targetLabel} · H1${h2Enabled.checked ? "/H2" : ""}${h3Enabled.checked ? "/H3" : ""}${aliasCount ? ` · +${aliasCount} ${t("dockerAliasesShort")}` : ""}`; } updateHint();
|
||||
for (const control of [host, aliases.input, target, scheme]) { control.addEventListener("input", updateHint); control.addEventListener("change", updateHint); }
|
||||
for (const control of [h2Enabled, h3Enabled, certMismatch]) control.addEventListener("change", updateHint);
|
||||
host.addEventListener("input", () => syncOpenActions(host.value));
|
||||
row.addEventListener("input", event => { if (!event.target.classList.contains("docker-publish")) row.classList.add("is-dirty"); }); row.addEventListener("change", event => { if (!event.target.classList.contains("docker-publish")) row.classList.add("is-dirty"); });
|
||||
publish.addEventListener("change", async () => {
|
||||
const wanted = publish.checked; publish.disabled = true; apply.disabled = true;
|
||||
syncOpenActions(host.value);
|
||||
const wanted = publish.checked; publish.disabled = true; if (apply) apply.disabled = true;
|
||||
syncOpenActions(hostValue());
|
||||
try { const saved = await saveAssignment(agent.id, row, wanted); if (!saved) publish.checked = !wanted; } catch (error) { publish.checked = !wanted; toast(error.message, true); }
|
||||
finally { publish.setAttribute("aria-checked", String(publish.checked)); if (row.isConnected) { publish.disabled = false; apply.disabled = !publish.checked; row.classList.toggle("is-unpublished", !publish.checked); syncOpenActions(host.value); } }
|
||||
finally { publish.setAttribute("aria-checked", String(publish.checked)); if (row.isConnected) { publish.disabled = false; if (apply) apply.disabled = !publish.checked; row.classList.toggle("is-unpublished", !publish.checked); syncOpenActions(hostValue()); } }
|
||||
});
|
||||
row.classList.toggle("is-unpublished", !publish.checked); return row;
|
||||
}
|
||||
@@ -1064,7 +1095,7 @@
|
||||
box.append(summary, list); box.open = dockerAlerts.length <= 5; target.append(box);
|
||||
}
|
||||
function renderDiscovery() {
|
||||
const target = $("docker-discovery-list"); if (!target || !envelope) return; target.replaceChildren(); const agents = cfg().agents || [];
|
||||
const target = $("docker-discovery-list"); if (!target || !envelope) return; metricsObserver?.disconnect(); target.replaceChildren(); const agents = cfg().agents || [];
|
||||
renderAlertsBanner(target);
|
||||
if (!agents.length) { target.append(el("p", t("dockerNoAgentsConfigured"), "card empty")); applyViewFilters(); return; }
|
||||
for (const agent of agents) {
|
||||
@@ -1137,8 +1168,7 @@
|
||||
const rows = [...card.querySelectorAll(".docker-service-row")]; let visible = 0;
|
||||
for (const row of rows) {
|
||||
const viewHidden = hiddenVhosts.has(row.dataset.viewKey);
|
||||
const values = [...row.querySelectorAll("input, select")].map(control => control.value || "").join(" ");
|
||||
const matches = !query || agentMatch || `${row.textContent} ${values}`.toLowerCase().includes(query);
|
||||
const matches = !query || agentMatch || `${row.textContent} ${row.dockerSearchText || ""} ${[...row.querySelectorAll("input, select")].map(control => control.value || "").join(" ")}`.toLowerCase().includes(query);
|
||||
row.classList.toggle("is-view-hidden", viewHidden);
|
||||
row.hidden = (!showHidden && viewHidden) || !matches;
|
||||
if (!row.hidden) visible += 1;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
const na = () => t("unavailable");
|
||||
const size = value => known(value) ? bytes(Number(value)) : na();
|
||||
const count = value => known(value) ? Number(value).toLocaleString(locale()) : na();
|
||||
const percent = value => known(value) ? `${Number(value).toLocaleString(locale(), { maximumFractionDigits: 1 })}%` : na();
|
||||
const percent = value => known(value) ? `${formatNumber(value, 1)}%` : na();
|
||||
const ratio = (part, whole) => known(part) && known(whole) && Number(whole) > 0 ? Math.max(0, Math.min(100, Number(part) / Number(whole) * 100)) : 0;
|
||||
const rate = value => known(value) ? `${bytes(Number(value))}/s` : na();
|
||||
const setText = (id, value) => { const node = $(id); if (node) node.textContent = value ?? na(); };
|
||||
|
||||
@@ -225,7 +225,7 @@ function syncPoolSortDirection() {
|
||||
// milliseconds per update; defer them until Overview is shown again.
|
||||
let overviewViewsPending = false;
|
||||
const overviewViewsHidden = () => typeof currentPanel !== "undefined" && currentPanel !== "overview";
|
||||
function flushOverviewViews() { if (!overviewViewsPending) return; overviewViewsPending = false; applyPoolTableView(); }
|
||||
function flushOverviewViews() { if (!overviewViewsPending) return; overviewViewsPending = false; if (latestStatus) renderStatus(latestStatus); else applyPoolTableView(); }
|
||||
function applyPoolTableView() {
|
||||
if (overviewViewsHidden()) { overviewViewsPending = true; return; }
|
||||
for (const id of ["pool-sort", "bo-sort"]) { const control = $(id); if (control && control.value !== poolTablePrefs.sort) control.value = poolTablePrefs.sort; }
|
||||
@@ -546,7 +546,9 @@ function applyBackendOverviewView() {
|
||||
}
|
||||
const scroller = body.closest(".table-scroll"), scrollTop = scroller?.scrollTop ?? 0, scrollLeft = scroller?.scrollLeft ?? 0;
|
||||
body.replaceChildren(...rows);
|
||||
if (scroller) { scroller.scrollTop = scrollTop; scroller.scrollLeft = scrollLeft; }
|
||||
// Writing scroll offsets forces a synchronous layout; only restore a
|
||||
// position the user actually scrolled to.
|
||||
if (scroller && (scrollTop || scrollLeft)) { scroller.scrollTop = scrollTop; scroller.scrollLeft = scrollLeft; }
|
||||
if (hadFocus) [...body.querySelectorAll(".bo-expand")].find(button => button.dataset.boKey === focusKey)?.focus({ preventScroll: true });
|
||||
const empty = $("bo-empty");
|
||||
if (empty) { empty.textContent = boItems.length ? t("backendSearchEmpty") : t("vhHealthEmpty"); empty.hidden = list.length > 0 || !boHasProxy; }
|
||||
@@ -773,7 +775,7 @@ function renderStatus(status) {
|
||||
renderUpstreamProtocolBadges(status);
|
||||
refreshVhostBackendPopup(status);
|
||||
form.querySelectorAll(".vh-member").forEach(row => row.syncLocalRisk?.());
|
||||
const rows = [], summaries = new Map(), aggregate = new Map(), overviewItems = [];
|
||||
const rows = [], summaries = new Map(), aggregate = new Map(), overviewItems = [], buildPoolRows = !overviewViewsHidden();
|
||||
const trafficSnapshot = status, trafficNow = performance.now(), seenTraffic = new Set(), seenVhostTraffic = new Set(), seenRequests = new Set();
|
||||
const statusKeys = { up: "vhUp", down: "vhDown", checking: "vhChecking", draining: "vhDraining", disabled: "vhDisabled" };
|
||||
const configuredVhosts = new Map((envelope?.config.vhosts || []).map(vhost => [vhost.id, vhost]));
|
||||
@@ -795,7 +797,7 @@ function renderStatus(status) {
|
||||
member.ewma_latency_ms > 0 ? `${member.ewma_latency_ms.toFixed(1)} ms` : "-", `${rateBytes(memberTraffic)}/s`, extra.text.rate, extra.text.statuses, extra.text.p95, extra.text.cache, extra.text.probe, extra.text.causes, extra.text.protocol, member.upstream_client_generation ?? "-", member.upstream_client_generation_requests ?? "-", generationAgeText, member.upstream_client_rotations_total ?? "-", lastFailure, lastRecovery];
|
||||
const sortValues = { vhost: poolLabel.toLowerCase(), backend: String(member.id || "").toLowerCase(), status: label.toLowerCase(), active: Number(member.active) || 0, requests: Number(member.requests) || 0, errors: Number(member.errors) || 0, latency: Number(member.ewma_latency_ms) || 0, traffic: memberTraffic, ...extra.sort, generation: Number(member.upstream_client_generation) || 0, generationRequests: Number(member.upstream_client_generation_requests) || 0, generationAge: Number.isFinite(generationAge) ? generationAge : -1, rotations: Number(member.upstream_client_rotations_total) || 0, lastFailure: Number(member.last_failure_at_ms) || 0, lastRecovery: Number(member.last_recovered_ms) || 0 };
|
||||
row.poolSort = sortValues; row.poolSearchValue = [poolLabel, member.id, label, member.status, member.last_failure_class, member.last_failure_detail].filter(Boolean).join(" ").toLowerCase();
|
||||
cells.forEach((value, index) => { const cell = el("td", String(value ?? "-")); const column = poolColumns[index]; cell.dataset.poolColumn = column; cell.title = column === "status" ? (vhostDisabled ? t("vhDisabled") : `${label} · ${healthDetail}`) : column === "lastFailure" ? (member.last_failure_detail || lastFailure) : String(value ?? "-"); if (column === "status" && !vhostDisabled) cell.className = member.status === "down" ? "status-error" : member.status === "up" ? "status-good" : ""; if (column === "lastFailure" && member.last_failure_at_ms) cell.classList.add("backend-last-failure"); row.append(cell); }); rows.push(row);
|
||||
if (buildPoolRows) cells.forEach((value, index) => { const cell = el("td", String(value ?? "-")); const column = poolColumns[index]; cell.dataset.poolColumn = column; cell.title = column === "status" ? (vhostDisabled ? t("vhDisabled") : `${label} · ${healthDetail}`) : column === "lastFailure" ? (member.last_failure_detail || lastFailure) : String(value ?? "-"); if (column === "status" && !vhostDisabled) cell.className = member.status === "down" ? "status-error" : member.status === "up" ? "status-good" : ""; if (column === "lastFailure" && member.last_failure_at_ms) cell.classList.add("backend-last-failure"); row.append(cell); }); if (buildPoolRows) rows.push(row);
|
||||
const tone = vhostDisabled ? "muted" : member.health_mode === "off" && member.status === "up" ? "muted" : member.status === "up" ? "up" : member.status === "down" ? "down" : member.status === "checking" || member.status === "draining" ? "warn" : "muted";
|
||||
overviewItems.push({
|
||||
key: `${pool.id}\u0000${member.id}`, vhost: poolLabel, backend: `${member.id}${member.backup ? " / " + t("vhBackup") : ""}`, disabled: vhostDisabled, tone, group: tone === "up" ? "up" : tone === "down" ? "down" : "other",
|
||||
@@ -847,7 +849,7 @@ function renderStatus(status) {
|
||||
const hasConfiguredProxySource = [...configuredVhosts.values()].some(vhost =>
|
||||
vhost.source?.type !== "web_server" || (vhost.routes || []).some(route => !route.response && (route.source?.type || "reverse_proxy") === "reverse_proxy")
|
||||
);
|
||||
$("pool-rows").replaceChildren(...rows);
|
||||
if (buildPoolRows) $("pool-rows").replaceChildren(...rows); else overviewViewsPending = true;
|
||||
renderBackendOverview(overviewItems, hasConfiguredProxySource, status, false);
|
||||
const backendDiagnosticsCard = $("backend-diagnostics-card");
|
||||
backendDiagnosticsCard?.classList.toggle("is-no-proxy", !hasConfiguredProxySource);
|
||||
|
||||
@@ -51,5 +51,5 @@ const events = openapi.paths["/api/events"].get;
|
||||
const logsFlag = (events.parameters || []).find(parameter => parameter.name === "logs");
|
||||
assert.equal(logsFlag?.schema?.type, "boolean");
|
||||
assert.equal(logsFlag?.schema?.default, true);
|
||||
assert.equal(openapi.info.version, "0.38.4");
|
||||
assert.equal(openapi.info.version, "0.38.5");
|
||||
console.log("Panel refresh/API contract checks: OK");
|
||||
Reference in new issue
Block a user