mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-02 23:53:56 +08:00
update 2026-09-26 11:07:27
This commit is contained in:
1 parent
7b88b273d0
commit
97ae9f68da
4898 files changed
-1712274
No files matched your search
@@ -1,21 +0,0 @@
|
||||
<script type="text/javascript">
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
function niceBytes(x) {
|
||||
let l = 0, n = parseInt(x, 10) || 0;
|
||||
while (n >= 1024 && ++l) {
|
||||
n = n / 1024;
|
||||
}
|
||||
return (n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]);
|
||||
}
|
||||
|
||||
fnWindowLoad = function () {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin/docker/get_system_df")%>/', null, (x, info)=>{
|
||||
if(!info || !info.Volumes || !info.Volumes.forEach) return
|
||||
info.Volumes.forEach(item=>{
|
||||
console.log(info)
|
||||
const size_c = document.getElementsByClassName("volume_size_" + item.Name)
|
||||
size_c[0].innerText = item.UsageData ? niceBytes(item.UsageData.Size) : '-'
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user