Improved alertify notification logic. Remove AlertifyWrapper class and extend notification methods in alertify itself.

This commit is contained in:
Akshay Joshi
2017-07-31 18:59:44 +05:30
parent a7f58e2b92
commit e506fa1dbe
29 changed files with 220 additions and 352 deletions

View File

@@ -1,10 +1,8 @@
define('pgadmin.node.pga_job', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify',
'sources/alerts/alertify_wrapper',
'underscore.string', 'pgadmin', 'pgadmin.browser', 'pgadmin.alertifyjs',
'pgadmin.node.pga_jobstep', 'pgadmin.node.pga_schedule'
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, AlertifyWrapper) {
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify) {
if (!pgBrowser.Nodes['coll-pga_job']) {
var pga_jobs = pgBrowser.Nodes['coll-pga_job'] =
@@ -181,18 +179,17 @@ define('pgadmin.node.pga_job', [
},
error: function(xhr, status, error) {
var error_msg = "Unable to run pgagent job.";
var alertifyWrapper = new AlertifyWrapper();
if (xhr.readyState == 0) {
alertifyWrapper.error(gettext('Not connected to the server or the connection to the server has been closed.'));
alertify.error(gettext('Not connected to the server or the connection to the server has been closed.'));
}
else {
if (_.isUndefined(xhr.responseText)) {
alertifyWrapper.error(error_msg);
alertify.error(error_msg);
}
else {
var err = $.parseJSON(xhr.responseText);
if (err.success == 0) {
alertifyWrapper.error(err.errormsg);
alertify.error(err.errormsg);
}
}
}