fix visual glitches in upload ui

This commit is contained in:
ed 2022-09-07 00:38:19 +02:00
parent e6b12ef14c
commit 8f5bae95ce
2 changed files with 16 additions and 5 deletions

View file

@ -310,7 +310,6 @@ var Ls = {
"u_etaprep": '(preparing to upload)', "u_etaprep": '(preparing to upload)',
"u_hashdone": 'hashing done', "u_hashdone": 'hashing done',
"u_hashing": 'hash', "u_hashing": 'hash',
"u_upping": 'uploading',
"u_fixed": "OK!  Fixed it 👍", "u_fixed": "OK!  Fixed it 👍",
"u_cuerr": "failed to upload chunk {0} of {1};\nprobably harmless, continuing\n\nfile: {2}", "u_cuerr": "failed to upload chunk {0} of {1};\nprobably harmless, continuing\n\nfile: {2}",
"u_cuerr2": "server rejected upload (chunk {0} of {1});\nwill retry later\n\nfile: {2}\n\nerror ", "u_cuerr2": "server rejected upload (chunk {0} of {1});\nwill retry later\n\nfile: {2}\n\nerror ",
@ -653,7 +652,6 @@ var Ls = {
"u_etaprep": '(forbereder opplastning)', "u_etaprep": '(forbereder opplastning)',
"u_hashdone": 'befaring ferdig', "u_hashdone": 'befaring ferdig',
"u_hashing": 'les', "u_hashing": 'les',
"u_upping": 'sender',
"u_fixed": "OK!  Løste seg 👍", "u_fixed": "OK!  Løste seg 👍",
"u_cuerr": "kunne ikke laste opp del {0} av {1};\nsikkert harmløst, fortsetter\n\nfil: {2}", "u_cuerr": "kunne ikke laste opp del {0} av {1};\nsikkert harmløst, fortsetter\n\nfil: {2}",
"u_cuerr2": "server nektet opplastningen (del {0} av {1});\nprøver igjen senere\n\nfil: {2}\n\nerror ", "u_cuerr2": "server nektet opplastningen (del {0} av {1});\nprøver igjen senere\n\nfil: {2}\n\nerror ",

View file

@ -267,6 +267,9 @@ function U2pvis(act, btns, uc, st) {
fo.cb[nchunk] = cbd; fo.cb[nchunk] = cbd;
fo.bd += delta; fo.bd += delta;
if (!fo.bd)
return;
var p = r.perc(fo.bd, fo.bd0, fo.bt, fobj.t_uploading); var p = r.perc(fo.bd, fo.bd0, fo.bt, fobj.t_uploading);
fo.hp = f2f(p[0], 2) + '%, ' + p[1] + ', ' + f2f(p[2], 2) + ' MB/s'; fo.hp = f2f(p[0], 2) + '%, ' + p[1] + ', ' + f2f(p[2], 2) + ' MB/s';
@ -2093,7 +2096,7 @@ function up2k_init(subtle) {
'npart': t.postlist[a] 'npart': t.postlist[a]
}); });
msg = L.u_upping; msg = null;
done = false; done = false;
if (sort) if (sort)
@ -2103,7 +2106,10 @@ function up2k_init(subtle) {
a.npart < b.npart ? -1 : 1; a.npart < b.npart ? -1 : 1;
}); });
} }
if (msg)
pvis.seth(t.n, 1, msg); pvis.seth(t.n, 1, msg);
apop(st.busy.handshake, t); apop(st.busy.handshake, t);
if (done) { if (done) {
@ -2207,7 +2213,14 @@ function up2k_init(subtle) {
function can_upload_next() { function can_upload_next() {
var upt = st.todo.upload[0], var upt = st.todo.upload[0],
upf = st.files[upt.nfile]; upf = st.files[upt.nfile],
now = Date.now();
for (var a = 0, aa = st.busy.handshake.length; a < aa; a++) {
var hs = st.busy.handshake[a];
if (hs.n < upt.nfile && hs.t_busied > now - 10 * 1000 && !st.files[hs.n].bytes_uploaded)
return false; // handshake race; wait for lexically first
}
if (upf.sprs) if (upf.sprs)
return true; return true;