diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js b/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js index 2a7e3244..dded4d77 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js +++ b/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js @@ -1,7 +1,10 @@ define('pgadmin.node.cast', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify) { + 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', + + 'pgadmin.browser.collection' +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify, AlertifyWrapper) { // Extend the collection class for cast if (!pgBrowser.Nodes['coll-cast']) { var casts = pgAdmin.Browser.Nodes['coll-cast'] = @@ -212,7 +215,8 @@ define('pgadmin.node.cast', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js index ee5cbd76..0dc11da7 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js @@ -1,8 +1,10 @@ define('pgadmin.node.synonym', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', + 'pgadmin.browser.collection' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify, AlertifyWrapper) { if (!pgBrowser.Nodes['coll-synonym']) { var databases = pgAdmin.Browser.Nodes['coll-synonym'] = @@ -167,7 +169,8 @@ define('pgadmin.node.synonym', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js index 82bb8293..b12d9d30 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js @@ -2,8 +2,10 @@ define('pgadmin.node.check_constraints', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', + 'pgadmin.browser.collection' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, AlertifyWrapper) { // Check Constraint Node if (!pgBrowser.Nodes['check_constraints']) { @@ -63,7 +65,8 @@ define('pgadmin.node.check_constraints', [ type:'GET', success: function(res) { if (res.success == 1) { - Alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.removeIcon(i); data.valid = true; data.icon = 'icon-check_constraints'; @@ -76,7 +79,8 @@ define('pgadmin.node.check_constraints', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - Alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js index 84b7adfb..95afa3ef 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js @@ -1,8 +1,10 @@ define('pgadmin.node.foreign_key', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', + 'pgadmin.browser.collection' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, AlertifyWrapper) { var formatNode = function(opt) { if (!opt.id) { @@ -653,7 +655,8 @@ define('pgadmin.node.foreign_key', [ type:'GET', success: function(res) { if (res.success == 1) { - Alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.removeIcon(i); data.valid = true; data.icon = 'icon-foreign_key'; @@ -666,7 +669,8 @@ define('pgadmin.node.foreign_key', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - Alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js index 0b701a4b..dbd171e3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js @@ -1,9 +1,10 @@ define('pgadmin.node.table', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', 'pgadmin.browser.collection', 'pgadmin.node.column', 'pgadmin.node.constraints' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify, AlertifyWrapper) { if (!pgBrowser.Nodes['coll-table']) { var databases = pgBrowser.Nodes['coll-table'] = @@ -122,7 +123,8 @@ define('pgadmin.node.table', [ dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.unload(i); t.setInode(i); t.deselect(i); @@ -135,7 +137,8 @@ define('pgadmin.node.table', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -174,7 +177,8 @@ define('pgadmin.node.table', [ dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.removeIcon(i); data.icon = 'icon-table'; t.addIcon(i, {icon: data.icon}); @@ -191,7 +195,8 @@ define('pgadmin.node.table', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -221,7 +226,8 @@ define('pgadmin.node.table', [ type:'DELETE', success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.removeIcon(i); data.icon = 'icon-table'; t.addIcon(i, {icon: data.icon}); @@ -238,7 +244,8 @@ define('pgadmin.node.table', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js index 7716b878..1623fe54 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js @@ -1,8 +1,9 @@ define('pgadmin.node.trigger', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'backform', 'alertify', + 'sources/alerts/alertify_wrapper', 'pgadmin.browser.collection' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, alertify, AlertifyWrapper) { var CustomSwitchControl = Backform.CustomSwitchControl = Backform.SwitchControl.extend({ template: _.template([ @@ -109,7 +110,8 @@ define('pgadmin.node.trigger', [ dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.removeIcon(i); data.icon = 'icon-trigger'; t.addIcon(i, {icon: data.icon}); @@ -126,7 +128,8 @@ define('pgadmin.node.trigger', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -152,7 +155,8 @@ define('pgadmin.node.trigger', [ dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.removeIcon(i); data.icon = 'icon-trigger-bad'; t.addIcon(i, {icon: data.icon}); @@ -169,7 +173,8 @@ define('pgadmin.node.trigger', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js index 7e1c8351..24981071 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js @@ -1,8 +1,10 @@ define('pgadmin.node.mview', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'alertify', 'pgadmin.browser', 'codemirror', + 'sources/alerts/alertify_wrapper', + 'pgadmin.browser.server.privilege' -], function(gettext, url_for, $, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { +], function(gettext, url_for, $, _, S, pgAdmin, alertify, pgBrowser, CodeMirror, AlertifyWrapper) { /** Create and add a view collection into nodes @@ -292,7 +294,8 @@ define('pgadmin.node.mview', [ dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success('View refreshed successfully'); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success('View refreshed successfully'); } else { alertify.alert( diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js index aead13c6..e3797338 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js +++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js @@ -1,9 +1,11 @@ define('pgadmin.node.database', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', + 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege', 'pgadmin.browser.server.variable', -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, AlertifyWrapper) { if (!pgBrowser.Nodes['coll-database']) { var databases = pgBrowser.Nodes['coll-database'] = @@ -191,7 +193,8 @@ define('pgadmin.node.database', [ success: function(res) { if (res.success == 1) { var prv_i = t.parent(i); - Alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.removeIcon(i); data.connected = false; data.icon = 'icon-database-not-connected'; @@ -205,7 +208,8 @@ define('pgadmin.node.database', [ } else { try { - Alertify.error(res.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(res.errormsg); } catch (e) {} t.unload(i); } @@ -214,7 +218,8 @@ define('pgadmin.node.database', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - Alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -511,7 +516,8 @@ define('pgadmin.node.database', [ tree.addIcon(item, {icon: data.icon}); } - Alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); obj.trigger('connected', obj, item, data); pgBrowser.Events.trigger( 'pgadmin:database:connected', item, data diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js b/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js index ea1f118b..f5ec62bc 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js @@ -1,8 +1,10 @@ define('pgadmin.node.pga_job', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', + 'pgadmin.node.pga_jobstep', 'pgadmin.node.pga_schedule' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, AlertifyWrapper) { if (!pgBrowser.Nodes['coll-pga_job']) { var pga_jobs = pgBrowser.Nodes['coll-pga_job'] = @@ -178,18 +180,19 @@ define('pgadmin.node.pga_job', [ t.unload(i); }, error: function(xhr, status, error) { - var error_msg = "Unable to run pgagent job."; + var error_msg = "Unable to run pgagent job."; + var alertifyWrapper = new AlertifyWrapper(); if (xhr.readyState == 0) { - alertify.error(gettext('Not connected to the server or the connection to the server has been closed.')); + alertifyWrapper.error(gettext('Not connected to the server or the connection to the server has been closed.')); } else { if (_.isUndefined(xhr.responseText)) { - alertify.error(error_msg); + alertifyWrapper.error(error_msg); } else { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + alertifyWrapper.error(err.errormsg); } } } diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js index 72d44d16..34560583 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js @@ -2,10 +2,11 @@ define('pgadmin.node.server', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.server.supported_servers', - 'pgadmin.user_management.current_user' + 'pgadmin.user_management.current_user', + 'sources/alerts/alertify_wrapper', ], function( gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify, - supported_servers, current_user + supported_servers, current_user, AlertifyWrapper ) { if (!pgBrowser.Nodes['server']) { @@ -189,7 +190,8 @@ define('pgadmin.node.server', [ type:'DELETE', success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); d = t.itemData(i); t.removeIcon(i); d.connected = false; @@ -208,7 +210,8 @@ define('pgadmin.node.server', [ } else { try { - alertify.error(res.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(res.errormsg); } catch (e) {} t.unload(i); } @@ -217,7 +220,8 @@ define('pgadmin.node.server', [ try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -285,17 +289,20 @@ define('pgadmin.node.server', [ method:'GET', success: function(res) { if (res.data.status) { - alertify.success(res.data.result); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.data.result); } else { - alertify.error(res.data.result); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(res.data.result); } }, error: function(xhr, status, error) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -330,13 +337,15 @@ define('pgadmin.node.server', [ method:'POST', data:{ 'value': JSON.stringify(value) }, success: function(res) { - alertify.success(res.data.result, 10); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.data.result, 10); }, error: function(xhr, status, error) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg, 10); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg, 10); } } catch (e) {} t.unload(i); @@ -344,7 +353,8 @@ define('pgadmin.node.server', [ }); } else { evt.cancel = true; - alertify.error( gettext('Please enter a valid name.'), 10); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error( gettext('Please enter a valid name.'), 10); } }, // We will execute this function when user clicks on the Cancel button @@ -485,18 +495,20 @@ define('pgadmin.node.server', [ method:'POST', data:{'data': JSON.stringify(args) }, success: function(res) { + var alertifyWrapper = new AlertifyWrapper(); if (res.success) { - alertify.success(res.info); + alertifyWrapper.success(res.info); self.close(); } else { - alertify.error(res.errormsg); + alertifyWrapper.error(res.errormsg); } }, error: function(xhr, status, error) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} } @@ -529,7 +541,8 @@ define('pgadmin.node.server', [ dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.itemData(i).wal_pause=res.data.wal_pause; t.unload(i); t.setInode(i); @@ -545,7 +558,8 @@ define('pgadmin.node.server', [ var err = $.parseJSON(xhr.responseText); if (err.success == 0) { msg = S(err.errormsg).value(); - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -571,7 +585,8 @@ define('pgadmin.node.server', [ dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); t.itemData(i).wal_pause=res.data.wal_pause; t.unload(i); t.setInode(i); @@ -587,7 +602,8 @@ define('pgadmin.node.server', [ var err = $.parseJSON(xhr.responseText); if (err.success == 0) { msg = S(err.errormsg).value(); - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -888,7 +904,8 @@ define('pgadmin.node.server', [ pgBrowser.serverInfo || {}; serverInfo[data._id] = _.extend({}, data); - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); obj.trigger('connected', obj, item, data); // Generate the event that server is connected diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js index 4e6d26eb..61814879 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js @@ -1,9 +1,11 @@ define('pgadmin.node.tablespace', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', + 'sources/alerts/alertify_wrapper', + 'pgadmin.browser.collection', 'pgadmin.browser.node.ui', 'pgadmin.browser.server.privilege' -], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify) { +], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify, AlertifyWrapper) { if (!pgBrowser.Nodes['coll-tablespace']) { var databases = pgBrowser.Nodes['coll-tablespace'] = @@ -278,17 +280,20 @@ define('pgadmin.node.tablespace', [ data:{'data': JSON.stringify(args) }, success: function(res) { if (res.success) { - alertify.success(res.info); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(res.info); self.close(); } else { - alertify.error(res.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(res.errormsg); } }, error: function(xhr, status, error) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error(err.errormsg); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(err.errormsg); } } catch (e) {} } diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js index c7b4220f..3273b2be 100644 --- a/web/pgadmin/browser/templates/browser/js/node.js +++ b/web/pgadmin/browser/templates/browser/js/node.js @@ -1,8 +1,11 @@ define([ 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser.menu', 'backbone', 'alertify', 'pgadmin.browser.datamodel', - 'backform', 'pgadmin.backform', 'wcdocker', 'pgadmin.alertifyjs' -], function(gettext, $, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { + 'backform', + 'sources/alerts/alertify_wrapper', + + 'pgadmin.backform', 'wcdocker', 'pgadmin.alertifyjs' +], function(gettext, $, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform, AlertifyWrapper) { var wcDocker = window.wcDocker, keyCode = { @@ -616,10 +619,10 @@ define([ if (!(_.isFunction(obj.canDropCascade) ? obj.canDropCascade.apply(obj, [d, i]) : obj.canDropCascade)) { - Alertify.notify( + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error( S('The %s "%s" cannot be dropped!') .sprintf(obj.label, d.label).value(), - 'error', 10 ); return; @@ -630,12 +633,13 @@ define([ title = S( gettext('DROP %s?')).sprintf(obj.label).value(); if (!(_.isFunction(obj.canDrop) ? - obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) { - Alertify.notify( - S('The %s "%s" cannot be dropped!') - .sprintf(obj.label, d.label).value(), - 'error', 10 - ); + obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) { + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error( + S('The %s "%s" cannot be dropped!') + .sprintf(obj.label, d.label).value(), + 10 + ); return; } } diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js index 0763849d..91de0eef 100644 --- a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js +++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js @@ -1,7 +1,8 @@ // This defines File Manager dialog define([ - 'sources/gettext', 'jquery', 'underscore', 'alertify' -], function(gettext, $, _, alertify) { + 'sources/gettext', 'jquery', 'underscore', 'alertify', + 'sources/alerts/alertify_wrapper', +], function(gettext, $, _, alertify, AlertifyWrapper) { pgAdmin = pgAdmin || window.pgAdmin || {}; /* @@ -595,12 +596,14 @@ define([ permission = true; } else { $('.file_manager_ok').addClass('disabled'); - alertify.error(data.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(data.Error); } }, error: function() { $('.file_manager_ok').addClass('disabled'); - alertify.error( gettext('Error occurred while checking access permission.')); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error( gettext('Error occurred while checking access permission.')); } }); return permission; diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js index 920a1715..d0eaf7a8 100755 --- a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js +++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js @@ -13,7 +13,7 @@ "use strict"; // use alertify and underscore js -var alertify = require("alertify"), +var AlertifyWrapper = require('sources/alerts/alertify_wrapper'), _ = require("underscore"), S = require("underscore.string"), gettext = require('sources/gettext'); @@ -296,14 +296,17 @@ var setUploader = function(path) { $.getJSON(fileConnector + '?mode=addfolder&path=' + $('.currentpath').val() + '&name=' + foldername, function(resp) { var result = resp.data.result; if (result.Code === 1) { - alertify.success(lg.successful_added_folder); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(lg.successful_added_folder); getFolderInfo(result.Parent); } else { - alertify.error(result.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(result.Error); } }); } else { - alertify.error(lg.no_foldername); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(lg.no_foldername); } }; @@ -466,9 +469,11 @@ var renameItem = function(data) { // UnBind toolbar functions. $('.fileinfo').find('button.rename, button.delete, button.download').unbind(); - alertify.success(lg.successful_rename); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(lg.successful_rename); } else { - alertify.error(result.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(result.Error); } finalName = result['New Name']; @@ -508,14 +513,16 @@ var deleteItem = function(data) { if (result.Code === 1) { isDeleted = true; if (isDeleted) { - alertify.success(lg.successful_delete); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(lg.successful_delete); var rootpath = result.Path.substring(0, result.Path.length-1); // removing the last slash rootpath = rootpath.substr(0, rootpath.lastIndexOf('/') + 1); getFolderInfo(rootpath); } } else { isDeleted = false; - alertify.error(result.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(result.Error); } } }); @@ -601,7 +608,8 @@ var getFileInfo = function(file) { } } else { $('.file_manager_ok').addClass('disabled'); - alertify.error(data.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(data.Error); } } }); @@ -628,12 +636,14 @@ var checkPermission = function(path) { permission = true; } else { $('.file_manager_ok').addClass('disabled'); - alertify.error(data.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(data.Error); } }, error: function() { $('.file_manager_ok').addClass('disabled'); - alertify.error( gettext('Error occurred while checking access permission.')); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error( gettext('Error occurred while checking access permission.')); } }); return permission; @@ -703,7 +713,8 @@ var getFolderInfo = function(path, file_type) { // hide activity indicator $('.fileinfo').find('span.activity').hide(); if (data.Code === 0) { - alertify.error(data.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(data.Error); return; } // generate HTML for files/folder and render into container @@ -1599,18 +1610,21 @@ if (has_capability(data, 'upload')) { $this.find(".dz-upload").addClass("success"); }, 1000); $this.find(".dz-upload").css('width', "100%").html("100%"); - alertify.success(lg.upload_success); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.success(lg.upload_success); } else { $this.find(".dz-upload").addClass("error"); $this.find(".dz-upload").css('width', "0%").html("0%"); - alertify.error(data.Error); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(data.Error); } getFolderInfo(path); }, totaluploadprogress: function(progress) {}, complete: function(file) { if (file.status == "error") { - alertify.error(lg.ERROR_UPLOADING_FILE); + var alertifyWrapper = new AlertifyWrapper(); + alertifyWrapper.error(lg.ERROR_UPLOADING_FILE); } $('.upload_file .dz_cross_btn').removeAttr('disabled'); getFolderInfo(path); diff --git a/web/pgadmin/static/css/bootstrap.overrides.css b/web/pgadmin/static/css/bootstrap.overrides.css index 2bb97512..4acf484a 100755 --- a/web/pgadmin/static/css/bootstrap.overrides.css +++ b/web/pgadmin/static/css/bootstrap.overrides.css @@ -1019,137 +1019,12 @@ ul.nav.nav-tabs { height: 8em; overflow: scroll; } -/* Overrides alertify js headers */ -.alertify .ajs-header { - padding: 6px 10px!important; - min-height: 35px; - max-height: 35px; - border-bottom: 2px solid darkgray; - background-color: #2C76B4; - font-weight: bold; - color: white; - font-size: 14px; - font-weight: bold; - border-radius: 0; -} - -.alertify.ajs-maximized .ajs-commands, .alertify.ajs-resizable .ajs-commands { - margin: 2px 0px 0 0; -} - -/* Overrides alertify js headers hovering behaviour*/ -.alertify .ajs-header:hover { - background-color:#2C76B4; -} -/* Removes padding from alertify footer */ -.alertify .ajs-footer { - padding: 0; - min-height: 35px; -} -/* Restyling alertify buttons */ -.alertify .ajs-footer .ajs-buttons { - background-color: #D2D2D2; - border-width: 2px 0px 0px 0px; - border-style: solid; - border-color: rgb(85, 85, 85); -} - -.alertify .ajs-footer .ajs-buttons.ajs-auxiliary .ajs-button, .alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button { - margin-left: 2px; - margin-right: 2px; - margin-top:2px; - margin-bottom:0px; -} - -.alertify .ajs-footer .ajs-buttons .ajs-button { - min-width: 40px; - min-height: 30px; -} - -.alertify .ajs-commands { - margin: -22px 4px 0 0; -} - -/* Replaces alertify button icons */ -.alertify .ajs-commands button{ - margin-left: 5px; -} - -/* Prevent text blur in the runtime */ -.alertify .ajs-dimmer, -.alertify .ajs-modal { - -webkit-transform: none; -} - -.ajs-commands { - position: absolute; - width: auto!important; -} - -.ajs-pin , .ajs-maximize , .ajs-close{ - width: 20px; - height: 20px; - border: 2px solid #9E9E9E !important; - background-color: #ddd!important; - font-size: 12px; - border-radius: 5px 5px 5px 5px; - position: relative; - //float: right; - cursor: pointer; - text-align: center; - overflow: hidden; - z-index: 1; -} -.ajs-pin:hover , .ajs-maximize:hover , .ajs-close:hover{ - border: 2px solid #CCCCCC!important; -} - -.alertify .ajs-commands button.ajs-maximize { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVQ4jcWTuw2AMAxEn5jBs7B/e0gpmAiKEGRS5QDBSS7v+Q8fSsCWQgDTA+DsGgJYuypumTNkWCWZg9q/HIAOSDim/xTUcu0exXXaxQG0teRVWQPLx2Gbe8B55yNqv7C4GV/TDq//J11odoZgAAAAAElFTkSuQmCC); - background-size: 14px; -} - -.alertify.ajs-modeless.ajs-pinnable .ajs-commands button.ajs-pin { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAkElEQVQ4jWNkwAR8DAwMBxkYGMTQxF8xMDDYMzAwfMKiBwMYMDAw3GRgYPgPxTehYiSBKCQDonApYiLV1KFjABsDA4MpEt8UKkYUkGBgYDjPgAhAGD4PlSPooqNYNMPwUXRXM+IwBAbaoXQlktg/ZMUsWAxAVvASmyZCBiCDNwTkCRrwasANIOgFQoADinECAAtnIEoWoODLAAAAAElFTkSuQmCC); - background-size: 13px; -} - -.alertify .ajs-commands button.ajs-close { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAdklEQVQ4jd2SwQnAIAxF36GH0pOTFHEgF3IkR5LO0F4SCGJVEHroAy/f/E+igV+yAa6hO7nrcgAZuIBg9CBalppXEnDL0RA1q556ASdQqhBrLlLTxVch1uxHZiU2AuKs2Vdt23GGHSy/wfIvzOzBPhpjaRO/5wG/szevJ+ZXzAAAAABJRU5ErkJggg==); -} - -.alertify.ajs-maximized .ajs-commands button.ajs-maximize { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA8klEQVQ4jZ3QMUpDQRCH8V+ewULQE4iERTyCrQiDCpbaCKKljbV4A89gqVgGrCMDWlpaWwVPoFYiIjYv8hBJXjLN7s7u9+3wZ4aKiOWI2IJOi8dHuM7MXxj3WMHe3CRBKeUGvVJKllJG8CrmoNty6jMsYKeGoY/jtgI4bez7OMjMr2oKwaieRzDMIljDRUSgXQZPeG2cv7GOffQ7ETGPcyw2HozWQWY+jLN3M/MzIu4wwNKf+zeMFVSQmY/YbfzeuiqIiAonZgi1quErHNa9F7xPM8FlAx5iA9ttJRVu8VHDm5k5rDNpLRERWxHR+6c/MZMfLIJDwzY66IkAAAAASUVORK5CYII=); -} - -/* Restyling alertify dialogue panel boundaries */ -.alertify .ajs-dialog { - border: 3px solid #DDDDDD; - border-radius: 0; -} -.alertify .ajs-content { - padding-left: 0 !important; - padding-right: 0 !important; -} - -.alertify .ajs-handle { - right: -4px; - bottom: -4px; -} span.button-label { font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; font-size: initial; } -button.pg-alertify-button { - font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; - font-size: 14px; - -webkit-font-smoothing: auto; -} -.fa.pg-alertify-button:before { - font: normal normal normal 18px/1 FontAwesome; - margin-right: 5px; -} + .backform_control_notes { background-color: #f5f5f5; border: 1px solid #ccc; diff --git a/web/pgadmin/static/js/alerts/alertify_wrapper.js b/web/pgadmin/static/js/alerts/alertify_wrapper.js new file mode 100644 index 00000000..c47091ee --- /dev/null +++ b/web/pgadmin/static/js/alerts/alertify_wrapper.js @@ -0,0 +1,40 @@ +define([ + 'jquery', + 'alertify', +], function ($, alertify) { + var AlertifyWrapper = function () { + var success = function (message, timeout) { + var alertMessage = '\ +
\ +
\ +
\ + \ +
\ +
' + message + '
\ +
\ +
'; + var alert = alertify.success(alertMessage, timeout); + return alert; + }; + + var error = function(message, timeout) { + var alertMessage = '\ +
\ +
\ +
\ + \ +
\ +
' + message + '
\ +
\ +
'; + var alert = alertify.error(alertMessage, timeout); + return alert; + }; + + $.extend(this, { + 'success': success, + 'error': error, + }); + }; + return AlertifyWrapper; +}); \ No newline at end of file diff --git a/web/pgadmin/static/scss/_alert.scss b/web/pgadmin/static/scss/_alert.scss new file mode 100644 index 00000000..ea25d31c --- /dev/null +++ b/web/pgadmin/static/scss/_alert.scss @@ -0,0 +1,119 @@ +/*doc +--- +title: Alerts +name: alerts +category: alerts +--- + +```html_example +
+
+
+
+
+ +
+
+ Successfully run. Total query runtime: 32 msec. 1 row retrieved +
+
+
+
+
+ +
+
+
+
+
+ +
+
+ Error retrieving properties - INTERNAL SERVER ERROR +
+
+
+
+
+ +
+
+
+
+
+ This is a neutral message +
+
+
+
+
+ +``` +*/ + + +// from bootstrap scss: + +@if $enable-flex { + .media { + display: flex; + } + .media-body { + flex: 1; + } + .media-middle { + align-self: center; + } + .media-bottom { + align-self: flex-end; + } +} @else { + .media, + .media-body { + overflow: hidden; + } + .media-body { + width: 10000px; + } + .media-left, + .media-right, + .media-body { + display: inline; + vertical-align: top; + } + .media-middle { + vertical-align: middle; + } + .media-bottom { + vertical-align: bottom; + } +} + +.alert-row { + display: block; +} + +.alert-box { + padding: 15px; + display: inline-block; +} + +.alert-icon { + display: inline-block; +} + +.alert-text { + display: inline-block; + padding: 0 12px 0 10px; +} + +.alert-info { + border-color: #84acdd +} + +.media-body { + display: inline; + vertical-align: top; +} + + diff --git a/web/pgadmin/static/scss/_alertify.overrides.scss b/web/pgadmin/static/scss/_alertify.overrides.scss new file mode 100644 index 00000000..b4460644 --- /dev/null +++ b/web/pgadmin/static/scss/_alertify.overrides.scss @@ -0,0 +1,166 @@ +/* Overrides alertify js headers */ +.alertify { + .ajs-header { + padding: 6px 10px !important; + min-height: 35px; + max-height: 35px; + border-bottom: 2px solid darkgray; + background-color: #2C76B4; + font-weight: bold; + color: white; + font-size: 14px; + font-weight: bold; + border-radius: 0; + } + + /* Overrides alertify js headers hovering behaviour*/ + .ajs-header:hover { + background-color: #2C76B4; + } + + /* Removes padding from alertify footer */ + .ajs-footer { + padding: 0; + min-height: 35px; + } + + /* Restyling alertify buttons */ + .ajs-footer .ajs-buttons { + background-color: #D2D2D2; + border-width: 2px 0px 0px 0px; + border-style: solid; + border-color: rgb(85, 85, 85); + } + + .ajs-footer .ajs-buttons.ajs-auxiliary .ajs-button, + .ajs-footer .ajs-buttons.ajs-primary .ajs-button { + margin-left: 2px; + margin-right: 2px; + margin-top: 2px; + margin-bottom: 0px; + } + + .ajs-footer .ajs-buttons .ajs-button { + min-width: 40px; + min-height: 30px; + } + + .ajs-commands { + margin: -22px 4px 0 0; + } + + /* Replaces alertify button icons */ + .ajs-commands button { + margin-left: 5px; + } + + /* Prevent text blur in the runtime */ + .ajs-dimmer, + .ajs-modal { + -webkit-transform: none; + } + + .ajs-commands button.ajs-maximize { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVQ4jcWTuw2AMAxEn5jBs7B/e0gpmAiKEGRS5QDBSS7v+Q8fSsCWQgDTA+DsGgJYuypumTNkWCWZg9q/HIAOSDim/xTUcu0exXXaxQG0teRVWQPLx2Gbe8B55yNqv7C4GV/TDq//J11odoZgAAAAAElFTkSuQmCC); + background-size: 14px; + } + + .ajs-commands button.ajs-close { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAdklEQVQ4jd2SwQnAIAxF36GH0pOTFHEgF3IkR5LO0F4SCGJVEHroAy/f/E+igV+yAa6hO7nrcgAZuIBg9CBalppXEnDL0RA1q556ASdQqhBrLlLTxVch1uxHZiU2AuKs2Vdt23GGHSy/wfIvzOzBPhpjaRO/5wG/szevJ+ZXzAAAAABJRU5ErkJggg==); + } + + /* Restyling alertify dialogue panel boundaries */ + .ajs-dialog { + border: 3px solid #DDDDDD; + border-radius: 0; + } + .ajs-content { + padding-left: 0 !important; + padding-right: 0 !important; + } + + .ajs-handle { + right: -4px; + bottom: -4px; + } +} + +.alertify.ajs-maximized .ajs-commands, +.alertify.ajs-resizable .ajs-commands { + margin: 2px 0px 0 0; +} + +.ajs-commands { + position: absolute; + width: auto !important; +} + +.ajs-pin, .ajs-maximize, .ajs-close { + width: 20px; + height: 20px; + border: 2px solid #9E9E9E !important; + background-color: #ddd !important; + font-size: 12px; + border-radius: 5px 5px 5px 5px; + position: relative; + //float: right; + cursor: pointer; + text-align: center; + overflow: hidden; + z-index: 1; +} + +.ajs-pin:hover, .ajs-maximize:hover, .ajs-close:hover { + border: 2px solid #CCCCCC !important; +} + +.alertify.ajs-modeless.ajs-pinnable .ajs-commands button.ajs-pin { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAkElEQVQ4jWNkwAR8DAwMBxkYGMTQxF8xMDDYMzAwfMKiBwMYMDAw3GRgYPgPxTehYiSBKCQDonApYiLV1KFjABsDA4MpEt8UKkYUkGBgYDjPgAhAGD4PlSPooqNYNMPwUXRXM+IwBAbaoXQlktg/ZMUsWAxAVvASmyZCBiCDNwTkCRrwasANIOgFQoADinECAAtnIEoWoODLAAAAAElFTkSuQmCC); + background-size: 13px; +} + +.alertify.ajs-maximized .ajs-commands button.ajs-maximize { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA8klEQVQ4jZ3QMUpDQRCH8V+ewULQE4iERTyCrQiDCpbaCKKljbV4A89gqVgGrCMDWlpaWwVPoFYiIjYv8hBJXjLN7s7u9+3wZ4aKiOWI2IJOi8dHuM7MXxj3WMHe3CRBKeUGvVJKllJG8CrmoNty6jMsYKeGoY/jtgI4bez7OMjMr2oKwaieRzDMIljDRUSgXQZPeG2cv7GOffQ7ETGPcyw2HozWQWY+jLN3M/MzIu4wwNKf+zeMFVSQmY/YbfzeuiqIiAonZgi1quErHNa9F7xPM8FlAx5iA9ttJRVu8VHDm5k5rDNpLRERWxHR+6c/MZMfLIJDwzY66IkAAAAASUVORK5CYII=); +} + +/* Restyling alertify query results messages */ +.alertify-notifier.ajs-right .ajs-message.ajs-visible { + right: 0; +} + +.alertify-notifier .ajs-message { + width: initial; + border-radius: 4px; +} + +.alertify-notifier { + width: initial; +} + +button.pg-alertify-button { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + -webkit-font-smoothing: auto; +} + +.fa.pg-alertify-button:before { + font: normal normal normal 18px/1 FontAwesome; + margin-right: 5px; +} + +.ajs-text-smoothing { + text-shadow: none; + -webkit-font-smoothing: antialiased; +} + +.ajs-message.ajs-error.ajs-visible { + @extend .bg-red-1; + @extend .border-red-2; + @extend .ajs-text-smoothing; +} + +.ajs-message.ajs-success.ajs-visible { + @extend .bg-green-1; + @extend .border-green-2; + @extend .ajs-text-smoothing; +} diff --git a/web/pgadmin/static/scss/_othercolors.scss b/web/pgadmin/static/scss/_othercolors.scss new file mode 100644 index 00000000..92cfe5af --- /dev/null +++ b/web/pgadmin/static/scss/_othercolors.scss @@ -0,0 +1,156 @@ +/*doc +--- +title: Others +name: z-othercolors +category: colors +--- +These colors should be used to highlight hover options in dropdown menus and catalog browser or to tell the user when something is right or wrong. + + +```html_example +
+
+
+
+ #e7f2ff +
+
+
+
+ #84acdd +
+
+
+
+
+
+
+
+
+ #f2dede +
+
+
+
+ #de8585 +
+
+
+
+ #d0021b +
+
+
+
+
+
+
+
+
+ #dff0d7 +
+
+
+
+ #a2c189 +
+
+
+
+ #3a773a +
+
+
+
+``` + +*/ + +.color-chip { + align-items: center; + border-radius: 3px; + box-shadow: inset 0 -3px 0 0 rgba(0, 0, 0, .15); + color: rgba(0, 0, 0, .65); + display: flex; + font-size: 1.25em; + height: 100px; + justify-content: center; + margin: 0 0 1em; + width: 100%; +} + +.bg-blue-1 { + background-color: #e7f2ff; +} + +.bg-blue-2 { + background-color: #84acdd; +} + +.bg-red-1 { + background-color: #f2dede; +} + +.bg-red-2 { + background-color: #de8585; +} + +.bg-red-3 { + background-color: #d0021b; +} + +.bg-green-1 { + background-color: #dff0d7; +} + +.bg-green-2 { + background-color: #a2c189; +} + +.bg-green-3 { + background-color: #3a773a; +} + +.border-blue-1 { + border-color: #e7f2ff; +} + +.border-blue-2 { + border-color: #84acdd; +} + +.border-red-1 { + border-color: #f2dede; +} + +.border-red-2 { + border-color: #de8585; +} + +.border-red-3 { + border-color: #d0021b; +} + +.border-green-1 { + border-color: #dff0d7; +} + +.border-green-2 { + border-color: #a2c189; +} + +.border-green-3 { + border-color: #3a773a; +} + +.font-red-3 { + color: #d0021b; +} + +.font-green-3 { + color: #3a773a; +} + +.font-white { + color: #FFFFFF; +} diff --git a/web/pgadmin/static/scss/_typography.scss b/web/pgadmin/static/scss/_typography.scss new file mode 100644 index 00000000..60801702 --- /dev/null +++ b/web/pgadmin/static/scss/_typography.scss @@ -0,0 +1,68 @@ +/*doc +--- +title: Typography +name: typography +category: typography +--- + +Font Typography + +```html_example_table +
+ Body 14 px Helvetica Neue +
+ +
+ Body 14 px Helvetica Neue bold +
+ +
+ Body 13 px Helvetica Neue +
+ +
+ Body 13 px Helvetica Neue bold +
+ +
+ Body 12 px Helvetica Neue +
+ +
+ Body 12 px Helvetica Neue bold +
+ +
+ Body 11 px Helvetica Neue +
+ +
+ Body 11 px Helvetica Neue bold +
+``` + +*/ + +.text-bold { + font-weight: bold; +} + +.text-14 { + font-family: "Helvetica Neue"; + font-size: 14px; +} + +.text-13 { + font-family: "Helvetica Neue"; + font-size: 13px; +} + +.text-12 { + font-family: "Helvetica Neue"; + font-size: 12px; +} + +.text-11 { + font-family: "Helvetica Neue"; + font-size: 11px; +} diff --git a/web/pgadmin/static/scss/pgadmin.scss b/web/pgadmin/static/scss/pgadmin.scss index e69de29b..e9992418 100644 --- a/web/pgadmin/static/scss/pgadmin.scss +++ b/web/pgadmin/static/scss/pgadmin.scss @@ -0,0 +1,6 @@ +$enable-flex: false; + +@import 'alert'; +@import 'othercolors'; +@import 'typography'; +@import 'alertify.overrides'; diff --git a/web/pgadmin/tools/backup/templates/backup/js/backup.js b/web/pgadmin/tools/backup/templates/backup/js/backup.js index 874bbeb3..c43dcd2b 100644 --- a/web/pgadmin/tools/backup/templates/backup/js/backup.js +++ b/web/pgadmin/tools/backup/templates/backup/js/backup.js @@ -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); } }, diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 9e5b7d51..ba71acb7 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -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) { diff --git a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js index 8eebac58..7d3ef3fd 100644 --- a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js +++ b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js @@ -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); } }, diff --git a/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js b/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js index f3823f91..5ab3c44b 100644 --- a/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js +++ b/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js @@ -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) { diff --git a/web/pgadmin/tools/restore/templates/restore/js/restore.js b/web/pgadmin/tools/restore/templates/restore/js/restore.js index f8211623..c23d9e36 100644 --- a/web/pgadmin/tools/restore/templates/restore/js/restore.js +++ b/web/pgadmin/tools/restore/templates/restore/js/restore.js @@ -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 { diff --git a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css index 528541d9..b1b75727 100644 --- a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css +++ b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css @@ -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 { diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js index 44c9f254..173301bc 100644 --- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js @@ -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 + '
' + 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 ); }, diff --git a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js index f11b5527..ace50aa3 100644 --- a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js +++ b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js @@ -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. @@ -337,10 +338,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.')); } }); }, @@ -517,13 +520,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() diff --git a/web/regression/javascript/alerts/alertify_wrapper_spec.js b/web/regression/javascript/alerts/alertify_wrapper_spec.js new file mode 100644 index 00000000..b385c95d --- /dev/null +++ b/web/regression/javascript/alerts/alertify_wrapper_spec.js @@ -0,0 +1,41 @@ +////////////////////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2017, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////////////////// + +import alertify from '../../../pgadmin/static/vendor/alertifyjs/alertify'; +import AlertifyWrapper from '../../../pgadmin/static/js/alerts/alertify_wrapper'; + +describe('alertify_wrapper', function () { + describe('success', function () { + it('calls the success function from alertify and adds the checkmark to the element', function () { + spyOn(alertify, 'success'); + var alertifyWrapper = new AlertifyWrapper(); + + alertifyWrapper.success('Yay, congrats!', 1); + + var calledWithMessage = alertify.success.calls.mostRecent().args[0]; + + expect(calledWithMessage).toContain('Yay, congrats!'); + expect(calledWithMessage).toContain('class="fa fa-check"'); + }); + }); + + describe('error', function () { + it('calls the error function from alertify and adds the warning symbol to the element', function () { + spyOn(alertify, 'error'); + var alertifyWrapper = new AlertifyWrapper(); + + alertifyWrapper.error('bad, very bad', 1); + + var calledWithMessage = alertify.error.calls.mostRecent().args[0]; + + expect(calledWithMessage).toContain('bad, very bad'); + expect(calledWithMessage).toContain('class="fa fa-exclamation-triangle"'); + }); + }); +});