From fb1d0fc66475ee64991ebbcd0f7d2f729b204529 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Wed, 25 May 2022 16:23:42 -0400 Subject: [PATCH] Added a CPU info page with some rudimentary CPU temperature polling --- assets/coffee/{index.coffee => cpu.coffee} | 18 +++++----- assets/coffee/gpu.coffee | 10 ++++++ assets/sass/sentry.sass | 10 ++++++ assets/twig/cpu.twig | 27 ++++++++++++++ assets/twig/index.twig | 42 +++++++++------------- assets/twig/layout.twig | 2 +- 6 files changed, 74 insertions(+), 35 deletions(-) rename assets/coffee/{index.coffee => cpu.coffee} (55%) create mode 100644 assets/coffee/gpu.coffee create mode 100644 assets/twig/cpu.twig diff --git a/assets/coffee/index.coffee b/assets/coffee/cpu.coffee similarity index 55% rename from assets/coffee/index.coffee rename to assets/coffee/cpu.coffee index 75f3463..afd7780 100644 --- a/assets/coffee/index.coffee +++ b/assets/coffee/cpu.coffee @@ -1,13 +1,22 @@ si = require('systeminformation') window.onload = () -> + # Grab the static CPU information si.cpu() .then((data) -> document.getElementById('cpuInfo').innerText = data.brand + 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) ) + + # Start the CPU temperature loop + setCpuTemp() + +setCpuTemp = () -> si.cpuTemperature() .then((data) -> document.getElementById('cpuTemp').innerText = data.main @@ -15,11 +24,4 @@ window.onload = () -> ).catch((error) -> console.error(error) ) - - si.graphics() - .then((data) -> - document.getElementById('gpuInfo').innerText = data.controllers[0].model - console.log(data) - ).catch((error) -> - console.error(error) - ) + setTimeout(setCpuTemp, 2000) diff --git a/assets/coffee/gpu.coffee b/assets/coffee/gpu.coffee new file mode 100644 index 0000000..068ee6a --- /dev/null +++ b/assets/coffee/gpu.coffee @@ -0,0 +1,10 @@ +si = require('systeminformation') + +window.onload = () -> + si.graphics() + .then((data) -> + document.getElementById('gpuInfo').innerText = data.controllers[0].model + console.log(data) + ).catch((error) -> + console.error(error) + ) diff --git a/assets/sass/sentry.sass b/assets/sass/sentry.sass index 8e69506..52cc0a1 100644 --- a/assets/sass/sentry.sass +++ b/assets/sass/sentry.sass @@ -30,6 +30,16 @@ button .container.fluid max-width: 100% +.pageLink + text-decoration: none + i + font-size: 10rem + p + margin-top: 10px + color: #212121 + font-size: 2.5rem + text-decoration: none + #header h1 text-align: center diff --git a/assets/twig/cpu.twig b/assets/twig/cpu.twig new file mode 100644 index 0000000..a2c5b10 --- /dev/null +++ b/assets/twig/cpu.twig @@ -0,0 +1,27 @@ +{% extends 'layout.twig' %} + +{% block scripts %} + +{% endblock %} + +{% block content %} + +
+
+

Sentry System Info

+
+
+ +
+
CPU Model: Random CPU
+

2c/4t @ 2.0Ghz

+

CPU temperature: 12°C

+
+ +
+
+ Back +
+
+ +{% endblock %} diff --git a/assets/twig/index.twig b/assets/twig/index.twig index ac2f251..b84c98d 100644 --- a/assets/twig/index.twig +++ b/assets/twig/index.twig @@ -1,39 +1,29 @@ {% extends 'layout.twig' %} -{% block scripts %} - -{% endblock %} - {% block content %}
-

Sentry System Info

+

Sentry System Monitor

- - - - - - - - - - - - - - - - - - - - -
HW TypeHardware Model Info.Current Temp.
CPU
GPU
+ + + + +
{% endblock %} diff --git a/assets/twig/layout.twig b/assets/twig/layout.twig index a695015..ae86657 100644 --- a/assets/twig/layout.twig +++ b/assets/twig/layout.twig @@ -3,8 +3,8 @@ - + Sentry System Monitor