mirror of
https://github.com/9001/copyparty.git
synced 2026-06-19 04:32:26 -06:00
fix jank implementation of space used progress bar
This commit is contained in:
parent
db864b921d
commit
06b2ff3e56
|
|
@ -6989,6 +6989,7 @@ class HttpCli(object):
|
|||
zi = vn.flags["du_iwho"]
|
||||
h1 = ""
|
||||
h2 = ""
|
||||
space_used_percent = 0
|
||||
if zi and (
|
||||
zi == 9
|
||||
or (zi == 7 and self.uname != "*")
|
||||
|
|
@ -7016,6 +7017,8 @@ class HttpCli(object):
|
|||
h1 = humansize(free or 0)
|
||||
h2 = humansize(total)
|
||||
srv_info.append("{} free of {}".format(h1, h2))
|
||||
if(total > 0)
|
||||
space_used_percent = (total - (free or 0)) / total * 100
|
||||
elif zs:
|
||||
self.log("diskfree(%r): %s" % (abspath, zs), 3)
|
||||
|
||||
|
|
@ -7066,9 +7069,9 @@ class HttpCli(object):
|
|||
"files": [],
|
||||
"taglist": [],
|
||||
"srvinf": srv_infot,
|
||||
"space_free": float(h1.split()[0]),
|
||||
"space_total": float(h2.split()[0]),
|
||||
"space_unit": h2.split()[1],
|
||||
"space_used_percent": space_used_percent
|
||||
"space_free": h1,
|
||||
"space_total": h2,
|
||||
"acct": self.uname,
|
||||
"perms": perms,
|
||||
"cfg": vn.js_ls,
|
||||
|
|
@ -7093,9 +7096,9 @@ class HttpCli(object):
|
|||
"title": html_escape("%s %s" % (self.args.bname, self.vpath), crlf=True),
|
||||
"srv_info": srv_infot,
|
||||
"srv_name": srv_name,
|
||||
"space_free": float(h1.split()[0]),
|
||||
"space_total": float(h2.split()[0]),
|
||||
"space_unit": h2.split()[1],
|
||||
"space_used_percent": space_used_percent
|
||||
"space_free": h1,
|
||||
"space_total": h2,
|
||||
"dtheme": self.args.theme,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,11 +136,11 @@
|
|||
|
||||
|
||||
<div id="acc_button" class="popup_button">
|
||||
<div id="spaceFree" style="display: block;">{{ space_free }} {{ space_unit }} free of {{ space_total }} {{ space_unit }}</div>
|
||||
<div id="spaceFree" style="display: block;">{{ space_free }} free of {{ space_total }}</div>
|
||||
|
||||
<div id="space_bar" style="display: block; cursor: default;">
|
||||
<div id="spaceTotal_bar"></div>
|
||||
<div id="spaceUsed_bar" style="width: {{ (space_total - space_free) / space_total * 100 }}%;"></div>
|
||||
<div id="spaceUsed_bar" style="width: {{ space_used_percent }}%;"></div>
|
||||
</div>
|
||||
|
||||
<div id="acc_btnContent">
|
||||
|
|
|
|||
|
|
@ -7447,8 +7447,8 @@ var treectl = (function () {
|
|||
clmod(ebi('griden'), 'on', thegrid.en = dgrid);
|
||||
|
||||
srvinf = res.srvinf;
|
||||
ebi('spaceFree').innerHTML = (res.space_total - res.space_free) + ' ' + res.space_unit + ' free of ' + res.space_total + ' ' + res.space_unit;
|
||||
ebi('spaceUsed_bar').width = ((res.space_total - res.space_free) / res.space_total * 100) + '%';
|
||||
ebi('spaceFree').innerHTML = res.space_free + ' free of ' + res.space_total ;
|
||||
ebi('spaceUsed_bar').width = res.space_used_percent + '%';
|
||||
if (rtt !== null)
|
||||
srvinf += (srvinf ? '</span> // <span>rtt: ' : 'rtt: ') + rtt;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue