Improve UX when maxUploadSize is reached in sheets

pull/1/head
yflory 4 years ago
parent 0c3d4b0e49
commit ffe9f4db0f

@ -356,10 +356,32 @@ define([
}
};
Messages.oo_cantMigrate = "This sheet exceeds the maximum upload size and is too large to be migrated."; // XXX
var onUploaded = function (ev, data, err) {
content.saveLock = undefined;
if (err) {
console.error(err);
if (content.saveLock === myOOId) { delete content.saveLock; } // Unlock checkpoints
if (APP.migrateModal) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
setEditable(true);
delete content.migration;
APP.migrateModal.closeModal();
APP.onLocal();
}
if (isLockedModal.modal && err === "TOO_LARGE") {
if (APP.migrate) {
UI.warn(Messages.oo_cantMigrate);
}
APP.cantCheckpoint = true;
isLockedModal.modal.closeModal();
delete isLockedModal.modal;
if (content.saveLock === myOOId) {
delete content.saveLock;
}
APP.onLocal();
return;
}
return void UI.alert(Messages.oo_saveError);
}
// Get the last cp idx
@ -453,6 +475,7 @@ define([
};
var saveToServer = function () {
if (APP.cantCheckpoint) { return; } // TOO_LARGE
var text = getContent();
if (!text) {
setEditable(false, true);
@ -490,6 +513,8 @@ define([
var noLogin = false;
var makeCheckpoint = function (force) {
if (APP.cantCheckpoint) { return; } // TOO_LARGE
var locked = content.saveLock;
var lastCp = getLastCp();
@ -1385,7 +1410,7 @@ define([
h('span.fa.fa-spin.fa-spinner'),
h('span', Messages.oo_sheetMigration_loading)
]);
UI.openCustomModal(UI.dialog.customModal(div, {buttons: []}));
APP.migrateModal = UI.openCustomModal(UI.dialog.customModal(div, {buttons: []}));
makeCheckpoint(true);
});
// DEPRECATED: from version 3, the queue is sent again during init

@ -133,6 +133,7 @@ define([
$pv.text(Messages.error);
queue.inProgress = false;
queue.next();
if (config.onError) { config.onError("TOO_LARGE"); }
return void UI.alert(Messages._getKey('upload_tooLargeBrief', [maxSizeStr]));
}

Loading…
Cancel
Save