Added a basic temperature display to the CPU page
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2022-06-08 00:46:56 -04:00
parent 5b42a1ef05
commit 9d8678e421
4 changed files with 35 additions and 9 deletions

View File

@ -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)
)

View File

@ -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)
)

View File

@ -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

View File

@ -8,14 +8,22 @@
<header class="row">
<div class="columns twelve u-text-center">
<h1>Sentry System Info</h1>
<h1>Sentry CPU Info</h1>
</div>
</header>
<section class="row">
<article class="columns eight">
<h5>CPU Model: <span id="cpuInfo">Random CPU</span></h5>
<p><span id="cpuCores">2</span>c/<span id="cpuThreads">4</span>t @ <span id="cpuClock">2.0</span>Ghz</p>
<p>CPU temperature: <span id="cpuTemp">12</span>&deg;C</p>
</article>
<article class="columns four">
<div id="cpuTempDisplay" class="tempGauge">
<div class="tempGaugeFill"></div>
</div>
</article>
</section>
<section class="row">