// Dashboard view
function MetricCard({ label, value, unit, delta, spark, sparkColor }) {
return (
{label}
{value}{unit && {unit}}
{delta != null && (
= 0 ? "up" : "down")}>
{delta >= 0 ? "▲" : "▼"} {Math.abs(delta).toFixed(1)}%
)}
{spark && (
)}
);
}
function Dashboard({ instances, onOpenInstance, onNav }) {
const active = instances.filter(i => i.status === "active").length;
const trial = instances.filter(i => i.status === "trial").length;
const errored = instances.filter(i => i.status === "error").length;
const totalTokens = instances.reduce((a, i) => a + i.tokensIn + i.tokensOut, 0);
const totalCost = instances.reduce((a, i) => a + i.cost, 0);
const totalMsgs = instances.reduce((a, i) => a + i.messages, 0);
// Usage over time — synthesize 30 days
const days = Array.from({ length: 30 }, (_, i) => i);
const seriesIn = days.map((d) => 300_000 + Math.sin(d / 3) * 60_000 + Math.random() * 40_000 + d * 4_000);
const seriesOut = days.map((d) => 80_000 + Math.cos(d / 4) * 18_000 + Math.random() * 12_000 + d * 1_400);
const dayLabels = days.map((d) => {
const dt = new Date(2026, 2, 22 + d);
return `${dt.getDate()}.${dt.getMonth() + 1}`;
});
const recent = [...instances].sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, 5);
return (
Dashboard
Agency overview · 12 active OpenClaw instances across your book
Token consumption
· last 30 days, all instances
Input
Output
Instance health
i.status==='paused').length} total={instances.length} color="var(--text-mute)" />
i.status==='archived').length} total={instances.length} color="var(--text-mute)" />
Uptime (agency avg, 30d)
99.84%
Instances
· {instances.length} total
{instances.map((inst) => (
))}
Recently launched
| Instance |
Status |
Created |
Cost MTD |
{recent.map((inst) => (
onOpenInstance(inst.id)}>
|
|
|
{inst.createdAt} |
{fmtEur(inst.cost)} |
))}
Needs attention
onOpenInstance('nordflow-logistics')}/>
onNav('keys')}/>
onOpenInstance('vinzenz-klinik')}/>
);
}
function HealthRow({ label, count, total, color }) {
const pct = (count / total) * 100;
return (
);
}
function AttnRow({ type, title, msg, cta, onClick }) {
const colorMap = { error: "var(--rose)", warn: "var(--amber)", info: "var(--blue)" };
const iconMap = { error: "alert", warn: "alert", info: "clock" };
return (
);
}
window.Dashboard = Dashboard;