From 6452e927eaa5a38e7f4093eebe9cb5f32b6392bc Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 26 Aug 2021 00:40:12 +0200 Subject: [PATCH] download-eta accuracy + misc ux --- copyparty/web/browser.css | 7 +++++-- copyparty/web/browser.js | 6 +++--- copyparty/web/up2k.js | 19 +++++++++++-------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index e4db307d..72d2045d 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -1603,7 +1603,7 @@ html.light #bbox-overlay figcaption a { border-radius: .5em; border-width: .25em 0; width: 17em; - text-align: left; + text-align: center; white-space: nowrap; display: inline-block; font-family: 'scp', monospace, monospace; @@ -1618,10 +1618,13 @@ html.light #bbox-overlay figcaption a { display: unset; } #u2etaw { - width: 21em; + width: 18em; font-size: .94em; margin: 2.5em auto 1em auto; } +#u2etas.o #u2etaw { + width: 21em; +} #u2cards { padding: 1em 1em .3em 1em; margin: 0 auto -1.5em auto; diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 66054b00..e07f7778 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -103,9 +103,9 @@ ebi('op_up2k').innerHTML = ( '\n' + '
\n' + - ' hash: (nothing to do yet)
\n' + - ' send: (nothing to do yet)
\n' + - '
task: (nothing to do yet)\n' + + ' hash: (no uploads are queued yet)
\n' + + ' send: (no uploads are queued yet)
\n' + + '
done: (no uploads are queued yet)\n' + '
\n' + '
\n' + diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index ffe83d6d..f24b9a6b 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -903,6 +903,7 @@ function up2k_init(subtle) { td = (now - (etaref || now)) / 1000.0; etaref = now; + ebi('acc_info').innerHTML = st.time.busy.toFixed(1) + ' ' + (now / 1000).toFixed(1); if (!nhash) ebi('u2etah').innerHTML = 'Done ({0}, {1} files)'.format(humansize(st.bytes.hashed), pvis.ctr["ok"] + pvis.ctr["ng"]); @@ -920,23 +921,23 @@ function up2k_init(subtle) { var t = []; if (nhash) { st.time.hashing += td; - t.push(['u2etah', st.bytes.hashed, st.time.hashing]); + t.push(['u2etah', st.bytes.hashed, st.bytes.hashed, st.time.hashing]); } if (nsend) { st.time.uploading += td; - t.push(['u2etau', st.bytes.uploaded, st.time.uploading]); + t.push(['u2etau', st.bytes.uploaded, st.bytes.finished, st.time.uploading]); } if (nhash || nsend) { st.time.busy += td; - t.push(['u2etat', st.bytes.finished, st.time.busy]); + t.push(['u2etat', st.bytes.finished, st.bytes.finished, st.time.busy]); } for (var a = 0; a < t.length; a++) { - var rem = st.bytes.total - t[a][1], - bps = t[a][1] / t[a][2], + var rem = st.bytes.total - t[a][2], + bps = t[a][1] / t[a][3], eta = Math.floor(rem / bps); - if (t[a][1] < 1024 || t[a][2] < 0.1) { - ebi(t[a][0]).innerHTML = '(nothing to do yet)'; + if (t[a][1] < 1024 || t[a][3] < 0.1) { + ebi(t[a][0]).innerHTML = '(no uploads are queued yet)'; continue; } @@ -1058,8 +1059,10 @@ function up2k_init(subtle) { etafun(); timer.rm(etafun); } - else + else { timer.add(etafun); + ebi('u2etas').style.textAlign = 'left'; + } } if (flag) {