Sentry/assets/coffee/sentry.coffee
Gregory Ballantine c878447c45
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Changed to using a tabbed layout instead of separate pages for everything
2022-10-28 01:06:09 -04:00

29 lines
619 B
CoffeeScript

@openTab = (tab) ->
displays = document.querySelectorAll('.component-display')
i = 0
while i < displays.length
if displays[i].getAttribute('data-component') == tab
displays[i].classList.add('active')
else
displays[i].classList.remove('active')
i++
@formatBytes = (bytes, decimals = 2) ->
if bytes == 0
return '0 Bytes'
k = 1024
dm = if decimals < 0 then 0 else decimals
sizes = [
'Bytes'
'KB'
'MB'
'GB'
'TB'
'PB'
'EB'
'ZB'
'YB'
]
i = Math.floor(Math.log(bytes) / Math.log(k))
parseFloat((bytes / k ** i).toFixed(dm)) + ' ' + sizes[i]