@enigmax/dashboard 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/assets/index.html +21 -10
  2. package/package.json +1 -1
package/assets/index.html CHANGED
@@ -212,6 +212,9 @@
212
212
  border-radius: 7px; padding: 5px 14px; font-size: 12px; cursor: pointer; font-family: inherit;
213
213
  }
214
214
  .btn-danger:hover { border-color: var(--accent2); }
215
+ .btn-danger.icon { display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; }
216
+ .btn-danger.icon:hover { color: var(--bad); border-color: var(--bad); }
217
+ .btn-danger svg { width: 15px; height: 15px; display: block; }
215
218
  /* List settings (guard block/allow globs, custom secret patterns): chips + add input. A list row spans the full grid width. */
216
219
  .set-row.list { grid-column: 1 / -1; align-items: stretch; flex-direction: column; }
217
220
  .lchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
@@ -1652,8 +1655,11 @@ export {
1652
1655
  } else if (w.resetsAt) {
1653
1656
  const start = w.resetsAt - span;
1654
1657
  barPct = Math.max(0, Math.min(100, (Date.now() - start) / span * 100));
1655
- barCol = "var(--muted)";
1656
- barNote = "window " + Math.round(barPct) + "% elapsed";
1658
+ // No usage % available (no live rate-limit headers, no plan limit): the bar
1659
+ // shows window time-elapsed. Use the brand accent, not dead grey. The green/
1660
+ // yellow/orange/red consumption scale needs a real % (set a limit, or live data).
1661
+ barCol = "var(--accent)";
1662
+ barNote = "window " + Math.round(barPct) + "% elapsed - set a limit for usage %";
1657
1663
  valLine = fmt(w.used || 0) + " tok";
1658
1664
  } else {
1659
1665
  barPct = 0; barCol = "var(--muted)"; barNote = ""; valLine = fmt(w.used || 0) + " tok";
@@ -2183,10 +2189,13 @@ export {
2183
2189
  const res = await fetch("/api/update", { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
2184
2190
  const out = await res.json();
2185
2191
  if (!out.ok) { $("updateNote").textContent = "Update failed: " + (out.error || "error"); return; }
2186
- // The UI bundle may have been refreshed server-side; reload so the browser
2187
- // picks up the new dashboard and fresh data automatically.
2188
- $("updateNote").textContent = (out.note || "Updated.") + " Refreshing the dashboard...";
2189
- setTimeout(() => location.reload(), 1200);
2192
+ // Only reload when something actually changed; an up-to-date check just reports.
2193
+ if (out.changed) {
2194
+ $("updateNote").textContent = (out.note || "Updated.") + " Refreshing the dashboard...";
2195
+ setTimeout(() => location.reload(), 1200);
2196
+ } else {
2197
+ $("updateNote").textContent = out.note || "Already up to date.";
2198
+ }
2190
2199
  } catch { $("updateNote").textContent = "Could not reach the server to update."; }
2191
2200
  }
2192
2201
 
@@ -2362,14 +2371,16 @@ export {
2362
2371
  try { const r = await fetch("/api/accounts", { cache: "no-store" }); renderAccounts(await r.json()); }
2363
2372
  catch { $("accountsBody").innerHTML = '<div class="empty" style="padding:24px 0">Accounts unavailable.</div>'; }
2364
2373
  }
2374
+ const TRASH_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>';
2365
2375
  function accountRow(a) {
2366
2376
  const badges = (a.active ? '<span class="tag meas">active</span>' : "")
2367
2377
  + (a.loggedIn ? '<span class="tag">' + esc(a.email || "logged in") + "</span>" : '<span class="tag warn">not logged in</span>');
2368
2378
  const btn = (act, label, cls) => '<button type="button" class="' + (cls || "toggle") + '" data-acc="' + act + '" data-tool="' + esc(a.tool) + '" data-name="' + esc(a.name) + '">' + label + "</button>";
2369
- const acts = '<div class="set-ctl" style="display:flex;gap:6px;flex-wrap:wrap">'
2379
+ const removeBtn = '<button type="button" class="btn-danger icon" title="Remove" aria-label="Remove account ' + esc(a.name) + '" data-acc="remove" data-tool="' + esc(a.tool) + '" data-name="' + esc(a.name) + '">' + TRASH_ICON + "</button>";
2380
+ const acts = '<div class="set-ctl" style="display:flex;gap:6px;flex-wrap:wrap;align-items:center">'
2370
2381
  + (a.active ? "" : btn("activate", "Use"))
2371
2382
  + (a.loggedIn ? "" : btn("login", "Log in..."))
2372
- + (a.removable ? btn("rename", "Rename") + btn("remove", "Remove", "btn-danger") : "")
2383
+ + (a.removable ? btn("rename", "Rename") + removeBtn : "")
2373
2384
  + "</div>";
2374
2385
  return '<div class="set-row"><div class="set-meta"><div class="set-name">' + esc(a.name) + ' <span class="tag ext">' + esc(a.toolLabel) + "</span> " + badges
2375
2386
  + '</div><div class="set-hint">' + esc(a.dir) + "</div></div>" + acts + "</div>";
@@ -2382,10 +2393,10 @@ export {
2382
2393
  return '<label style="font-size:12px;color:var(--muted);display:inline-flex;align-items:center;gap:6px;margin:0 12px 6px 0">' + esc(t.label)
2383
2394
  + ' <select class="choice" data-prof-tool="' + esc(t.name) + '" data-prof="' + esc(p.name) + '">' + opts + "</select></label>";
2384
2395
  }).join("");
2385
- const acts = '<div class="set-ctl" style="display:flex;gap:6px">'
2396
+ const acts = '<div class="set-ctl" style="display:flex;gap:6px;align-items:center">'
2386
2397
  + (p.active ? "" : '<button type="button" class="toggle" data-prof-act="activate" data-name="' + esc(p.name) + '">Use</button>')
2387
2398
  + '<button type="button" class="toggle" data-prof-act="rename" data-name="' + esc(p.name) + '">Rename</button>'
2388
- + '<button type="button" class="btn-danger" data-prof-act="remove" data-name="' + esc(p.name) + '">Remove</button></div>';
2399
+ + '<button type="button" class="btn-danger icon" title="Remove" aria-label="Remove profile ' + esc(p.name) + '" data-prof-act="remove" data-name="' + esc(p.name) + '">' + TRASH_ICON + "</button></div>";
2389
2400
  return '<div class="set-row"><div class="set-meta"><div class="set-name">' + esc(p.name) + (p.active ? ' <span class="tag meas">active</span>' : "")
2390
2401
  + '</div><div class="set-hint" style="margin-top:6px">' + maps + "</div></div>" + acts + "</div>";
2391
2402
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enigmax/dashboard",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Local browser dashboard UI for enigma: the static page and chart assets enigma serves on its loopback dashboard (savings, real tool usage, in-browser settings). Installed on demand by enigma-cli; not a runtime dependency.",
5
5
  "type": "module",
6
6
  "files": [