Update alertify alerts to use the styling defined in the styleguide.

This commit is contained in:
Joao Pedro De Almeida Pereira
2017-06-30 10:21:05 +01:00
committed by Dave Page
parent ba3ab7b322
commit 2a30a86e7d
24 changed files with 253 additions and 279 deletions

View File

@@ -1,8 +1,9 @@
// Backup dialog
define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node'
], function(gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) {
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
'sources/alerts/alertify_wrapper',
], function(gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode, AlertifyWrapper) {
// if module is already initialized, refer to that.
if (pgBrowser.Backup) {
@@ -555,10 +556,8 @@ TODO LIST FOR BACKUP:
data:{ 'data': JSON.stringify(args) },
success: function(res) {
if (res.success) {
alertify.notify(
gettext('Backup job created.'), 'success',
5
);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(gettext('Backup job created.'), 5);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
} else {
console.log(res);
@@ -786,7 +785,8 @@ TODO LIST FOR BACKUP:
data:{ 'data': JSON.stringify(args) },
success: function(res) {
if (res.success) {
alertify.notify(gettext('Backup job created.'), 'success', 5);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(gettext('Backup job created.'), 5);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
}
},

View File

@@ -1,7 +1,10 @@
define([
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin','pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform',
'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
'pgadmin.tools.debugger.ui',
'sources/alerts/alertify_wrapper',
'wcdocker', 'pgadmin.backform',
'pgadmin.backgrid', 'codemirror/addon/selection/active-line',
'codemirror/addon/fold/foldgutter', 'codemirror/addon/fold/foldcode',
'pgadmin-sqlfoldcode', 'codemirror/addon/edit/matchbrackets',
@@ -9,7 +12,7 @@ define([
], function(
gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
CodeMirror, Backform, debug_function_again
CodeMirror, Backform, debug_function_again, AlertifyWrapper
) {
if (pgAdmin.Browser.tree != null) {
@@ -463,12 +466,8 @@ define([
pgTools.DirectDebug.polling_timeout_idle = true;
//Set the alertify message to inform the user that execution is completed.
Alertify.notify(
res.info,
'success',
3,
function() { }
);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(res.info, 3);
// Update the message tab of the debugger
if (res.data.status_message) {
@@ -499,12 +498,8 @@ define([
pgTools.DirectDebug.polling_timeout_idle = true;
//Set the alertify message to inform the user that execution is completed.
Alertify.notify(
res.info,
'success',
3,
function() { }
);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(res.info, 3);
// Update the message tab of the debugger
if (res.data.status_message) {
@@ -547,12 +542,8 @@ define([
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.
Alertify.notify(
res.info,
'error',
3,
function() { }
);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.error(res.info, 3);
// Update the message tab of the debugger
if (res.data.status_message) {
@@ -792,12 +783,8 @@ define([
pgTools.DirectDebug.direct_execution_completed = true;
//Set the alertify message to inform the user that execution is completed.
Alertify.notify(
res.info,
'success',
3,
function() { }
);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(res.info, 3);
//Disable the buttons other than continue button. If user wants to again then it should allow to debug again...
self.enable('continue', true);
@@ -1185,12 +1172,12 @@ 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
Alertify.notify(
res.data.info,
res.data.result ? 'success': 'error',
3,
function() { }
);
var alertifyWrapper = new AlertifyWrapper();
if (res.data.result) {
alertifyWrapper.success(res.data.info, 3);
} else {
alertifyWrapper.error(res.data.info, 3);
}
}
},
error: function(e) {

View File

@@ -1,9 +1,11 @@
define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
'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
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform, AlertifyWrapper
) {
pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -418,7 +420,8 @@ define([
data:{ 'data': JSON.stringify(this.view.model.toJSON()) },
success: function(res) {
if (res.success) {
Alertify.notify(gettext('Import/export job created.'), 'success', 5);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(gettext('Import/export job created.'), 5);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
}
},

View File

@@ -1,11 +1,14 @@
define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'alertify', 'pgadmin', 'pgadmin.browser', 'backbone',
'backgrid', 'backform', 'pgadmin.backform', 'pgadmin.backgrid',
'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
Backform, AlertifyWrapper
) {
pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -347,11 +350,13 @@ define([
success: function(res) {
if (res.data && res.data.status) {
//Do nothing as we are creating the job and exiting from the main dialog
Alertify.success(res.data.info);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(res.data.info);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
}
else {
Alertify.error(res.data.errmsg);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.error(res.data.errmsg);
}
},
error: function(e) {

View File

@@ -2,10 +2,11 @@
define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'alertify', 'pgadmin.browser', 'backbone', 'backgrid',
'backform', 'pgadmin.browser.node'
'backform', 'pgadmin.browser.node',
'sources/alerts/alertify_wrapper',
], function(
gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform,
pgNode
pgNode, AlertifyWrapper
) {
// if module is already initialized, refer to that.
@@ -529,8 +530,9 @@ define([
data:{ 'data': JSON.stringify(args) },
success: function(res) {
if (res.success) {
alertify.notify(
gettext('Restore job created.'), 'success', 5
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(
gettext('Restore job created.'), 5
);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
} else {

View File

@@ -348,11 +348,11 @@ li {
}
#datagrid .slick-header .slick-header-column.ui-state-default {
color: #222222;
color: #333333;
padding: 4px 0 3px 6px;
background-color: #E8E8E8;
border-bottom: 1px solid #888 !important;
border-right: 1px solid #888 !important;
border-bottom: 1px solid #CCCCCC !important;
border-right: 1px solid #CCCCCC !important;
}
#datagrid .slick-header .slick-header-column.selected {

View File

@@ -10,6 +10,7 @@ define([
'sources/selection/xcell_selection_model',
'sources/selection/set_staged_rows',
'sources/sqleditor_utils',
'sources/alerts/alertify_wrapper',
'sources/generated/history',
'sources/generated/reactComponents',
@@ -34,7 +35,7 @@ define([
], function(
gettext, url_for, $, _, S, alertify, pgAdmin, Backbone, Backgrid, CodeMirror,
pgExplain, GridSelector, ActiveCellCapture, clipboard, copyData, RangeSelectionHelper, handleQueryOutputKeyboardEvent,
XCellSelectionModel, setStagedRows, SqlEditorUtils, HistoryBundle, reactComponents
XCellSelectionModel, setStagedRows, SqlEditorUtils, AlertifyWrapper, HistoryBundle, reactComponents
) {
/* Return back, this has been called more than once */
if (pgAdmin.SqlEditor)
@@ -1706,7 +1707,8 @@ define([
self.update_msg_history(true, res.result, false);
// Display the notifier if the timeout is set to >= 0
if (self.info_notifier_timeout >= 0) {
alertify.success(msg, self.info_notifier_timeout);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(msg, self.info_notifier_timeout);
}
}
@@ -1852,12 +1854,14 @@ define([
// Show message in message and history tab in case of query tool
self.total_time = self.get_query_run_time(self.query_start_time, self.query_end_time);
var msg1 = S(gettext("Total query runtime: %s.")).sprintf(self.total_time).value();
self.update_msg_history(true, "", false);
var msg1 = S(gettext("Successfully run. Total query runtime: %s.")).sprintf(self.total_time).value();
var msg2 = S(gettext("%s rows affected.")).sprintf(self.rows_affected).value();
// Display the notifier if the timeout is set to >= 0
if (self.info_notifier_timeout >= 0) {
alertify.success(msg1 + '<br />' + msg2, self.info_notifier_timeout);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(msg1 + ' ' + msg2, self.info_notifier_timeout);
}
var _msg = msg1 + '\n' + msg2;
@@ -2172,7 +2176,8 @@ define([
} else {
$("#btn-save").prop('disabled', true);
}
alertify.success(gettext("Row(s) deleted"));
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(gettext("Row(s) deleted"));
} else {
// There are other data to needs to be updated on server
if(is_updated) {
@@ -2323,7 +2328,8 @@ define([
$("#btn-flash").prop('disabled', false);
$('.sql-editor-message').text(res.data.result);
var err_msg = S(gettext("%s.")).sprintf(res.data.result).value();
alertify.notify(err_msg, 'error', 20);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.error(err_msg, 20);
grid.setSelectedRows([]);
// To highlight the row at fault
if(_.has(res.data, '_rowid') &&
@@ -2511,7 +2517,8 @@ define([
},
error: function(e) {
var errmsg = $.parseJSON(e.responseText).errormsg;
alertify.error(errmsg);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.error(errmsg);
self.trigger('pgadmin-sqleditor:loading-icon:hide');
// hide cursor
$busy_icon_div.removeClass('show_progress');
@@ -2539,7 +2546,8 @@ define([
data: JSON.stringify(data),
success: function(res) {
if (res.data.status) {
alertify.success(gettext("File saved successfully."));
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(gettext("File saved successfully."));
self.gridView.current_file = e;
self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, ''));
// disable save button on file save
@@ -2557,7 +2565,8 @@ define([
var errmsg = $.parseJSON(e.responseText).errormsg;
setTimeout(
function() {
alertify.error(errmsg);
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.error(errmsg);
}, 10
);
},

View File

@@ -2,9 +2,10 @@
define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
'sources/alerts/alertify_wrapper',
'backgrid.select.all', 'backgrid.filter'
], function(
gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode
gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode, AlertifyWrapper
) {
// if module is already initialized, refer to that.
@@ -310,10 +311,12 @@ define([
self.model.destroy({
wait: true,
success: function(res) {
alertify.success(gettext('User deleted.'));
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(gettext('User deleted.'));
},
error: function(m, jqxhr) {
alertify.error(gettext('Error during deleting user.'));
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.error(gettext('Error during deleting user.'));
}
});
},
@@ -490,13 +493,15 @@ define([
'confirmPassword':undefined});
m.startNewSession();
alertify.success(S(gettext("User '%s' saved.")).sprintf(
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.success(S(gettext("User '%s' saved.")).sprintf(
m.get('email')
).value());
},
error: function(res, jqxhr) {
m.startNewSession();
alertify.error(
var alertifyWrapper = new AlertifyWrapper();
alertifyWrapper.error(
S(gettext("Error saving user: '%s'")).sprintf(
jqxhr.responseJSON.errormsg
).value()