aboutsummaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/dashboard.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/static/dashboard.js b/static/dashboard.js
index 70fdd6c..adf690e 100644
--- a/static/dashboard.js
+++ b/static/dashboard.js
@@ -117,7 +117,7 @@ const SKELETON = `
<div class="chip c-cpu"><svg viewBox="0 0 120 100" preserveAspectRatio="none"><path class="hy"/></svg>
<i class="nf ic">${G.cpu}</i><span class="col"><span class="n"></span><span class="v num"></span></span><span class="s"></span></div>
<div class="chip c-mem"><i class="fill"></i><i class="nf ic">${G.mem}</i><span class="v num"></span><span class="s"></span></div>
- <div class="chip c-gpu"><i class="fill"></i>
+ <div class="chip c-gpu"><svg viewBox="0 0 120 100" preserveAspectRatio="none"><path class="hy"/></svg>
<i class="nf ic">${G.gpu}</i><span class="col"><span class="n"></span><span class="v num"></span></span><span class="s"></span></div>
<div class="chip c-net"><svg viewBox="0 0 120 100" preserveAspectRatio="none"><path class="hy"/><path class="up"/></svg>
<i class="nf ic">${G.net}</i><span class="v num"></span></div>
@@ -162,7 +162,7 @@ export default {
$(".c-bat").hidden = $(".c-wifi").hidden = !on.has("tablet");
$(".dash-music").hidden = !on.has("music");
- const hist = { cpu: [], down: [], up: [] };
+ const hist = { cpu: [], gpu: [], down: [], up: [] };
if (on.has("stats")) poll("stats", 1, (st) => {
$(".logo").textContent = DISTRO[st.os?.id] ?? G.tux;
$(".os").textContent = st.os?.name ?? "";
@@ -182,9 +182,15 @@ export default {
$(".c-gpu").hidden = !g;
if (g) {
$(".c-gpu .n").textContent = g.name ?? "";
- chip(".c-gpu", g.temp != null ? `${g.temp}°C` : "—",
- g.memTotal ? `${gib(g.memUsed)} / ${Math.round(g.memTotal / 2 ** 30)} GiB` : `${gib(g.memUsed)} GiB`,
- g.memTotal ? (100 * g.memUsed) / g.memTotal : 0, g.temp >= 85);
+ // Like the CPU chip: usage on a trend, temperature beside it. VRAM
+ // and fan are on keystone's performance page. Without usage (an
+ // older kernel) the temperature takes the big value.
+ if (g.util != null) {
+ push(hist.gpu, g.util);
+ $(".c-gpu path").setAttribute("d", area(hist.gpu, Math.max(25, ...hist.gpu)));
+ }
+ const t = g.temp != null ? `${g.temp}°C` : "—";
+ chip(".c-gpu", g.util != null ? `${g.util}%` : t, g.util != null ? t : "", null, g.temp >= 85);
}
const max = Math.max(1, ...hist.down, ...hist.up);
const [down, up] = $(".c-net").querySelectorAll("path");