@nockdev/hsa 1.2.2 → 1.2.3
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.
- package/dashboard.html +26 -3
- package/package.json +1 -1
package/dashboard.html
CHANGED
|
@@ -1491,6 +1491,9 @@
|
|
|
1491
1491
|
let selectedIde = "";
|
|
1492
1492
|
let selectedProject = "";
|
|
1493
1493
|
let sessionSSERetryMs = 1000;
|
|
1494
|
+
let fetchErrorCount = 0;
|
|
1495
|
+
const BASE_REFRESH_MS = 5000;
|
|
1496
|
+
const MAX_REFRESH_MS = 30000;
|
|
1494
1497
|
|
|
1495
1498
|
document.getElementById("endpointInput").value = endpoint;
|
|
1496
1499
|
|
|
@@ -1503,6 +1506,7 @@
|
|
|
1503
1506
|
.value.replace(/\/$/, "");
|
|
1504
1507
|
localStorage.setItem("hsa_endpoint", endpoint);
|
|
1505
1508
|
setStatus("connecting");
|
|
1509
|
+
fetchErrorCount = 0; // Reset error counter on manual connect
|
|
1506
1510
|
fetchDashboard();
|
|
1507
1511
|
fetchSessions();
|
|
1508
1512
|
}
|
|
@@ -1518,7 +1522,7 @@
|
|
|
1518
1522
|
const badge = document.getElementById("refreshBadge");
|
|
1519
1523
|
if (autoRefresh) {
|
|
1520
1524
|
btn.classList.add("active");
|
|
1521
|
-
badge
|
|
1525
|
+
updateRefreshBadge(badge);
|
|
1522
1526
|
startRefresh();
|
|
1523
1527
|
} else {
|
|
1524
1528
|
btn.classList.remove("active");
|
|
@@ -1528,10 +1532,14 @@
|
|
|
1528
1532
|
}
|
|
1529
1533
|
function startRefresh() {
|
|
1530
1534
|
stopRefresh();
|
|
1535
|
+
const interval = Math.min(
|
|
1536
|
+
BASE_REFRESH_MS * Math.pow(2, fetchErrorCount),
|
|
1537
|
+
MAX_REFRESH_MS,
|
|
1538
|
+
);
|
|
1531
1539
|
refreshInterval = setInterval(() => {
|
|
1532
1540
|
fetchDashboard();
|
|
1533
1541
|
fetchSessions();
|
|
1534
|
-
},
|
|
1542
|
+
}, interval);
|
|
1535
1543
|
}
|
|
1536
1544
|
function stopRefresh() {
|
|
1537
1545
|
if (refreshInterval) {
|
|
@@ -1539,6 +1547,15 @@
|
|
|
1539
1547
|
refreshInterval = null;
|
|
1540
1548
|
}
|
|
1541
1549
|
}
|
|
1550
|
+
function adjustRefreshInterval() {
|
|
1551
|
+
if (!autoRefresh) return;
|
|
1552
|
+
updateRefreshBadge(document.getElementById("refreshBadge"));
|
|
1553
|
+
startRefresh();
|
|
1554
|
+
}
|
|
1555
|
+
function updateRefreshBadge(badge) {
|
|
1556
|
+
const ms = Math.min(BASE_REFRESH_MS * Math.pow(2, fetchErrorCount), MAX_REFRESH_MS);
|
|
1557
|
+
badge.textContent = ms >= 1000 ? (ms / 1000) + "s" : ms + "ms";
|
|
1558
|
+
}
|
|
1542
1559
|
|
|
1543
1560
|
/* ================================================================
|
|
1544
1561
|
CONTEXT SELECTORS
|
|
@@ -1599,13 +1616,19 @@
|
|
|
1599
1616
|
try {
|
|
1600
1617
|
let url = endpoint + "/api/dashboard";
|
|
1601
1618
|
// Note: /api/dashboard doesn't support session filtering yet, handled client-side
|
|
1602
|
-
const res = await fetch(url, { signal: AbortSignal.timeout(
|
|
1619
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(15000) });
|
|
1603
1620
|
if (!res.ok) throw new Error("HTTP " + res.status);
|
|
1604
1621
|
const data = await res.json();
|
|
1605
1622
|
setStatus("connected");
|
|
1623
|
+
if (fetchErrorCount > 0) {
|
|
1624
|
+
fetchErrorCount = 0;
|
|
1625
|
+
adjustRefreshInterval();
|
|
1626
|
+
}
|
|
1606
1627
|
render(data);
|
|
1607
1628
|
} catch (err) {
|
|
1608
1629
|
setStatus("error");
|
|
1630
|
+
fetchErrorCount++;
|
|
1631
|
+
adjustRefreshInterval();
|
|
1609
1632
|
console.warn("HSA fetch error:", err.message);
|
|
1610
1633
|
}
|
|
1611
1634
|
}
|