Fix stacking disconnection alerts
This commit is contained in:
@@ -491,6 +491,11 @@ define([
|
||||
$ok.focus();
|
||||
Notifier.notify();
|
||||
});
|
||||
|
||||
return {
|
||||
element: frame,
|
||||
delete: close
|
||||
};
|
||||
};
|
||||
|
||||
UI.prompt = function (msg, def, cb, opt, force) {
|
||||
|
||||
@@ -56,6 +56,21 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
var dcAlert;
|
||||
UIElements.disconnectAlert = function () {
|
||||
if (dcAlert && $(dcAlert.element).length) { return; }
|
||||
dcAlert = UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
};
|
||||
UIElements.reconnectAlert = function () {
|
||||
if (!dcAlert) { return; }
|
||||
if (!dcAlert.delete) {
|
||||
dcAlert = undefined;
|
||||
return;
|
||||
}
|
||||
dcAlert.delete();
|
||||
dcAlert = undefined;
|
||||
};
|
||||
|
||||
var importContent = function (type, f, cfg) {
|
||||
return function () {
|
||||
var $files = $('<input>', {type:"file"});
|
||||
|
||||
@@ -1606,17 +1606,10 @@ define([
|
||||
pinImages();
|
||||
};
|
||||
|
||||
config.onAbort = function () {
|
||||
// inform of network disconnect
|
||||
setEditable(false);
|
||||
toolbar.failed();
|
||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
};
|
||||
|
||||
config.onConnectionChange = function (info) {
|
||||
if (info.state) {
|
||||
// If we tried to send changes while we were offline, force a page reload
|
||||
UI.findOKButton().click();
|
||||
UIElements.reconnectAlert();
|
||||
if (Object.keys(pendingChanges).length) {
|
||||
return void UI.confirm(Messages.oo_reconnect, function (yes) {
|
||||
if (!yes) { return; }
|
||||
@@ -1629,7 +1622,7 @@ define([
|
||||
setEditable(false);
|
||||
offline = true;
|
||||
UI.findOKButton().click();
|
||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
UIElements.disconnectAlert();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -396,9 +396,9 @@ define([
|
||||
if (state === STATE.DELETED) { return; }
|
||||
stateChange(info.state ? STATE.INITIALIZING : STATE.DISCONNECTED, info.permanent);
|
||||
/*if (info.state) {
|
||||
UI.findOKButton().click();
|
||||
UIElements.reconnectAlert();
|
||||
} else {
|
||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
UIElements.disconnectAlert();
|
||||
}*/
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user