Handle server connection loss

pull/1/head
yflory 6 years ago
parent e93c9c3faa
commit 6e153dc858

@ -61,6 +61,7 @@ define([
var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
var readOnly = false;
var offline = false;
var config = {};
var content = {
hashes: {},
@ -451,7 +452,7 @@ define([
});
// Update current index
var last = ooChannel.queue.pop();
ooChannel.lastHash = last.hash;
if (last) { ooChannel.lastHash = last.hash; }
ooChannel.cpIndex += ooChannel.queue.length;
// Apply existing locks
deleteOfflineLocks();
@ -529,6 +530,7 @@ define([
locks: [content.locks[getId()]],
excelAdditionalInfo: null
}, null, function (err, hash) {
if (err) { return void console.error(err); }
// Increment index and update latest hash
ooChannel.cpIndex++;
ooChannel.lastHash = hash;
@ -567,6 +569,7 @@ define([
handleAuth(obj, send);
break;
case "isSaveLock":
// TODO ping the server to check if we're online first?
send({
type: "saveLock",
saveLock: false
@ -738,6 +741,11 @@ define([
};
var setEditable = function (state) {
if (!state) {
try {
window.frames[0].editor.setViewModeDisconnect(true);
} catch (e) {}
}
console.log(state);
};
@ -887,9 +895,14 @@ define([
config.onConnectionChange = function (info) {
setEditable(info.state);
if (info.state) {
initializing = true;
UI.findOKButton().click();
UI.confirm(Messages.oo_reconnect, function (yes) {
if (!yes) { return; }
common.gotoURL();
});
} else {
offline = true;
UI.findOKButton().click();
UI.alert(Messages.common_connectionLost, undefined, true);
}
};
@ -897,6 +910,7 @@ define([
cpNfInner = common.startRealtime(config);
cpNfInner.onInfiniteSpinner(function () {
if (offline) { return; }
setEditable(false);
UI.confirm(Messages.realtime_unrecoverableError, function (yes) {
if (!yes) { return; }

@ -20,6 +20,7 @@ define(function () {
out.type.media = "Média";
out.type.todo = "Todo";
out.type.contacts = "Contacts";
out.type.sheet = 'Tableur (Beta)';
out.button_newpad = 'Nouveau document texte';
out.button_newcode = 'Nouvelle page de code';
@ -327,6 +328,9 @@ define(function () {
out.poll_comment_disabled = "Publiez ce sondage en utilisant le bouton ✓ afin d'activer les commentaires.";
// OnlyOffice
out.oo_reconnect = "La connexion au serveur est rétablie. Cliquez sur OK pour recharger la page et continuer l'édition.";
// Canvas
out.canvas_clear = "Nettoyer";
out.canvas_delete = "Supprimer la sélection";

@ -20,9 +20,9 @@ define(function () {
out.type.media = 'Media';
out.type.todo = "Todo";
out.type.contacts = 'Contacts';
out.type.oocell = 'OnlyOffice Cell';
out.type.ooslide = 'OnlyOffice Slide';
out.type.oodoc = 'OnlyOffice Doc';
out.type.sheet = 'Spreadsheet (Beta)';
//out.type.ooslide = 'OnlyOffice Slide';
//out.type.oodoc = 'OnlyOffice Doc';
out.button_newpad = 'New Rich Text pad';
out.button_newcode = 'New Code pad';
@ -332,6 +332,9 @@ define(function () {
out.poll_comment_disabled = "Publish this poll using the ✓ button to enable the comments.";
// OnlyOffice
out.oo_reconnect = "The server connection is back. Click OK to reload and continue the edition.";
// Canvas
out.canvas_clear = "Clear";
out.canvas_delete = "Delete selection";
@ -1287,7 +1290,7 @@ define(function () {
out.properties_confirmChange = "Are you sure? Changing the password will remove its history. Users without the new password will lose access to this pad";
out.properties_passwordSame = "New passwords must differ from the current one.";
out.properties_passwordError = "An error occured while trying to change the password. Please try again.";
out.properties_passwordWarning = "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the pad manually.<br>Press OK to reload and update your acces rights.";
out.properties_passwordWarning = "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the pad manually.<br>Press OK to reload and update your access rights.";
out.properties_passwordSuccess = "The password was successfully changed.<br>Press OK to reload and update your access rights.";
out.properties_changePasswordButton = "Submit";

Loading…
Cancel
Save