Update app.js

This commit is contained in:
oliver
2026-06-09 14:59:02 -03:00
parent 3d3986ae2f
commit 58c564d263
+11 -3
View File
@@ -66,6 +66,15 @@ function normalizeAgents(raw) {
if (!Array.isArray(raw)) return []; if (!Array.isArray(raw)) return [];
// unwrap double-wrapped array: [[{…}]] → [{…}] // unwrap double-wrapped array: [[{…}]] → [{…}]
if (raw.length > 0 && Array.isArray(raw[0])) return normalizeAgents(raw[0]); if (raw.length > 0 && Array.isArray(raw[0])) return normalizeAgents(raw[0]);
// unwrap [{data:[…]}] envelope (agents list with nested data array)
if (
raw.length > 0 &&
raw[0] !== null &&
typeof raw[0] === "object" &&
Array.isArray(raw[0].data)
) {
return normalizeAgents(raw[0].data);
}
// unwrap n8n {json:{…}} envelope // unwrap n8n {json:{…}} envelope
if ( if (
raw.length > 0 && raw.length > 0 &&
@@ -847,7 +856,7 @@ function renderKeys(keys) {
day: "numeric", day: "numeric",
year: "numeric", year: "numeric",
}) })
: "\u2014"; : "";
const statusColor = k.disabled ? "var(--danger)" : "var(--success)"; const statusColor = k.disabled ? "var(--danger)" : "var(--success)";
const statusLabel = k.disabled ? "Disabled" : "Active"; const statusLabel = k.disabled ? "Disabled" : "Active";
@@ -867,8 +876,7 @@ function renderKeys(keys) {
<span class="key-stat-val">${k.limit_remaining ?? "\u2014"}</span> <span class="key-stat-val">${k.limit_remaining ?? "\u2014"}</span>
<span class="text-muted"> / ${total} credits</span> <span class="text-muted"> / ${total} credits</span>
</span> </span>
<span class="sep-dot">&middot;</span> ${exp ? `<span class="sep-dot">&middot;</span><span class="text-muted">${escHtml(exp)}</span>` : ""}
<span class="text-muted">${exp}</span>
</div> </div>
</div> </div>