Handle server connection loss
This commit is contained in:
parent
e93c9c3faa
commit
6e153dc858
@ -61,6 +61,7 @@ define([
|
|||||||
var metadataMgr = common.getMetadataMgr();
|
var metadataMgr = common.getMetadataMgr();
|
||||||
var privateData = metadataMgr.getPrivateData();
|
var privateData = metadataMgr.getPrivateData();
|
||||||
var readOnly = false;
|
var readOnly = false;
|
||||||
|
var offline = false;
|
||||||
var config = {};
|
var config = {};
|
||||||
var content = {
|
var content = {
|
||||||
hashes: {},
|
hashes: {},
|
||||||
@ -451,7 +452,7 @@ define([
|
|||||||
});
|
});
|
||||||
// Update current index
|
// Update current index
|
||||||
var last = ooChannel.queue.pop();
|
var last = ooChannel.queue.pop();
|
||||||
ooChannel.lastHash = last.hash;
|
if (last) { ooChannel.lastHash = last.hash; }
|
||||||
ooChannel.cpIndex += ooChannel.queue.length;
|
ooChannel.cpIndex += ooChannel.queue.length;
|
||||||
// Apply existing locks
|
// Apply existing locks
|
||||||
deleteOfflineLocks();
|
deleteOfflineLocks();
|
||||||
@ -529,6 +530,7 @@ define([
|
|||||||
locks: [content.locks[getId()]],
|
locks: [content.locks[getId()]],
|
||||||
excelAdditionalInfo: null
|
excelAdditionalInfo: null
|
||||||
}, null, function (err, hash) {
|
}, null, function (err, hash) {
|
||||||
|
if (err) { return void console.error(err); }
|
||||||
// Increment index and update latest hash
|
// Increment index and update latest hash
|
||||||
ooChannel.cpIndex++;
|
ooChannel.cpIndex++;
|
||||||
ooChannel.lastHash = hash;
|
ooChannel.lastHash = hash;
|
||||||
@ -567,6 +569,7 @@ define([
|
|||||||
handleAuth(obj, send);
|
handleAuth(obj, send);
|
||||||
break;
|
break;
|
||||||
case "isSaveLock":
|
case "isSaveLock":
|
||||||
|
// TODO ping the server to check if we're online first?
|
||||||
send({
|
send({
|
||||||
type: "saveLock",
|
type: "saveLock",
|
||||||
saveLock: false
|
saveLock: false
|
||||||
@ -738,6 +741,11 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var setEditable = function (state) {
|
var setEditable = function (state) {
|
||||||
|
if (!state) {
|
||||||
|
try {
|
||||||
|
window.frames[0].editor.setViewModeDisconnect(true);
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
console.log(state);
|
console.log(state);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -887,9 +895,14 @@ define([
|
|||||||
config.onConnectionChange = function (info) {
|
config.onConnectionChange = function (info) {
|
||||||
setEditable(info.state);
|
setEditable(info.state);
|
||||||
if (info.state) {
|
if (info.state) {
|
||||||
initializing = true;
|
|
||||||
UI.findOKButton().click();
|
UI.findOKButton().click();
|
||||||
|
UI.confirm(Messages.oo_reconnect, function (yes) {
|
||||||
|
if (!yes) { return; }
|
||||||
|
common.gotoURL();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
offline = true;
|
||||||
|
UI.findOKButton().click();
|
||||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
UI.alert(Messages.common_connectionLost, undefined, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -897,6 +910,7 @@ define([
|
|||||||
cpNfInner = common.startRealtime(config);
|
cpNfInner = common.startRealtime(config);
|
||||||
|
|
||||||
cpNfInner.onInfiniteSpinner(function () {
|
cpNfInner.onInfiniteSpinner(function () {
|
||||||
|
if (offline) { return; }
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
UI.confirm(Messages.realtime_unrecoverableError, function (yes) {
|
UI.confirm(Messages.realtime_unrecoverableError, function (yes) {
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
|
|||||||
@ -20,6 +20,7 @@ define(function () {
|
|||||||
out.type.media = "Média";
|
out.type.media = "Média";
|
||||||
out.type.todo = "Todo";
|
out.type.todo = "Todo";
|
||||||
out.type.contacts = "Contacts";
|
out.type.contacts = "Contacts";
|
||||||
|
out.type.sheet = 'Tableur (Beta)';
|
||||||
|
|
||||||
out.button_newpad = 'Nouveau document texte';
|
out.button_newpad = 'Nouveau document texte';
|
||||||
out.button_newcode = 'Nouvelle page de code';
|
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.";
|
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
|
// Canvas
|
||||||
out.canvas_clear = "Nettoyer";
|
out.canvas_clear = "Nettoyer";
|
||||||
out.canvas_delete = "Supprimer la sélection";
|
out.canvas_delete = "Supprimer la sélection";
|
||||||
|
|||||||
@ -20,9 +20,9 @@ define(function () {
|
|||||||
out.type.media = 'Media';
|
out.type.media = 'Media';
|
||||||
out.type.todo = "Todo";
|
out.type.todo = "Todo";
|
||||||
out.type.contacts = 'Contacts';
|
out.type.contacts = 'Contacts';
|
||||||
out.type.oocell = 'OnlyOffice Cell';
|
out.type.sheet = 'Spreadsheet (Beta)';
|
||||||
out.type.ooslide = 'OnlyOffice Slide';
|
//out.type.ooslide = 'OnlyOffice Slide';
|
||||||
out.type.oodoc = 'OnlyOffice Doc';
|
//out.type.oodoc = 'OnlyOffice Doc';
|
||||||
|
|
||||||
out.button_newpad = 'New Rich Text pad';
|
out.button_newpad = 'New Rich Text pad';
|
||||||
out.button_newcode = 'New Code 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.";
|
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
|
// Canvas
|
||||||
out.canvas_clear = "Clear";
|
out.canvas_clear = "Clear";
|
||||||
out.canvas_delete = "Delete selection";
|
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_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_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_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_passwordSuccess = "The password was successfully changed.<br>Press OK to reload and update your access rights.";
|
||||||
out.properties_changePasswordButton = "Submit";
|
out.properties_changePasswordButton = "Submit";
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user