Sentry/assets/coffee/storage.coffee
Gregory Ballantine be030532ea
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fixed the hardware info tables to use the full section width
2022-08-23 23:59:05 -04:00

42 lines
1.3 KiB
CoffeeScript

si = require('systeminformation')
window.onload = () ->
# Set the option selector to trigger an info grab on element change
document.getElementById('diskSelector').addEventListener('change', () ->
updateDiskInfo(@value)
)
# Load GPUs into the selector
loadDisks()
# Run the updateGpuInfo function with the default value of 0
updateDiskInfo()
loadDisks = () ->
si.diskLayout()
.then((data) ->
console.log(data)
i = 0
while i < data.length
optionElem = document.createElement('option')
diskName = data[i].name + ' (' + data[i].device + ')'
optionElem.innerText = diskName
optionElem.setAttribute('value', i)
document.getElementById('diskSelector').appendChild(optionElem)
i++
).catch((error) ->
console.error(error)
)
updateDiskInfo = (diskId = 0) ->
si.diskLayout()
.then((data) ->
document.getElementById('diskInfo').innerText = data[diskId].name
document.getElementById('diskPath').innerText = data[diskId].device
document.getElementById('diskType').innerText = data[diskId].type
document.getElementById('diskSize').innerText = formatBytes(data[diskId].size)
document.getElementById('diskVendor').innerText = data[diskId].vendor
).catch((error) ->
console.error(error)
)