Added a temperature reading for the current selected disk
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2022-08-24 00:23:36 -04:00
parent be030532ea
commit a23827355a
2 changed files with 24 additions and 1 deletions

View File

@ -12,10 +12,12 @@ window.onload = () ->
# Run the updateGpuInfo function with the default value of 0
updateDiskInfo()
# Start running our function to update the drive's temperature
setDiskTemp()
loadDisks = () ->
si.diskLayout()
.then((data) ->
console.log(data)
i = 0
while i < data.length
optionElem = document.createElement('option')
@ -39,3 +41,20 @@ updateDiskInfo = (diskId = 0) ->
).catch((error) ->
console.error(error)
)
setDiskTemp = (diskId = -1) ->
selector = document.getElementById('diskSelector')
if selector.length < 1
return
if (diskId = -1)
diskId = selector.value
si.diskLayout()
.then((data) ->
if (data[diskId].temperature)
document.getElementById('diskTemp').innerText = data[diskId].temperature
).catch((error) ->
console.error(error)
)
setTimeout(setDiskTemp, 2000)

View File

@ -34,6 +34,10 @@
<td>Vendor</td>
<td><span id="diskVendor">N/a</span></td>
</tr>
<tr>
<td>Current Temperature</td>
<td><span id="diskTemp">N/a</span></td>
</tr>
</tbody>
</table>
</article>