@blockrun/franklin 3.6.12 → 3.6.13
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/dist/panel/html.js +14 -4
- package/dist/panel/server.js +5 -1
- package/package.json +1 -1
package/dist/panel/html.js
CHANGED
|
@@ -456,6 +456,13 @@ async function loadOverview() {
|
|
|
456
456
|
api('wallet'), api('stats'), api('insights?days=30')
|
|
457
457
|
]);
|
|
458
458
|
|
|
459
|
+
// Surface API errors so users see "offline" instead of silent "—"
|
|
460
|
+
if (!wallet && !stats) {
|
|
461
|
+
const err = document.getElementById('total-cost');
|
|
462
|
+
if (err) err.textContent = 'API offline';
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
459
466
|
if (wallet) {
|
|
460
467
|
document.getElementById('balance').textContent = usdBig(wallet.balance) + ' USDC';
|
|
461
468
|
document.getElementById('wallet-chain').textContent = wallet.chain;
|
|
@@ -495,11 +502,14 @@ async function loadOverview() {
|
|
|
495
502
|
).join('');
|
|
496
503
|
}
|
|
497
504
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
505
|
+
// Backend returns insights.daily with [{date, requests, costUsd}]
|
|
506
|
+
const dailyData = insights && (insights.daily || insights.dailyCosts);
|
|
507
|
+
if (dailyData && dailyData.length) {
|
|
508
|
+
const days = dailyData.slice(-30);
|
|
509
|
+
const getCost = (d) => d.costUsd !== undefined ? d.costUsd : d.cost || 0;
|
|
510
|
+
const maxDay = Math.max(...days.map(getCost), 0.001);
|
|
501
511
|
document.getElementById('daily-chart').innerHTML = days.map(d =>
|
|
502
|
-
'<div class="daily-bar" data-tip="' + d.date + ': ' + usd(d
|
|
512
|
+
'<div class="daily-bar" data-tip="' + d.date + ': ' + usd(getCost(d)) + '" style="height:' + Math.max(getCost(d)/maxDay*100, 2) + '%"></div>'
|
|
503
513
|
).join('');
|
|
504
514
|
}
|
|
505
515
|
}
|
package/dist/panel/server.js
CHANGED
|
@@ -40,7 +40,11 @@ export function createPanelServer(port) {
|
|
|
40
40
|
const p = url.pathname;
|
|
41
41
|
// ─── HTML ──
|
|
42
42
|
if (p === '/') {
|
|
43
|
-
res.writeHead(200, {
|
|
43
|
+
res.writeHead(200, {
|
|
44
|
+
'Content-Type': 'text/html; charset=utf-8',
|
|
45
|
+
'Cache-Control': 'no-store, no-cache, must-revalidate',
|
|
46
|
+
'Pragma': 'no-cache',
|
|
47
|
+
});
|
|
44
48
|
res.end(html);
|
|
45
49
|
return;
|
|
46
50
|
}
|
package/package.json
CHANGED