From 9d8678e421afbb13b915f8a3aea80c84d2569f26 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Wed, 8 Jun 2022 00:46:56 -0400 Subject: [PATCH] Added a basic temperature display to the CPU page --- assets/coffee/cpu.coffee | 3 +-- assets/coffee/gpu.coffee | 5 ++--- assets/sass/sentry.sass | 20 ++++++++++++++++++++ assets/twig/cpu.twig | 16 ++++++++++++---- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/assets/coffee/cpu.coffee b/assets/coffee/cpu.coffee index afd7780..b17a456 100644 --- a/assets/coffee/cpu.coffee +++ b/assets/coffee/cpu.coffee @@ -8,7 +8,6 @@ window.onload = () -> document.getElementById('cpuCores').innerText = data.physicalCores document.getElementById('cpuThreads').innerText = data.cores document.getElementById('cpuClock').innerText = data.speed - console.log(data) ).catch((error) -> console.error(error) ) @@ -20,7 +19,7 @@ setCpuTemp = () -> si.cpuTemperature() .then((data) -> document.getElementById('cpuTemp').innerText = data.main - console.log(data) + document.getElementById('cpuTempDisplay').children.item(0).style.height = (parseInt(data.main) + '%') ).catch((error) -> console.error(error) ) diff --git a/assets/coffee/gpu.coffee b/assets/coffee/gpu.coffee index d021370..79890ca 100644 --- a/assets/coffee/gpu.coffee +++ b/assets/coffee/gpu.coffee @@ -19,8 +19,8 @@ loadGpus = () -> while i < data.controllers.length optionElem = document.createElement('option') optionElem.innerText = data.controllers[i].model - optionElem.setAttribute 'value', i - document.getElementById('gpuSelector').appendChild optionElem + optionElem.setAttribute('value', i) + document.getElementById('gpuSelector').appendChild(optionElem) i++ ).catch((error) -> console.error(error) @@ -34,7 +34,6 @@ updateGpuInfo = (gpuId = 0) -> document.getElementById('gpuVendorId').innerText = data.controllers[gpuId].vendorId document.getElementById('gpuVram').innerText = data.controllers[gpuId].vram + 'MB' document.getElementById('gpuBus').innerText = data.controllers[gpuId].bus - console.log(data) ).catch((error) -> console.error(error) ) diff --git a/assets/sass/sentry.sass b/assets/sass/sentry.sass index 3377874..efb237b 100644 --- a/assets/sass/sentry.sass +++ b/assets/sass/sentry.sass @@ -40,6 +40,26 @@ button font-size: 2.5rem text-decoration: none +.tempGauge + position: relative + box-sizing: border-box + width: 100% + max-width: 175px + height: 300px + margin-left: auto + margin-right: auto + border: 4px solid #212121 + + .tempGaugeFill + display: block + position: absolute + left: 0 + bottom: 0 + box-sizing: border-box + width: 100% + height: 0 + background: pink + #header h1 text-align: center diff --git a/assets/twig/cpu.twig b/assets/twig/cpu.twig index a2c5b10..839489d 100644 --- a/assets/twig/cpu.twig +++ b/assets/twig/cpu.twig @@ -8,14 +8,22 @@
-

Sentry System Info

+

Sentry CPU Info

-
CPU Model: Random CPU
-

2c/4t @ 2.0Ghz

-

CPU temperature: 12°C

+
+
CPU Model: Random CPU
+

2c/4t @ 2.0Ghz

+

CPU temperature: 12°C

+
+ +
+
+
+
+