Unslop du dashboard : rampe graphite, accent rose à plat, Geist, grille de 4px

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 22:30:55 +01:00
co-authored by Claude Sonnet 5.5
Unverified
parent f247858bb2
commit 7b45a729fe
+69 -56
View File
@@ -6,74 +6,85 @@
<title>Proxmox Dashboard</title> <title>Proxmox Dashboard</title>
<link rel="icon" type="image/png" href="https://sunshine.li/uploads/ethansun/S.png"> <link rel="icon" type="image/png" href="https://sunshine.li/uploads/ethansun/S.png">
<link rel="apple-touch-icon" href="https://sunshine.li/uploads/ethansun/S.png"> <link rel="apple-touch-icon" href="https://sunshine.li/uploads/ethansun/S.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500&family=Geist+Mono:wght@400;500&display=swap">
<style> <style>
:root { :root {
--bg: #07070a; --card: #101015; --card2: #16161d; --line: #23232d; --bg: #141415; --card: #19191b; --raised: #232325; --line: rgba(237,237,237,.08);
--text: #f2f2f5; --muted: #8a8a98; --pink: #ff2e93; --pink2: #ff7ac0; --text: #ededed; --text2: #a1a1a6; --muted: #85858b;
--ok: #34d399; --warn: #fbbf24; --bad: #f87171; --accent: #ff2e93;
--r: 18px; --ok: #4cc38a; --warn: #d9a441; --bad: #e5484d;
--ease: cubic-bezier(.22, 1, .36, 1);
--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
} }
* { box-sizing: border-box; margin: 0; } * { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 -apple-system, "Inter", "Segoe UI", sans-serif; padding: 24px 16px 48px; } body { background: var(--bg); color: var(--text); font: 400 14px/20px "Geist", -apple-system, "Inter", "Segoe UI", sans-serif; padding: 32px 24px 64px; }
.wrap { max-width: 1400px; margin: 0 auto; } .wrap { max-width: 1440px; margin: 0 auto; }
header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; } header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; } h1 { font-size: 18px; line-height: 24px; font-weight: 500; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: rgba(52,211,153,.12); color: var(--ok); border: 1px solid rgba(52,211,153,.3); } .pill { display: inline-flex; align-items: center; gap: 8px; font: 400 12px/16px var(--mono); color: var(--text2); }
.pill.bad { background: rgba(248,113,113,.12); color: var(--bad); border-color: rgba(248,113,113,.3); } .pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pill.bad::before { background: var(--bad); }
.spacer { flex: 1; } .spacer { flex: 1; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; } .clock { color: var(--muted); font: 400 12px/16px var(--mono); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; } .seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 4px 12px; border-radius: 8px; cursor: pointer; font: inherit; } .seg button { background: none; border: 0; color: var(--muted); height: 28px; padding: 0 12px; border-radius: 8px; cursor: pointer; font: inherit; transition: color 150ms var(--ease), background-color 150ms var(--ease); }
.seg button.on { background: #2a2a35; color: var(--text); } .seg button:hover { color: var(--text); }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; font-weight: 600; } .seg button.on { background: var(--raised); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
h2 { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--text2); margin: 40px 0 12px; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; } .totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; } .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; }
@media (max-width: 480px) { .grid { grid-template-columns: 1fr; } } @media (max-width: 480px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset; } .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card.off { opacity: .55; } .card.off { opacity: .55; }
.label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; } .label { font-size: 12px; line-height: 16px; color: var(--muted); }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; } .big { font-size: 28px; line-height: 36px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 4px; }
.big small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; } .big small { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; } .sub { color: var(--muted); font-size: 12px; line-height: 16px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.nodehead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; } .nodehead { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); } .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.off .dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); } .off .dot { background: var(--bad); }
.nodename { font-weight: 700; font-size: 16px; } .nodename { font-weight: 500; font-size: 16px; line-height: 24px; }
.ip { color: var(--muted); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; } .ip { color: var(--muted); font: 400 12px/16px var(--mono); margin-left: auto; font-variant-numeric: tabular-nums; }
.nodebody { display: grid; grid-template-columns: 150px 1fr; gap: 18px; } .nodebody { display: grid; grid-template-columns: 160px 1fr; gap: 24px; }
@media (max-width: 480px) { .nodebody { grid-template-columns: 1fr; } } @media (max-width: 480px) { .nodebody { grid-template-columns: 1fr; } }
.temp { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; } .temp { font-size: 32px; line-height: 40px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 4px; }
.temp small { font-size: 14px; color: var(--muted); font-weight: 500; } .temp small { font-size: 14px; color: var(--muted); font-weight: 400; }
.spark { width: 100%; height: 56px; margin-top: 8px; display: block; } .spark { width: 100%; height: 56px; margin-top: 8px; display: block; }
.bar { margin-bottom: 9px; } .bar { margin-bottom: 12px; }
.bar .row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; } .bar:last-child { margin-bottom: 0; }
.bar .row b { font-weight: 500; color: var(--muted); } .bar .row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; line-height: 16px; margin-bottom: 4px; }
.bar .row span { font-variant-numeric: tabular-nums; } .bar .row b { font-weight: 400; color: var(--muted); }
.track { height: 5px; background: #24242e; border-radius: 9px; overflow: hidden; } .bar .row span { font-variant-numeric: tabular-nums; color: var(--text2); }
.fill { height: 100%; background: linear-gradient(90deg, var(--pink), var(--pink2)); border-radius: 9px; transition: width .6s; } .track { height: 4px; background: var(--raised); border-radius: 2px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); border-radius: 2px; }
.fill.warn { background: var(--warn); } .fill.bad { background: var(--bad); } .fill.warn { background: var(--warn); } .fill.bad { background: var(--bad); }
.foot { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; } .foot { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font: 400 12px/16px var(--mono); font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-size: 13px; } table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; }
th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px; } th { text-align: left; font-size: 12px; line-height: 16px; color: var(--muted); font-weight: 400; padding: 8px 12px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; } th.sortable { cursor: pointer; user-select: none; white-space: nowrap; transition: color 150ms var(--ease); }
th.sortable:hover { color: var(--text); } th.sortable:hover { color: var(--text); }
td { padding: 8px 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; } th svg { width: 12px; height: 12px; margin-left: 4px; vertical-align: -2px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tablecard { padding: 8px 8px; overflow-x: auto; } td { padding: 8px 12px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 6px; background: #22222c; color: var(--muted); } tr:hover td { background: rgba(237,237,237,.02); }
.st { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 6px; } .tablecard { padding: 8px; overflow-x: auto; }
.tag { font: 400 11px/16px var(--mono); padding: 0 6px; border-radius: 4px; background: var(--raised); color: var(--text2); }
.st { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 8px; }
.st.running { background: var(--ok); } .st.stopped { background: var(--bad); } .st.running { background: var(--ok); } .st.stopped { background: var(--bad); }
.mini { width: 70px; display: inline-block; vertical-align: middle; } .mini { width: 72px; display: inline-block; vertical-align: middle; }
#err { display: none; margin-bottom: 14px; padding: 10px 14px; border-radius: 12px; background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--bad); } #err { display: none; margin-bottom: 16px; padding: 12px 16px; border-radius: 10px; background: rgba(229,72,77,.08); border: 1px solid rgba(229,72,77,.24); color: var(--bad); }
</style> </style>
</head> </head>
<body> <body>
<div class="wrap"> <div class="wrap">
<header> <header>
<h1>proxmox</h1> <h1>Proxmox</h1>
<span class="pill" id="clusterPill">…</span> <span class="pill" id="clusterPill">…</span>
<span class="spacer"></span> <span class="spacer"></span>
<div class="seg" id="range"> <div class="seg" id="range">
@@ -90,7 +101,7 @@
<h2>Nodes</h2> <h2>Nodes</h2>
<div class="grid" id="nodes"></div> <div class="grid" id="nodes"></div>
<h2>VM &amp; conteneurs</h2> <h2>VM et conteneurs</h2>
<div class="card tablecard"><table id="guests"></table></div> <div class="card tablecard"><table id="guests"></table></div>
<h2>Stockage</h2> <h2>Stockage</h2>
@@ -98,6 +109,8 @@
</div> </div>
<script> <script>
const ARROW_UP = '<svg viewBox="0 0 24 24"><path d="m5 12 7-7 7 7M12 19V5"/></svg>';
const ARROW_DOWN = '<svg viewBox="0 0 24 24"><path d="M12 5v14m7-7-7 7-7-7"/></svg>';
const $ = (id) => document.getElementById(id); const $ = (id) => document.getElementById(id);
let range = 3600, data = null, hist = {}; let range = 3600, data = null, hist = {};
let sort = { key: 'vmid', dir: 1 }; let sort = { key: 'vmid', dir: 1 };
@@ -131,11 +144,11 @@ function spark(points, idx, min, max) {
const lo = min ?? Math.min(...vals) - 2, hi = max ?? Math.max(...vals) + 2; const lo = min ?? Math.min(...vals) - 2, hi = max ?? Math.max(...vals) + 2;
const W = 300, H = 56; const W = 300, H = 56;
const xy = pts.map((p) => `${((p[0] - t0) / (t1 - t0 || 1) * W).toFixed(1)},${(H - (p[idx] - lo) / (hi - lo || 1) * (H - 4) - 2).toFixed(1)}`); const xy = pts.map((p) => `${((p[0] - t0) / (t1 - t0 || 1) * W).toFixed(1)},${(H - (p[idx] - lo) / (hi - lo || 1) * (H - 4) - 2).toFixed(1)}`);
const id = 'g' + idx + Math.random().toString(36).slice(2, 6);
return `<svg class="spark" viewBox="0 0 ${W} ${H}" preserveAspectRatio="none"> return `<svg class="spark" viewBox="0 0 ${W} ${H}" preserveAspectRatio="none">
<defs><linearGradient id="${id}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ff2e93" stop-opacity=".35"/><stop offset="1" stop-color="#ff2e93" stop-opacity="0"/></linearGradient></defs> <line x1="0" x2="${W}" y1="0.5" y2="0.5" stroke="rgba(237,237,237,.08)" vector-effect="non-scaling-stroke"/>
<polygon points="0,${H} ${xy.join(' ')} ${W},${H}" fill="url(#${id})"/> <line x1="0" x2="${W}" y1="${H / 2}" y2="${H / 2}" stroke="rgba(237,237,237,.08)" vector-effect="non-scaling-stroke"/>
<polyline points="${xy.join(' ')}" fill="none" stroke="#ff2e93" stroke-width="1.8" vector-effect="non-scaling-stroke" stroke-linejoin="round"/></svg>`; <line x1="0" x2="${W}" y1="${H - 0.5}" y2="${H - 0.5}" stroke="rgba(237,237,237,.08)" vector-effect="non-scaling-stroke"/>
<polyline points="${xy.join(' ')}" fill="none" stroke="#ff2e93" stroke-width="1.5" vector-effect="non-scaling-stroke" stroke-linejoin="round" stroke-linecap="round"/></svg>`;
} }
function render() { function render() {
@@ -187,16 +200,16 @@ function render() {
<div class="foot"> <div class="foot">
<span>up ${fmtUp(n.uptime)}</span> <span>up ${fmtUp(n.uptime)}</span>
<span>load ${n.load ? n.load.map((x) => x.toFixed(2)).join(' ') : '–'}</span> <span>load ${n.load ? n.load.map((x) => x.toFixed(2)).join(' ') : '–'}</span>
<span>${guests} invité(s) actif(s)</span> <span>${guests} actifs</span>
${n.pveVersion ? `<span>${esc(n.pveVersion.replace('pve-manager/', 'PVE ').split('/')[0])}</span>` : ''} ${n.pveVersion ? `<span>${esc(n.pveVersion.replace('pve-manager/', 'PVE ').split('/')[0])}</span>` : ''}
</div> </div>
${n.cpuModel ? `<div class="sub" style="margin-top:6px">${esc(n.cpuModel)}</div>` : ''} ${n.cpuModel ? `<div class="sub" style="margin-top:8px">${esc(n.cpuModel)}</div>` : ''}
</div>`; </div>`;
}).join(''); }).join('');
// invités // invités
const cols = [['vmid', 'ID'], ['name', 'Nom'], ['type', 'Type'], ['node', 'Node'], ['status', 'État'], ['cpu', 'CPU'], ['mem', 'RAM'], ['uptime', 'Uptime']]; const cols = [['vmid', 'ID'], ['name', 'Nom'], ['type', 'Type'], ['node', 'Node'], ['status', 'État'], ['cpu', 'CPU'], ['mem', 'RAM'], ['uptime', 'Uptime']];
const th = cols.map(([k, l]) => `<th class="sortable" data-k="${k}">${l}${sort.key === k ? (sort.dir > 0 ? ' ▲' : ' ▼') : ''}</th>`).join(''); const th = cols.map(([k, l]) => `<th class="sortable" data-k="${k}">${l}${sort.key === k ? (sort.dir > 0 ? ARROW_UP : ARROW_DOWN) : ''}</th>`).join('');
const sortedGuests = [...data.guests].sort((a, b) => { const sortedGuests = [...data.guests].sort((a, b) => {
let x = a[sort.key], y = b[sort.key]; let x = a[sort.key], y = b[sort.key];
// valeurs vides (VM arrêtées) toujours en bas // valeurs vides (VM arrêtées) toujours en bas
@@ -220,7 +233,7 @@ function render() {
const p = pct(s.disk, s.maxdisk); const p = pct(s.disk, s.maxdisk);
return `<tr><td>${esc(s.id)}</td><td>${s.shared ? '<span class="tag">partagé</span>' : esc(s.node)}</td><td>${esc(s.plugintype || '')}</td> return `<tr><td>${esc(s.id)}</td><td>${s.shared ? '<span class="tag">partagé</span>' : esc(s.node)}</td><td>${esc(s.plugintype || '')}</td>
<td>${fmtBytes(s.disk)} / ${fmtBytes(s.maxdisk)} · ${p.toFixed(0)}%</td> <td>${fmtBytes(s.disk)} / ${fmtBytes(s.maxdisk)} · ${p.toFixed(0)}%</td>
<td><div class="track mini"><div class="fill ${cls(p)}" style="width:${p}%"></div></div></td></tr>`; <td><div class="track mini"><div class="fill ${cls(p)}" style="width:${Math.min(100, p).toFixed(1)}%"></div></div></td></tr>`;
}).join(''); }).join('');
} }