Replace Alertify alert and confirm with React-based model dialog. Fixes #7053

This commit is contained in:
Akshay Joshi
2021-12-07 18:52:40 +05:30
parent e327066523
commit fd53e4f5f9
62 changed files with 393 additions and 398 deletions

View File

@@ -19,6 +19,7 @@ Housekeeping
| `Issue #6984 <https://redmine.postgresql.org/issues/6984>`_ - Port Backup Global, Backup Server, and Backup object dialog in React. | `Issue #6984 <https://redmine.postgresql.org/issues/6984>`_ - Port Backup Global, Backup Server, and Backup object dialog in React.
| `Issue #7004 <https://redmine.postgresql.org/issues/7004>`_ - Replaced alertifyjs notifiers with React-based notistack. | `Issue #7004 <https://redmine.postgresql.org/issues/7004>`_ - Replaced alertifyjs notifiers with React-based notistack.
| `Issue #7010 <https://redmine.postgresql.org/issues/7010>`_ - Upgrade Flask to version 2. | `Issue #7010 <https://redmine.postgresql.org/issues/7010>`_ - Upgrade Flask to version 2.
| `Issue #7053 <https://redmine.postgresql.org/issues/7053>`_ - Replace Alertify alert and confirm with React-based model dialog.
Bug fixes Bug fixes
********* *********

View File

@@ -5,8 +5,8 @@ import { isEmptyString } from 'sources/validators';
import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../../../static/js/SchemaView'; import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../../../static/js/SchemaView';
import DataGridViewWithHeaderForm from '../../../../../../../../../../static/js/helpers/DataGridViewWithHeaderForm'; import DataGridViewWithHeaderForm from '../../../../../../../../../../static/js/helpers/DataGridViewWithHeaderForm';
import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../../static/js/node_ajax'; import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../../static/js/node_ajax';
import { pgAlertify } from '../../../../../../../../../../static/js/helpers/legacyConnector';
import TableSchema from '../../../../static/js/table.ui'; import TableSchema from '../../../../static/js/table.ui';
import Notify from '../../../../../../../../../../static/js/helpers/Notifier';
export function getNodeExclusionConstraintSchema(treeNodeInfo, itemNodeData, pgBrowser, noColumns=false) { export function getNodeExclusionConstraintSchema(treeNodeInfo, itemNodeData, pgBrowser, noColumns=false) {
let tableNode = pgBrowser.Nodes['table']; let tableNode = pgBrowser.Nodes['table'];
@@ -275,7 +275,7 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
options: this.fieldOptions.amname, options: this.fieldOptions.amname,
deferredDepChange: (state, source, topState, actionObj)=>{ deferredDepChange: (state, source, topState, actionObj)=>{
return new Promise((resolve)=>{ return new Promise((resolve)=>{
pgAlertify().confirm( Notify.confirm(
gettext('Change access method?'), gettext('Change access method?'),
gettext('Changing access method will clear columns collection'), gettext('Changing access method will clear columns collection'),
function () { function () {

View File

@@ -11,8 +11,8 @@ import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui'; import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../static/js/node_ajax'; import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../static/js/node_ajax';
import _ from 'lodash'; import _ from 'lodash';
import { pgAlertify } from 'sources/helpers/legacyConnector';
import { isEmptyString } from 'sources/validators'; import { isEmptyString } from 'sources/validators';
import Notify from '../../../../../../../../../static/js/helpers/Notifier';
export function getColumnSchema(nodeObj, treeNodeInfo, itemNodeData) { export function getColumnSchema(nodeObj, treeNodeInfo, itemNodeData) {
return new ColumnSchema( return new ColumnSchema(
@@ -296,7 +296,7 @@ export default class IndexSchema extends BaseUISchema {
}; };
if(state.amname != actionObj.oldState.amname) { if(state.amname != actionObj.oldState.amname) {
return new Promise((resolve)=>{ return new Promise((resolve)=>{
pgAlertify().confirm( Notify.confirm(
gettext('Changing access method will clear columns collection'), gettext('Changing access method will clear columns collection'),
function () { function () {
setColumns(resolve); setColumns(resolve);

View File

@@ -194,7 +194,7 @@ function(
if (!d) if (!d)
return false; return false;
Alertify.confirm( Notify.confirm(
gettext('Truncate Table'), gettext('Truncate Table'),
gettext('Are you sure you want to truncate table %s?', d.label), gettext('Are you sure you want to truncate table %s?', d.label),
function (e) { function (e) {
@@ -238,7 +238,7 @@ function(
if (!d) if (!d)
return false; return false;
Alertify.confirm( Notify.confirm(
gettext('Reset statistics'), gettext('Reset statistics'),
gettext('Are you sure you want to reset the statistics for table "%s"?', d._label), gettext('Are you sure you want to reset the statistics for table "%s"?', d._label),
function (e) { function (e) {
@@ -282,7 +282,7 @@ function(
if (!d) if (!d)
return false; return false;
Alertify.confirm( Notify.confirm(
gettext('Detach Partition'), gettext('Detach Partition'),
gettext('Are you sure you want to detach the partition %s?', d._label), gettext('Are you sure you want to detach the partition %s?', d._label),
function (e) { function (e) {

View File

@@ -180,7 +180,7 @@ define('pgadmin.node.table', [
if (!d) if (!d)
return false; return false;
Alertify.confirm( Notify.confirm(
gettext('Truncate Table'), gettext('Truncate Table'),
gettext('Are you sure you want to truncate table %s?', d.label), gettext('Are you sure you want to truncate table %s?', d.label),
function (e) { function (e) {
@@ -228,7 +228,7 @@ define('pgadmin.node.table', [
if (!d) if (!d)
return false; return false;
Alertify.confirm( Notify.confirm(
gettext('Reset statistics'), gettext('Reset statistics'),
gettext('Are you sure you want to reset the statistics for table "%s"?', d._label), gettext('Are you sure you want to reset the statistics for table "%s"?', d._label),
function (e) { function (e) {

View File

@@ -6,7 +6,6 @@ import { isEmptyString } from 'sources/validators';
import PrimaryKeySchema from '../../constraints/index_constraint/static/js/primary_key.ui'; import PrimaryKeySchema from '../../constraints/index_constraint/static/js/primary_key.ui';
import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../static/js/SchemaView'; import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../static/js/SchemaView';
import { PartitionKeysSchema, PartitionsSchema } from './partition.utils.ui'; import { PartitionKeysSchema, PartitionsSchema } from './partition.utils.ui';
import { pgAlertify } from '../../../../../../../../static/js/helpers/legacyConnector';
import CheckConstraintSchema from '../../constraints/check_constraint/static/js/check_constraint.ui'; import CheckConstraintSchema from '../../constraints/check_constraint/static/js/check_constraint.ui';
import UniqueConstraintSchema from '../../constraints/index_constraint/static/js/unique_constraint.ui'; import UniqueConstraintSchema from '../../constraints/index_constraint/static/js/unique_constraint.ui';
import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../static/js/node_ajax'; import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../static/js/node_ajax';
@@ -15,6 +14,7 @@ import { getNodeVacuumSettingsSchema } from '../../../../../static/js/vacuum.ui'
import { getNodeForeignKeySchema } from '../../constraints/foreign_key/static/js/foreign_key.ui'; import { getNodeForeignKeySchema } from '../../constraints/foreign_key/static/js/foreign_key.ui';
import { getNodeExclusionConstraintSchema } from '../../constraints/exclusion_constraint/static/js/exclusion_constraint.ui'; import { getNodeExclusionConstraintSchema } from '../../constraints/exclusion_constraint/static/js/exclusion_constraint.ui';
import { getNodePrivilegeRoleSchema } from '../../../../../static/js/privilege.ui'; import { getNodePrivilegeRoleSchema } from '../../../../../static/js/privilege.ui';
import Notify from '../../../../../../../../static/js/helpers/Notifier';
export function getNodeTableSchema(treeNodeInfo, itemNodeData, pgBrowser) { export function getNodeTableSchema(treeNodeInfo, itemNodeData, pgBrowser) {
const spcname = ()=>getNodeListByName('tablespace', treeNodeInfo, itemNodeData, {}, (m)=>{ const spcname = ()=>getNodeListByName('tablespace', treeNodeInfo, itemNodeData, {}, (m)=>{
@@ -598,7 +598,7 @@ export default class TableSchema extends BaseUISchema {
group: 'advanced', min_version: 90600, group: 'advanced', min_version: 90600,
depChange: (state)=>{ depChange: (state)=>{
if (state.rlspolicy && this.origData.rlspolicy != state.rlspolicy) { if (state.rlspolicy && this.origData.rlspolicy != state.rlspolicy) {
pgAlertify().alert( Notify.alert(
gettext('Check Policy?'), gettext('Check Policy?'),
gettext('Please check if any policy exist. If no policy exists for the table, a default-deny policy is used, meaning that no rows are visible or can be modified by other users') gettext('Please check if any policy exist. If no policy exists for the table, a default-deny policy is used, meaning that no rows are visible or can be modified by other users')
); );
@@ -730,7 +730,7 @@ export default class TableSchema extends BaseUISchema {
}; };
if(!isEmptyString(state.typname) && isEmptyString(actionObj.oldState.typname)) { if(!isEmptyString(state.typname) && isEmptyString(actionObj.oldState.typname)) {
return new Promise((resolve)=>{ return new Promise((resolve)=>{
pgAlertify().confirm( Notify.confirm(
gettext('Remove column definitions?'), gettext('Remove column definitions?'),
gettext('Changing \'Of type\' will remove column definitions.'), gettext('Changing \'Of type\' will remove column definitions.'),
function () { function () {

View File

@@ -256,7 +256,7 @@ define('pgadmin.node.mview', [
if (pgBrowser.tree.hasParent(j)) { if (pgBrowser.tree.hasParent(j)) {
j = pgBrowser.tree.parent(j); j = pgBrowser.tree.parent(j);
} else { } else {
Alertify.alert(gettext('Please select server or child node from tree.')); Notify.alert(gettext('Please select server or child node from tree.'));
break; break;
} }
} }
@@ -275,7 +275,7 @@ define('pgadmin.node.mview', [
dataType: 'json', dataType: 'json',
}).done(function(res) { }).done(function(res) {
if (!res.success) { if (!res.success) {
Alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
res.errormsg res.errormsg
); );
@@ -294,7 +294,7 @@ define('pgadmin.node.mview', [
Notify.success(refreshed_res.data.info); Notify.success(refreshed_res.data.info);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', obj); pgBrowser.Events.trigger('pgadmin-bgprocess:created', obj);
} else { } else {
Alertify.alert( Notify.alert(
gettext('Failed to create materialized view refresh job.'), gettext('Failed to create materialized view refresh job.'),
refreshed_res.errormsg refreshed_res.errormsg
); );
@@ -306,7 +306,7 @@ define('pgadmin.node.mview', [
); );
}); });
}).fail(function() { }).fail(function() {
Alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
gettext('Failed to fetch Utility information') gettext('Failed to fetch Utility information')
); );

View File

@@ -176,7 +176,7 @@ define('pgadmin.node.database', [
connect(self, d, t, i, true); connect(self, d, t, i, true);
return; return;
} }
Alertify.confirm( Notify.confirm(
gettext('Connection lost'), gettext('Connection lost'),
gettext('Would you like to reconnect to the database?'), gettext('Would you like to reconnect to the database?'),
function() { function() {
@@ -218,7 +218,7 @@ define('pgadmin.node.database', [
d = i ? t.itemData(i) : undefined; d = i ? t.itemData(i) : undefined;
if (d) { if (d) {
Alertify.confirm( Notify.confirm(
gettext('Disconnect the database'), gettext('Disconnect the database'),
gettext('Are you sure you want to disconnect the database - %s?', d.label), gettext('Are you sure you want to disconnect the database - %s?', d.label),
function() { function() {

View File

@@ -9,8 +9,8 @@
import { getNodeListByName } from '../../../../../../static/js/node_ajax'; import { getNodeListByName } from '../../../../../../static/js/node_ajax';
import SubscriptionSchema from './subscription.ui'; import SubscriptionSchema from './subscription.ui';
import getApiInstance from '../../../../../../../static/js/api_instance'; import getApiInstance from '../../../../../../../static/js/api_instance';
import { pgAlertify } from '../../../../../../../../pgadmin/static/js/helpers/legacyConnector';
import _ from 'lodash'; import _ from 'lodash';
import Notify from '../../../../../../../static/js/helpers/Notifier';
define('pgadmin.node.subscription', [ define('pgadmin.node.subscription', [
'sources/gettext', 'sources/url_for', 'jquery', 'sources/gettext', 'sources/url_for', 'jquery',
@@ -195,12 +195,12 @@ define('pgadmin.node.subscription', [
.then(res=>{ .then(res=>{
if ((res.data.errormsg === '') && !_.isNull(res.data.data)){ if ((res.data.errormsg === '') && !_.isNull(res.data.data)){
resolve(res.data.data); resolve(res.data.data);
pgAlertify().info( Notify.info(
gettext('Publication fetched successfully.') gettext('Publication fetched successfully.')
); );
}else if(!_.isNull(res.data.errormsg) && _.isNull(res.data.data)){ }else if(!_.isNull(res.data.errormsg) && _.isNull(res.data.data)){
reject(res.data.errormsg); reject(res.data.errormsg);
pgAlertify().alert( Notify.alert(
gettext('Check connection?'), gettext('Check connection?'),
gettext(res.data.errormsg) gettext(res.data.errormsg)
); );

View File

@@ -535,7 +535,7 @@ define('pgadmin.node.role', [
roleOp = roleReassignData.role_op, roleOp = roleReassignData.role_op,
confirmBoxTitle = utils.titleize(roleOp); confirmBoxTitle = utils.titleize(roleOp);
alertify.confirm( Notify.confirm(
gettext('%s Objects', confirmBoxTitle), gettext('%s Objects', confirmBoxTitle),
gettext('Are you sure you wish to %s all the objects owned by the selected role?', roleOp), gettext('Are you sure you wish to %s all the objects owned by the selected role?', roleOp),
function() { function() {
@@ -548,7 +548,7 @@ define('pgadmin.node.role', [
}).catch(function (error) { }).catch(function (error) {
try { try {
const err = error.response.data; const err = error.response.data;
alertify.alert( Notify.alert(
gettext('Role reassign/drop failed.'), gettext('Role reassign/drop failed.'),
err.errormsg err.errormsg
); );

View File

@@ -284,15 +284,12 @@ define('pgadmin.node.server', [
}; };
if (notify) { if (notify) {
Alertify.confirm( Notify.confirm(
gettext('Disconnect server'), gettext('Disconnect server'),
gettext('Are you sure you want to disconnect the server %s?', d.label), gettext('Are you sure you want to disconnect the server %s?', d.label),
function() { disconnect(); }, function() { disconnect(); },
function() { return true;} function() { return true;},
).set('labels', { );
ok: gettext('OK'),
cancel: gettext('Cancel'),
});
} else { } else {
disconnect(); disconnect();
} }
@@ -337,7 +334,7 @@ define('pgadmin.node.server', [
d = i ? t.itemData(i) : undefined; d = i ? t.itemData(i) : undefined;
if (d) { if (d) {
Alertify.confirm( Notify.confirm(
gettext('Reload server configuration'), gettext('Reload server configuration'),
gettext('Are you sure you want to reload the server configuration on %s?', d.label), gettext('Are you sure you want to reload the server configuration on %s?', d.label),
function() { function() {
@@ -358,7 +355,7 @@ define('pgadmin.node.server', [
t.unload(i); t.unload(i);
}); });
}, },
function() { return true; } function() { return true; },
); );
} }
@@ -545,7 +542,7 @@ define('pgadmin.node.server', [
if (res.success) { if (res.success) {
// Notify user to update pgpass file // Notify user to update pgpass file
if(is_pgpass_file_used) { if(is_pgpass_file_used) {
Alertify.alert( Notify.alert(
gettext('Change Password'), gettext('Change Password'),
gettext('Please make sure to disconnect the server' gettext('Please make sure to disconnect the server'
+ ' and update the new password in the pgpass file' + ' and update the new password in the pgpass file'
@@ -666,7 +663,7 @@ define('pgadmin.node.server', [
d = i ? t.itemData(i) : undefined; d = i ? t.itemData(i) : undefined;
if (d) { if (d) {
Alertify.confirm( Notify.confirm(
gettext('Clear saved password'), gettext('Clear saved password'),
gettext('Are you sure you want to clear the saved password for server %s?', d.label), gettext('Are you sure you want to clear the saved password for server %s?', d.label),
function() { function() {
@@ -703,7 +700,7 @@ define('pgadmin.node.server', [
d = i ? t.itemData(i) : undefined; d = i ? t.itemData(i) : undefined;
if (d) { if (d) {
Alertify.confirm( Notify.confirm(
gettext('Clear SSH Tunnel password'), gettext('Clear SSH Tunnel password'),
gettext('Are you sure you want to clear the saved password of SSH Tunnel for server %s?', d.label), gettext('Are you sure you want to clear the saved password of SSH Tunnel for server %s?', d.label),
function() { function() {
@@ -790,7 +787,7 @@ define('pgadmin.node.server', [
pgBrowser.Events.on( pgBrowser.Events.on(
'pgadmin:server:connect:cancelled', disconnect 'pgadmin:server:connect:cancelled', disconnect
); );
Alertify.confirm( Notify.confirm(
gettext('Connection lost'), gettext('Connection lost'),
gettext('Would you like to reconnect to the database?'), gettext('Would you like to reconnect to the database?'),
function() { function() {

View File

@@ -288,7 +288,7 @@ define('pgadmin.node.tablespace', [
btn_args = this.view.model.toJSON(); btn_args = this.view.model.toJSON();
btn_args.old_tblspc = d.label; btn_args.old_tblspc = d.label;
e.cancel = true; e.cancel = true;
Alertify.confirm( Notify.confirm(
gettext('Move objects...'), gettext('Move objects...'),
gettext( gettext(
'Are you sure you wish to move the objects from %s to %s?', 'Are you sure you wish to move the objects from %s to %s?',

View File

@@ -545,24 +545,20 @@ define('pgadmin.browser', [
}).done((res)=> { }).done((res)=> {
if(res.data.length > 0) { if(res.data.length > 0) {
Alertify.alert( Notify.alert(
'Warning', 'Warning',
'pgAdmin detected unrecoverable corruption in it\'s SQLite configuration database. ' + 'pgAdmin detected unrecoverable corruption in it\'s SQLite configuration database. ' +
'The database has been backed up and recreated with default settings. '+ 'The database has been backed up and recreated with default settings. '+
'It may be possible to recover data such as query history manually from '+ 'It may be possible to recover data such as query history manually from '+
'the original/corrupt file using a tool such as DB Browser for SQLite if desired.'+ 'the original/corrupt file using a tool such as DB Browser for SQLite if desired.'+
'<br><br>Original file: ' + res.data + '<br>Replacement file: ' + '<br><br>Original file: ' + res.data + '<br>Replacement file: ' +
res.data.substring(0, res.data.length - 14) res.data.substring(0, res.data.length - 14),
) function() {
.set({'closable': true, }
'onok': function() { );
},
});
} }
}).fail(function(xhr, status, error) { }).fail(function(xhr, status, error) {
Alertify.alert(error); Notify.alert(error);
}); });
}, },
init_master_password: function() { init_master_password: function() {
@@ -632,7 +628,7 @@ define('pgadmin.browser', [
/* Reset Button */ /* Reset Button */
event.cancel = true; event.cancel = true;
Alertify.confirm(gettext('Reset Master Password'), Notify.confirm(gettext('Reset Master Password'),
gettext('This will remove all the saved passwords. This will also remove established connections to ' gettext('This will remove all the saved passwords. This will also remove established connections to '
+ 'the server and you may need to reconnect again. Do you wish to continue?'), + 'the server and you may need to reconnect again. Do you wish to continue?'),
function() { function() {
@@ -642,10 +638,7 @@ define('pgadmin.browser', [
return true; return true;
}, },
function() {/* If user clicks No */ return true;} function() {/* If user clicks No */ return true;}
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
});
} else if(event.index == 0) { } else if(event.index == 0) {
/* help Button */ /* help Button */
event.cancel = true; event.cancel = true;

View File

@@ -399,7 +399,7 @@ define([
} }
if (sel_rows.length === 0) { if (sel_rows.length === 0) {
Alertify.alert(gettext('Drop Multiple'), Notify.alert(gettext('Drop Multiple'),
gettext('Please select at least one object to delete.') gettext('Please select at least one object to delete.')
); );
return; return;
@@ -463,7 +463,7 @@ define([
}; };
if(confirm) { if(confirm) {
Alertify.confirm(title, msg, dropAjaxHook, null).show(); Notify.confirm(title, msg, dropAjaxHook, null);
} else { } else {
dropAjaxHook(); dropAjaxHook();
} }

View File

@@ -7,9 +7,11 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import Notify from '../../../static/js/helpers/Notifier';
define( define(
['sources/gettext', 'underscore', 'alertify', 'sources/pgadmin'], ['sources/gettext', 'underscore', 'sources/pgadmin'],
function(gettext, _, alertify, pgAdmin) { function(gettext, _, pgAdmin) {
pgAdmin.Browser = pgAdmin.Browser || {}; pgAdmin.Browser = pgAdmin.Browser || {};
_.extend(pgAdmin.Browser, { _.extend(pgAdmin.Browser, {
@@ -44,7 +46,7 @@ define(
} }
text += '</div>'; text += '</div>';
alertify.alert( Notify.alert(
title, title,
text text
) )

View File

@@ -815,7 +815,7 @@ define('pgadmin.browser.node', [
msg = gettext('Are you sure want to reset the current changes and re-open the panel for %s "%s"?'); msg = gettext('Are you sure want to reset the current changes and re-open the panel for %s "%s"?');
} }
Alertify.confirm( Notify.confirm(
gettext('Edit in progress?'), gettext('Edit in progress?'),
commonUtils.sprintf(msg, o.label.toLowerCase(), d.label), commonUtils.sprintf(msg, o.label.toLowerCase(), d.label),
function() { function() {
@@ -898,7 +898,7 @@ define('pgadmin.browser.node', [
return; return;
} }
} }
Alertify.confirm(title, msg, Notify.confirm(title, msg,
function() { function() {
$.ajax({ $.ajax({
url: obj.generate_url(i, input.url, d, true), url: obj.generate_url(i, input.url, d, true),
@@ -939,12 +939,8 @@ define('pgadmin.browser.node', [
pgBrowser.report_error( pgBrowser.report_error(
gettext('Error dropping/removing %s: "%s"', obj.label, objName), errmsg); gettext('Error dropping/removing %s: "%s"', obj.label, objName), errmsg);
}); });
}, }
null );
).set('labels', {
ok: gettext('Yes'),
cancel: gettext('No'),
}).show();
}, },
// Callback for creating script(s) & opening them in Query editor // Callback for creating script(s) & opening them in Query editor
show_script: function(args, item) { show_script: function(args, item) {
@@ -1387,7 +1383,7 @@ define('pgadmin.browser.node', [
let confirm_on_properties_close = pgBrowser.get_preferences_for_module('browser').confirm_on_properties_close; let confirm_on_properties_close = pgBrowser.get_preferences_for_module('browser').confirm_on_properties_close;
if (confirm_on_properties_close && confirm_close && objview && objview.model) { if (confirm_on_properties_close && confirm_close && objview && objview.model) {
if(objview.model.sessChanged()){ if(objview.model.sessChanged()){
Alertify.confirm( Notify.confirm(
gettext('Warning'), gettext('Warning'),
warn_text, warn_text,
function() { function() {
@@ -1399,10 +1395,7 @@ define('pgadmin.browser.node', [
function() { function() {
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
}).show();
} else { } else {
return true; return true;
} }
@@ -1421,7 +1414,7 @@ define('pgadmin.browser.node', [
let warn_text; let warn_text;
warn_text = gettext(objview.model.warn_text); warn_text = gettext(objview.model.warn_text);
if(objview.model.sessChanged()){ if(objview.model.sessChanged()){
Alertify.confirm( Notify.confirm(
gettext('Warning'), gettext('Warning'),
warn_text, warn_text,
function() { function() {
@@ -1433,10 +1426,7 @@ define('pgadmin.browser.node', [
function() { function() {
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
}).show();
} else { } else {
return true; return true;
} }
@@ -1451,7 +1441,7 @@ define('pgadmin.browser.node', [
objview = $props && $props.data('obj-view'); objview = $props && $props.data('obj-view');
if (objview && objview.model && !_.isUndefined(objview.model.inform_text) && !_.isNull(objview.model.inform_text)) { if (objview && objview.model && !_.isUndefined(objview.model.inform_text) && !_.isNull(objview.model.inform_text)) {
Alertify.alert( Notify.alert(
gettext('Warning'), gettext('Warning'),
gettext(objview.model.inform_text) gettext(objview.model.inform_text)
); );

View File

@@ -15,7 +15,8 @@ import getApiInstance from 'sources/api_instance';
import {getHelpUrl, getEPASHelpUrl} from 'pgadmin.help'; import {getHelpUrl, getEPASHelpUrl} from 'pgadmin.help';
import SchemaView from 'sources/SchemaView'; import SchemaView from 'sources/SchemaView';
import { generateNodeUrl } from './node_ajax'; import { generateNodeUrl } from './node_ajax';
import Alertify from 'pgadmin.alertifyjs'; import Notify from '../../../static/js/helpers/Notifier';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import 'wcdocker'; import 'wcdocker';
@@ -125,7 +126,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
let confirmOnClose = pgAdmin.Browser.get_preferences_for_module('browser').confirm_on_properties_close; let confirmOnClose = pgAdmin.Browser.get_preferences_for_module('browser').confirm_on_properties_close;
if (warnOnCloseFlag && confirmOnClose) { if (warnOnCloseFlag && confirmOnClose) {
if(isDirty){ if(isDirty){
Alertify.confirm( Notify.confirm(
gettext('Warning'), gettext('Warning'),
gettext('Changes will be lost. Are you sure you want to close the dialog?'), gettext('Changes will be lost. Are you sure you want to close the dialog?'),
function() { function() {
@@ -135,10 +136,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
function() { function() {
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
}).show();
} else { } else {
return true; return true;
} }

View File

@@ -98,7 +98,7 @@ define('pgadmin.dashboard', [
action_url = terminate_session_url + self.model.get('pid'); action_url = terminate_session_url + self.model.get('pid');
} }
Alertify.confirm( Notify.confirm(
title, txtConfirm, title, txtConfirm,
function() { function() {
$.ajax({ $.ajax({

View File

@@ -647,16 +647,15 @@ SELECT 1, pg_sleep(300)"""
(By.CSS_SELECTOR, "td.channel"), "foo") (By.CSS_SELECTOR, "td.channel"), "foo")
) )
print("OK.", file=sys.stderr) print("OK.", file=sys.stderr)
self.page.clear_query_tool()
print("\tNotify event with data... ", file=sys.stderr, end="") print("\tNotify event with data... ", file=sys.stderr, end="")
if self._supported_server_version(): if self._supported_server_version():
self.page.clear_query_tool()
self.page.execute_query("SELECT pg_notify('foo', 'Hello')") self.page.execute_query("SELECT pg_notify('foo', 'Hello')")
self.page.click_tab('Notifications') self.page.click_tab('Notifications')
self.wait.until(WaitForAnyElementWithText( self.wait.until(WaitForAnyElementWithText(
(By.CSS_SELECTOR, 'td.payload'), "Hello")) (By.CSS_SELECTOR, 'td.payload'), "Hello"))
print("OK.", file=sys.stderr) print("OK.", file=sys.stderr)
self.page.clear_query_tool()
else: else:
print("Skipped.", file=sys.stderr) print("Skipped.", file=sys.stderr)
@@ -724,8 +723,6 @@ SELECT 1, pg_sleep(300)"""
# Search for 'Output' word in result (verbose option) # Search for 'Output' word in result (verbose option)
canvas.find_element(By.XPATH, "//*[contains(string(), 'JIT')]") canvas.find_element(By.XPATH, "//*[contains(string(), 'JIT')]")
self.page.clear_query_tool()
class WaitForAnyElementWithText(object): class WaitForAnyElementWithText(object):
def __init__(self, locator, text): def __init__(self, locator, text):

View File

@@ -78,9 +78,8 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
try: try:
wait = WebDriverWait(self.page.driver, 2) wait = WebDriverWait(self.page.driver, 2)
is_error = wait.until(EC.presence_of_element_located( is_error = wait.until(EC.presence_of_element_located(
(By.XPATH, "//div[contains(@class, 'alertify') and " (By.XPATH, "//div[@class ='MuiDialogTitle-root']"
"not(contains(@class, 'ajs-hidden'))]//div[" "//div[text()='Debugger Error']")
"contains(@class,'ajs-header')]")
)) ))
except TimeoutException: except TimeoutException:
@@ -91,11 +90,10 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
click = True click = True
while click: while click:
try: try:
self.page.click_modal('OK') self.page.click_modal('OK', True)
wait.until(EC.invisibility_of_element( wait.until(EC.invisibility_of_element(
(By.XPATH, "//div[contains(@class, 'alertify') and " (By.XPATH, "//div[@class ='MuiDialogTitle-root']"
"not(contains(@class, 'ajs-hidden'))]//div[" "//div[text()='Debugger Error']")
"contains(@class,'ajs-header')]")
)) ))
click = False click = False
except TimeoutException: except TimeoutException:

View File

@@ -7,6 +7,8 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import Notify from '../../../static/js/helpers/Notifier';
define('pgadmin.preferences', [ define('pgadmin.preferences', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone', 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone',
'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.backform', 'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.backform',
@@ -568,7 +570,7 @@ define('pgadmin.preferences', [
} }
if(pref.name == 'hide_shared_server') { if(pref.name == 'hide_shared_server') {
Alertify.confirm( Notify.confirm(
gettext('Browser tree refresh required'), gettext('Browser tree refresh required'),
gettext('A browser tree refresh is required. Do you wish to refresh the tree?'), gettext('A browser tree refresh is required. Do you wish to refresh the tree?'),
function() { function() {
@@ -583,16 +585,15 @@ define('pgadmin.preferences', [
preferences.reset(); preferences.reset();
changed = {}; changed = {};
return true; return true;
} },
).set('labels', { gettext('Refresh'),
ok: gettext('Refresh'), gettext('Later')
cancel: gettext('Later'), );
});
} }
}); });
if(requires_refresh) { if(requires_refresh) {
Alertify.confirm( Notify.confirm(
gettext('Refresh required'), gettext('Refresh required'),
gettext('A page refresh is required to apply the theme. Do you wish to refresh the page now?'), gettext('A page refresh is required to apply the theme. Do you wish to refresh the page now?'),
function() { function() {
@@ -600,11 +601,10 @@ define('pgadmin.preferences', [
location.reload(); location.reload();
return true; return true;
}, },
function() {/* If user clicks No */ return true;} function() {/* If user clicks No */ return true;},
).set('labels', { gettext('Refresh'),
ok: gettext('Refresh'), gettext('Later')
cancel: gettext('Later'), );
});
} }
// Refresh preferences cache // Refresh preferences cache
pgBrowser.cache_preferences(modulesChanged); pgBrowser.cache_preferences(modulesChanged);

View File

@@ -7,10 +7,12 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import Notify from '../../../static/js/helpers/Notifier';
define('pgadmin.settings', [ define('pgadmin.settings', [
'jquery', 'pgadmin.alertifyjs', 'sources/pgadmin', 'jquery', 'sources/pgadmin',
'sources/gettext', 'sources/url_for', 'pgadmin.backform', 'sources/gettext', 'sources/url_for', 'pgadmin.backform',
], function($, Alertify, pgAdmin, gettext, url_for) { ], function($, pgAdmin, gettext, url_for) {
// This defines the Preference/Options Dialog for pgAdmin IV. // This defines the Preference/Options Dialog for pgAdmin IV.
pgAdmin = pgAdmin || window.pgAdmin || {}; pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -32,7 +34,7 @@ define('pgadmin.settings', [
// We will force unload method to not to save current layout // We will force unload method to not to save current layout
// and reload the window // and reload the window
show: function() { show: function() {
Alertify.confirm(gettext('Reset layout'), Notify.confirm(gettext('Reset layout'),
gettext('Are you sure you want to reset the current layout? This will cause the application to reload and any un-saved data will be lost.'), gettext('Are you sure you want to reset the current layout? This will cause the application to reload and any un-saved data will be lost.'),
function() { function() {
var reloadingIndicator = $('<div id="reloading-indicator"></div>'); var reloadingIndicator = $('<div id="reloading-indicator"></div>');

View File

@@ -29,7 +29,6 @@ import { MappedFormControl } from './MappedControl';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui'; import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import FormView, { getFieldMetaData } from './FormView'; import FormView, { getFieldMetaData } from './FormView';
import { pgAlertify } from '../helpers/legacyConnector';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import CustomPropTypes from '../custom_prop_types'; import CustomPropTypes from '../custom_prop_types';
import { parseApiError } from '../api_instance'; import { parseApiError } from '../api_instance';
@@ -37,6 +36,7 @@ import DepListener, {DepListenerContext} from './DepListener';
import FieldSetView from './FieldSetView'; import FieldSetView from './FieldSetView';
import DataGridView from './DataGridView'; import DataGridView from './DataGridView';
import { useIsMounted } from '../custom_hooks'; import { useIsMounted } from '../custom_hooks';
import Notify from '../helpers/Notifier';
const useDialogStyles = makeStyles((theme)=>({ const useDialogStyles = makeStyles((theme)=>({
root: { root: {
@@ -514,6 +514,14 @@ function SchemaDialogView({
}); });
setFormReady(true); setFormReady(true);
setLoaderText(''); setLoaderText('');
}).catch((err)=>{
setLoaderText('');
if (err.response && err.response.data && err.response.data.errormsg) {
Notify.alert(
gettext(err.response.statusText),
gettext(err.response.data.errormsg)
);
}
}); });
} else { } else {
/* Use the defaults as the initital data */ /* Use the defaults as the initital data */
@@ -552,17 +560,14 @@ function SchemaDialogView({
}; };
/* Confirm before reset */ /* Confirm before reset */
if(props.confirmOnCloseReset) { if(props.confirmOnCloseReset) {
pgAlertify().confirm( Notify.confirm(
gettext('Warning'), gettext('Warning'),
gettext('Changes will be lost. Are you sure you want to reset?'), gettext('Changes will be lost. Are you sure you want to reset?'),
resetIt, resetIt,
function() { function() {
return true; return true;
} },
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
}).show();
} else { } else {
resetIt(); resetIt();
} }
@@ -582,7 +587,7 @@ function SchemaDialogView({
changeData[schema.idAttribute] = schema.origData[schema.idAttribute]; changeData[schema.idAttribute] = schema.origData[schema.idAttribute];
} }
if (schema.warningText) { if (schema.warningText) {
pgAlertify().confirm( Notify.confirm(
gettext('Warning'), gettext('Warning'),
schema.warningText, schema.warningText,
()=> { ()=> {
@@ -592,7 +597,7 @@ function SchemaDialogView({
setSaving(false); setSaving(false);
setLoaderText(''); setLoaderText('');
return true; return true;
} },
); );
} else { } else {
save(changeData); save(changeData);
@@ -603,7 +608,7 @@ function SchemaDialogView({
props.onSave(isNew, changeData) props.onSave(isNew, changeData)
.then(()=>{ .then(()=>{
if(schema.informText) { if(schema.informText) {
pgAlertify().alert( Notify.alert(
gettext('Warning'), gettext('Warning'),
schema.informText, schema.informText,
); );
@@ -791,6 +796,14 @@ function SchemaPropertiesView({
setOrigData(data || {}); setOrigData(data || {});
setLoaderText(''); setLoaderText('');
} }
}).catch((err)=>{
setLoaderText('');
if (err.response && err.response.data && err.response.data.errormsg) {
Notify.alert(
gettext(err.response.statusText),
gettext(err.response.data.errormsg)
);
}
}); });
}, [getInitData]); }, [getInitData]);

View File

@@ -453,7 +453,7 @@ define([
); );
} }
} else { } else {
Alertify.alert(gettext('Edit object'), gettext('This object is not user editable.'), Notify.alert(gettext('Edit object'), gettext('This object is not user editable.'),
function() { function() {
return true; return true;
}); });
@@ -528,7 +528,7 @@ define([
this.column.get('customDeleteMsg') : that.defaults.defaultDeleteMsg; this.column.get('customDeleteMsg') : that.defaults.defaultDeleteMsg;
var delete_title = !_.isUndefined(this.column.get('customDeleteTitle')) ? var delete_title = !_.isUndefined(this.column.get('customDeleteTitle')) ?
this.column.get('customDeleteTitle') : that.defaults.defaultDeleteTitle; this.column.get('customDeleteTitle') : that.defaults.defaultDeleteTitle;
Alertify.confirm( Notify.confirm(
delete_title, delete_title,
delete_msg, delete_msg,
function() { function() {
@@ -548,7 +548,7 @@ define([
} }
); );
} else { } else {
Alertify.alert(gettext('Delete object'), gettext('This object cannot be deleted.'), Notify.alert(gettext('Delete object'), gettext('This object cannot be deleted.'),
function() { function() {
return true; return true;
} }
@@ -630,7 +630,7 @@ define([
this.column.get('customClearMsg') : that.defaults.defaultClearMsg; this.column.get('customClearMsg') : that.defaults.defaultClearMsg;
var clear_title = !_.isUndefined(this.column.get('customClearTitle')) ? var clear_title = !_.isUndefined(this.column.get('customClearTitle')) ?
this.column.get('customClearTitle') : that.defaults.defaultClearTitle; this.column.get('customClearTitle') : that.defaults.defaultClearTitle;
Alertify.confirm( Notify.confirm(
clear_title, clear_title,
clear_msg, clear_msg,
function() { function() {
@@ -2413,7 +2413,7 @@ define([
val = this.formatter.toRaw(this.$input.prop('value'), model); val = this.formatter.toRaw(this.$input.prop('value'), model);
if (_.isNull(val) || val.trim() === '') { if (_.isNull(val) || val.trim() === '') {
Alertify.alert(gettext('Validate Path'), gettext('Path should not be empty.')); Notify.alert(gettext('Validate Path'), gettext('Path should not be empty.'));
} }
$.ajax({ $.ajax({
@@ -2425,7 +2425,7 @@ define([
}), }),
}) })
.done(function(res) { .done(function(res) {
Alertify.alert(gettext('Validate binary path'), gettext(res.data)); Notify.alert(gettext('Validate binary path'), gettext(res.data));
}) })
.fail(function(xhr, error) { .fail(function(xhr, error) {
Notify.pgNotifier(error, xhr, gettext('Failed to validate binary path.')); Notify.pgNotifier(error, xhr, gettext('Failed to validate binary path.'));

View File

@@ -15,6 +15,7 @@ import Draggable from 'react-draggable';
import CloseIcon from '@material-ui/icons/CloseRounded'; import CloseIcon from '@material-ui/icons/CloseRounded';
import CustomPropTypes from '../custom_prop_types'; import CustomPropTypes from '../custom_prop_types';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import gettext from 'sources/gettext';
const ModalContext = React.createContext({}); const ModalContext = React.createContext({});
@@ -77,7 +78,7 @@ function ModalContainer({id, title, content}) {
> >
<DialogTitle> <DialogTitle>
<Box marginRight="0.25rem">{title}</Box> <Box marginRight="0.25rem">{title}</Box>
<Box marginLeft="auto"><PgIconButton icon={<CloseIcon />} size="xs" noBorder onClick={closeModal}/></Box> <Box marginLeft="auto"><PgIconButton title={gettext('Close')} icon={<CloseIcon />} size="xs" noBorder onClick={closeModal}/></Box>
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
{content(closeModal)} {content(closeModal)}
@@ -88,5 +89,5 @@ function ModalContainer({id, title, content}) {
ModalContainer.propTypes = { ModalContainer.propTypes = {
id: PropTypes.string, id: PropTypes.string,
title: CustomPropTypes.children, title: CustomPropTypes.children,
content: CustomPropTypes.children, content: PropTypes.func,
}; };

View File

@@ -15,7 +15,6 @@ import { NotifierMessage, MESSAGE_TYPE } from '../components/FormComponents';
import CustomPropTypes from '../custom_prop_types'; import CustomPropTypes from '../custom_prop_types';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import pgWindow from 'sources/window'; import pgWindow from 'sources/window';
import Alertify from 'pgadmin.alertifyjs';
import ModalProvider, { useModal } from './ModalProvider'; import ModalProvider, { useModal } from './ModalProvider';
import { DefaultButton, PrimaryButton } from '../components/Buttons'; import { DefaultButton, PrimaryButton } from '../components/Buttons';
import { Box } from '@material-ui/core'; import { Box } from '@material-ui/core';
@@ -35,6 +34,12 @@ export function initializeNotifier(notifierContainer) {
snackbarRef = useSnackbar(); snackbarRef = useSnackbar();
return <></>; return <></>;
}; };
if (!notifierContainer) {
notifierContainer = document.createElement('div');
document.body.appendChild(notifierContainer);
}
ReactDOM.render( ReactDOM.render(
<Theme> <Theme>
<SnackbarProvider <SnackbarProvider
@@ -54,6 +59,12 @@ export function initializeModalProvider(modalContainer) {
modalRef = useModal(); modalRef = useModal();
return <></>; return <></>;
}; };
if (!modalContainer) {
modalContainer = document.createElement('div');
document.body.appendChild(modalContainer);
}
ReactDOM.render( ReactDOM.render(
<Theme> <Theme>
<ModalProvider> <ModalProvider>
@@ -82,16 +93,16 @@ const useAlertStyles = makeStyles((theme)=>({
marginLeft: '0.25rem', marginLeft: '0.25rem',
} }
})); }));
function AlertContent({text, confirm, onOkClick, onCancelClick}) { function AlertContent({text, confirm, okLabel=gettext('OK'), cancelLabel=gettext('Cancel'), onOkClick, onCancelClick}) {
const classes = useAlertStyles(); const classes = useAlertStyles();
return ( return (
<Box display="flex" flexDirection="column" height="100%"> <Box display="flex" flexDirection="column" height="100%">
<Box flexGrow="1" p={2}>{HTMLReactParse(text)}</Box> <Box flexGrow="1" p={2}>{HTMLReactParse(text)}</Box>
<Box className={classes.footer}> <Box className={classes.footer}>
<DefaultButton startIcon={<CloseIcon />} onClick={onCancelClick} autoFocus={!confirm}>Close</DefaultButton>
{confirm && {confirm &&
<PrimaryButton className={classes.margin} startIcon={<CheckRoundedIcon />} onClick={onOkClick} autoFocus={confirm}>OK</PrimaryButton> <DefaultButton startIcon={<CloseIcon />} onClick={onCancelClick} >{cancelLabel}</DefaultButton>
} }
<PrimaryButton className={classes.margin} startIcon={<CheckRoundedIcon />} onClick={onOkClick} autoFocus={true} >{okLabel}</PrimaryButton>
</Box> </Box>
</Box> </Box>
); );
@@ -101,6 +112,8 @@ AlertContent.propTypes = {
confirm: PropTypes.bool, confirm: PropTypes.bool,
onOkClick: PropTypes.func, onOkClick: PropTypes.func,
onCancelClick: PropTypes.func, onCancelClick: PropTypes.func,
okLabel: PropTypes.string,
cancelLabel: PropTypes.string,
}; };
var Notifier = { var Notifier = {
@@ -194,54 +207,33 @@ var Notifier = {
msg = _.escape(resp.result) || _.escape(resp.errormsg) || 'Unknown error'; msg = _.escape(resp.result) || _.escape(resp.errormsg) || 'Unknown error';
} }
if (contentType.indexOf('text/html') == 0) { if (contentType.indexOf('text/html') == 0) {
var alertMessage = promptmsg;
if (type === 'error') { if (type === 'error') {
alertMessage = this.alert('Error', promptmsg);
'<div class="media text-danger text-14">'
+ '<div class="media-body media-middle">'
+ '<div class="alert-text" role="alert">' + promptmsg + '</div><br/>'
+ '<div class="alert-text" role="alert">' + gettext('Click for details.') + '</div>'
+ '</div>'
+ '</div>';
} }
Alertify.notify(
alertMessage, type, 0,
function() {
Alertify.pgIframeDialog().show().set({
frameless: false,
}).set(
'pg_msg', msg
);
});
return; return;
} }
} catch (e) { } catch (e) {
Alertify.alert().show().set('message', e.message).set( this.alert('Error', e.message);
'title', 'Error'
).set('closable', true);
} }
} }
} }
Alertify.alert().show().set( this.alert(promptmsg, msg.replace(new RegExp(/\r?\n/, 'g'), '<br />'));
'message', msg.replace(new RegExp(/\r?\n/, 'g'), '<br />')
).set('title', promptmsg).set('closable', true);
}, },
alert: (title, text, onCancelClick)=>{ alert: (title, text, okLabel=gettext('OK'), onOkClick)=>{
if(!modalInitialized) { if(!modalInitialized) {
initializeModalProvider(document.getElementById('modalContainer')); initializeModalProvider(document.getElementById('modalContainer'));
} }
modalRef.showModal(title, (closeModal)=>{ modalRef.showModal(title, (closeModal)=>{
const onCancelClickClose = ()=>{ const onOkClickClose = ()=>{
onCancelClick && onCancelClick(); onOkClick && onOkClick();
closeModal(); closeModal();
}; };
return ( return (
<AlertContent text={text} onCancelClick={onCancelClickClose} /> <AlertContent text={text} onOkClick={onOkClickClose} okLabel={okLabel} />
); );
}); });
}, },
confirm: (title, text, onOkClick, onCancelClick)=>{ confirm: (title, text, onOkClick, onCancelClick, okLabel=gettext('Yes'), cancelLabel=gettext('No'))=>{
if(!modalInitialized) { if(!modalInitialized) {
initializeModalProvider(document.getElementById('modalContainer')); initializeModalProvider(document.getElementById('modalContainer'));
} }
@@ -255,14 +247,14 @@ var Notifier = {
closeModal(); closeModal();
}; };
return ( return (
<AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} /> <AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} okLabel={okLabel} cancelLabel={cancelLabel}/>
); );
}); });
}, },
}; };
if(window.frameElement) { if(window.frameElement) {
Notifier = pgWindow.Notifier; Notifier = pgWindow.Notifier || Notifier;
} else { } else {
pgWindow.Notifier = Notifier; pgWindow.Notifier = Notifier;
} }

View File

@@ -12,12 +12,12 @@
* These functions may not be needed once all are migrated * These functions may not be needed once all are migrated
*/ */
import Alertify from 'pgadmin.alertifyjs';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import pgAdmin from 'sources/pgadmin'; import pgAdmin from 'sources/pgadmin';
import Notify from './Notifier';
export function confirmDeleteRow(onOK, onCancel, title, message) { export function confirmDeleteRow(onOK, onCancel, title, message) {
Alertify.confirm( Notify.confirm(
title || gettext('Delete Row'), title || gettext('Delete Row'),
message || gettext('Are you sure you wish to delete this row?'), message || gettext('Are you sure you wish to delete this row?'),
function() { function() {
@@ -31,11 +31,6 @@ export function confirmDeleteRow(onOK, onCancel, title, message) {
); );
} }
/* Don't import alertfiy directly in react files. Not good for testability */
export function pgAlertify() {
return Alertify;
}
/* Used by file select component to re-use existing logic */ /* Used by file select component to re-use existing logic */
export function showFileDialog(dialogParams, onFileSelect) { export function showFileDialog(dialogParams, onFileSelect) {
let params = { let params = {

View File

@@ -7,7 +7,9 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
define(['sources/gettext', 'alertify'], function (gettext, alertify) { import Notify from '../helpers/Notifier';
define(['sources/gettext'], function (gettext) {
var clipboard = { var clipboard = {
copyTextToClipboard: function (text) { copyTextToClipboard: function (text) {
var textArea = document.createElement('textarea'); var textArea = document.createElement('textarea');
@@ -79,7 +81,7 @@ define(['sources/gettext', 'alertify'], function (gettext, alertify) {
// triggered on document and then we can set clipboardData. // triggered on document and then we can set clipboardData.
document.execCommand('copy'); document.execCommand('copy');
} catch (err) { } catch (err) {
alertify.alert( Notify.alert(
gettext('Error'), gettext('Error'),
gettext('Oops, unable to copy to clipboard')); gettext('Oops, unable to copy to clipboard'));
} }

View File

@@ -242,7 +242,7 @@ let FilterDialog = {
}, 10 }, 10
); );
} else { } else {
Alertify.alert( Notify.alert(
gettext('Validation Error'), gettext('Validation Error'),
filterResponse.result filterResponse.result
); );

View File

@@ -308,7 +308,7 @@ let MacroDialog = {
}, 10 }, 10
); );
} else { } else {
Alertify.alert( Notify.alert(
gettext('Validation Error'), gettext('Validation Error'),
macroResponse.result macroResponse.result
); );

View File

@@ -14,7 +14,7 @@ import Backgrid from 'pgadmin.backgrid';
import url_for from 'sources/url_for'; import url_for from 'sources/url_for';
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import Alertify from 'pgadmin.alertifyjs'; import Notify from '../helpers/Notifier';
export default function macroModel(transId) { export default function macroModel(transId) {
@@ -129,7 +129,7 @@ export default function macroModel(transId) {
let macros = that.collection.toJSON().filter(m => m.name !== undefined && m.name !== null); let macros = that.collection.toJSON().filter(m => m.name !== undefined && m.name !== null);
if (macros.length > 0) { if (macros.length > 0) {
Alertify.confirm( Notify.confirm(
gettext('Clear All Rows'), gettext('Clear All Rows'),
gettext('Are you sure you wish to clear all rows?'), gettext('Are you sure you wish to clear all rows?'),
function() { function() {

View File

@@ -272,7 +272,7 @@ let NewConnectionDialog = {
Alertify.newConnectionDialog('Connect to server.').resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md); Alertify.newConnectionDialog('Connect to server.').resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
}, 500); }, 500);
}).fail(function() { }).fail(function() {
Alertify.alert().setting({ Notify.alert().setting({
'title': gettext('Connection lost'), 'title': gettext('Connection lost'),
'label':gettext('OK'), 'label':gettext('OK'),
'message': gettext('Connection to the server has been lost.'), 'message': gettext('Connection to the server has been lost.'),

View File

@@ -8,8 +8,9 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import Notify from '../helpers/Notifier';
export function retrieveAncestorOfTypeServer(pgBrowser, item, errorAlertTitle, alertify) { export function retrieveAncestorOfTypeServer(pgBrowser, item, errorAlertTitle) {
let serverInformation = null; let serverInformation = null;
let aciTreeItem = item || pgBrowser.tree.selected(); let aciTreeItem = item || pgBrowser.tree.selected();
let treeNode = pgBrowser.tree.findNodeByDomElement(aciTreeItem); let treeNode = pgBrowser.tree.findNodeByDomElement(aciTreeItem);
@@ -30,7 +31,7 @@ export function retrieveAncestorOfTypeServer(pgBrowser, item, errorAlertTitle, a
if (databaseNode !== null) { if (databaseNode !== null) {
if (nodeData._label.indexOf('=') >= 0) { if (nodeData._label.indexOf('=') >= 0) {
alertify.alert( Notify.alert(
gettext(errorAlertTitle), gettext(errorAlertTitle),
gettext( gettext(
'Databases with = symbols in the name cannot be backed up or restored using this utility.' 'Databases with = symbols in the name cannot be backed up or restored using this utility.'
@@ -47,7 +48,7 @@ export function retrieveAncestorOfTypeServer(pgBrowser, item, errorAlertTitle, a
} }
if (serverInformation === null) { if (serverInformation === null) {
alertify.alert( Notify.alert(
gettext(errorAlertTitle), gettext(errorAlertTitle),
gettext('Please select server or child node from the browser tree.') gettext('Please select server or child node from the browser tree.')
); );
@@ -56,7 +57,7 @@ export function retrieveAncestorOfTypeServer(pgBrowser, item, errorAlertTitle, a
return serverInformation; return serverInformation;
} }
export function retrieveAncestorOfTypeDatabase(pgBrowser, item, errorAlertTitle, alertify) { export function retrieveAncestorOfTypeDatabase(pgBrowser, item, errorAlertTitle) {
let databaseInfo = null; let databaseInfo = null;
let aciTreeItem = item || pgBrowser.tree.selected(); let aciTreeItem = item || pgBrowser.tree.selected();
let treeNode = pgBrowser.tree.findNodeByDomElement(aciTreeItem); let treeNode = pgBrowser.tree.findNodeByDomElement(aciTreeItem);
@@ -79,7 +80,7 @@ export function retrieveAncestorOfTypeDatabase(pgBrowser, item, errorAlertTitle,
} }
if (databaseInfo === null) { if (databaseInfo === null) {
alertify.alert( Notify.alert(
gettext(errorAlertTitle), gettext(errorAlertTitle),
gettext('Please select a database or its child node from the browser.') gettext('Please select a database or its child node from the browser.')
); );

View File

@@ -11,6 +11,7 @@ import _ from 'underscore';
import $ from 'jquery'; import $ from 'jquery';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import 'wcdocker'; import 'wcdocker';
import Notify from './helpers/Notifier';
var wcDocker = window.wcDocker; var wcDocker = window.wcDocker;
@@ -363,7 +364,7 @@ export function CSVToArray( strData, strDelimiter, quoteChar){
return arrData; return arrData;
} }
export function hasBinariesConfiguration(pgBrowser, serverInformation, alertify) { export function hasBinariesConfiguration(pgBrowser, serverInformation) {
const module = 'paths'; const module = 'paths';
let preference_name = 'pg_bin_dir'; let preference_name = 'pg_bin_dir';
let msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.'); let msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.');
@@ -378,11 +379,11 @@ export function hasBinariesConfiguration(pgBrowser, serverInformation, alertify)
if (preference) { if (preference) {
if (_.isUndefined(preference.value) || !checkBinaryPathExists(preference.value, serverInformation.version)) { if (_.isUndefined(preference.value) || !checkBinaryPathExists(preference.value, serverInformation.version)) {
alertify.alert(gettext('Configuration required'), msg); Notify.alert(gettext('Configuration required'), msg);
return false; return false;
} }
} else { } else {
alertify.alert( Notify.alert(
gettext('Preferences Error'), gettext('Preferences Error'),
gettext('Failed to load preference %s of module %s', preference_name, module) gettext('Failed to load preference %s of module %s', preference_name, module)
); );

View File

@@ -10,15 +10,17 @@ import {getUtilityView, removeNodeView} from '../../../../browser/static/js/util
import { getNodeListByName, getNodeAjaxOptions } from '../../../../browser/static/js/node_ajax'; import { getNodeListByName, getNodeAjaxOptions } from '../../../../browser/static/js/node_ajax';
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema} from './backup.ui'; import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema} from './backup.ui';
import BackupGlobalSchema, {getMiscellaneousSchema as getMiscellaneousGlobalSchema} from './backupGlobal.ui'; import BackupGlobalSchema, {getMiscellaneousSchema as getMiscellaneousGlobalSchema} from './backupGlobal.ui';
import Notify from '../../../../static/js/helpers/Notifier';
// Backup dialog // Backup dialog
define([ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'sources/pgadmin', 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'sources/pgadmin',
'pgadmin.alertifyjs', 'backbone', 'pgadmin.backgrid', 'backbone', 'pgadmin.backgrid',
'pgadmin.backform', 'pgadmin.browser', 'sources/utils', 'pgadmin.backform', 'pgadmin.browser', 'sources/utils',
'tools/backup/static/js/menu_utils', 'tools/backup/static/js/menu_utils',
'sources/nodes/supported_database_node', 'sources/nodes/supported_database_node',
], function( ], function(
gettext, url_for, $, _, pgAdmin, alertify, Backbone, Backgrid, Backform, pgBrowser, gettext, url_for, $, _, pgAdmin, Backbone, Backgrid, Backform, pgBrowser,
commonUtils, menuUtils, supportedNodes commonUtils, menuUtils, supportedNodes
) { ) {
@@ -175,7 +177,7 @@ define([
}, },
saveCallBack: function(data, dialog) { saveCallBack: function(data, dialog) {
if(data.errormsg) { if(data.errormsg) {
alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
gettext(data.errormsg) gettext(data.errormsg)
); );

View File

@@ -228,7 +228,7 @@ define('pgadmin.datagrid', [
if(d._type.includes('coll-')){ if(d._type.includes('coll-')){
url = ''; url = '';
} }
showQueryTool.showQueryTool(this, pgBrowser, alertify, url, aciTreeIdentifier, transId); showQueryTool.showQueryTool(this, pgBrowser, url, aciTreeIdentifier, transId);
} }
}, },

View File

@@ -8,8 +8,8 @@
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import Alertify from 'pgadmin.alertifyjs';
import pgWindow from 'sources/window'; import pgWindow from 'sources/window';
import Notify from '../../../../static/js/helpers/Notifier';
const pgAdmin = pgWindow.pgAdmin; const pgAdmin = pgWindow.pgAdmin;
@@ -124,7 +124,7 @@ export function generateTitle(title_placeholder, title_data) {
* This function is used refresh the db node after showing alert to the user * This function is used refresh the db node after showing alert to the user
*/ */
export function refresh_db_node(message, dbNode) { export function refresh_db_node(message, dbNode) {
Alertify.alert() Notify.alert()
.setting({ .setting({
'title': gettext('Database moved/renamed'), 'title': gettext('Database moved/renamed'),
'label':gettext('OK'), 'label':gettext('OK'),

View File

@@ -13,6 +13,7 @@ import CodeMirror from 'bundled_codemirror';
import * as SqlEditorUtils from 'sources/sqleditor_utils'; import * as SqlEditorUtils from 'sources/sqleditor_utils';
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import Notify from '../../../../static/js/helpers/Notifier';
export function showDataGrid( export function showDataGrid(
datagrid, datagrid,
@@ -26,7 +27,7 @@ export function showDataGrid(
) { ) {
const node = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier); const node = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier);
if (node === undefined || !node.getData()) { if (node === undefined || !node.getData()) {
alertify.alert( Notify.alert(
gettext('Data Grid Error'), gettext('Data Grid Error'),
gettext('No object selected.') gettext('No object selected.')
); );
@@ -239,15 +240,13 @@ function initFilterDialog(alertify, pgBrowser) {
that.close(); // Close the dialog that.close(); // Close the dialog
} }
else { else {
alertify.alert() Notify.alert(
.setting({ gettext('Validation Error'),
'title': gettext('Validation Error'), gettext(res.data.result),
'label':gettext('OK'), function(){
'message': gettext(res.data.result), filter_editor.focus();
'onok': function(){ },
filter_editor.focus(); );
},
}).show();
} }
}) })
.fail(function(e) { .fail(function(e) {
@@ -255,7 +254,7 @@ function initFilterDialog(alertify, pgBrowser) {
pgBrowser.report_error(gettext('Error filtering rows - %s.', e.statusText), e.responseJSON.errormsg); pgBrowser.report_error(gettext('Error filtering rows - %s.', e.statusText), e.responseJSON.errormsg);
} else { } else {
alertify.alert( Notify.alert(
gettext('Validation Error'), gettext('Validation Error'),
e e
); );

View File

@@ -12,6 +12,7 @@ import url_for from '../../../../static/js/url_for';
import {getPanelTitle} from './datagrid_panel_title'; import {getPanelTitle} from './datagrid_panel_title';
import {getRandomInt} from 'sources/utils'; import {getRandomInt} from 'sources/utils';
import $ from 'jquery'; import $ from 'jquery';
import Notify from '../../../../static/js/helpers/Notifier';
function hasDatabaseInformation(parentData) { function hasDatabaseInformation(parentData) {
return parentData.database; return parentData.database;
@@ -47,13 +48,13 @@ function generateTitle(pgBrowser, aciTreeIdentifier) {
return baseTitle; return baseTitle;
} }
export function showQueryTool(datagrid, pgBrowser, alertify, url, aciTreeIdentifier, transId) { export function showQueryTool(datagrid, pgBrowser, url, aciTreeIdentifier, transId) {
const sURL = url || ''; const sURL = url || '';
const queryToolTitle = generateTitle(pgBrowser, aciTreeIdentifier); const queryToolTitle = generateTitle(pgBrowser, aciTreeIdentifier);
const currentNode = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier); const currentNode = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier);
if (currentNode === undefined) { if (currentNode === undefined) {
alertify.alert( Notify.alert(
gettext('Query Tool Error'), gettext('Query Tool Error'),
gettext('No object selected.') gettext('No object selected.')
); );
@@ -67,10 +68,10 @@ export function showQueryTool(datagrid, pgBrowser, alertify, url, aciTreeIdentif
} }
const gridUrl = generateUrl(transId, queryToolTitle, parentData); const gridUrl = generateUrl(transId, queryToolTitle, parentData);
launchDataGrid(datagrid, transId, gridUrl, queryToolTitle, sURL, alertify); launchDataGrid(datagrid, transId, gridUrl, queryToolTitle, sURL);
} }
export function generateScript(parentData, datagrid, alertify) { export function generateScript(parentData, datagrid) {
const queryToolTitle = `${parentData.database}/${parentData.user}@${parentData.server}`; const queryToolTitle = `${parentData.database}/${parentData.user}@${parentData.server}`;
const transId = getRandomInt(1, 9999999); const transId = getRandomInt(1, 9999999);
@@ -84,10 +85,10 @@ export function generateScript(parentData, datagrid, alertify) {
+`&server_type=${parentData.stype}` +`&server_type=${parentData.stype}`
+`&did=${parentData.did}`; +`&did=${parentData.did}`;
launchDataGrid(datagrid, transId, url_endpoint, queryToolTitle, '', alertify); launchDataGrid(datagrid, transId, url_endpoint, queryToolTitle, '');
} }
export function showERDSqlTool(parentData, erdSqlId, queryToolTitle, datagrid, alertify) { export function showERDSqlTool(parentData, erdSqlId, queryToolTitle, datagrid) {
const transId = getRandomInt(1, 9999999); const transId = getRandomInt(1, 9999999);
parentData = { parentData = {
server_group: { server_group: {
@@ -103,14 +104,14 @@ export function showERDSqlTool(parentData, erdSqlId, queryToolTitle, datagrid, a
}; };
const gridUrl = generateUrl(transId, queryToolTitle, parentData, erdSqlId); const gridUrl = generateUrl(transId, queryToolTitle, parentData, erdSqlId);
launchDataGrid(datagrid, transId, gridUrl, queryToolTitle, '', alertify); launchDataGrid(datagrid, transId, gridUrl, queryToolTitle, '');
} }
export function launchDataGrid(datagrid, transId, gridUrl, queryToolTitle, sURL, alertify) { export function launchDataGrid(datagrid, transId, gridUrl, queryToolTitle, sURL) {
let retVal = datagrid.launch_grid(transId, gridUrl, true, queryToolTitle, sURL); let retVal = datagrid.launch_grid(transId, gridUrl, true, queryToolTitle, sURL);
if(!retVal) { if(!retVal) {
alertify.alert( Notify.alert(
gettext('Query tool launch error'), gettext('Query tool launch error'),
gettext( gettext(
'Please allow pop-ups for this site to perform the desired action. If the main window of pgAdmin is closed then close this window and open a new pgAdmin session.' 'Please allow pop-ups for this site to perform the desired action. If the main window of pgAdmin is closed then close this window and open a new pgAdmin session.'

View File

@@ -7,6 +7,8 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import Notify from '../../../../static/js/helpers/Notifier';
define([ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'alertify', 'sources/pgadmin', 'pgadmin.browser', 'alertify', 'sources/pgadmin', 'pgadmin.browser',
@@ -322,7 +324,7 @@ define([
try { try {
var err = JSON.parse(xhr.responseText); var err = JSON.parse(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg); Notify.alert(gettext('Debugger Error'), err.errormsg);
} }
} catch (e) { } catch (e) {
console.warn(e.stack || e); console.warn(e.stack || e);
@@ -491,12 +493,12 @@ define([
self.start_global_debugger(); self.start_global_debugger();
}, },
function(error) { function(error) {
Alertify.alert(gettext('Debugger Error'), error); Notify.alert(gettext('Debugger Error'), error);
} }
); );
} else { } else {
if (err.success == 0) { if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg); Notify.alert(gettext('Debugger Error'), err.errormsg);
} }
} }
} catch (e) { } catch (e) {
@@ -656,7 +658,7 @@ define([
} }
}) })
.fail(function(e) { .fail(function(e) {
Alertify.alert( Notify.alert(
gettext('Debugger Target Initialization Error'), gettext('Debugger Target Initialization Error'),
e.responseJSON.errormsg e.responseJSON.errormsg
); );
@@ -667,7 +669,7 @@ define([
try { try {
var err = JSON.parse(xhr.responseText); var err = JSON.parse(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg); Notify.alert(gettext('Debugger Error'), err.errormsg);
} }
} catch (e) { } catch (e) {
console.warn(e.stack || e); console.warn(e.stack || e);

View File

@@ -7,6 +7,8 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import Notify from '../../../../static/js/helpers/Notifier';
define([ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone', 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone',
'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.browser', 'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.browser',
@@ -258,7 +260,7 @@ define([
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Unable to fetch the arguments from server') gettext('Unable to fetch the arguments from server')
); );
@@ -856,14 +858,14 @@ define([
}) })
.done(function() {}) .done(function() {})
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Unable to set the arguments on the server') gettext('Unable to set the arguments on the server')
); );
}); });
}) })
.fail(function(er) { .fail(function(er) {
Alertify.alert( Notify.alert(
gettext('Debugger Target Initialization Error'), gettext('Debugger Target Initialization Error'),
er.responseJSON.errormsg er.responseJSON.errormsg
); );
@@ -884,7 +886,7 @@ define([
}) })
.done(function() {}) .done(function() {})
.fail(function(er) { .fail(function(er) {
Alertify.alert( Notify.alert(
gettext('Debugger Listener Startup Error'), gettext('Debugger Listener Startup Error'),
er.responseJSON.errormsg er.responseJSON.errormsg
); );
@@ -906,7 +908,7 @@ define([
}) })
.done(function() {}) .done(function() {})
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Unable to set the arguments on the server') gettext('Unable to set the arguments on the server')
); );
@@ -968,7 +970,7 @@ define([
); );
_self.prepare(); _self.prepare();
}).fail(function(er) { }).fail(function(er) {
Alertify.alert( Notify.alert(
gettext('Clear failed'), gettext('Clear failed'),
er.responseJSON.errormsg er.responseJSON.errormsg
); );

View File

@@ -84,7 +84,7 @@ define([
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while setting debugging breakpoint.') gettext('Error while setting debugging breakpoint.')
); );
@@ -144,14 +144,14 @@ define([
if (res.data.status === 'Success') { if (res.data.status === 'Success') {
result = res.data.result; result = res.data.result;
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while fetching breakpoint information.') gettext('Error while fetching breakpoint information.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while fetching breakpoint information.') gettext('Error while fetching breakpoint information.')
); );
@@ -206,14 +206,14 @@ define([
// If status is Success then find the port number to attach the executer. // If status is Success then find the port number to attach the executer.
self.execute_query(trans_id); self.execute_query(trans_id);
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while starting debugging session.') gettext('Error while starting debugging session.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while starting debugging session.') gettext('Error while starting debugging session.')
); );
@@ -250,14 +250,14 @@ define([
self.poll_end_execution_result(trans_id); self.poll_end_execution_result(trans_id);
} }
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing requested debugging information.') gettext('Error while executing requested debugging information.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing requested debugging information.') gettext('Error while executing requested debugging information.')
); );
@@ -292,14 +292,14 @@ define([
pgTools.DirectDebug.debug_restarted = false; pgTools.DirectDebug.debug_restarted = false;
} }
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while fetching variable information.') gettext('Error while fetching variable information.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while fetching variable information.') gettext('Error while fetching variable information.')
); );
@@ -326,14 +326,14 @@ define([
self.AddStackInformation(res.data.result); self.AddStackInformation(res.data.result);
self.GetLocalVariables(pgTools.DirectDebug.trans_id); self.GetLocalVariables(pgTools.DirectDebug.trans_id);
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while fetching stack information.') gettext('Error while fetching stack information.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while fetching stack information.') gettext('Error while fetching stack information.')
); );
@@ -436,14 +436,14 @@ define([
self.poll_result(trans_id); self.poll_result(trans_id);
} }
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while polling result.') gettext('Error while polling result.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while polling result.') gettext('Error while polling result.')
); );
@@ -592,7 +592,7 @@ define([
self.update_messages(res.data.status_message); self.update_messages(res.data.status_message);
} }
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger poll end execution error'), gettext('Debugger poll end execution error'),
res.data.result res.data.result
); );
@@ -636,7 +636,7 @@ define([
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while polling result.') gettext('Error while polling result.')
); );
@@ -700,7 +700,7 @@ define([
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while polling result.') gettext('Error while polling result.')
); );
@@ -711,7 +711,7 @@ define([
try { try {
var err = JSON.parse(xhr.responseText); var err = JSON.parse(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg); Notify.alert(gettext('Debugger Error'), err.errormsg);
} }
} catch (e) { } catch (e) {
console.warn(e.stack || e); console.warn(e.stack || e);
@@ -742,14 +742,14 @@ define([
if (res.data.status) { if (res.data.status) {
self.poll_result(trans_id); self.poll_result(trans_id);
} else { } else {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing continue in debugging session.') gettext('Error while executing continue in debugging session.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing continue in debugging session.') gettext('Error while executing continue in debugging session.')
); );
@@ -774,14 +774,14 @@ define([
if (res.data.status) { if (res.data.status) {
self.poll_result(trans_id); self.poll_result(trans_id);
} else { } else {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing step over in debugging session.') gettext('Error while executing step over in debugging session.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing step over in debugging session.') gettext('Error while executing step over in debugging session.')
); );
@@ -805,14 +805,14 @@ define([
if (res.data.status) { if (res.data.status) {
self.poll_result(trans_id); self.poll_result(trans_id);
} else { } else {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing step into in debugging session.') gettext('Error while executing step into in debugging session.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing step into in debugging session.') gettext('Error while executing step into in debugging session.')
); );
@@ -851,14 +851,14 @@ define([
// is completed. // is completed.
Notify.success(res.info, 3000); Notify.success(res.info, 3000);
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing stop in debugging session.') gettext('Error while executing stop in debugging session.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while executing stop in debugging session.') gettext('Error while executing stop in debugging session.')
); );
@@ -911,14 +911,14 @@ define([
self.enable_toolbar_buttons(); self.enable_toolbar_buttons();
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while toggling breakpoint.') gettext('Error while toggling breakpoint.')
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while toggling breakpoint.') gettext('Error while toggling breakpoint.')
); );
@@ -970,7 +970,7 @@ define([
self.enable_toolbar_buttons(); self.enable_toolbar_buttons();
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while clearing all breakpoint.') gettext('Error while clearing all breakpoint.')
); );
@@ -1325,7 +1325,7 @@ define([
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while depositing variable value.') gettext('Error while depositing variable value.')
); );
@@ -1354,7 +1354,7 @@ define([
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while selecting frame.') gettext('Error while selecting frame.')
); );
@@ -1555,10 +1555,10 @@ define([
try { try {
var err = JSON.parse(xhr.responseText); var err = JSON.parse(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg); Notify.alert(gettext('Debugger Error'), err.errormsg);
} }
} catch (e) { } catch (e) {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while starting debugging listener.') gettext('Error while starting debugging listener.')
); );
@@ -1583,10 +1583,10 @@ define([
try { try {
var err = JSON.parse(xhr.responseText); var err = JSON.parse(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg); Notify.alert(gettext('Debugger Error'), err.errormsg);
} }
} catch (e) { } catch (e) {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while starting debugging listener.') gettext('Error while starting debugging listener.')
); );
@@ -1620,14 +1620,14 @@ define([
// If status is Busy then poll the result by recursive call to the poll function // If status is Busy then poll the result by recursive call to the poll function
self.messages(trans_id); self.messages(trans_id);
} else if (res.data.status === 'NotConnected') { } else if (res.data.status === 'NotConnected') {
Alertify.alert( Notify.alert(
gettext('Not connected to server or connection with the server has been closed.'), gettext('Not connected to server or connection with the server has been closed.'),
res.data.result res.data.result
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Debugger Error'), gettext('Debugger Error'),
gettext('Error while fetching messages information.') gettext('Error while fetching messages information.')
); );
@@ -1910,7 +1910,7 @@ define([
/* Register to log the activity */ /* Register to log the activity */
pgBrowser.register_to_activity_listener(document, ()=>{ pgBrowser.register_to_activity_listener(document, ()=>{
Alertify.alert(gettext('Timeout'), gettext('Your session has timed out due to inactivity. Please close the window and login again.')); Notify.alert(gettext('Timeout'), gettext('Your session has timed out due to inactivity. Please close the window and login again.'));
}); });
controller.poll_result = pgBrowser.override_activity_event_decorator(controller.poll_result).bind(controller); controller.poll_result = pgBrowser.override_activity_event_decorator(controller.poll_result).bind(controller);

View File

@@ -7,9 +7,9 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import Alertify from 'pgadmin.alertifyjs';
import {getPanelTitle} from 'tools/datagrid/static/js/datagrid_panel_title'; import {getPanelTitle} from 'tools/datagrid/static/js/datagrid_panel_title';
import {getRandomInt, registerDetachEvent} from 'sources/utils'; import {getRandomInt, registerDetachEvent} from 'sources/utils';
import Notify from '../../../../static/js/helpers/Notifier';
export function setPanelTitle(erdToolPanel, panelTitle) { export function setPanelTitle(erdToolPanel, panelTitle) {
@@ -100,7 +100,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, pgBrowser
// Callback to draw ERD Tool for objects // Callback to draw ERD Tool for objects
showErdTool: function(data, aciTreeIdentifier, gen=false) { showErdTool: function(data, aciTreeIdentifier, gen=false) {
if (aciTreeIdentifier === undefined) { if (aciTreeIdentifier === undefined) {
Alertify.alert( Notify.alert(
gettext('ERD Error'), gettext('ERD Error'),
gettext('No object selected.') gettext('No object selected.')
); );
@@ -110,7 +110,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, pgBrowser
const parentData = pgBrowser.tree.getTreeNodeHierarchy(aciTreeIdentifier); const parentData = pgBrowser.tree.getTreeNodeHierarchy(aciTreeIdentifier);
if(_.isUndefined(parentData.database)) { if(_.isUndefined(parentData.database)) {
Alertify.alert( Notify.alert(
gettext('ERD Error'), gettext('ERD Error'),
gettext('Please select a database/database object.') gettext('Please select a database/database object.')
); );

View File

@@ -27,6 +27,7 @@ import {showERDSqlTool} from 'tools/datagrid/static/js/show_query_tool';
import 'wcdocker'; import 'wcdocker';
import Theme from '../../../../../../static/js/Theme'; import Theme from '../../../../../../static/js/Theme';
import TableSchema from '../../../../../../browser/server_groups/servers/databases/schemas/tables/static/js/table.ui'; import TableSchema from '../../../../../../browser/server_groups/servers/databases/schemas/tables/static/js/table.ui';
import Notify from '../../../../../../static/js/helpers/Notifier';
/* Custom react-diagram action for keyboard events */ /* Custom react-diagram action for keyboard events */
export class KeyboardShortcutAction extends Action { export class KeyboardShortcutAction extends Action {
@@ -179,17 +180,19 @@ export default class BodyWidget extends React.Component {
} }
handleAxiosCatch(err) { handleAxiosCatch(err) {
let alert = this.props.alertify.alert().set('title', gettext('Error'));
if (err.response) { if (err.response) {
// client received an error response (5xx, 4xx) // client received an error response (5xx, 4xx)
alert.set('message', `${err.response.statusText} - ${err.response.data.errormsg}`).show(); Notify.alert(
gettext('Error'),
`${err.response.statusText} - ${err.response.data.errormsg}`
);
console.error('response error', err.response); console.error('response error', err.response);
} else if (err.request) { } else if (err.request) {
// client never received a response, or request never left // client never received a response, or request never left
alert.set('message', gettext('Client error') + ':' + err).show(); Notify.alert(gettext('Error'), gettext('Client error') + ':' + err);
console.error('client eror', err); console.error('client eror', err);
} else { } else {
alert.set('message', err.message).show(); Notify.alert(gettext('Error'), err.message);
console.error('other error', err); console.error('other error', err);
} }
} }
@@ -374,7 +377,7 @@ export default class BodyWidget extends React.Component {
if(nodeDropData.objUrl && nodeDropData.nodeType === 'table') { if(nodeDropData.objUrl && nodeDropData.nodeType === 'table') {
let matchUrl = `/${this.props.params.sgid}/${this.props.params.sid}/${this.props.params.did}/`; let matchUrl = `/${this.props.params.sgid}/${this.props.params.sid}/${this.props.params.did}/`;
if(nodeDropData.objUrl.indexOf(matchUrl) == -1) { if(nodeDropData.objUrl.indexOf(matchUrl) == -1) {
this.props.alertify.error(gettext('Cannot drop table from outside of the current database.')); Notify.error(gettext('Cannot drop table from outside of the current database.'));
} else { } else {
let dataPromise = new Promise((resolve, reject)=>{ let dataPromise = new Promise((resolve, reject)=>{
axios.get(nodeDropData.objUrl) axios.get(nodeDropData.objUrl)
@@ -416,7 +419,7 @@ export default class BodyWidget extends React.Component {
} }
onDeleteNode() { onDeleteNode() {
this.props.alertify.confirm( Notify.confirm(
gettext('Delete ?'), gettext('Delete ?'),
gettext('You have selected %s tables and %s links.', this.diagram.getSelectedNodes().length, this.diagram.getSelectedLinks().length) gettext('You have selected %s tables and %s links.', this.diagram.getSelectedNodes().length, this.diagram.getSelectedLinks().length)
+ '<br />' + gettext('Are you sure you want to delete ?'), + '<br />' + gettext('Are you sure you want to delete ?'),
@@ -513,7 +516,7 @@ export default class BodyWidget extends React.Component {
'file_name': decodeURI(fileName), 'file_name': decodeURI(fileName),
'file_content': JSON.stringify(this.diagram.serialize(this.props.pgAdmin.Browser.utils.app_version_int)), 'file_content': JSON.stringify(this.diagram.serialize(this.props.pgAdmin.Browser.utils.app_version_int)),
}).then(()=>{ }).then(()=>{
this.props.alertify.success(gettext('Project saved successfully.')); Notify.success(gettext('Project saved successfully.'));
this.setState({ this.setState({
current_file: fileName, current_file: fileName,
dirty: false, dirty: false,
@@ -674,9 +677,7 @@ export default class BodyWidget extends React.Component {
if(err.name) { if(err.name) {
msg = `${err.name}: ${err.message}`; msg = `${err.name}: ${err.message}`;
} }
this.props.alertify.alert() Notify.alert(gettext('Error'), msg);
.set('title', gettext('Error'))
.set('message', msg).show();
}).then(()=>{ }).then(()=>{
/* Revert back to the original CSS styles */ /* Revert back to the original CSS styles */
this.canvasEle.classList.remove('html2canvas-reset'); this.canvasEle.classList.remove('html2canvas-reset');

View File

@@ -437,7 +437,7 @@ define([
if (pgBrowser.tree.hasParent(i)) { if (pgBrowser.tree.hasParent(i)) {
i = pgBrowser.tree.parent(i); i = pgBrowser.tree.parent(i);
} else { } else {
Alertify.alert(gettext('Please select server or child node from tree.')); Notify.alert(gettext('Please select server or child node from tree.'));
break; break;
} }
} }
@@ -533,7 +533,7 @@ define([
Notify.success(gettext('Import/Export job created.'), 5000); Notify.success(gettext('Import/Export job created.'), 5000);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self); pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
} else { } else {
Alertify.alert( Notify.alert(
gettext('Import/Export job creation failed.'), gettext('Import/Export job creation failed.'),
res.errormsg res.errormsg
); );
@@ -542,7 +542,7 @@ define([
.fail(function(xhr) { .fail(function(xhr) {
try { try {
var err = JSON.parse(xhr.responseText); var err = JSON.parse(xhr.responseText);
Alertify.alert( Notify.alert(
gettext('Import/Export job failed.'), gettext('Import/Export job failed.'),
err.errormsg err.errormsg
); );
@@ -696,7 +696,7 @@ define([
}) })
.done(function(res) { .done(function(res) {
if (!res.success) { if (!res.success) {
Alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
res.errormsg res.errormsg
); );
@@ -710,7 +710,7 @@ define([
).set('resizable', true).resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.lg); ).set('resizable', true).resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.lg);
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
gettext('Failed to fetch Utility information') gettext('Failed to fetch Utility information')
); );

View File

@@ -215,7 +215,7 @@ define([
if (pgBrowser.tree.hasParent(i)) { if (pgBrowser.tree.hasParent(i)) {
i = pgBrowser.tree.parent(i); i = pgBrowser.tree.parent(i);
} else { } else {
Alertify.alert(gettext('Please select server or child node from tree.')); Notify.alert(gettext('Please select server or child node from tree.'));
break; break;
} }
} }
@@ -241,7 +241,7 @@ define([
var treeInfo = t && t.getTreeNodeHierarchy(i); var treeInfo = t && t.getTreeNodeHierarchy(i);
if (treeInfo.database._label.indexOf('=') >= 0) { if (treeInfo.database._label.indexOf('=') >= 0) {
Alertify.alert( Notify.alert(
gettext('Maintenance error'), gettext('Maintenance error'),
gettext('Maintenance job creation failed. '+ gettext('Maintenance job creation failed. '+
'Databases with = symbols in the name cannot be maintained using this utility.') 'Databases with = symbols in the name cannot be maintained using this utility.')
@@ -375,14 +375,14 @@ define([
Notify.success(res.data.info); Notify.success(res.data.info);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self); pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
} else { } else {
Alertify.alert( Notify.alert(
gettext('Maintenance job creation failed.'), gettext('Maintenance job creation failed.'),
res.errormsg res.errormsg
); );
} }
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Maintenance job creation failed.') gettext('Maintenance job creation failed.')
); );
}); });
@@ -464,7 +464,7 @@ define([
}) })
.done(function(res) { .done(function(res) {
if (!res.success) { if (!res.success) {
Alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
res.errormsg res.errormsg
); );
@@ -475,7 +475,7 @@ define([
.resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md); .resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
}) })
.fail(function() { .fail(function() {
Alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
gettext('Failed to fetch Utility information') gettext('Failed to fetch Utility information')
); );

View File

@@ -11,12 +11,12 @@ import { FitAddon } from 'xterm-addon-fit';
import { WebLinksAddon } from 'xterm-addon-web-links'; import { WebLinksAddon } from 'xterm-addon-web-links';
import { SearchAddon } from 'xterm-addon-search'; import { SearchAddon } from 'xterm-addon-search';
import { io } from 'socketio'; import { io } from 'socketio';
import Alertify from 'pgadmin.alertifyjs';
import {enable} from 'pgadmin.browser.toolbar'; import {enable} from 'pgadmin.browser.toolbar';
import 'wcdocker'; import 'wcdocker';
import {getRandomInt, hasBinariesConfiguration, registerDetachEvent} from 'sources/utils'; import {getRandomInt, hasBinariesConfiguration, registerDetachEvent} from 'sources/utils';
import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils'; import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils';
import pgWindow from 'sources/window'; import pgWindow from 'sources/window';
import Notify from '../../../../static/js/helpers/Notifier';
import {generateTitle, refresh_db_node} from 'tools/datagrid/static/js/datagrid_panel_title'; import {generateTitle, refresh_db_node} from 'tools/datagrid/static/js/datagrid_panel_title';
@@ -114,14 +114,14 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
return isEnabled; return isEnabled;
}, },
psql_tool: function(data, aciTreeIdentifier, gen=false) { psql_tool: function(data, aciTreeIdentifier, gen=false) {
const serverInformation = retrieveAncestorOfTypeServer(pgBrowser, aciTreeIdentifier, gettext('PSQL Error'), Alertify); const serverInformation = retrieveAncestorOfTypeServer(pgBrowser, aciTreeIdentifier, gettext('PSQL Error'));
if (!hasBinariesConfiguration(pgBrowser, serverInformation, Alertify)) { if (!hasBinariesConfiguration(pgBrowser, serverInformation)) {
return; return;
} }
const node = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier); const node = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier);
if (node === undefined || !node.getData()) { if (node === undefined || !node.getData()) {
Alertify.alert( Notify.alert(
gettext('PSQL Error'), gettext('PSQL Error'),
gettext('No object selected.') gettext('No object selected.')
); );
@@ -131,7 +131,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
parentData = pgBrowser.tree.getTreeNodeHierarchy(aciTreeIdentifier); parentData = pgBrowser.tree.getTreeNodeHierarchy(aciTreeIdentifier);
if(_.isUndefined(parentData.server)) { if(_.isUndefined(parentData.server)) {
Alertify.alert( Notify.alert(
gettext('PSQL Error'), gettext('PSQL Error'),
gettext('Please select a server/database object.') gettext('Please select a server/database object.')
); );
@@ -350,7 +350,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
} }
}); });
} else{ } else{
Alertify.alert(gettext('Clipboard read permission required'), gettext('To paste data on the PSQL terminal, Clipboard read permission required.')); Notify.alert(gettext('Clipboard read permission required'), gettext('To paste data on the PSQL terminal, Clipboard read permission required.'));
} }
}); });
}); });

View File

@@ -14,6 +14,7 @@ import url_for from 'sources/url_for';
import axios from 'axios/index'; import axios from 'axios/index';
import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils'; import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils';
import {hasBinariesConfiguration} from 'sources/utils'; import {hasBinariesConfiguration} from 'sources/utils';
import Notify from '../../../../static/js/helpers/Notifier';
export class RestoreDialog extends Dialog { export class RestoreDialog extends Dialog {
constructor(pgBrowser, $, alertify, RestoreModel, backform = Backform) { constructor(pgBrowser, $, alertify, RestoreModel, backform = Backform) {
@@ -29,12 +30,12 @@ export class RestoreDialog extends Dialog {
} }
draw(action, aciTreeItem, width, height) { draw(action, aciTreeItem, width, height) {
const serverInformation = retrieveAncestorOfTypeServer(this.pgBrowser, aciTreeItem, gettext('Restore Error'), this.alertify); const serverInformation = retrieveAncestorOfTypeServer(this.pgBrowser, aciTreeItem, gettext('Restore Error'));
if (!serverInformation) { if (!serverInformation) {
return; return;
} }
if (!hasBinariesConfiguration(this.pgBrowser, serverInformation, this.alertify)) { if (!hasBinariesConfiguration(this.pgBrowser, serverInformation)) {
return; return;
} }
@@ -46,7 +47,7 @@ export class RestoreDialog extends Dialog {
baseUrl baseUrl
).then(function(res) { ).then(function(res) {
if (!res.data.success) { if (!res.data.success) {
that.alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
res.data.errormsg res.data.errormsg
); );
@@ -70,7 +71,7 @@ export class RestoreDialog extends Dialog {
that.alertify.pg_restore(title, aciTreeItem1, data, node) that.alertify.pg_restore(title, aciTreeItem1, data, node)
.resizeTo(width, height); .resizeTo(width, height);
}).catch(function() { }).catch(function() {
that.alertify.alert( Notify.alert(
gettext('Utility not found'), gettext('Utility not found'),
gettext('Failed to fetch Utility information') gettext('Failed to fetch Utility information')
); );

View File

@@ -12,6 +12,7 @@ import _ from 'underscore';
import gettext from '../../../../static/js/gettext'; import gettext from '../../../../static/js/gettext';
import url_for from '../../../../static/js/url_for'; import url_for from '../../../../static/js/url_for';
import {DialogWrapper} from '../../../../static/js/alertify/dialog_wrapper'; import {DialogWrapper} from '../../../../static/js/alertify/dialog_wrapper';
import Notify from '../../../../static/js/helpers/Notifier';
export class RestoreDialogWrapper extends DialogWrapper { export class RestoreDialogWrapper extends DialogWrapper {
constructor(dialogContainerSelector, dialogTitle, typeOfDialog, constructor(dialogContainerSelector, dialogTitle, typeOfDialog,
@@ -156,10 +157,10 @@ export class RestoreDialogWrapper extends DialogWrapper {
this.view.model.toJSON() this.view.model.toJSON()
).then(function (res) { ).then(function (res) {
if (res.data.success) { if (res.data.success) {
dialogWrapper.alertify.success(gettext('Restore job created.'), 5); Notify.success(gettext('Restore job created.'), 5);
dialogWrapper.pgBrowser.Events.trigger('pgadmin-bgprocess:created', dialogWrapper); dialogWrapper.pgBrowser.Events.trigger('pgadmin-bgprocess:created', dialogWrapper);
} else { } else {
dialogWrapper.alertify.alert( Notify.alert(
gettext('Restore job creation failed.'), gettext('Restore job creation failed.'),
res.data.errormsg res.data.errormsg
); );
@@ -167,7 +168,7 @@ export class RestoreDialogWrapper extends DialogWrapper {
}).catch(function (error) { }).catch(function (error) {
try { try {
const err = error.response.data; const err = error.response.data;
dialogWrapper.alertify.alert( Notify.alert(
gettext('Restore job failed.'), gettext('Restore job failed.'),
err.errormsg err.errormsg
); );

View File

@@ -117,9 +117,9 @@ export default class SchemaDiffUI {
raise_error_on_fail(alert_title, xhr) { raise_error_on_fail(alert_title, xhr) {
try { try {
var err = JSON.parse(xhr.responseText); var err = JSON.parse(xhr.responseText);
Alertify.alert(alert_title, err.errormsg); Notify.alert(alert_title, err.errormsg);
} catch (e) { } catch (e) {
Alertify.alert(alert_title, e.statusText); Notify.alert(alert_title, e.statusText);
} }
} }
@@ -154,7 +154,7 @@ export default class SchemaDiffUI {
url_params['target_sid'] == '' || _.isUndefined(url_params['target_sid']) || url_params['target_sid'] == '' || _.isUndefined(url_params['target_sid']) ||
url_params['target_did'] == '' || _.isUndefined(url_params['target_did']) url_params['target_did'] == '' || _.isUndefined(url_params['target_did'])
) { ) {
Alertify.alert(gettext('Selection Error'), gettext('Please select source and target.')); Notify.alert(gettext('Selection Error'), gettext('Please select source and target.'));
return false; return false;
} }
@@ -168,7 +168,7 @@ export default class SchemaDiffUI {
} }
} }
if (isSameOptsSelected) { if (isSameOptsSelected) {
Alertify.alert(gettext('Selection Error'), gettext('Please select the different source and target.')); Notify.alert(gettext('Selection Error'), gettext('Please select the different source and target.'));
return false; return false;
} }

View File

@@ -414,7 +414,7 @@ define('tools.querytool', [
if (_.isUndefined(self.sql_panel_obj) || _.isUndefined(self.history_panel) || if (_.isUndefined(self.sql_panel_obj) || _.isUndefined(self.history_panel) ||
_.isUndefined(self.data_output_panel) || _.isUndefined(self.explain_panel) || _.isUndefined(self.data_output_panel) || _.isUndefined(self.explain_panel) ||
_.isUndefined(self.messages_panel) || _.isUndefined(self.notifications_panel)) { _.isUndefined(self.messages_panel) || _.isUndefined(self.notifications_panel)) {
alertify.alert( Notify.alert(
gettext('Panel Loading Error'), gettext('Panel Loading Error'),
gettext('Something went wrong while loading the panels.' gettext('Something went wrong while loading the panels.'
+ ' Please make sure to reset the layout (File > Reset Layout) for the better user experience.') + ' Please make sure to reset the layout (File > Reset Layout) for the better user experience.')
@@ -778,7 +778,7 @@ define('tools.querytool', [
/* Register to log the activity */ /* Register to log the activity */
pgBrowser.register_to_activity_listener(document, ()=>{ pgBrowser.register_to_activity_listener(document, ()=>{
alertify.alert(gettext('Timeout'), gettext('Your session has timed out due to inactivity. Please close the window and login again.')); Notify.alert(gettext('Timeout'), gettext('Your session has timed out due to inactivity. Please close the window and login again.'));
}); });
self.render_connection(self.connection_list); self.render_connection(self.connection_list);
@@ -1967,7 +1967,7 @@ define('tools.querytool', [
* confirm with the user for unsaved changes. * confirm with the user for unsaved changes.
*/ */
if (self.handler.is_query_changed) { if (self.handler.is_query_changed) {
alertify.confirm( Notify.confirm(
gettext('Unsaved changes'), gettext('Unsaved changes'),
gettext('Are you sure you wish to discard the current changes?'), gettext('Are you sure you wish to discard the current changes?'),
function() { function() {
@@ -1978,10 +1978,7 @@ define('tools.querytool', [
function() { function() {
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
});
} else { } else {
self.query_tool_obj.setValue(''); self.query_tool_obj.setValue('');
} }
@@ -1997,7 +1994,7 @@ define('tools.querytool', [
return; return;
} }
alertify.confirm(gettext('Clear history'), Notify.confirm(gettext('Clear history'),
gettext('Are you sure you wish to clear the history?') + '</br>' + gettext('Are you sure you wish to clear the history?') + '</br>' +
gettext('This will remove all of your query history from this and other sessions for this database.'), gettext('This will remove all of your query history from this and other sessions for this database.'),
function() { function() {
@@ -2023,10 +2020,7 @@ define('tools.querytool', [
function() { function() {
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
});
}, },
// Callback function for the auto commit button click. // Callback function for the auto commit button click.
@@ -2256,7 +2250,7 @@ define('tools.querytool', [
if(!connection_details['is_selected']) { if(!connection_details['is_selected']) {
var self = this; var self = this;
if(add_new_connection) { if(add_new_connection) {
alertify.confirm(gettext('Change connection'), Notify.confirm(gettext('Change connection'),
gettext('By changing the connection you will lose all your unsaved data for the current connection. <br> Do you want to continue?'), gettext('By changing the connection you will lose all your unsaved data for the current connection. <br> Do you want to continue?'),
function() { function() {
self.change_connection(connection_details, ref, true); self.change_connection(connection_details, ref, true);
@@ -2267,10 +2261,7 @@ define('tools.querytool', [
alertify.newConnectionDialog().destroy(); alertify.newConnectionDialog().destroy();
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
});
} else { } else {
self.change_connection(connection_details, ref, false); self.change_connection(connection_details, ref, false);
} }
@@ -2382,7 +2373,7 @@ define('tools.querytool', [
pgWindow.default.pgAdmin && pgWindow.default.pgAdmin.Browser pgWindow.default.pgAdmin && pgWindow.default.pgAdmin.Browser
&& pgWindow.default.pgAdmin.Browser.preference_version() <= 0) { && pgWindow.default.pgAdmin.Browser.preference_version() <= 0) {
alertify.alert() Notify.alert()
.setting({ .setting({
'title': gettext('Connection lost'), 'title': gettext('Connection lost'),
'label':gettext('Close'), 'label':gettext('Close'),
@@ -2567,7 +2558,7 @@ define('tools.querytool', [
warn_before_continue: function() { warn_before_continue: function() {
var self = this; var self = this;
alertify.confirm( Notify.confirm(
gettext('Connection Warning'), gettext('Connection Warning'),
'<p style="float:left">'+ '<p style="float:left">'+
'<span class="fa fa-exclamation-triangle warn-icon" aria-hidden="true" role="img">'+ '<span class="fa fa-exclamation-triangle warn-icon" aria-hidden="true" role="img">'+
@@ -2607,13 +2598,10 @@ define('tools.querytool', [
} }
}, function() { }, function() {
self.saveState(); self.saveState();
}) },
.set({ gettext('Continue'),
labels: { gettext('Cancel')
ok: gettext('Continue'), );
cancel: gettext('Cancel'),
},
});
}, },
init_connection: function(create_transaction, passdata) { init_connection: function(create_transaction, passdata) {
var self = this; var self = this;
@@ -2880,7 +2868,7 @@ define('tools.querytool', [
_.size(self.data_store.updated) || _.size(self.data_store.updated) ||
_.size(self.data_store.deleted)) _.size(self.data_store.deleted))
) { ) {
alertify.confirm(gettext('Unsaved changes'), Notify.confirm(gettext('Unsaved changes'),
gettext('The data has been modified, but not saved. Are you sure you wish to discard the changes?'), gettext('The data has been modified, but not saved. Are you sure you wish to discard the changes?'),
function() { function() {
// The user does not want to save, just continue // The user does not want to save, just continue
@@ -2899,10 +2887,7 @@ define('tools.querytool', [
$('#btn-flash').prop('disabled', false); $('#btn-flash').prop('disabled', false);
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
});
} else { } else {
if (macroId !== undefined) { if (macroId !== undefined) {
self._execute_macro_query(explain_prefix, shouldReconnect, macroId); self._execute_macro_query(explain_prefix, shouldReconnect, macroId);
@@ -3884,7 +3869,7 @@ define('tools.querytool', [
* confirm with the user for unsaved changes. * confirm with the user for unsaved changes.
*/ */
if (self.is_query_changed) { if (self.is_query_changed) {
alertify.confirm(gettext('Unsaved changes'), Notify.confirm(gettext('Unsaved changes'),
gettext('Are you sure you wish to discard the current changes?'), gettext('Are you sure you wish to discard the current changes?'),
function() { function() {
// User do not want to save, just continue // User do not want to save, just continue
@@ -3893,10 +3878,7 @@ define('tools.querytool', [
function() { function() {
return true; return true;
} }
).set('labels', { );
ok: gettext('Yes'),
cancel: gettext('No'),
});
} else { } else {
self._open_select_file_manager(); self._open_select_file_manager();
} }
@@ -4161,7 +4143,7 @@ define('tools.querytool', [
// Refresh the sql grid // Refresh the sql grid
queryToolActions.executeQuery(self); queryToolActions.executeQuery(self);
} else { } else {
alertify.alert(gettext('Filter By Selection Error'), res.data.result); Notify.alert(gettext('Filter By Selection Error'), res.data.result);
} }
} }
); );
@@ -4172,7 +4154,7 @@ define('tools.querytool', [
pgAdmin, self, e, '_include_filter', [], true pgAdmin, self, e, '_include_filter', [], true
); );
if (msg) if (msg)
alertify.alert(gettext('Filter By Selection Error'), msg); Notify.alert(gettext('Filter By Selection Error'), msg);
}); });
}, },
@@ -4221,7 +4203,7 @@ define('tools.querytool', [
// Refresh the sql grid // Refresh the sql grid
queryToolActions.executeQuery(self); queryToolActions.executeQuery(self);
} else { } else {
alertify.alert(gettext('Filter Exclude Selection Error'), res.data.result); Notify.alert(gettext('Filter Exclude Selection Error'), res.data.result);
} }
}, 10 }, 10
); );
@@ -4232,7 +4214,7 @@ define('tools.querytool', [
pgAdmin, self, e, '_exclude_filter', [], true pgAdmin, self, e, '_exclude_filter', [], true
); );
if (msg) if (msg)
alertify.alert(gettext('Filter Exclude Selection Error'), msg); Notify.alert(gettext('Filter Exclude Selection Error'), msg);
}); });
}, },
@@ -4260,7 +4242,7 @@ define('tools.querytool', [
// Refresh the sql grid // Refresh the sql grid
queryToolActions.executeQuery(self); queryToolActions.executeQuery(self);
} else { } else {
alertify.alert(gettext('Remove Filter Error'), res.data.result); Notify.alert(gettext('Remove Filter Error'), res.data.result);
} }
} }
); );
@@ -4271,7 +4253,7 @@ define('tools.querytool', [
pgAdmin, self, e, '_remove_filter', [], true pgAdmin, self, e, '_remove_filter', [], true
); );
if (msg) if (msg)
alertify.alert(gettext('Remove Filter Error'), msg); Notify.alert(gettext('Remove Filter Error'), msg);
}); });
}, },
@@ -4428,7 +4410,7 @@ define('tools.querytool', [
// Refresh the sql grid // Refresh the sql grid
queryToolActions.executeQuery(self); queryToolActions.executeQuery(self);
} else { } else {
alertify.alert(gettext('Change limit Error'), res.data.result); Notify.alert(gettext('Change limit Error'), res.data.result);
} }
}, 10 }, 10
); );
@@ -4439,7 +4421,7 @@ define('tools.querytool', [
pgAdmin, self, e, '_set_limit', [], true pgAdmin, self, e, '_set_limit', [], true
); );
if (msg) if (msg)
alertify.alert(gettext('Change limit Error'), msg); Notify.alert(gettext('Change limit Error'), msg);
}); });
}, },
@@ -4575,7 +4557,7 @@ define('tools.querytool', [
}) })
.done(function(res) { .done(function(res) {
if (!res.data.status) { if (!res.data.status) {
alertify.alert(gettext('Cancel Query Error'), res.data.result); Notify.alert(gettext('Cancel Query Error'), res.data.result);
} }
self.disable_tool_buttons(false); self.disable_tool_buttons(false);
is_query_running = false; is_query_running = false;
@@ -4594,7 +4576,7 @@ define('tools.querytool', [
pgAdmin, self, e, '_cancel_query', [], false pgAdmin, self, e, '_cancel_query', [], false
); );
if (msg) if (msg)
alertify.alert(gettext('Cancel Query Error'), msg); Notify.alert(gettext('Cancel Query Error'), msg);
}); });
}, },
@@ -4674,7 +4656,7 @@ define('tools.querytool', [
} }
// Check if error message is present // Check if error message is present
if (msg) if (msg)
alertify.alert(gettext('Download CSV error'), msg); Notify.alert(gettext('Download CSV error'), msg);
}); });
}, },
@@ -4708,7 +4690,7 @@ define('tools.querytool', [
}) })
.done(function(res) { .done(function(res) {
if (!res.data.status) if (!res.data.status)
alertify.alert(gettext('Auto Rollback Error'), res.data.result); Notify.alert(gettext('Auto Rollback Error'), res.data.result);
}) })
.fail(function(e) { .fail(function(e) {
@@ -4716,7 +4698,7 @@ define('tools.querytool', [
pgAdmin, self, e, '_auto_rollback', [], true pgAdmin, self, e, '_auto_rollback', [], true
); );
if (msg) if (msg)
alertify.alert(gettext('Auto Rollback Error'), msg); Notify.alert(gettext('Auto Rollback Error'), msg);
}); });
}, },
@@ -4742,14 +4724,14 @@ define('tools.querytool', [
}) })
.done(function(res) { .done(function(res) {
if (!res.data.status) if (!res.data.status)
alertify.alert(gettext('Auto Commit Error'), res.data.result); Notify.alert(gettext('Auto Commit Error'), res.data.result);
}) })
.fail(function(e) { .fail(function(e) {
let msg = httpErrorHandler.handleQueryToolAjaxError( let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_auto_commit', [], true pgAdmin, self, e, '_auto_commit', [], true
); );
if (msg) if (msg)
alertify.alert(gettext('Auto Commit Error'), msg); Notify.alert(gettext('Auto Commit Error'), msg);
}); });
}, },
@@ -5086,7 +5068,7 @@ define('tools.querytool', [
closeEvent.cancel = true; closeEvent.cancel = true;
} }
} else { } else {
alertify.confirm( Notify.confirm(
gettext('Warning'), gettext('Warning'),
gettext('The current transaction has been rolled back because the server was disconnected.'), gettext('The current transaction has been rolled back because the server was disconnected.'),
function() { function() {
@@ -5095,10 +5077,10 @@ define('tools.querytool', [
}, },
function() { function() {
return true; return true;
} },
).set('labels', { gettext('OK'),
ok: gettext('OK') gettext('Cancel')
}); );
} }
}).fail(function() { }).fail(function() {
/* failure should be ignored */ /* failure should be ignored */

View File

@@ -698,7 +698,7 @@ define([
e.cancel = true; // Do not close dialog e.cancel = true; // Do not close dialog
let newOwnershipModel = this.ownershipModel.toJSON(); let newOwnershipModel = this.ownershipModel.toJSON();
if (newOwnershipModel.user == '' || newOwnershipModel.user == undefined) { if (newOwnershipModel.user == '' || newOwnershipModel.user == undefined) {
alertify.confirm( Notify.confirm(
gettext('Delete user?'), gettext('Delete user?'),
gettext('The shared servers owned by <b>'+ self.model.get('username') +'</b> will be deleted. Do you wish to continue?'), gettext('The shared servers owned by <b>'+ self.model.get('username') +'</b> will be deleted. Do you wish to continue?'),
function() { function() {
@@ -751,7 +751,7 @@ define([
}, },
deleteUser: function() { deleteUser: function() {
let self = this; let self = this;
alertify.confirm( Notify.confirm(
gettext('Delete user?'), gettext('Delete user?'),
gettext('Are you sure you wish to delete this user?'), gettext('Are you sure you wish to delete this user?'),
function() { function() {
@@ -777,7 +777,7 @@ define([
e.preventDefault(); e.preventDefault();
if (self.model.get('id') == userInfo['id']) { if (self.model.get('id') == userInfo['id']) {
alertify.alert( Notify.alert(
gettext('Cannot delete user.'), gettext('Cannot delete user.'),
gettext('Cannot delete currently logged in user.'), gettext('Cannot delete currently logged in user.'),
function() { function() {
@@ -819,7 +819,7 @@ define([
} }
} else { } else {
alertify.alert( Notify.alert(
gettext('Error'), gettext('Error'),
gettext('This user cannot be deleted.'), gettext('This user cannot be deleted.'),
function() { function() {
@@ -1071,7 +1071,7 @@ define([
}) })
.fail(function() { .fail(function() {
setTimeout(function() { setTimeout(function() {
alertify.alert( Notify.alert(
gettext('Error'), gettext('Error'),
gettext('Cannot load user roles.') gettext('Cannot load user roles.')
); );
@@ -1088,7 +1088,7 @@ define([
}) })
.fail(function() { .fail(function() {
setTimeout(function() { setTimeout(function() {
alertify.alert( Notify.alert(
gettext('Error'), gettext('Error'),
gettext('Cannot load user Sources.') gettext('Cannot load user Sources.')
); );
@@ -1162,7 +1162,7 @@ define([
var self = this; var self = this;
if (!_.all(this.userCollection.pluck('id')) || !_.isEmpty(this.userCollection.invalidUsers)) { if (!_.all(this.userCollection.pluck('id')) || !_.isEmpty(this.userCollection.invalidUsers)) {
e.cancel = true; e.cancel = true;
alertify.confirm( Notify.confirm(
gettext('Discard unsaved changes?'), gettext('Discard unsaved changes?'),
gettext('Are you sure you want to close the dialog? Any unsaved changes will be lost.'), gettext('Are you sure you want to close the dialog? Any unsaved changes will be lost.'),
function() { function() {

View File

@@ -80,14 +80,22 @@ class PgadminPage:
except TimeoutException: except TimeoutException:
pass pass
def click_modal(self, button_text): def click_modal(self, button_text, react_dialog=False):
time.sleep(0.5) time.sleep(0.5)
# Find active alertify dialog in case of multiple alertify dialog # Find active alertify dialog in case of multiple alertify dialog
# & click on that dialog # & click on that dialog
modal_button = self.find_by_xpath(
"//div[contains(@class, 'alertify') and " # In case of react dialog we use different xpath
"not(contains(@class, 'ajs-hidden'))]//button[.='%s']" if react_dialog:
% button_text) modal_button = self.find_by_xpath(
"//div[@class ='MuiDialogContent-root']"
"//span[text()='%s']" % button_text)
else:
modal_button = self.find_by_xpath(
"//div[contains(@class, 'alertify') and "
"not(contains(@class, 'ajs-hidden'))]//button[.='%s']"
% button_text)
self.click_element(modal_button) self.click_element(modal_button)
def add_server(self, server_config): def add_server(self, server_config):
@@ -214,7 +222,8 @@ class PgadminPage:
self.click_element( self.click_element(
self.find_by_css_selector(QueryToolLocators.btn_clear) self.find_by_css_selector(QueryToolLocators.btn_clear)
) )
self.click_modal('Yes') self.driver.switch_to.default_content()
self.click_modal('Yes', True)
def execute_query(self, query): def execute_query(self, query):
self.fill_codemirror_area_with(query) self.fill_codemirror_area_with(query)
@@ -322,7 +331,7 @@ class PgadminPage:
self.click_element(object_menu_item) self.click_element(object_menu_item)
delete_menu_item = self.find_by_partial_link_text("Remove Server") delete_menu_item = self.find_by_partial_link_text("Remove Server")
self.click_element(delete_menu_item) self.click_element(delete_menu_item)
self.click_modal('Yes') self.click_modal('Yes', True)
time.sleep(1) time.sleep(1)
else: else:
print("%s Server is not removed", server_config['name'], print("%s Server is not removed", server_config['name'],

View File

@@ -16,6 +16,7 @@ import pgAdmin from 'sources/pgadmin';
import {messages} from '../fake_messages'; import {messages} from '../fake_messages';
import SchemaView from '../../../pgadmin/static/js/SchemaView'; import SchemaView from '../../../pgadmin/static/js/SchemaView';
import * as legacyConnector from 'sources/helpers/legacyConnector'; import * as legacyConnector from 'sources/helpers/legacyConnector';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
const initData = { const initData = {
id: 1, id: 1,
@@ -58,6 +59,7 @@ describe('SchemaView', ()=>{
/* https://material-ui.com/guides/testing/#api */ /* https://material-ui.com/guides/testing/#api */
beforeAll(()=>{ beforeAll(()=>{
mount = createMount(); mount = createMount();
spyOn(Notify, 'alert');
}); });
afterAll(() => { afterAll(() => {
@@ -242,7 +244,6 @@ describe('SchemaView', ()=>{
it('onSave click', (done)=>{ it('onSave click', (done)=>{
simulateValidData(); simulateValidData();
let alertSpy = spyOn(legacyConnector.pgAlertify(), 'alert');
onSave.calls.reset(); onSave.calls.reset();
ctrl.find('PrimaryButton[data-test="Save"]').simulate('click'); ctrl.find('PrimaryButton[data-test="Save"]').simulate('click');
setTimeout(()=>{ setTimeout(()=>{
@@ -257,7 +258,7 @@ describe('SchemaView', ()=>{
{field3: null, field4: null, field5: 'rval52'}, {field3: null, field4: null, field5: 'rval52'},
] ]
}); });
expect(alertSpy).toHaveBeenCalledWith('Warning', 'some inform text'); expect(Notify.alert).toHaveBeenCalledWith('Warning', 'some inform text');
done(); done();
}, 0); }, 0);
}); });
@@ -266,7 +267,7 @@ describe('SchemaView', ()=>{
it('with confirm check and yes click', (done)=>{ it('with confirm check and yes click', (done)=>{
simulateValidData(); simulateValidData();
onDataChange.calls.reset(); onDataChange.calls.reset();
let confirmSpy = spyOn(legacyConnector.pgAlertify(), 'confirm').and.callThrough(); let confirmSpy = spyOn(Notify, 'confirm').and.callThrough();
ctrl.find('DefaultButton[data-test="Reset"]').simulate('click'); ctrl.find('DefaultButton[data-test="Reset"]').simulate('click');
/* Press OK */ /* Press OK */
confirmSpy.calls.argsFor(0)[2](); confirmSpy.calls.argsFor(0)[2]();
@@ -281,7 +282,7 @@ describe('SchemaView', ()=>{
it('with confirm check and cancel click', (done)=>{ it('with confirm check and cancel click', (done)=>{
simulateValidData(); simulateValidData();
let confirmSpy = spyOn(legacyConnector.pgAlertify(), 'confirm').and.callThrough(); let confirmSpy = spyOn(Notify, 'confirm').and.callThrough();
ctrl.find('DefaultButton[data-test="Reset"]').simulate('click'); ctrl.find('DefaultButton[data-test="Reset"]').simulate('click');
/* Press cancel */ /* Press cancel */
confirmSpy.calls.argsFor(0)[3](); confirmSpy.calls.argsFor(0)[3]();
@@ -301,7 +302,7 @@ describe('SchemaView', ()=>{
ctrl.update(); ctrl.update();
simulateValidData(); simulateValidData();
onDataChange.calls.reset(); onDataChange.calls.reset();
let confirmSpy = spyOn(legacyConnector.pgAlertify(), 'confirm').and.callThrough(); let confirmSpy = spyOn(Notify, 'confirm').and.callThrough();
ctrl.find('DefaultButton[data-test="Reset"]').simulate('click'); ctrl.find('DefaultButton[data-test="Reset"]').simulate('click');
setTimeout(()=>{ setTimeout(()=>{
ctrl.update(); ctrl.update();
@@ -380,7 +381,6 @@ describe('SchemaView', ()=>{
ctrl.update(); ctrl.update();
simulateChanges(); simulateChanges();
let alertSpy = spyOn(legacyConnector.pgAlertify(), 'alert');
onSave.calls.reset(); onSave.calls.reset();
ctrl.find('PrimaryButton[data-test="Save"]').simulate('click'); ctrl.find('PrimaryButton[data-test="Save"]').simulate('click');
setTimeout(()=>{ setTimeout(()=>{
@@ -402,7 +402,7 @@ describe('SchemaView', ()=>{
] ]
} }
}); });
expect(alertSpy).toHaveBeenCalledWith('Warning', 'some inform text'); expect(Notify.alert).toHaveBeenCalledWith('Warning', 'some inform text');
done(); done();
}, 0); }, 0);
}, 0); }, 0);
@@ -413,7 +413,7 @@ describe('SchemaView', ()=>{
ctrl.update(); ctrl.update();
simulateChanges(); simulateChanges();
onDataChange.calls.reset(); onDataChange.calls.reset();
let confirmSpy = spyOn(legacyConnector.pgAlertify(), 'confirm').and.callThrough(); let confirmSpy = spyOn(Notify, 'confirm').and.callThrough();
ctrl.find('DefaultButton[data-test="Reset"]').simulate('click'); ctrl.find('DefaultButton[data-test="Reset"]').simulate('click');
/* Press OK */ /* Press OK */
confirmSpy.calls.argsFor(0)[2](); confirmSpy.calls.argsFor(0)[2]();

View File

@@ -11,6 +11,7 @@ import {showDataGrid} from '../../../pgadmin/tools/datagrid/static/js/show_data'
import {TreeFake} from '../tree/tree_fake'; import {TreeFake} from '../tree/tree_fake';
import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes'; import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes';
import {pgBrowser} from 'pgadmin.browser.preferences'; import {pgBrowser} from 'pgadmin.browser.preferences';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
const context = describe; const context = describe;
@@ -31,6 +32,8 @@ describe('#show_data', () => {
beforeEach(() => { beforeEach(() => {
pgBrowser.preferences_cache = dummy_cache; pgBrowser.preferences_cache = dummy_cache;
alertify = jasmine.createSpyObj('alertify', ['alert', 'error']); alertify = jasmine.createSpyObj('alertify', ['alert', 'error']);
spyOn(Notify, 'error');
spyOn(Notify, 'alert');
datagrid = { datagrid = {
launch_grid: jasmine.createSpy('launch_grid'), launch_grid: jasmine.createSpy('launch_grid'),
}; };
@@ -114,7 +117,7 @@ describe('#show_data', () => {
it('display alert', () => { it('display alert', () => {
showDataGrid(datagrid, pgBrowser, alertify, {}, [{id: '10'}], transId); showDataGrid(datagrid, pgBrowser, alertify, {}, [{id: '10'}], transId);
expect(alertify.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Data Grid Error', 'Data Grid Error',
'No object selected.' 'No object selected.'
); );

View File

@@ -11,6 +11,7 @@ import {TreeFake} from '../tree/tree_fake';
import {showQueryTool} from '../../../pgadmin/tools/datagrid/static/js/show_query_tool'; import {showQueryTool} from '../../../pgadmin/tools/datagrid/static/js/show_query_tool';
import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes'; import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes';
import {pgBrowser} from 'pgadmin.browser.preferences'; import {pgBrowser} from 'pgadmin.browser.preferences';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
const context = describe; const context = describe;
@@ -26,11 +27,10 @@ var dummy_cache = [
describe('#showQueryTool', () => { describe('#showQueryTool', () => {
let queryTool; let queryTool;
let alertify;
let transId = 98765432; let transId = 98765432;
beforeEach(() => { beforeEach(() => {
pgBrowser.preferences_cache = dummy_cache; pgBrowser.preferences_cache = dummy_cache;
alertify = jasmine.createSpyObj('alertify', ['alert']); spyOn(Notify, 'alert');
queryTool = { queryTool = {
launch_grid: jasmine.createSpy('launch_grid'), launch_grid: jasmine.createSpy('launch_grid'),
}; };
@@ -77,14 +77,14 @@ describe('#showQueryTool', () => {
context('cannot find the tree node', () => { context('cannot find the tree node', () => {
beforeEach(() => { beforeEach(() => {
showQueryTool(queryTool, pgBrowser, alertify, '', [{id: '10'}], transId); showQueryTool(queryTool, pgBrowser, '', [{id: '10'}], transId);
}); });
it('does not create a transaction', () => { it('does not create a transaction', () => {
expect(queryTool.launch_grid).not.toHaveBeenCalled(); expect(queryTool.launch_grid).not.toHaveBeenCalled();
}); });
it('display alert', () => { it('display alert', () => {
expect(alertify.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Query Tool Error', 'Query Tool Error',
'No object selected.' 'No object selected.'
); );
@@ -93,19 +93,19 @@ describe('#showQueryTool', () => {
context('current node is not underneath a server', () => { context('current node is not underneath a server', () => {
it('does not create a transaction', () => { it('does not create a transaction', () => {
showQueryTool(queryTool, pgBrowser, alertify, '', [{id: 'parent'}], transId); showQueryTool(queryTool, pgBrowser, '', [{id: 'parent'}], transId);
expect(queryTool.launch_grid).not.toHaveBeenCalled(); expect(queryTool.launch_grid).not.toHaveBeenCalled();
}); });
it('no alert is displayed', () => { it('no alert is displayed', () => {
expect(alertify.alert).not.toHaveBeenCalled(); expect(Notify.alert).not.toHaveBeenCalled();
}); });
}); });
context('current node is underneath a server', () => { context('current node is underneath a server', () => {
context('current node is not underneath a database', () => { context('current node is not underneath a database', () => {
it('creates a transaction', () => { it('creates a transaction', () => {
showQueryTool(queryTool, pgBrowser, alertify, 'http://someurl', [{id: 'server1'}], transId); showQueryTool(queryTool, pgBrowser, 'http://someurl', [{id: 'server1'}], transId);
expect(queryTool.launch_grid).toHaveBeenCalledWith( expect(queryTool.launch_grid).toHaveBeenCalledWith(
98765432, 98765432,
'/panel/98765432?is_query_tool=true&sgid=1&sid=2&server_type=pg', '/panel/98765432?is_query_tool=true&sgid=1&sid=2&server_type=pg',
@@ -118,7 +118,7 @@ describe('#showQueryTool', () => {
context('current node is underneath a database', () => { context('current node is underneath a database', () => {
it('creates a transaction', () => { it('creates a transaction', () => {
showQueryTool(queryTool, pgBrowser, alertify, 'http://someurl', [{id: 'database1'}], transId); showQueryTool(queryTool, pgBrowser, 'http://someurl', [{id: 'database1'}], transId);
expect(queryTool.launch_grid).toHaveBeenCalledWith( expect(queryTool.launch_grid).toHaveBeenCalledWith(
98765432, 98765432,
'/panel/98765432?is_query_tool=true&sgid=1&sid=2&server_type=pg&did=3', '/panel/98765432?is_query_tool=true&sgid=1&sid=2&server_type=pg&did=3',

View File

@@ -11,6 +11,8 @@ import erdPref from './erd_preferences';
import BodyWidget from 'pgadmin.tools.erd/erd_tool/ui_components/BodyWidget'; import BodyWidget from 'pgadmin.tools.erd/erd_tool/ui_components/BodyWidget';
import * as ERDSqlTool from 'tools/datagrid/static/js/show_query_tool'; import * as ERDSqlTool from 'tools/datagrid/static/js/show_query_tool';
import { FakeLink, FakeNode } from '../fake_item'; import { FakeLink, FakeNode } from '../fake_item';
import Notify from '../../../../pgadmin/static/js/helpers/Notifier';
let pgAdmin = { let pgAdmin = {
Browser: { Browser: {
@@ -104,7 +106,7 @@ describe('ERD BodyWidget', ()=>{
spyOn(ERDCore.prototype, 'deserializeData'); spyOn(ERDCore.prototype, 'deserializeData');
spyOn(ERDCore.prototype, 'addNode').and.returnValue(newNode); spyOn(ERDCore.prototype, 'addNode').and.returnValue(newNode);
spyOn(ERDCore.prototype, 'addLink').and.returnValue(new FakeLink()); spyOn(ERDCore.prototype, 'addLink').and.returnValue(new FakeLink());
spyOn(alertify, 'confirm').and.callFake((arg1, arg2, okCallback)=>{ spyOn(Notify, 'confirm').and.callFake((arg1, arg2, okCallback)=>{
okCallback(); okCallback();
}); });

View File

@@ -10,6 +10,7 @@ import {TreeFake} from '../tree/tree_fake';
import {RestoreDialog} from '../../../pgadmin/tools/restore/static/js/restore_dialog'; import {RestoreDialog} from '../../../pgadmin/tools/restore/static/js/restore_dialog';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from 'axios/index'; import axios from 'axios/index';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
const context = describe; const context = describe;
@@ -44,6 +45,7 @@ describe('RestoreDialog', () => {
pgBrowser.Nodes.database.hasId = true; pgBrowser.Nodes.database.hasId = true;
jquerySpy = jasmine.createSpy('jquerySpy'); jquerySpy = jasmine.createSpy('jquerySpy');
restoreModelSpy = jasmine.createSpy('restoreModelSpy'); restoreModelSpy = jasmine.createSpy('restoreModelSpy');
spyOn(Notify, 'alert');
const hierarchy = { const hierarchy = {
children: [ children: [
@@ -145,7 +147,7 @@ describe('RestoreDialog', () => {
it('display an alert with a Restore Error', () => { it('display an alert with a Restore Error', () => {
restoreDialog.draw(null, [{id: 'root'}], null); restoreDialog.draw(null, [{id: 'root'}], null);
expect(alertifySpy.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Restore Error', 'Restore Error',
'Please select server or child node from the browser tree.' 'Please select server or child node from the browser tree.'
); );
@@ -161,7 +163,7 @@ describe('RestoreDialog', () => {
context('server is a PostgreSQL server', () => { context('server is a PostgreSQL server', () => {
it('display an alert with "Preferences Error"', () => { it('display an alert with "Preferences Error"', () => {
restoreDialog.draw(null, [{id: 'serverTreeNode'}], null); restoreDialog.draw(null, [{id: 'serverTreeNode'}], null);
expect(alertifySpy.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Preferences Error', 'Preferences Error',
'Failed to load preference pg_bin_dir of module paths' 'Failed to load preference pg_bin_dir of module paths'
); );
@@ -171,7 +173,7 @@ describe('RestoreDialog', () => {
context('server is a EPAS server', () => { context('server is a EPAS server', () => {
it('display an alert with "Preferences Error"', () => { it('display an alert with "Preferences Error"', () => {
restoreDialog.draw(null, [{id: 'ppasServer'}], null); restoreDialog.draw(null, [{id: 'ppasServer'}], null);
expect(alertifySpy.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Preferences Error', 'Preferences Error',
'Failed to load preference ppas_bin_dir of module paths' 'Failed to load preference ppas_bin_dir of module paths'
); );
@@ -188,7 +190,7 @@ describe('RestoreDialog', () => {
context('server is a PostgreSQL server', () => { context('server is a PostgreSQL server', () => {
it('display an alert with "Configuration required"', () => { it('display an alert with "Configuration required"', () => {
restoreDialog.draw(null, [{id: 'serverTreeNodeWrongPath'}], null); restoreDialog.draw(null, [{id: 'serverTreeNodeWrongPath'}], null);
expect(alertifySpy.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Configuration required', 'Configuration required',
'Please configure the PostgreSQL Binary Path in the Preferences dialog.' 'Please configure the PostgreSQL Binary Path in the Preferences dialog.'
); );
@@ -270,7 +272,7 @@ describe('RestoreDialog', () => {
context('server is a EPAS server', () => { context('server is a EPAS server', () => {
it('display an alert with "Configuration required"', () => { it('display an alert with "Configuration required"', () => {
restoreDialog.draw(null, [{id: 'ppasServerTreeNodeWrongPath'}], null); restoreDialog.draw(null, [{id: 'ppasServerTreeNodeWrongPath'}], null);
expect(alertifySpy.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Configuration required', 'Configuration required',
'Please configure the EDB Advanced Server Binary Path in the Preferences dialog.' 'Please configure the EDB Advanced Server Binary Path in the Preferences dialog.'
); );

View File

@@ -12,6 +12,7 @@ import MockAdapter from 'axios-mock-adapter';
import axios from 'axios/index'; import axios from 'axios/index';
import {FakeModel} from '../fake_model'; import {FakeModel} from '../fake_model';
import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes'; import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
let context = describe; let context = describe;
@@ -91,6 +92,8 @@ describe('RestoreDialogWrapper', () => {
return jasmine.createSpyObj('obj', ['appendTo']); return jasmine.createSpyObj('obj', ['appendTo']);
} }
}); });
spyOn(Notify, 'success');
spyOn(Notify, 'alert');
}); });
describe('#prepare', () => { describe('#prepare', () => {
@@ -404,7 +407,7 @@ describe('RestoreDialogWrapper', () => {
it('create an success alert box', (done) => { it('create an success alert box', (done) => {
restoreDialogWrapper.callback(event); restoreDialogWrapper.callback(event);
setTimeout(() => { setTimeout(() => {
expect(alertifySpy.success).toHaveBeenCalledWith( expect(Notify.success).toHaveBeenCalledWith(
'Restore job created.', 'Restore job created.',
5 5
); );
@@ -445,7 +448,7 @@ describe('RestoreDialogWrapper', () => {
it('creates an alert box', (done) => { it('creates an alert box', (done) => {
restoreDialogWrapper.callback(event); restoreDialogWrapper.callback(event);
setTimeout(() => { setTimeout(() => {
expect(alertifySpy.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
'Restore job failed.', 'Restore job failed.',
undefined undefined
); );

View File

@@ -17,9 +17,9 @@ import SchemaView, { SCHEMA_STATE_ACTIONS } from '../../../pgadmin/static/js/Sch
import BaseUISchema from '../../../pgadmin/static/js/SchemaView/base_schema.ui'; import BaseUISchema from '../../../pgadmin/static/js/SchemaView/base_schema.ui';
import _ from 'lodash'; import _ from 'lodash';
import { getNodeExclusionConstraintSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.ui'; import { getNodeExclusionConstraintSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.ui';
import * as legacyConnector from 'sources/helpers/legacyConnector';
import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax'; import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax';
import TableSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui'; import TableSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
class SchemaInColl extends BaseUISchema { class SchemaInColl extends BaseUISchema {
constructor(schemaObj) { constructor(schemaObj) {
@@ -259,7 +259,7 @@ describe('ExclusionConstraintSchema', ()=>{
beforeEach(()=>{ beforeEach(()=>{
spyOn(schemaObj.exColumnSchema, 'setOperClassOptions').and.callThrough(); spyOn(schemaObj.exColumnSchema, 'setOperClassOptions').and.callThrough();
spyOn(schemaObj.fieldOptions, 'getOperClass').and.returnValue(operClassOptions); spyOn(schemaObj.fieldOptions, 'getOperClass').and.returnValue(operClassOptions);
confirmSpy = spyOn(legacyConnector.pgAlertify(), 'confirm').and.callThrough(); confirmSpy = spyOn(Notify, 'confirm').and.callThrough();
deferredDepChange = _.find(schemaObj.fields, (f)=>f.id=='amname')?.deferredDepChange; deferredDepChange = _.find(schemaObj.fields, (f)=>f.id=='amname')?.deferredDepChange;
}); });

View File

@@ -16,8 +16,8 @@ import {messages} from '../fake_messages';
import SchemaView, { SCHEMA_STATE_ACTIONS } from '../../../pgadmin/static/js/SchemaView'; import SchemaView, { SCHEMA_STATE_ACTIONS } from '../../../pgadmin/static/js/SchemaView';
import _ from 'lodash'; import _ from 'lodash';
import { getNodeTableSchema, LikeSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui'; import { getNodeTableSchema, LikeSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui';
import * as legacyConnector from 'sources/helpers/legacyConnector';
import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax'; import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
function getFieldDepChange(schema, id) { function getFieldDepChange(schema, id) {
return _.find(schema.fields, (f)=>f.id==id)?.depChange; return _.find(schema.fields, (f)=>f.id==id)?.depChange;
@@ -154,7 +154,7 @@ describe('TableSchema', ()=>{
beforeEach(()=>{ beforeEach(()=>{
spyOn(schemaObj,'changeColumnOptions').and.callThrough(); spyOn(schemaObj,'changeColumnOptions').and.callThrough();
spyOn(schemaObj, 'getTableOid').and.returnValue(140391); spyOn(schemaObj, 'getTableOid').and.returnValue(140391);
confirmSpy = spyOn(legacyConnector.pgAlertify(), 'confirm').and.callThrough(); confirmSpy = spyOn(Notify, 'confirm').and.callThrough();
deferredDepChange = _.find(schemaObj.fields, (f)=>f.id=='typname')?.deferredDepChange; deferredDepChange = _.find(schemaObj.fields, (f)=>f.id=='typname')?.deferredDepChange;
schemaObj.ofTypeTables = [ schemaObj.ofTypeTables = [
{label: 'type1', oftype_columns: oftypeColumns} {label: 'type1', oftype_columns: oftypeColumns}

View File

@@ -11,6 +11,7 @@ import {TreeFake} from '../tree/tree_fake';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from 'axios/index'; import axios from 'axios/index';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
const context = describe; const context = describe;
@@ -67,6 +68,7 @@ describe('SearchObjectsDialog', () => {
pgBrowser.Nodes.server.hasId = true; pgBrowser.Nodes.server.hasId = true;
pgBrowser.Nodes.database.hasId = true; pgBrowser.Nodes.database.hasId = true;
jquerySpy = jasmine.createSpy('jquerySpy'); jquerySpy = jasmine.createSpy('jquerySpy');
spyOn(Notify, 'alert');
const hierarchy = { const hierarchy = {
children: [ children: [
@@ -143,7 +145,7 @@ describe('SearchObjectsDialog', () => {
it('display an alert with a Search object Error', () => { it('display an alert with a Search object Error', () => {
soDialog.draw(null, [{id: 'serverTreeNode'}], null); soDialog.draw(null, [{id: 'serverTreeNode'}], null);
expect(alertifySpy.alert).toHaveBeenCalledWith( expect(Notify.alert).toHaveBeenCalledWith(
gettext('Search Objects Error'), gettext('Search Objects Error'),
gettext('Please select a database or its child node from the browser.') gettext('Please select a database or its child node from the browser.')
); );