mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Fixed error in alertify.pgNotifier when server connection is lost.
2) Change styling of alertify.pgNotifier as we did for success, error and info.
This commit is contained in:
parent
2945b3fe93
commit
47cf874460
@ -89,33 +89,42 @@ function(gettext, alertify, S) {
|
|||||||
|
|
||||||
if (xhr.status == 0) {
|
if (xhr.status == 0) {
|
||||||
msg = gettext('Connection to the server has been lost.');
|
msg = gettext('Connection to the server has been lost.');
|
||||||
}
|
promptmsg = gettext('Connection Lost');
|
||||||
|
} else {
|
||||||
|
if (contentType) {
|
||||||
|
try {
|
||||||
|
if (contentType.indexOf('application/json') == 0) {
|
||||||
|
resp = $.parseJSON(msg);
|
||||||
|
|
||||||
if (contentType) {
|
if (resp.result != null && (!resp.errormsg || resp.errormsg == '') &&
|
||||||
try {
|
onJSONResult && typeof(onJSONResult) == 'function') {
|
||||||
if (contentType.indexOf('application/json') == 0) {
|
return onJSONResult(resp.result);
|
||||||
var resp = $.parseJSON(msg);
|
}
|
||||||
|
msg = _.escape(resp.result) || _.escape(resp.errormsg) || "Unknown error";
|
||||||
if (resp.result != null && (!resp.errormsg || resp.errormsg == '') &&
|
|
||||||
onJSONResult && typeof(onJSONResult) == 'function') {
|
|
||||||
return onJSONResult(resp.result);
|
|
||||||
}
|
}
|
||||||
msg = _.escape(resp.result) || _.escape(resp.errormsg) || "Unknown error";
|
if (contentType.indexOf('text/html') == 0) {
|
||||||
|
var alertMessage = promptmsg;
|
||||||
|
if (type === 'error') {
|
||||||
|
alertMessage = '\
|
||||||
|
<div class="media font-red-3 text-14">\
|
||||||
|
<div class="media-body media-middle">\
|
||||||
|
<div class="alert-text">' + promptmsg + '</div><br/>\
|
||||||
|
<div class="alert-text">' + gettext('Click for details.') + '</div>\
|
||||||
|
</div>\
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
alertify.notify(
|
||||||
|
alertMessage, type, 0, function() {
|
||||||
|
alertify.pgIframeDialog().show().set({frameless: false}).set(
|
||||||
|
'pg_msg', msg
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alertify.alert().show().set('message', e.message).set('title', "Error");
|
||||||
}
|
}
|
||||||
if (contentType.indexOf('text/html') == 0) {
|
|
||||||
alertify.notify(
|
|
||||||
S(
|
|
||||||
'%s<br><br>' +
|
|
||||||
gettext('Click here for details.')
|
|
||||||
).sprintf(promptmsg).value(), type, 0, function() {
|
|
||||||
alertify.pgIframeDialog().show().set({frameless: false}).set(
|
|
||||||
'pg_msg', msg
|
|
||||||
);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
alertify.alert().show().set('message', e.message).set('title', "Error");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alertify.alert().show().set(
|
alertify.alert().show().set(
|
||||||
|
Loading…
Reference in New Issue
Block a user