mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Improved alertify notification logic. Remove AlertifyWrapper class and extend notification methods in alertify itself.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
// Backup dialog
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
|
||||
'sources/alerts/alertify_wrapper'
|
||||
], function(gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode, AlertifyWrapper) {
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin.alertifyjs',
|
||||
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node'
|
||||
], function(gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) {
|
||||
|
||||
// if module is already initialized, refer to that.
|
||||
if (pgBrowser.Backup) {
|
||||
@@ -556,8 +555,7 @@ TODO LIST FOR BACKUP:
|
||||
data:{ 'data': JSON.stringify(args) },
|
||||
success: function(res) {
|
||||
if (res.success) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(gettext('Backup job created.'), 5);
|
||||
alertify.success(gettext('Backup job created.'), 5);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
|
||||
} else {
|
||||
console.log(res);
|
||||
@@ -785,8 +783,7 @@ TODO LIST FOR BACKUP:
|
||||
data:{ 'data': JSON.stringify(args) },
|
||||
success: function(res) {
|
||||
if (res.success) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(gettext('Backup job created.'), 5);
|
||||
alertify.success(gettext('Backup job created.'), 5);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
|
||||
}
|
||||
},
|
||||
|
@@ -1,15 +1,12 @@
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for' ,'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'sources/gettext', 'sources/url_for' ,'jquery', 'underscore', 'underscore.string', 'pgadmin.alertifyjs',
|
||||
'pgadmin','pgadmin.browser', 'backbone', 'backgrid', 'sources/../bundle/codemirror', 'backform',
|
||||
'pgadmin.tools.debugger.ui',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
|
||||
'wcdocker', 'pgadmin.backform',
|
||||
'pgadmin.backgrid'
|
||||
|
||||
], function(
|
||||
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
|
||||
codemirror, Backform, debug_function_again, AlertifyWrapper
|
||||
codemirror, Backform, debug_function_again
|
||||
) {
|
||||
|
||||
var CodeMirror = codemirror.default;
|
||||
@@ -481,8 +478,7 @@ define([
|
||||
pgTools.DirectDebug.polling_timeout_idle = true;
|
||||
|
||||
//Set the alertify message to inform the user that execution is completed.
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(res.info, 3);
|
||||
Alertify.success(res.info, 3);
|
||||
|
||||
// Update the message tab of the debugger
|
||||
if (res.data.status_message) {
|
||||
@@ -513,8 +509,7 @@ define([
|
||||
pgTools.DirectDebug.polling_timeout_idle = true;
|
||||
|
||||
//Set the alertify message to inform the user that execution is completed.
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(res.info, 3);
|
||||
Alertify.success(res.info, 3);
|
||||
|
||||
// Update the message tab of the debugger
|
||||
if (res.data.status_message) {
|
||||
@@ -556,11 +551,9 @@ define([
|
||||
pgTools.DirectDebug.direct_execution_completed = true;
|
||||
pgTools.DirectDebug.editor.removeLineClass(self.active_line_no, 'wrap', 'CodeMirror-activeline-background');
|
||||
|
||||
//Set the alertify message to inform the user that execution is completed with error.
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
|
||||
//Set the Alertify message to inform the user that execution is completed with error.
|
||||
if(!pgTools.DirectDebug.is_user_aborted_debugging) {
|
||||
alertifyWrapper.error(res.info, 3);
|
||||
Alertify.error(res.info, 3);
|
||||
}
|
||||
|
||||
// Update the message tab of the debugger
|
||||
@@ -825,10 +818,9 @@ define([
|
||||
// We will give same behaviour as pgAdmin3 and disable all buttons
|
||||
self.enable('continue', false);
|
||||
|
||||
// Set the alertify message to inform the user that execution
|
||||
// Set the Alertify message to inform the user that execution
|
||||
// is completed.
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(res.info, 3);
|
||||
Alertify.success(res.info, 3);
|
||||
}
|
||||
else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
@@ -1221,11 +1213,10 @@ define([
|
||||
// Get the updated variables value
|
||||
self.GetLocalVariables(pgTools.DirectDebug.trans_id);
|
||||
// Show the message to the user that deposit value is success or failure
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
if (res.data.result) {
|
||||
alertifyWrapper.success(res.data.info, 3);
|
||||
Alertify.success(res.data.info, 3);
|
||||
} else {
|
||||
alertifyWrapper.error(res.data.info, 3);
|
||||
Alertify.error(res.data.info, 3);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -1,11 +1,9 @@
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin.alertifyjs',
|
||||
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'backform',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
|
||||
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'
|
||||
], function(
|
||||
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform, AlertifyWrapper
|
||||
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform
|
||||
) {
|
||||
|
||||
pgAdmin = pgAdmin || window.pgAdmin || {};
|
||||
@@ -420,8 +418,7 @@ define([
|
||||
data:{ 'data': JSON.stringify(this.view.model.toJSON()) },
|
||||
success: function(res) {
|
||||
if (res.success) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(gettext('Import/export job created.'), 5);
|
||||
Alertify.success(gettext('Import/export job created.'), 5);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
|
||||
}
|
||||
},
|
||||
|
@@ -1,14 +1,12 @@
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
|
||||
'underscore.string', 'alertify', 'pgadmin', 'pgadmin.browser', 'backbone',
|
||||
'underscore.string', 'pgadmin.alertifyjs', 'pgadmin', 'pgadmin.browser', 'backbone',
|
||||
'backgrid', 'backform',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
|
||||
'pgadmin.backform', 'pgadmin.backgrid',
|
||||
'pgadmin.browser.node.ui'
|
||||
], function(
|
||||
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
|
||||
Backform, AlertifyWrapper
|
||||
Backform
|
||||
) {
|
||||
|
||||
pgAdmin = pgAdmin || window.pgAdmin || {};
|
||||
@@ -353,13 +351,11 @@ define([
|
||||
success: function(res) {
|
||||
if (res.data && res.data.status) {
|
||||
//Do nothing as we are creating the job and exiting from the main dialog
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(res.data.info);
|
||||
Alertify.success(res.data.info);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
|
||||
}
|
||||
else {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.error(res.data.errmsg);
|
||||
Alertify.error(res.data.errmsg);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
|
@@ -1,12 +1,11 @@
|
||||
// Restore dialog
|
||||
define('tools.restore', [
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
|
||||
'underscore.string', 'alertify', 'pgadmin.browser', 'backbone', 'backgrid',
|
||||
'backform', 'pgadmin.browser.node',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
'underscore.string', 'pgadmin.alertifyjs', 'pgadmin.browser', 'backbone', 'backgrid',
|
||||
'backform', 'pgadmin.browser.node'
|
||||
], function(
|
||||
gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform,
|
||||
pgNode, AlertifyWrapper
|
||||
pgNode
|
||||
) {
|
||||
|
||||
// if module is already initialized, refer to that.
|
||||
@@ -531,8 +530,7 @@ define('tools.restore', [
|
||||
data:{ 'data': JSON.stringify(args) },
|
||||
success: function(res) {
|
||||
if (res.success) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(
|
||||
alertify.success(
|
||||
gettext('Restore job created.'), 5
|
||||
);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
define('tools.querytool', [
|
||||
'babel-polyfill', 'sources/gettext','sources/url_for', 'jquery',
|
||||
'underscore', 'underscore.string', 'alertify',
|
||||
'underscore', 'underscore.string', 'pgadmin.alertifyjs',
|
||||
'pgadmin', 'backbone', 'sources/../bundle/codemirror',
|
||||
'pgadmin.misc.explain',
|
||||
'sources/selection/grid_selector',
|
||||
@@ -15,7 +15,6 @@ define('tools.querytool', [
|
||||
'sources/history/index.js',
|
||||
'sources/../jsx/history/query_history',
|
||||
'react', 'react-dom',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
'sources/sqleditor/keyboard_shortcuts',
|
||||
'sources/../bundle/slickgrid',
|
||||
'pgadmin.file_manager',
|
||||
@@ -26,7 +25,7 @@ define('tools.querytool', [
|
||||
], function(
|
||||
babelPollyfill, gettext, url_for, $, _, S, alertify, pgAdmin, Backbone, codemirror,
|
||||
pgExplain, GridSelector, ActiveCellCapture, clipboard, copyData, RangeSelectionHelper, handleQueryOutputKeyboardEvent,
|
||||
XCellSelectionModel, setStagedRows, SqlEditorUtils, HistoryBundle, queryHistory, React, ReactDOM, AlertifyWrapper,
|
||||
XCellSelectionModel, setStagedRows, SqlEditorUtils, HistoryBundle, queryHistory, React, ReactDOM,
|
||||
keyboardShortcuts
|
||||
) {
|
||||
/* Return back, this has been called more than once */
|
||||
@@ -1734,8 +1733,7 @@ define('tools.querytool', [
|
||||
self.update_msg_history(true, res.result, false);
|
||||
// Display the notifier if the timeout is set to >= 0
|
||||
if (self.info_notifier_timeout >= 0) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(msg, self.info_notifier_timeout);
|
||||
alertify.success(msg, self.info_notifier_timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1886,8 +1884,7 @@ define('tools.querytool', [
|
||||
|
||||
// Display the notifier if the timeout is set to >= 0
|
||||
if (self.info_notifier_timeout >= 0) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(msg1 + ' ' + msg2, self.info_notifier_timeout);
|
||||
alertify.success(msg1 + ' ' + msg2, self.info_notifier_timeout);
|
||||
}
|
||||
|
||||
var _msg = msg1 + '\n' + msg2;
|
||||
@@ -2205,8 +2202,7 @@ define('tools.querytool', [
|
||||
} else {
|
||||
$("#btn-save").prop('disabled', true);
|
||||
}
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(gettext("Row(s) deleted"));
|
||||
alertify.success(gettext("Row(s) deleted"));
|
||||
} else {
|
||||
// There are other data to needs to be updated on server
|
||||
if(is_updated) {
|
||||
@@ -2357,8 +2353,7 @@ define('tools.querytool', [
|
||||
$("#btn-flash").prop('disabled', false);
|
||||
$('.sql-editor-message').text(res.data.result);
|
||||
var err_msg = S(gettext("%s.")).sprintf(res.data.result).value();
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.error(err_msg, 20);
|
||||
alertify.error(err_msg, 20);
|
||||
grid.setSelectedRows([]);
|
||||
// To highlight the row at fault
|
||||
if(_.has(res.data, '_rowid') &&
|
||||
@@ -2393,8 +2388,7 @@ define('tools.querytool', [
|
||||
self.trigger('pgadmin-sqleditor:loading-icon:hide');
|
||||
|
||||
grid.invalidate();
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(gettext("Data saved successfully."));
|
||||
alertify.success(gettext("Data saved successfully."));
|
||||
if (self.close_on_save) {
|
||||
self.close();
|
||||
}
|
||||
@@ -2549,8 +2543,7 @@ define('tools.querytool', [
|
||||
},
|
||||
error: function(e) {
|
||||
var errmsg = $.parseJSON(e.responseText).errormsg;
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.error(errmsg);
|
||||
alertify.error(errmsg);
|
||||
self.trigger('pgadmin-sqleditor:loading-icon:hide');
|
||||
// hide cursor
|
||||
$busy_icon_div.removeClass('show_progress');
|
||||
@@ -2578,8 +2571,7 @@ define('tools.querytool', [
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if (res.data.status) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(gettext("File saved successfully."));
|
||||
alertify.success(gettext("File saved successfully."));
|
||||
self.gridView.current_file = e;
|
||||
self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, ''));
|
||||
// disable save button on file save
|
||||
@@ -2600,8 +2592,7 @@ define('tools.querytool', [
|
||||
var errmsg = $.parseJSON(e.responseText).errormsg;
|
||||
setTimeout(
|
||||
function() {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.error(errmsg);
|
||||
alertify.error(errmsg);
|
||||
}, 10
|
||||
);
|
||||
},
|
||||
|
@@ -1,11 +1,11 @@
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin.alertifyjs',
|
||||
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
|
||||
'sources/alerts/alertify_wrapper', 'pgadmin.user_management.current_user',
|
||||
'pgadmin.user_management.current_user',
|
||||
'backgrid.select.all', 'backgrid.filter'
|
||||
], function(
|
||||
gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform,
|
||||
pgNode, AlertifyWrapper, userInfo
|
||||
pgNode, userInfo
|
||||
) {
|
||||
|
||||
// if module is already initialized, refer to that.
|
||||
@@ -310,12 +310,10 @@ define([
|
||||
self.model.destroy({
|
||||
wait: true,
|
||||
success: function(res) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(gettext('User deleted.'));
|
||||
alertify.success(gettext('User deleted.'));
|
||||
},
|
||||
error: function(m, jqxhr) {
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.error(gettext('Error during deleting user.'));
|
||||
alertify.error(gettext('Error during deleting user.'));
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -492,15 +490,13 @@ define([
|
||||
'confirmPassword':undefined});
|
||||
|
||||
m.startNewSession();
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.success(S(gettext("User '%s' saved.")).sprintf(
|
||||
alertify.success(S(gettext("User '%s' saved.")).sprintf(
|
||||
m.get('email')
|
||||
).value());
|
||||
},
|
||||
error: function(res, jqxhr) {
|
||||
m.startNewSession();
|
||||
var alertifyWrapper = new AlertifyWrapper();
|
||||
alertifyWrapper.error(
|
||||
alertify.error(
|
||||
S(gettext("Error saving user: '%s'")).sprintf(
|
||||
jqxhr.responseJSON.errormsg
|
||||
).value()
|
||||
|
Reference in New Issue
Block a user