Fix stacking disconnection alerts
This commit is contained in:
parent
768dc71803
commit
1c013d8a4f
@ -491,6 +491,11 @@ define([
|
|||||||
$ok.focus();
|
$ok.focus();
|
||||||
Notifier.notify();
|
Notifier.notify();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
element: frame,
|
||||||
|
delete: close
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
UI.prompt = function (msg, def, cb, opt, force) {
|
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) {
|
var importContent = function (type, f, cfg) {
|
||||||
return function () {
|
return function () {
|
||||||
var $files = $('<input>', {type:"file"});
|
var $files = $('<input>', {type:"file"});
|
||||||
|
|||||||
@ -1606,17 +1606,10 @@ define([
|
|||||||
pinImages();
|
pinImages();
|
||||||
};
|
};
|
||||||
|
|
||||||
config.onAbort = function () {
|
|
||||||
// inform of network disconnect
|
|
||||||
setEditable(false);
|
|
||||||
toolbar.failed();
|
|
||||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
|
||||||
};
|
|
||||||
|
|
||||||
config.onConnectionChange = function (info) {
|
config.onConnectionChange = function (info) {
|
||||||
if (info.state) {
|
if (info.state) {
|
||||||
// If we tried to send changes while we were offline, force a page reload
|
// If we tried to send changes while we were offline, force a page reload
|
||||||
UI.findOKButton().click();
|
UIElements.reconnectAlert();
|
||||||
if (Object.keys(pendingChanges).length) {
|
if (Object.keys(pendingChanges).length) {
|
||||||
return void UI.confirm(Messages.oo_reconnect, function (yes) {
|
return void UI.confirm(Messages.oo_reconnect, function (yes) {
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
@ -1629,7 +1622,7 @@ define([
|
|||||||
setEditable(false);
|
setEditable(false);
|
||||||
offline = true;
|
offline = true;
|
||||||
UI.findOKButton().click();
|
UI.findOKButton().click();
|
||||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
UIElements.disconnectAlert();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -396,9 +396,9 @@ define([
|
|||||||
if (state === STATE.DELETED) { return; }
|
if (state === STATE.DELETED) { return; }
|
||||||
stateChange(info.state ? STATE.INITIALIZING : STATE.DISCONNECTED, info.permanent);
|
stateChange(info.state ? STATE.INITIALIZING : STATE.DISCONNECTED, info.permanent);
|
||||||
/*if (info.state) {
|
/*if (info.state) {
|
||||||
UI.findOKButton().click();
|
UIElements.reconnectAlert();
|
||||||
} else {
|
} else {
|
||||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
UIElements.disconnectAlert();
|
||||||
}*/
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ define([
|
|||||||
'/common/common-util.js',
|
'/common/common-util.js',
|
||||||
'/common/common-hash.js',
|
'/common/common-hash.js',
|
||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
|
'/common/common-ui-elements.js',
|
||||||
'/common/common-feedback.js',
|
'/common/common-feedback.js',
|
||||||
'/bower_components/nthen/index.js',
|
'/bower_components/nthen/index.js',
|
||||||
'/common/sframe-common.js',
|
'/common/sframe-common.js',
|
||||||
@ -22,6 +23,7 @@ define([
|
|||||||
Util,
|
Util,
|
||||||
Hash,
|
Hash,
|
||||||
UI,
|
UI,
|
||||||
|
UIElements,
|
||||||
Feedback,
|
Feedback,
|
||||||
nThen,
|
nThen,
|
||||||
SFCommon,
|
SFCommon,
|
||||||
@ -272,13 +274,13 @@ define([
|
|||||||
setEditable(false);
|
setEditable(false);
|
||||||
if (drive.refresh) { drive.refresh(); }
|
if (drive.refresh) { drive.refresh(); }
|
||||||
APP.toolbar.failed();
|
APP.toolbar.failed();
|
||||||
if (!noAlert) { UI.alert(Messages.common_connectionLost, undefined, true); }
|
if (!noAlert) { UIElements.disconnectAlert(); }
|
||||||
};
|
};
|
||||||
var onReconnect = function () {
|
var onReconnect = function () {
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
if (drive.refresh) { drive.refresh(); }
|
if (drive.refresh) { drive.refresh(); }
|
||||||
APP.toolbar.reconnecting();
|
APP.toolbar.reconnecting();
|
||||||
UI.findOKButton().click();
|
UIElements.reconnectAlert();
|
||||||
};
|
};
|
||||||
|
|
||||||
sframeChan.on('EV_DRIVE_LOG', function (msg) {
|
sframeChan.on('EV_DRIVE_LOG', function (msg) {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ define([
|
|||||||
'/common/sframe-common-codemirror.js',
|
'/common/sframe-common-codemirror.js',
|
||||||
'/common/common-thumbnail.js',
|
'/common/common-thumbnail.js',
|
||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
|
'/common/common-ui-elements.js',
|
||||||
'/common/hyperscript.js',
|
'/common/hyperscript.js',
|
||||||
'/customize/messages.js',
|
'/customize/messages.js',
|
||||||
'cm/lib/codemirror',
|
'cm/lib/codemirror',
|
||||||
@ -42,6 +43,7 @@ define([
|
|||||||
SframeCM,
|
SframeCM,
|
||||||
Thumb,
|
Thumb,
|
||||||
UI,
|
UI,
|
||||||
|
UIElements,
|
||||||
h,
|
h,
|
||||||
Messages,
|
Messages,
|
||||||
CMeditor,
|
CMeditor,
|
||||||
@ -1098,13 +1100,13 @@ define([
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
//UI.alert(Messages.common_connectionLost, undefined, true);
|
//UIElements.disconnectAlert();
|
||||||
};
|
};
|
||||||
|
|
||||||
var onReconnect = function () {
|
var onReconnect = function () {
|
||||||
if (APP.unrecoverable) { return; }
|
if (APP.unrecoverable) { return; }
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
//UI.findOKButton().click();
|
//UIElements.reconnectAlert();
|
||||||
};
|
};
|
||||||
|
|
||||||
var getHeadingText = function () {
|
var getHeadingText = function () {
|
||||||
|
|||||||
@ -1379,13 +1379,13 @@ define([
|
|||||||
setEditable(false);
|
setEditable(false);
|
||||||
if (APP.team && driveAPP.refresh) { driveAPP.refresh(); }
|
if (APP.team && driveAPP.refresh) { driveAPP.refresh(); }
|
||||||
toolbar.failed();
|
toolbar.failed();
|
||||||
if (!noAlert) { UI.alert(Messages.common_connectionLost, undefined, true); }
|
if (!noAlert) { UIElements.disconnectAlert(); }
|
||||||
};
|
};
|
||||||
var onReconnect = function () {
|
var onReconnect = function () {
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
if (APP.team && driveAPP.refresh) { driveAPP.refresh(); }
|
if (APP.team && driveAPP.refresh) { driveAPP.refresh(); }
|
||||||
toolbar.reconnecting();
|
toolbar.reconnecting();
|
||||||
UI.findOKButton().click();
|
UIElements.reconnectAlert();
|
||||||
};
|
};
|
||||||
|
|
||||||
sframeChan.on('EV_DRIVE_LOG', function (msg) {
|
sframeChan.on('EV_DRIVE_LOG', function (msg) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user