Improve timeout and progress bar while downloading sheets

pull/1/head
yflory 3 years ago
parent 777de599c3
commit 8846b2d10e

@ -126,7 +126,7 @@ define([
updateProgress.progress(data.progress); updateProgress.progress(data.progress);
if (data.progress === 1) { if (data.progress === 1) {
handler.stop(); handler.stop();
updateProgress.progress2(1); updateProgress.progress2(2);
} }
}); });
ctx.get({ ctx.get({
@ -142,6 +142,7 @@ define([
var dl = function () { var dl = function () {
saveAs(res.data, Util.fixFileName(name)+(res.ext || '')); saveAs(res.data, Util.fixFileName(name)+(res.ext || ''));
}; };
updateProgress.progress2(1);
cb(null, { cb(null, {
metadata: res.metadata, metadata: res.metadata,
content: res.data, content: res.data,
@ -199,9 +200,16 @@ define([
}); });
}; };
var timeout = 60000;
// OO pads can only be converted one at a time so we have to give them a
// bigger timeout value in case there are 5 of them in the current queue
if (['sheet', 'doc', 'presentation'].indexOf(parsed.type) !== -1) {
timeout = 180000;
}
to = setTimeout(function () { to = setTimeout(function () {
error('TIMEOUT'); error('TIMEOUT');
}, 60000); }, timeout);
setTimeout(function () { setTimeout(function () {
if (ctx.stop) { return; } if (ctx.stop) { return; }

@ -636,6 +636,11 @@ define([
var updateDecryptProgress = function (progressValue) { var updateDecryptProgress = function (progressValue) {
var text = Math.round(progressValue * 100) + '%'; var text = Math.round(progressValue * 100) + '%';
text += progressValue === 1 ? '' : ' (' + Messages.download_step2 + '...)'; text += progressValue === 1 ? '' : ' (' + Messages.download_step2 + '...)';
if (progressValue === 2) {
Messages.download_step3 = "Converting..."; // XXX
text = Messages.download_step3;
progressValue = 1;
}
$pv.text(text); $pv.text(text);
$pb.css({ $pb.css({
width: (progressValue * 100) + '%' width: (progressValue * 100) + '%'

@ -14,6 +14,7 @@ define([], function () {
var blob = new Blob([u8], {type: "application/bin;charset=utf-8"}); var blob = new Blob([u8], {type: "application/bin;charset=utf-8"});
cb(blob); cb(blob);
}, { }, {
timeout: 600000,
raw: true raw: true
}); });
}; };

Loading…
Cancel
Save