mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 15:26:46 -06:00
Replace Alertify alert and confirm with React-based model dialog. Fixes #7053
This commit is contained in:
parent
e327066523
commit
fd53e4f5f9
@ -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 #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 #7053 <https://redmine.postgresql.org/issues/7053>`_ - Replace Alertify alert and confirm with React-based model dialog.
|
||||
|
||||
Bug fixes
|
||||
*********
|
||||
|
@ -5,8 +5,8 @@ import { isEmptyString } from 'sources/validators';
|
||||
import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../../../static/js/SchemaView';
|
||||
import DataGridViewWithHeaderForm from '../../../../../../../../../../static/js/helpers/DataGridViewWithHeaderForm';
|
||||
import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../../static/js/node_ajax';
|
||||
import { pgAlertify } from '../../../../../../../../../../static/js/helpers/legacyConnector';
|
||||
import TableSchema from '../../../../static/js/table.ui';
|
||||
import Notify from '../../../../../../../../../../static/js/helpers/Notifier';
|
||||
|
||||
export function getNodeExclusionConstraintSchema(treeNodeInfo, itemNodeData, pgBrowser, noColumns=false) {
|
||||
let tableNode = pgBrowser.Nodes['table'];
|
||||
@ -275,7 +275,7 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
|
||||
options: this.fieldOptions.amname,
|
||||
deferredDepChange: (state, source, topState, actionObj)=>{
|
||||
return new Promise((resolve)=>{
|
||||
pgAlertify().confirm(
|
||||
Notify.confirm(
|
||||
gettext('Change access method?'),
|
||||
gettext('Changing access method will clear columns collection'),
|
||||
function () {
|
||||
|
@ -11,8 +11,8 @@ import gettext from 'sources/gettext';
|
||||
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
||||
import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../static/js/node_ajax';
|
||||
import _ from 'lodash';
|
||||
import { pgAlertify } from 'sources/helpers/legacyConnector';
|
||||
import { isEmptyString } from 'sources/validators';
|
||||
import Notify from '../../../../../../../../../static/js/helpers/Notifier';
|
||||
|
||||
export function getColumnSchema(nodeObj, treeNodeInfo, itemNodeData) {
|
||||
return new ColumnSchema(
|
||||
@ -296,7 +296,7 @@ export default class IndexSchema extends BaseUISchema {
|
||||
};
|
||||
if(state.amname != actionObj.oldState.amname) {
|
||||
return new Promise((resolve)=>{
|
||||
pgAlertify().confirm(
|
||||
Notify.confirm(
|
||||
gettext('Changing access method will clear columns collection'),
|
||||
function () {
|
||||
setColumns(resolve);
|
||||
|
@ -194,7 +194,7 @@ function(
|
||||
if (!d)
|
||||
return false;
|
||||
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Truncate Table'),
|
||||
gettext('Are you sure you want to truncate table %s?', d.label),
|
||||
function (e) {
|
||||
@ -238,7 +238,7 @@ function(
|
||||
if (!d)
|
||||
return false;
|
||||
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Reset statistics'),
|
||||
gettext('Are you sure you want to reset the statistics for table "%s"?', d._label),
|
||||
function (e) {
|
||||
@ -282,7 +282,7 @@ function(
|
||||
if (!d)
|
||||
return false;
|
||||
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Detach Partition'),
|
||||
gettext('Are you sure you want to detach the partition %s?', d._label),
|
||||
function (e) {
|
||||
|
@ -180,7 +180,7 @@ define('pgadmin.node.table', [
|
||||
if (!d)
|
||||
return false;
|
||||
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Truncate Table'),
|
||||
gettext('Are you sure you want to truncate table %s?', d.label),
|
||||
function (e) {
|
||||
@ -228,7 +228,7 @@ define('pgadmin.node.table', [
|
||||
if (!d)
|
||||
return false;
|
||||
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Reset statistics'),
|
||||
gettext('Are you sure you want to reset the statistics for table "%s"?', d._label),
|
||||
function (e) {
|
||||
|
@ -6,7 +6,6 @@ import { isEmptyString } from 'sources/validators';
|
||||
import PrimaryKeySchema from '../../constraints/index_constraint/static/js/primary_key.ui';
|
||||
import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../static/js/SchemaView';
|
||||
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 UniqueConstraintSchema from '../../constraints/index_constraint/static/js/unique_constraint.ui';
|
||||
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 { getNodeExclusionConstraintSchema } from '../../constraints/exclusion_constraint/static/js/exclusion_constraint.ui';
|
||||
import { getNodePrivilegeRoleSchema } from '../../../../../static/js/privilege.ui';
|
||||
import Notify from '../../../../../../../../static/js/helpers/Notifier';
|
||||
|
||||
export function getNodeTableSchema(treeNodeInfo, itemNodeData, pgBrowser) {
|
||||
const spcname = ()=>getNodeListByName('tablespace', treeNodeInfo, itemNodeData, {}, (m)=>{
|
||||
@ -598,7 +598,7 @@ export default class TableSchema extends BaseUISchema {
|
||||
group: 'advanced', min_version: 90600,
|
||||
depChange: (state)=>{
|
||||
if (state.rlspolicy && this.origData.rlspolicy != state.rlspolicy) {
|
||||
pgAlertify().alert(
|
||||
Notify.alert(
|
||||
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')
|
||||
);
|
||||
@ -730,7 +730,7 @@ export default class TableSchema extends BaseUISchema {
|
||||
};
|
||||
if(!isEmptyString(state.typname) && isEmptyString(actionObj.oldState.typname)) {
|
||||
return new Promise((resolve)=>{
|
||||
pgAlertify().confirm(
|
||||
Notify.confirm(
|
||||
gettext('Remove column definitions?'),
|
||||
gettext('Changing \'Of type\' will remove column definitions.'),
|
||||
function () {
|
||||
|
@ -256,7 +256,7 @@ define('pgadmin.node.mview', [
|
||||
if (pgBrowser.tree.hasParent(j)) {
|
||||
j = pgBrowser.tree.parent(j);
|
||||
} else {
|
||||
Alertify.alert(gettext('Please select server or child node from tree.'));
|
||||
Notify.alert(gettext('Please select server or child node from tree.'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -275,7 +275,7 @@ define('pgadmin.node.mview', [
|
||||
dataType: 'json',
|
||||
}).done(function(res) {
|
||||
if (!res.success) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
res.errormsg
|
||||
);
|
||||
@ -294,7 +294,7 @@ define('pgadmin.node.mview', [
|
||||
Notify.success(refreshed_res.data.info);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', obj);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Failed to create materialized view refresh job.'),
|
||||
refreshed_res.errormsg
|
||||
);
|
||||
@ -306,7 +306,7 @@ define('pgadmin.node.mview', [
|
||||
);
|
||||
});
|
||||
}).fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
gettext('Failed to fetch Utility information')
|
||||
);
|
||||
|
@ -176,7 +176,7 @@ define('pgadmin.node.database', [
|
||||
connect(self, d, t, i, true);
|
||||
return;
|
||||
}
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Connection lost'),
|
||||
gettext('Would you like to reconnect to the database?'),
|
||||
function() {
|
||||
@ -218,7 +218,7 @@ define('pgadmin.node.database', [
|
||||
d = i ? t.itemData(i) : undefined;
|
||||
|
||||
if (d) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Disconnect the database'),
|
||||
gettext('Are you sure you want to disconnect the database - %s?', d.label),
|
||||
function() {
|
||||
|
@ -9,8 +9,8 @@
|
||||
import { getNodeListByName } from '../../../../../../static/js/node_ajax';
|
||||
import SubscriptionSchema from './subscription.ui';
|
||||
import getApiInstance from '../../../../../../../static/js/api_instance';
|
||||
import { pgAlertify } from '../../../../../../../../pgadmin/static/js/helpers/legacyConnector';
|
||||
import _ from 'lodash';
|
||||
import Notify from '../../../../../../../static/js/helpers/Notifier';
|
||||
|
||||
define('pgadmin.node.subscription', [
|
||||
'sources/gettext', 'sources/url_for', 'jquery',
|
||||
@ -195,12 +195,12 @@ define('pgadmin.node.subscription', [
|
||||
.then(res=>{
|
||||
if ((res.data.errormsg === '') && !_.isNull(res.data.data)){
|
||||
resolve(res.data.data);
|
||||
pgAlertify().info(
|
||||
Notify.info(
|
||||
gettext('Publication fetched successfully.')
|
||||
);
|
||||
}else if(!_.isNull(res.data.errormsg) && _.isNull(res.data.data)){
|
||||
reject(res.data.errormsg);
|
||||
pgAlertify().alert(
|
||||
Notify.alert(
|
||||
gettext('Check connection?'),
|
||||
gettext(res.data.errormsg)
|
||||
);
|
||||
|
@ -535,7 +535,7 @@ define('pgadmin.node.role', [
|
||||
roleOp = roleReassignData.role_op,
|
||||
confirmBoxTitle = utils.titleize(roleOp);
|
||||
|
||||
alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('%s Objects', confirmBoxTitle),
|
||||
gettext('Are you sure you wish to %s all the objects owned by the selected role?', roleOp),
|
||||
function() {
|
||||
@ -548,7 +548,7 @@ define('pgadmin.node.role', [
|
||||
}).catch(function (error) {
|
||||
try {
|
||||
const err = error.response.data;
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Role reassign/drop failed.'),
|
||||
err.errormsg
|
||||
);
|
||||
|
@ -284,15 +284,12 @@ define('pgadmin.node.server', [
|
||||
};
|
||||
|
||||
if (notify) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Disconnect server'),
|
||||
gettext('Are you sure you want to disconnect the server %s?', d.label),
|
||||
function() { disconnect(); },
|
||||
function() { return true;}
|
||||
).set('labels', {
|
||||
ok: gettext('OK'),
|
||||
cancel: gettext('Cancel'),
|
||||
});
|
||||
function() { return true;},
|
||||
);
|
||||
} else {
|
||||
disconnect();
|
||||
}
|
||||
@ -337,7 +334,7 @@ define('pgadmin.node.server', [
|
||||
d = i ? t.itemData(i) : undefined;
|
||||
|
||||
if (d) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Reload server configuration'),
|
||||
gettext('Are you sure you want to reload the server configuration on %s?', d.label),
|
||||
function() {
|
||||
@ -358,7 +355,7 @@ define('pgadmin.node.server', [
|
||||
t.unload(i);
|
||||
});
|
||||
},
|
||||
function() { return true; }
|
||||
function() { return true; },
|
||||
);
|
||||
}
|
||||
|
||||
@ -545,7 +542,7 @@ define('pgadmin.node.server', [
|
||||
if (res.success) {
|
||||
// Notify user to update pgpass file
|
||||
if(is_pgpass_file_used) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Change Password'),
|
||||
gettext('Please make sure to disconnect the server'
|
||||
+ ' and update the new password in the pgpass file'
|
||||
@ -666,7 +663,7 @@ define('pgadmin.node.server', [
|
||||
d = i ? t.itemData(i) : undefined;
|
||||
|
||||
if (d) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Clear saved password'),
|
||||
gettext('Are you sure you want to clear the saved password for server %s?', d.label),
|
||||
function() {
|
||||
@ -703,7 +700,7 @@ define('pgadmin.node.server', [
|
||||
d = i ? t.itemData(i) : undefined;
|
||||
|
||||
if (d) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Clear SSH Tunnel password'),
|
||||
gettext('Are you sure you want to clear the saved password of SSH Tunnel for server %s?', d.label),
|
||||
function() {
|
||||
@ -790,7 +787,7 @@ define('pgadmin.node.server', [
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin:server:connect:cancelled', disconnect
|
||||
);
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Connection lost'),
|
||||
gettext('Would you like to reconnect to the database?'),
|
||||
function() {
|
||||
|
@ -288,7 +288,7 @@ define('pgadmin.node.tablespace', [
|
||||
btn_args = this.view.model.toJSON();
|
||||
btn_args.old_tblspc = d.label;
|
||||
e.cancel = true;
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Move objects...'),
|
||||
gettext(
|
||||
'Are you sure you wish to move the objects from %s to %s?',
|
||||
|
@ -545,24 +545,20 @@ define('pgadmin.browser', [
|
||||
}).done((res)=> {
|
||||
if(res.data.length > 0) {
|
||||
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
'Warning',
|
||||
'pgAdmin detected unrecoverable corruption in it\'s SQLite configuration database. ' +
|
||||
'The database has been backed up and recreated with default settings. '+
|
||||
'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.'+
|
||||
'<br><br>Original file: ' + res.data + '<br>Replacement file: ' +
|
||||
res.data.substring(0, res.data.length - 14)
|
||||
)
|
||||
.set({'closable': true,
|
||||
'onok': function() {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
res.data.substring(0, res.data.length - 14),
|
||||
function() {
|
||||
}
|
||||
);
|
||||
}
|
||||
}).fail(function(xhr, status, error) {
|
||||
Alertify.alert(error);
|
||||
Notify.alert(error);
|
||||
});
|
||||
},
|
||||
init_master_password: function() {
|
||||
@ -632,7 +628,7 @@ define('pgadmin.browser', [
|
||||
/* Reset Button */
|
||||
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 '
|
||||
+ 'the server and you may need to reconnect again. Do you wish to continue?'),
|
||||
function() {
|
||||
@ -642,10 +638,7 @@ define('pgadmin.browser', [
|
||||
return true;
|
||||
},
|
||||
function() {/* If user clicks No */ return true;}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
});
|
||||
);
|
||||
} else if(event.index == 0) {
|
||||
/* help Button */
|
||||
event.cancel = true;
|
||||
|
@ -399,7 +399,7 @@ define([
|
||||
}
|
||||
|
||||
if (sel_rows.length === 0) {
|
||||
Alertify.alert(gettext('Drop Multiple'),
|
||||
Notify.alert(gettext('Drop Multiple'),
|
||||
gettext('Please select at least one object to delete.')
|
||||
);
|
||||
return;
|
||||
@ -463,7 +463,7 @@ define([
|
||||
};
|
||||
|
||||
if(confirm) {
|
||||
Alertify.confirm(title, msg, dropAjaxHook, null).show();
|
||||
Notify.confirm(title, msg, dropAjaxHook, null);
|
||||
} else {
|
||||
dropAjaxHook();
|
||||
}
|
||||
|
@ -7,9 +7,11 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import Notify from '../../../static/js/helpers/Notifier';
|
||||
|
||||
define(
|
||||
['sources/gettext', 'underscore', 'alertify', 'sources/pgadmin'],
|
||||
function(gettext, _, alertify, pgAdmin) {
|
||||
['sources/gettext', 'underscore', 'sources/pgadmin'],
|
||||
function(gettext, _, pgAdmin) {
|
||||
pgAdmin.Browser = pgAdmin.Browser || {};
|
||||
|
||||
_.extend(pgAdmin.Browser, {
|
||||
@ -44,7 +46,7 @@ define(
|
||||
}
|
||||
|
||||
text += '</div>';
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
title,
|
||||
text
|
||||
)
|
||||
|
@ -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"?');
|
||||
}
|
||||
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Edit in progress?'),
|
||||
commonUtils.sprintf(msg, o.label.toLowerCase(), d.label),
|
||||
function() {
|
||||
@ -898,7 +898,7 @@ define('pgadmin.browser.node', [
|
||||
return;
|
||||
}
|
||||
}
|
||||
Alertify.confirm(title, msg,
|
||||
Notify.confirm(title, msg,
|
||||
function() {
|
||||
$.ajax({
|
||||
url: obj.generate_url(i, input.url, d, true),
|
||||
@ -939,12 +939,8 @@ define('pgadmin.browser.node', [
|
||||
pgBrowser.report_error(
|
||||
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
|
||||
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;
|
||||
if (confirm_on_properties_close && confirm_close && objview && objview.model) {
|
||||
if(objview.model.sessChanged()){
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Warning'),
|
||||
warn_text,
|
||||
function() {
|
||||
@ -1399,10 +1395,7 @@ define('pgadmin.browser.node', [
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
}).show();
|
||||
);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -1421,7 +1414,7 @@ define('pgadmin.browser.node', [
|
||||
let warn_text;
|
||||
warn_text = gettext(objview.model.warn_text);
|
||||
if(objview.model.sessChanged()){
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Warning'),
|
||||
warn_text,
|
||||
function() {
|
||||
@ -1433,10 +1426,7 @@ define('pgadmin.browser.node', [
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
}).show();
|
||||
);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -1451,7 +1441,7 @@ define('pgadmin.browser.node', [
|
||||
objview = $props && $props.data('obj-view');
|
||||
|
||||
if (objview && objview.model && !_.isUndefined(objview.model.inform_text) && !_.isNull(objview.model.inform_text)) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Warning'),
|
||||
gettext(objview.model.inform_text)
|
||||
);
|
||||
|
@ -15,7 +15,8 @@ import getApiInstance from 'sources/api_instance';
|
||||
import {getHelpUrl, getEPASHelpUrl} from 'pgadmin.help';
|
||||
import SchemaView from 'sources/SchemaView';
|
||||
import { generateNodeUrl } from './node_ajax';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import Notify from '../../../static/js/helpers/Notifier';
|
||||
|
||||
import gettext from 'sources/gettext';
|
||||
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;
|
||||
if (warnOnCloseFlag && confirmOnClose) {
|
||||
if(isDirty){
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Warning'),
|
||||
gettext('Changes will be lost. Are you sure you want to close the dialog?'),
|
||||
function() {
|
||||
@ -135,10 +136,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
}).show();
|
||||
);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ define('pgadmin.dashboard', [
|
||||
action_url = terminate_session_url + self.model.get('pid');
|
||||
}
|
||||
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
title, txtConfirm,
|
||||
function() {
|
||||
$.ajax({
|
||||
|
@ -647,16 +647,15 @@ SELECT 1, pg_sleep(300)"""
|
||||
(By.CSS_SELECTOR, "td.channel"), "foo")
|
||||
)
|
||||
print("OK.", file=sys.stderr)
|
||||
self.page.clear_query_tool()
|
||||
|
||||
print("\tNotify event with data... ", file=sys.stderr, end="")
|
||||
if self._supported_server_version():
|
||||
self.page.clear_query_tool()
|
||||
self.page.execute_query("SELECT pg_notify('foo', 'Hello')")
|
||||
self.page.click_tab('Notifications')
|
||||
self.wait.until(WaitForAnyElementWithText(
|
||||
(By.CSS_SELECTOR, 'td.payload'), "Hello"))
|
||||
print("OK.", file=sys.stderr)
|
||||
self.page.clear_query_tool()
|
||||
else:
|
||||
print("Skipped.", file=sys.stderr)
|
||||
|
||||
@ -724,8 +723,6 @@ SELECT 1, pg_sleep(300)"""
|
||||
# Search for 'Output' word in result (verbose option)
|
||||
canvas.find_element(By.XPATH, "//*[contains(string(), 'JIT')]")
|
||||
|
||||
self.page.clear_query_tool()
|
||||
|
||||
|
||||
class WaitForAnyElementWithText(object):
|
||||
def __init__(self, locator, text):
|
||||
|
@ -78,9 +78,8 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
|
||||
try:
|
||||
wait = WebDriverWait(self.page.driver, 2)
|
||||
is_error = wait.until(EC.presence_of_element_located(
|
||||
(By.XPATH, "//div[contains(@class, 'alertify') and "
|
||||
"not(contains(@class, 'ajs-hidden'))]//div["
|
||||
"contains(@class,'ajs-header')]")
|
||||
(By.XPATH, "//div[@class ='MuiDialogTitle-root']"
|
||||
"//div[text()='Debugger Error']")
|
||||
))
|
||||
|
||||
except TimeoutException:
|
||||
@ -91,11 +90,10 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
|
||||
click = True
|
||||
while click:
|
||||
try:
|
||||
self.page.click_modal('OK')
|
||||
self.page.click_modal('OK', True)
|
||||
wait.until(EC.invisibility_of_element(
|
||||
(By.XPATH, "//div[contains(@class, 'alertify') and "
|
||||
"not(contains(@class, 'ajs-hidden'))]//div["
|
||||
"contains(@class,'ajs-header')]")
|
||||
(By.XPATH, "//div[@class ='MuiDialogTitle-root']"
|
||||
"//div[text()='Debugger Error']")
|
||||
))
|
||||
click = False
|
||||
except TimeoutException:
|
||||
|
@ -7,6 +7,8 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import Notify from '../../../static/js/helpers/Notifier';
|
||||
|
||||
define('pgadmin.preferences', [
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone',
|
||||
'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.backform',
|
||||
@ -568,7 +570,7 @@ define('pgadmin.preferences', [
|
||||
}
|
||||
|
||||
if(pref.name == 'hide_shared_server') {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Browser tree refresh required'),
|
||||
gettext('A browser tree refresh is required. Do you wish to refresh the tree?'),
|
||||
function() {
|
||||
@ -583,16 +585,15 @@ define('pgadmin.preferences', [
|
||||
preferences.reset();
|
||||
changed = {};
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Refresh'),
|
||||
cancel: gettext('Later'),
|
||||
});
|
||||
},
|
||||
gettext('Refresh'),
|
||||
gettext('Later')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if(requires_refresh) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Refresh required'),
|
||||
gettext('A page refresh is required to apply the theme. Do you wish to refresh the page now?'),
|
||||
function() {
|
||||
@ -600,11 +601,10 @@ define('pgadmin.preferences', [
|
||||
location.reload();
|
||||
return true;
|
||||
},
|
||||
function() {/* If user clicks No */ return true;}
|
||||
).set('labels', {
|
||||
ok: gettext('Refresh'),
|
||||
cancel: gettext('Later'),
|
||||
});
|
||||
function() {/* If user clicks No */ return true;},
|
||||
gettext('Refresh'),
|
||||
gettext('Later')
|
||||
);
|
||||
}
|
||||
// Refresh preferences cache
|
||||
pgBrowser.cache_preferences(modulesChanged);
|
||||
|
@ -7,10 +7,12 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import Notify from '../../../static/js/helpers/Notifier';
|
||||
|
||||
define('pgadmin.settings', [
|
||||
'jquery', 'pgadmin.alertifyjs', 'sources/pgadmin',
|
||||
'jquery', 'sources/pgadmin',
|
||||
'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.
|
||||
pgAdmin = pgAdmin || window.pgAdmin || {};
|
||||
@ -32,7 +34,7 @@ define('pgadmin.settings', [
|
||||
// We will force unload method to not to save current layout
|
||||
// and reload the window
|
||||
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.'),
|
||||
function() {
|
||||
var reloadingIndicator = $('<div id="reloading-indicator"></div>');
|
||||
|
@ -29,7 +29,6 @@ import { MappedFormControl } from './MappedControl';
|
||||
import gettext from 'sources/gettext';
|
||||
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
||||
import FormView, { getFieldMetaData } from './FormView';
|
||||
import { pgAlertify } from '../helpers/legacyConnector';
|
||||
import PropTypes from 'prop-types';
|
||||
import CustomPropTypes from '../custom_prop_types';
|
||||
import { parseApiError } from '../api_instance';
|
||||
@ -37,6 +36,7 @@ import DepListener, {DepListenerContext} from './DepListener';
|
||||
import FieldSetView from './FieldSetView';
|
||||
import DataGridView from './DataGridView';
|
||||
import { useIsMounted } from '../custom_hooks';
|
||||
import Notify from '../helpers/Notifier';
|
||||
|
||||
const useDialogStyles = makeStyles((theme)=>({
|
||||
root: {
|
||||
@ -514,6 +514,14 @@ function SchemaDialogView({
|
||||
});
|
||||
setFormReady(true);
|
||||
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 {
|
||||
/* Use the defaults as the initital data */
|
||||
@ -552,17 +560,14 @@ function SchemaDialogView({
|
||||
};
|
||||
/* Confirm before reset */
|
||||
if(props.confirmOnCloseReset) {
|
||||
pgAlertify().confirm(
|
||||
Notify.confirm(
|
||||
gettext('Warning'),
|
||||
gettext('Changes will be lost. Are you sure you want to reset?'),
|
||||
resetIt,
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
}).show();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
resetIt();
|
||||
}
|
||||
@ -582,7 +587,7 @@ function SchemaDialogView({
|
||||
changeData[schema.idAttribute] = schema.origData[schema.idAttribute];
|
||||
}
|
||||
if (schema.warningText) {
|
||||
pgAlertify().confirm(
|
||||
Notify.confirm(
|
||||
gettext('Warning'),
|
||||
schema.warningText,
|
||||
()=> {
|
||||
@ -592,7 +597,7 @@ function SchemaDialogView({
|
||||
setSaving(false);
|
||||
setLoaderText('');
|
||||
return true;
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
save(changeData);
|
||||
@ -603,7 +608,7 @@ function SchemaDialogView({
|
||||
props.onSave(isNew, changeData)
|
||||
.then(()=>{
|
||||
if(schema.informText) {
|
||||
pgAlertify().alert(
|
||||
Notify.alert(
|
||||
gettext('Warning'),
|
||||
schema.informText,
|
||||
);
|
||||
@ -791,6 +796,14 @@ function SchemaPropertiesView({
|
||||
setOrigData(data || {});
|
||||
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]);
|
||||
|
||||
|
@ -453,7 +453,7 @@ define([
|
||||
);
|
||||
}
|
||||
} 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() {
|
||||
return true;
|
||||
});
|
||||
@ -528,7 +528,7 @@ define([
|
||||
this.column.get('customDeleteMsg') : that.defaults.defaultDeleteMsg;
|
||||
var delete_title = !_.isUndefined(this.column.get('customDeleteTitle')) ?
|
||||
this.column.get('customDeleteTitle') : that.defaults.defaultDeleteTitle;
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
delete_title,
|
||||
delete_msg,
|
||||
function() {
|
||||
@ -548,7 +548,7 @@ define([
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Alertify.alert(gettext('Delete object'), gettext('This object cannot be deleted.'),
|
||||
Notify.alert(gettext('Delete object'), gettext('This object cannot be deleted.'),
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
@ -630,7 +630,7 @@ define([
|
||||
this.column.get('customClearMsg') : that.defaults.defaultClearMsg;
|
||||
var clear_title = !_.isUndefined(this.column.get('customClearTitle')) ?
|
||||
this.column.get('customClearTitle') : that.defaults.defaultClearTitle;
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
clear_title,
|
||||
clear_msg,
|
||||
function() {
|
||||
@ -2413,7 +2413,7 @@ define([
|
||||
val = this.formatter.toRaw(this.$input.prop('value'), model);
|
||||
|
||||
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({
|
||||
@ -2425,7 +2425,7 @@ define([
|
||||
}),
|
||||
})
|
||||
.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) {
|
||||
Notify.pgNotifier(error, xhr, gettext('Failed to validate binary path.'));
|
||||
|
@ -15,6 +15,7 @@ import Draggable from 'react-draggable';
|
||||
import CloseIcon from '@material-ui/icons/CloseRounded';
|
||||
import CustomPropTypes from '../custom_prop_types';
|
||||
import PropTypes from 'prop-types';
|
||||
import gettext from 'sources/gettext';
|
||||
|
||||
const ModalContext = React.createContext({});
|
||||
|
||||
@ -77,7 +78,7 @@ function ModalContainer({id, title, content}) {
|
||||
>
|
||||
<DialogTitle>
|
||||
<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>
|
||||
<DialogContent>
|
||||
{content(closeModal)}
|
||||
@ -88,5 +89,5 @@ function ModalContainer({id, title, content}) {
|
||||
ModalContainer.propTypes = {
|
||||
id: PropTypes.string,
|
||||
title: CustomPropTypes.children,
|
||||
content: CustomPropTypes.children,
|
||||
content: PropTypes.func,
|
||||
};
|
||||
|
@ -15,7 +15,6 @@ import { NotifierMessage, MESSAGE_TYPE } from '../components/FormComponents';
|
||||
import CustomPropTypes from '../custom_prop_types';
|
||||
import gettext from 'sources/gettext';
|
||||
import pgWindow from 'sources/window';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import ModalProvider, { useModal } from './ModalProvider';
|
||||
import { DefaultButton, PrimaryButton } from '../components/Buttons';
|
||||
import { Box } from '@material-ui/core';
|
||||
@ -35,6 +34,12 @@ export function initializeNotifier(notifierContainer) {
|
||||
snackbarRef = useSnackbar();
|
||||
return <></>;
|
||||
};
|
||||
|
||||
if (!notifierContainer) {
|
||||
notifierContainer = document.createElement('div');
|
||||
document.body.appendChild(notifierContainer);
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<SnackbarProvider
|
||||
@ -54,6 +59,12 @@ export function initializeModalProvider(modalContainer) {
|
||||
modalRef = useModal();
|
||||
return <></>;
|
||||
};
|
||||
|
||||
if (!modalContainer) {
|
||||
modalContainer = document.createElement('div');
|
||||
document.body.appendChild(modalContainer);
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<ModalProvider>
|
||||
@ -82,16 +93,16 @@ const useAlertStyles = makeStyles((theme)=>({
|
||||
marginLeft: '0.25rem',
|
||||
}
|
||||
}));
|
||||
function AlertContent({text, confirm, onOkClick, onCancelClick}) {
|
||||
function AlertContent({text, confirm, okLabel=gettext('OK'), cancelLabel=gettext('Cancel'), onOkClick, onCancelClick}) {
|
||||
const classes = useAlertStyles();
|
||||
return (
|
||||
<Box display="flex" flexDirection="column" height="100%">
|
||||
<Box flexGrow="1" p={2}>{HTMLReactParse(text)}</Box>
|
||||
<Box className={classes.footer}>
|
||||
<DefaultButton startIcon={<CloseIcon />} onClick={onCancelClick} autoFocus={!confirm}>Close</DefaultButton>
|
||||
{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>
|
||||
);
|
||||
@ -101,6 +112,8 @@ AlertContent.propTypes = {
|
||||
confirm: PropTypes.bool,
|
||||
onOkClick: PropTypes.func,
|
||||
onCancelClick: PropTypes.func,
|
||||
okLabel: PropTypes.string,
|
||||
cancelLabel: PropTypes.string,
|
||||
};
|
||||
|
||||
var Notifier = {
|
||||
@ -194,54 +207,33 @@ var Notifier = {
|
||||
msg = _.escape(resp.result) || _.escape(resp.errormsg) || 'Unknown error';
|
||||
}
|
||||
if (contentType.indexOf('text/html') == 0) {
|
||||
var alertMessage = promptmsg;
|
||||
if (type === 'error') {
|
||||
alertMessage =
|
||||
'<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>';
|
||||
this.alert('Error', promptmsg);
|
||||
}
|
||||
|
||||
Alertify.notify(
|
||||
alertMessage, type, 0,
|
||||
function() {
|
||||
Alertify.pgIframeDialog().show().set({
|
||||
frameless: false,
|
||||
}).set(
|
||||
'pg_msg', msg
|
||||
);
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
Alertify.alert().show().set('message', e.message).set(
|
||||
'title', 'Error'
|
||||
).set('closable', true);
|
||||
this.alert('Error', e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Alertify.alert().show().set(
|
||||
'message', msg.replace(new RegExp(/\r?\n/, 'g'), '<br />')
|
||||
).set('title', promptmsg).set('closable', true);
|
||||
this.alert(promptmsg, msg.replace(new RegExp(/\r?\n/, 'g'), '<br />'));
|
||||
},
|
||||
alert: (title, text, onCancelClick)=>{
|
||||
alert: (title, text, okLabel=gettext('OK'), onOkClick)=>{
|
||||
if(!modalInitialized) {
|
||||
initializeModalProvider(document.getElementById('modalContainer'));
|
||||
}
|
||||
modalRef.showModal(title, (closeModal)=>{
|
||||
const onCancelClickClose = ()=>{
|
||||
onCancelClick && onCancelClick();
|
||||
const onOkClickClose = ()=>{
|
||||
onOkClick && onOkClick();
|
||||
closeModal();
|
||||
};
|
||||
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) {
|
||||
initializeModalProvider(document.getElementById('modalContainer'));
|
||||
}
|
||||
@ -255,14 +247,14 @@ var Notifier = {
|
||||
closeModal();
|
||||
};
|
||||
return (
|
||||
<AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} />
|
||||
<AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} okLabel={okLabel} cancelLabel={cancelLabel}/>
|
||||
);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
if(window.frameElement) {
|
||||
Notifier = pgWindow.Notifier;
|
||||
Notifier = pgWindow.Notifier || Notifier;
|
||||
} else {
|
||||
pgWindow.Notifier = Notifier;
|
||||
}
|
||||
|
@ -12,12 +12,12 @@
|
||||
* These functions may not be needed once all are migrated
|
||||
*/
|
||||
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import gettext from 'sources/gettext';
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import Notify from './Notifier';
|
||||
|
||||
export function confirmDeleteRow(onOK, onCancel, title, message) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
title || gettext('Delete Row'),
|
||||
message || gettext('Are you sure you wish to delete this row?'),
|
||||
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 */
|
||||
export function showFileDialog(dialogParams, onFileSelect) {
|
||||
let params = {
|
||||
|
@ -7,7 +7,9 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
define(['sources/gettext', 'alertify'], function (gettext, alertify) {
|
||||
import Notify from '../helpers/Notifier';
|
||||
|
||||
define(['sources/gettext'], function (gettext) {
|
||||
var clipboard = {
|
||||
copyTextToClipboard: function (text) {
|
||||
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.
|
||||
document.execCommand('copy');
|
||||
} catch (err) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
gettext('Oops, unable to copy to clipboard'));
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ let FilterDialog = {
|
||||
}, 10
|
||||
);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Validation Error'),
|
||||
filterResponse.result
|
||||
);
|
||||
|
@ -308,7 +308,7 @@ let MacroDialog = {
|
||||
}, 10
|
||||
);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Validation Error'),
|
||||
macroResponse.result
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ import Backgrid from 'pgadmin.backgrid';
|
||||
import url_for from 'sources/url_for';
|
||||
import $ from 'jquery';
|
||||
import _ from 'underscore';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import Notify from '../helpers/Notifier';
|
||||
|
||||
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);
|
||||
|
||||
if (macros.length > 0) {
|
||||
Alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Clear All Rows'),
|
||||
gettext('Are you sure you wish to clear all rows?'),
|
||||
function() {
|
||||
|
@ -272,7 +272,7 @@ let NewConnectionDialog = {
|
||||
Alertify.newConnectionDialog('Connect to server.').resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
|
||||
}, 500);
|
||||
}).fail(function() {
|
||||
Alertify.alert().setting({
|
||||
Notify.alert().setting({
|
||||
'title': gettext('Connection lost'),
|
||||
'label':gettext('OK'),
|
||||
'message': gettext('Connection to the server has been lost.'),
|
||||
|
@ -8,8 +8,9 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 aciTreeItem = item || pgBrowser.tree.selected();
|
||||
let treeNode = pgBrowser.tree.findNodeByDomElement(aciTreeItem);
|
||||
@ -30,7 +31,7 @@ export function retrieveAncestorOfTypeServer(pgBrowser, item, errorAlertTitle, a
|
||||
|
||||
if (databaseNode !== null) {
|
||||
if (nodeData._label.indexOf('=') >= 0) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext(errorAlertTitle),
|
||||
gettext(
|
||||
'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) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext(errorAlertTitle),
|
||||
gettext('Please select server or child node from the browser tree.')
|
||||
);
|
||||
@ -56,7 +57,7 @@ export function retrieveAncestorOfTypeServer(pgBrowser, item, errorAlertTitle, a
|
||||
return serverInformation;
|
||||
}
|
||||
|
||||
export function retrieveAncestorOfTypeDatabase(pgBrowser, item, errorAlertTitle, alertify) {
|
||||
export function retrieveAncestorOfTypeDatabase(pgBrowser, item, errorAlertTitle) {
|
||||
let databaseInfo = null;
|
||||
let aciTreeItem = item || pgBrowser.tree.selected();
|
||||
let treeNode = pgBrowser.tree.findNodeByDomElement(aciTreeItem);
|
||||
@ -79,7 +80,7 @@ export function retrieveAncestorOfTypeDatabase(pgBrowser, item, errorAlertTitle,
|
||||
}
|
||||
|
||||
if (databaseInfo === null) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext(errorAlertTitle),
|
||||
gettext('Please select a database or its child node from the browser.')
|
||||
);
|
||||
|
@ -11,6 +11,7 @@ import _ from 'underscore';
|
||||
import $ from 'jquery';
|
||||
import gettext from 'sources/gettext';
|
||||
import 'wcdocker';
|
||||
import Notify from './helpers/Notifier';
|
||||
|
||||
var wcDocker = window.wcDocker;
|
||||
|
||||
@ -363,7 +364,7 @@ export function CSVToArray( strData, strDelimiter, quoteChar){
|
||||
return arrData;
|
||||
}
|
||||
|
||||
export function hasBinariesConfiguration(pgBrowser, serverInformation, alertify) {
|
||||
export function hasBinariesConfiguration(pgBrowser, serverInformation) {
|
||||
const module = 'paths';
|
||||
let preference_name = 'pg_bin_dir';
|
||||
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 (_.isUndefined(preference.value) || !checkBinaryPathExists(preference.value, serverInformation.version)) {
|
||||
alertify.alert(gettext('Configuration required'), msg);
|
||||
Notify.alert(gettext('Configuration required'), msg);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Preferences Error'),
|
||||
gettext('Failed to load preference %s of module %s', preference_name, module)
|
||||
);
|
||||
|
@ -10,15 +10,17 @@ import {getUtilityView, removeNodeView} from '../../../../browser/static/js/util
|
||||
import { getNodeListByName, getNodeAjaxOptions } from '../../../../browser/static/js/node_ajax';
|
||||
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema} from './backup.ui';
|
||||
import BackupGlobalSchema, {getMiscellaneousSchema as getMiscellaneousGlobalSchema} from './backupGlobal.ui';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
// Backup dialog
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'sources/pgadmin',
|
||||
'pgadmin.alertifyjs', 'backbone', 'pgadmin.backgrid',
|
||||
'backbone', 'pgadmin.backgrid',
|
||||
'pgadmin.backform', 'pgadmin.browser', 'sources/utils',
|
||||
'tools/backup/static/js/menu_utils',
|
||||
'sources/nodes/supported_database_node',
|
||||
], function(
|
||||
gettext, url_for, $, _, pgAdmin, alertify, Backbone, Backgrid, Backform, pgBrowser,
|
||||
gettext, url_for, $, _, pgAdmin, Backbone, Backgrid, Backform, pgBrowser,
|
||||
commonUtils, menuUtils, supportedNodes
|
||||
) {
|
||||
|
||||
@ -175,7 +177,7 @@ define([
|
||||
},
|
||||
saveCallBack: function(data, dialog) {
|
||||
if(data.errormsg) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
gettext(data.errormsg)
|
||||
);
|
||||
|
@ -228,7 +228,7 @@ define('pgadmin.datagrid', [
|
||||
if(d._type.includes('coll-')){
|
||||
url = '';
|
||||
}
|
||||
showQueryTool.showQueryTool(this, pgBrowser, alertify, url, aciTreeIdentifier, transId);
|
||||
showQueryTool.showQueryTool(this, pgBrowser, url, aciTreeIdentifier, transId);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import gettext from 'sources/gettext';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import pgWindow from 'sources/window';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
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
|
||||
*/
|
||||
export function refresh_db_node(message, dbNode) {
|
||||
Alertify.alert()
|
||||
Notify.alert()
|
||||
.setting({
|
||||
'title': gettext('Database moved/renamed'),
|
||||
'label':gettext('OK'),
|
||||
|
@ -13,6 +13,7 @@ import CodeMirror from 'bundled_codemirror';
|
||||
import * as SqlEditorUtils from 'sources/sqleditor_utils';
|
||||
import $ from 'jquery';
|
||||
import _ from 'underscore';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
export function showDataGrid(
|
||||
datagrid,
|
||||
@ -26,7 +27,7 @@ export function showDataGrid(
|
||||
) {
|
||||
const node = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier);
|
||||
if (node === undefined || !node.getData()) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Data Grid Error'),
|
||||
gettext('No object selected.')
|
||||
);
|
||||
@ -239,15 +240,13 @@ function initFilterDialog(alertify, pgBrowser) {
|
||||
that.close(); // Close the dialog
|
||||
}
|
||||
else {
|
||||
alertify.alert()
|
||||
.setting({
|
||||
'title': gettext('Validation Error'),
|
||||
'label':gettext('OK'),
|
||||
'message': gettext(res.data.result),
|
||||
'onok': function(){
|
||||
filter_editor.focus();
|
||||
},
|
||||
}).show();
|
||||
Notify.alert(
|
||||
gettext('Validation Error'),
|
||||
gettext(res.data.result),
|
||||
function(){
|
||||
filter_editor.focus();
|
||||
},
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function(e) {
|
||||
@ -255,7 +254,7 @@ function initFilterDialog(alertify, pgBrowser) {
|
||||
pgBrowser.report_error(gettext('Error filtering rows - %s.', e.statusText), e.responseJSON.errormsg);
|
||||
|
||||
} else {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Validation Error'),
|
||||
e
|
||||
);
|
||||
|
@ -12,6 +12,7 @@ import url_for from '../../../../static/js/url_for';
|
||||
import {getPanelTitle} from './datagrid_panel_title';
|
||||
import {getRandomInt} from 'sources/utils';
|
||||
import $ from 'jquery';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
function hasDatabaseInformation(parentData) {
|
||||
return parentData.database;
|
||||
@ -47,13 +48,13 @@ function generateTitle(pgBrowser, aciTreeIdentifier) {
|
||||
return baseTitle;
|
||||
}
|
||||
|
||||
export function showQueryTool(datagrid, pgBrowser, alertify, url, aciTreeIdentifier, transId) {
|
||||
export function showQueryTool(datagrid, pgBrowser, url, aciTreeIdentifier, transId) {
|
||||
const sURL = url || '';
|
||||
const queryToolTitle = generateTitle(pgBrowser, aciTreeIdentifier);
|
||||
|
||||
const currentNode = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier);
|
||||
if (currentNode === undefined) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Query Tool Error'),
|
||||
gettext('No object selected.')
|
||||
);
|
||||
@ -67,10 +68,10 @@ export function showQueryTool(datagrid, pgBrowser, alertify, url, aciTreeIdentif
|
||||
}
|
||||
|
||||
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 transId = getRandomInt(1, 9999999);
|
||||
|
||||
@ -84,10 +85,10 @@ export function generateScript(parentData, datagrid, alertify) {
|
||||
+`&server_type=${parentData.stype}`
|
||||
+`&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);
|
||||
parentData = {
|
||||
server_group: {
|
||||
@ -103,14 +104,14 @@ export function showERDSqlTool(parentData, erdSqlId, queryToolTitle, datagrid, a
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
if(!retVal) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Query tool launch error'),
|
||||
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.'
|
||||
|
@ -7,6 +7,8 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
|
||||
'alertify', 'sources/pgadmin', 'pgadmin.browser',
|
||||
@ -322,7 +324,7 @@ define([
|
||||
try {
|
||||
var err = JSON.parse(xhr.responseText);
|
||||
if (err.success == 0) {
|
||||
Alertify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
Notify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
@ -491,12 +493,12 @@ define([
|
||||
self.start_global_debugger();
|
||||
},
|
||||
function(error) {
|
||||
Alertify.alert(gettext('Debugger Error'), error);
|
||||
Notify.alert(gettext('Debugger Error'), error);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (err.success == 0) {
|
||||
Alertify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
Notify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -656,7 +658,7 @@ define([
|
||||
}
|
||||
})
|
||||
.fail(function(e) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Target Initialization Error'),
|
||||
e.responseJSON.errormsg
|
||||
);
|
||||
@ -667,7 +669,7 @@ define([
|
||||
try {
|
||||
var err = JSON.parse(xhr.responseText);
|
||||
if (err.success == 0) {
|
||||
Alertify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
Notify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
|
@ -7,6 +7,8 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone',
|
||||
'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.browser',
|
||||
@ -258,7 +260,7 @@ define([
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Unable to fetch the arguments from server')
|
||||
);
|
||||
@ -856,14 +858,14 @@ define([
|
||||
})
|
||||
.done(function() {})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Unable to set the arguments on the server')
|
||||
);
|
||||
});
|
||||
})
|
||||
.fail(function(er) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Target Initialization Error'),
|
||||
er.responseJSON.errormsg
|
||||
);
|
||||
@ -884,7 +886,7 @@ define([
|
||||
})
|
||||
.done(function() {})
|
||||
.fail(function(er) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Listener Startup Error'),
|
||||
er.responseJSON.errormsg
|
||||
);
|
||||
@ -906,7 +908,7 @@ define([
|
||||
})
|
||||
.done(function() {})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Unable to set the arguments on the server')
|
||||
);
|
||||
@ -968,7 +970,7 @@ define([
|
||||
);
|
||||
_self.prepare();
|
||||
}).fail(function(er) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Clear failed'),
|
||||
er.responseJSON.errormsg
|
||||
);
|
||||
|
@ -84,7 +84,7 @@ define([
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while setting debugging breakpoint.')
|
||||
);
|
||||
@ -144,14 +144,14 @@ define([
|
||||
if (res.data.status === 'Success') {
|
||||
result = res.data.result;
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while fetching breakpoint information.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while fetching breakpoint information.')
|
||||
);
|
||||
@ -206,14 +206,14 @@ define([
|
||||
// If status is Success then find the port number to attach the executer.
|
||||
self.execute_query(trans_id);
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while starting debugging session.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while starting debugging session.')
|
||||
);
|
||||
@ -250,14 +250,14 @@ define([
|
||||
self.poll_end_execution_result(trans_id);
|
||||
}
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing requested debugging information.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing requested debugging information.')
|
||||
);
|
||||
@ -292,14 +292,14 @@ define([
|
||||
pgTools.DirectDebug.debug_restarted = false;
|
||||
}
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while fetching variable information.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while fetching variable information.')
|
||||
);
|
||||
@ -326,14 +326,14 @@ define([
|
||||
self.AddStackInformation(res.data.result);
|
||||
self.GetLocalVariables(pgTools.DirectDebug.trans_id);
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while fetching stack information.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while fetching stack information.')
|
||||
);
|
||||
@ -436,14 +436,14 @@ define([
|
||||
self.poll_result(trans_id);
|
||||
}
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while polling result.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while polling result.')
|
||||
);
|
||||
@ -592,7 +592,7 @@ define([
|
||||
self.update_messages(res.data.status_message);
|
||||
}
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger poll end execution error'),
|
||||
res.data.result
|
||||
);
|
||||
@ -636,7 +636,7 @@ define([
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while polling result.')
|
||||
);
|
||||
@ -700,7 +700,7 @@ define([
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while polling result.')
|
||||
);
|
||||
@ -711,7 +711,7 @@ define([
|
||||
try {
|
||||
var err = JSON.parse(xhr.responseText);
|
||||
if (err.success == 0) {
|
||||
Alertify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
Notify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
@ -742,14 +742,14 @@ define([
|
||||
if (res.data.status) {
|
||||
self.poll_result(trans_id);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing continue in debugging session.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing continue in debugging session.')
|
||||
);
|
||||
@ -774,14 +774,14 @@ define([
|
||||
if (res.data.status) {
|
||||
self.poll_result(trans_id);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing step over in debugging session.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing step over in debugging session.')
|
||||
);
|
||||
@ -805,14 +805,14 @@ define([
|
||||
if (res.data.status) {
|
||||
self.poll_result(trans_id);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing step into in debugging session.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing step into in debugging session.')
|
||||
);
|
||||
@ -851,14 +851,14 @@ define([
|
||||
// is completed.
|
||||
Notify.success(res.info, 3000);
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing stop in debugging session.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while executing stop in debugging session.')
|
||||
);
|
||||
@ -911,14 +911,14 @@ define([
|
||||
|
||||
self.enable_toolbar_buttons();
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while toggling breakpoint.')
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while toggling breakpoint.')
|
||||
);
|
||||
@ -970,7 +970,7 @@ define([
|
||||
self.enable_toolbar_buttons();
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while clearing all breakpoint.')
|
||||
);
|
||||
@ -1325,7 +1325,7 @@ define([
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while depositing variable value.')
|
||||
);
|
||||
@ -1354,7 +1354,7 @@ define([
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while selecting frame.')
|
||||
);
|
||||
@ -1555,10 +1555,10 @@ define([
|
||||
try {
|
||||
var err = JSON.parse(xhr.responseText);
|
||||
if (err.success == 0) {
|
||||
Alertify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
Notify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
}
|
||||
} catch (e) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while starting debugging listener.')
|
||||
);
|
||||
@ -1583,10 +1583,10 @@ define([
|
||||
try {
|
||||
var err = JSON.parse(xhr.responseText);
|
||||
if (err.success == 0) {
|
||||
Alertify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
Notify.alert(gettext('Debugger Error'), err.errormsg);
|
||||
}
|
||||
} catch (e) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
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
|
||||
self.messages(trans_id);
|
||||
} else if (res.data.status === 'NotConnected') {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Not connected to server or connection with the server has been closed.'),
|
||||
res.data.result
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Debugger Error'),
|
||||
gettext('Error while fetching messages information.')
|
||||
);
|
||||
@ -1910,7 +1910,7 @@ define([
|
||||
|
||||
/* Register to log the activity */
|
||||
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);
|
||||
|
@ -7,9 +7,9 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import {getPanelTitle} from 'tools/datagrid/static/js/datagrid_panel_title';
|
||||
import {getRandomInt, registerDetachEvent} from 'sources/utils';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
|
||||
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
|
||||
showErdTool: function(data, aciTreeIdentifier, gen=false) {
|
||||
if (aciTreeIdentifier === undefined) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('ERD Error'),
|
||||
gettext('No object selected.')
|
||||
);
|
||||
@ -110,7 +110,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, pgBrowser
|
||||
const parentData = pgBrowser.tree.getTreeNodeHierarchy(aciTreeIdentifier);
|
||||
|
||||
if(_.isUndefined(parentData.database)) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('ERD Error'),
|
||||
gettext('Please select a database/database object.')
|
||||
);
|
||||
|
@ -27,6 +27,7 @@ import {showERDSqlTool} from 'tools/datagrid/static/js/show_query_tool';
|
||||
import 'wcdocker';
|
||||
import Theme from '../../../../../../static/js/Theme';
|
||||
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 */
|
||||
export class KeyboardShortcutAction extends Action {
|
||||
@ -179,17 +180,19 @@ export default class BodyWidget extends React.Component {
|
||||
}
|
||||
|
||||
handleAxiosCatch(err) {
|
||||
let alert = this.props.alertify.alert().set('title', gettext('Error'));
|
||||
if (err.response) {
|
||||
// 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);
|
||||
} else if (err.request) {
|
||||
// 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);
|
||||
} else {
|
||||
alert.set('message', err.message).show();
|
||||
Notify.alert(gettext('Error'), err.message);
|
||||
console.error('other error', err);
|
||||
}
|
||||
}
|
||||
@ -374,7 +377,7 @@ export default class BodyWidget extends React.Component {
|
||||
if(nodeDropData.objUrl && nodeDropData.nodeType === 'table') {
|
||||
let matchUrl = `/${this.props.params.sgid}/${this.props.params.sid}/${this.props.params.did}/`;
|
||||
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 {
|
||||
let dataPromise = new Promise((resolve, reject)=>{
|
||||
axios.get(nodeDropData.objUrl)
|
||||
@ -416,7 +419,7 @@ export default class BodyWidget extends React.Component {
|
||||
}
|
||||
|
||||
onDeleteNode() {
|
||||
this.props.alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Delete ?'),
|
||||
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 ?'),
|
||||
@ -513,7 +516,7 @@ export default class BodyWidget extends React.Component {
|
||||
'file_name': decodeURI(fileName),
|
||||
'file_content': JSON.stringify(this.diagram.serialize(this.props.pgAdmin.Browser.utils.app_version_int)),
|
||||
}).then(()=>{
|
||||
this.props.alertify.success(gettext('Project saved successfully.'));
|
||||
Notify.success(gettext('Project saved successfully.'));
|
||||
this.setState({
|
||||
current_file: fileName,
|
||||
dirty: false,
|
||||
@ -674,9 +677,7 @@ export default class BodyWidget extends React.Component {
|
||||
if(err.name) {
|
||||
msg = `${err.name}: ${err.message}`;
|
||||
}
|
||||
this.props.alertify.alert()
|
||||
.set('title', gettext('Error'))
|
||||
.set('message', msg).show();
|
||||
Notify.alert(gettext('Error'), msg);
|
||||
}).then(()=>{
|
||||
/* Revert back to the original CSS styles */
|
||||
this.canvasEle.classList.remove('html2canvas-reset');
|
||||
|
@ -437,7 +437,7 @@ define([
|
||||
if (pgBrowser.tree.hasParent(i)) {
|
||||
i = pgBrowser.tree.parent(i);
|
||||
} else {
|
||||
Alertify.alert(gettext('Please select server or child node from tree.'));
|
||||
Notify.alert(gettext('Please select server or child node from tree.'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -533,7 +533,7 @@ define([
|
||||
Notify.success(gettext('Import/Export job created.'), 5000);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Import/Export job creation failed.'),
|
||||
res.errormsg
|
||||
);
|
||||
@ -542,7 +542,7 @@ define([
|
||||
.fail(function(xhr) {
|
||||
try {
|
||||
var err = JSON.parse(xhr.responseText);
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Import/Export job failed.'),
|
||||
err.errormsg
|
||||
);
|
||||
@ -696,7 +696,7 @@ define([
|
||||
})
|
||||
.done(function(res) {
|
||||
if (!res.success) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
res.errormsg
|
||||
);
|
||||
@ -710,7 +710,7 @@ define([
|
||||
).set('resizable', true).resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.lg);
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
gettext('Failed to fetch Utility information')
|
||||
);
|
||||
|
@ -215,7 +215,7 @@ define([
|
||||
if (pgBrowser.tree.hasParent(i)) {
|
||||
i = pgBrowser.tree.parent(i);
|
||||
} else {
|
||||
Alertify.alert(gettext('Please select server or child node from tree.'));
|
||||
Notify.alert(gettext('Please select server or child node from tree.'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -241,7 +241,7 @@ define([
|
||||
var treeInfo = t && t.getTreeNodeHierarchy(i);
|
||||
|
||||
if (treeInfo.database._label.indexOf('=') >= 0) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Maintenance error'),
|
||||
gettext('Maintenance job creation failed. '+
|
||||
'Databases with = symbols in the name cannot be maintained using this utility.')
|
||||
@ -375,14 +375,14 @@ define([
|
||||
Notify.success(res.data.info);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
|
||||
} else {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Maintenance job creation failed.'),
|
||||
res.errormsg
|
||||
);
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Maintenance job creation failed.')
|
||||
);
|
||||
});
|
||||
@ -464,7 +464,7 @@ define([
|
||||
})
|
||||
.done(function(res) {
|
||||
if (!res.success) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
res.errormsg
|
||||
);
|
||||
@ -475,7 +475,7 @@ define([
|
||||
.resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
|
||||
})
|
||||
.fail(function() {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
gettext('Failed to fetch Utility information')
|
||||
);
|
||||
|
@ -11,12 +11,12 @@ import { FitAddon } from 'xterm-addon-fit';
|
||||
import { WebLinksAddon } from 'xterm-addon-web-links';
|
||||
import { SearchAddon } from 'xterm-addon-search';
|
||||
import { io } from 'socketio';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import {enable} from 'pgadmin.browser.toolbar';
|
||||
import 'wcdocker';
|
||||
import {getRandomInt, hasBinariesConfiguration, registerDetachEvent} from 'sources/utils';
|
||||
import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils';
|
||||
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';
|
||||
|
||||
@ -114,14 +114,14 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
|
||||
return isEnabled;
|
||||
},
|
||||
psql_tool: function(data, aciTreeIdentifier, gen=false) {
|
||||
const serverInformation = retrieveAncestorOfTypeServer(pgBrowser, aciTreeIdentifier, gettext('PSQL Error'), Alertify);
|
||||
if (!hasBinariesConfiguration(pgBrowser, serverInformation, Alertify)) {
|
||||
const serverInformation = retrieveAncestorOfTypeServer(pgBrowser, aciTreeIdentifier, gettext('PSQL Error'));
|
||||
if (!hasBinariesConfiguration(pgBrowser, serverInformation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const node = pgBrowser.tree.findNodeByDomElement(aciTreeIdentifier);
|
||||
if (node === undefined || !node.getData()) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('PSQL Error'),
|
||||
gettext('No object selected.')
|
||||
);
|
||||
@ -131,7 +131,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
|
||||
parentData = pgBrowser.tree.getTreeNodeHierarchy(aciTreeIdentifier);
|
||||
|
||||
if(_.isUndefined(parentData.server)) {
|
||||
Alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('PSQL Error'),
|
||||
gettext('Please select a server/database object.')
|
||||
);
|
||||
@ -350,7 +350,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
|
||||
}
|
||||
});
|
||||
} 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.'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -14,6 +14,7 @@ import url_for from 'sources/url_for';
|
||||
import axios from 'axios/index';
|
||||
import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils';
|
||||
import {hasBinariesConfiguration} from 'sources/utils';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
export class RestoreDialog extends Dialog {
|
||||
constructor(pgBrowser, $, alertify, RestoreModel, backform = Backform) {
|
||||
@ -29,12 +30,12 @@ export class RestoreDialog extends Dialog {
|
||||
}
|
||||
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasBinariesConfiguration(this.pgBrowser, serverInformation, this.alertify)) {
|
||||
if (!hasBinariesConfiguration(this.pgBrowser, serverInformation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -46,7 +47,7 @@ export class RestoreDialog extends Dialog {
|
||||
baseUrl
|
||||
).then(function(res) {
|
||||
if (!res.data.success) {
|
||||
that.alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
res.data.errormsg
|
||||
);
|
||||
@ -70,7 +71,7 @@ export class RestoreDialog extends Dialog {
|
||||
that.alertify.pg_restore(title, aciTreeItem1, data, node)
|
||||
.resizeTo(width, height);
|
||||
}).catch(function() {
|
||||
that.alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Utility not found'),
|
||||
gettext('Failed to fetch Utility information')
|
||||
);
|
||||
|
@ -12,6 +12,7 @@ import _ from 'underscore';
|
||||
import gettext from '../../../../static/js/gettext';
|
||||
import url_for from '../../../../static/js/url_for';
|
||||
import {DialogWrapper} from '../../../../static/js/alertify/dialog_wrapper';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
export class RestoreDialogWrapper extends DialogWrapper {
|
||||
constructor(dialogContainerSelector, dialogTitle, typeOfDialog,
|
||||
@ -156,10 +157,10 @@ export class RestoreDialogWrapper extends DialogWrapper {
|
||||
this.view.model.toJSON()
|
||||
).then(function (res) {
|
||||
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);
|
||||
} else {
|
||||
dialogWrapper.alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Restore job creation failed.'),
|
||||
res.data.errormsg
|
||||
);
|
||||
@ -167,7 +168,7 @@ export class RestoreDialogWrapper extends DialogWrapper {
|
||||
}).catch(function (error) {
|
||||
try {
|
||||
const err = error.response.data;
|
||||
dialogWrapper.alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Restore job failed.'),
|
||||
err.errormsg
|
||||
);
|
||||
|
@ -117,9 +117,9 @@ export default class SchemaDiffUI {
|
||||
raise_error_on_fail(alert_title, xhr) {
|
||||
try {
|
||||
var err = JSON.parse(xhr.responseText);
|
||||
Alertify.alert(alert_title, err.errormsg);
|
||||
Notify.alert(alert_title, err.errormsg);
|
||||
} 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_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;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ export default class SchemaDiffUI {
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ define('tools.querytool', [
|
||||
if (_.isUndefined(self.sql_panel_obj) || _.isUndefined(self.history_panel) ||
|
||||
_.isUndefined(self.data_output_panel) || _.isUndefined(self.explain_panel) ||
|
||||
_.isUndefined(self.messages_panel) || _.isUndefined(self.notifications_panel)) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Panel Loading Error'),
|
||||
gettext('Something went wrong while loading the panels.'
|
||||
+ ' 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 */
|
||||
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);
|
||||
@ -1967,7 +1967,7 @@ define('tools.querytool', [
|
||||
* confirm with the user for unsaved changes.
|
||||
*/
|
||||
if (self.handler.is_query_changed) {
|
||||
alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Unsaved changes'),
|
||||
gettext('Are you sure you wish to discard the current changes?'),
|
||||
function() {
|
||||
@ -1978,10 +1978,7 @@ define('tools.querytool', [
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
});
|
||||
);
|
||||
} else {
|
||||
self.query_tool_obj.setValue('');
|
||||
}
|
||||
@ -1997,7 +1994,7 @@ define('tools.querytool', [
|
||||
return;
|
||||
}
|
||||
|
||||
alertify.confirm(gettext('Clear history'),
|
||||
Notify.confirm(gettext('Clear history'),
|
||||
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.'),
|
||||
function() {
|
||||
@ -2023,10 +2020,7 @@ define('tools.querytool', [
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
});
|
||||
);
|
||||
},
|
||||
|
||||
// Callback function for the auto commit button click.
|
||||
@ -2256,7 +2250,7 @@ define('tools.querytool', [
|
||||
if(!connection_details['is_selected']) {
|
||||
var self = this;
|
||||
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?'),
|
||||
function() {
|
||||
self.change_connection(connection_details, ref, true);
|
||||
@ -2267,10 +2261,7 @@ define('tools.querytool', [
|
||||
alertify.newConnectionDialog().destroy();
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
});
|
||||
);
|
||||
} else {
|
||||
self.change_connection(connection_details, ref, false);
|
||||
}
|
||||
@ -2382,7 +2373,7 @@ define('tools.querytool', [
|
||||
pgWindow.default.pgAdmin && pgWindow.default.pgAdmin.Browser
|
||||
&& pgWindow.default.pgAdmin.Browser.preference_version() <= 0) {
|
||||
|
||||
alertify.alert()
|
||||
Notify.alert()
|
||||
.setting({
|
||||
'title': gettext('Connection lost'),
|
||||
'label':gettext('Close'),
|
||||
@ -2567,7 +2558,7 @@ define('tools.querytool', [
|
||||
warn_before_continue: function() {
|
||||
var self = this;
|
||||
|
||||
alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Connection Warning'),
|
||||
'<p style="float:left">'+
|
||||
'<span class="fa fa-exclamation-triangle warn-icon" aria-hidden="true" role="img">'+
|
||||
@ -2607,13 +2598,10 @@ define('tools.querytool', [
|
||||
}
|
||||
}, function() {
|
||||
self.saveState();
|
||||
})
|
||||
.set({
|
||||
labels: {
|
||||
ok: gettext('Continue'),
|
||||
cancel: gettext('Cancel'),
|
||||
},
|
||||
});
|
||||
},
|
||||
gettext('Continue'),
|
||||
gettext('Cancel')
|
||||
);
|
||||
},
|
||||
init_connection: function(create_transaction, passdata) {
|
||||
var self = this;
|
||||
@ -2880,7 +2868,7 @@ define('tools.querytool', [
|
||||
_.size(self.data_store.updated) ||
|
||||
_.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?'),
|
||||
function() {
|
||||
// The user does not want to save, just continue
|
||||
@ -2899,10 +2887,7 @@ define('tools.querytool', [
|
||||
$('#btn-flash').prop('disabled', false);
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
});
|
||||
);
|
||||
} else {
|
||||
if (macroId !== undefined) {
|
||||
self._execute_macro_query(explain_prefix, shouldReconnect, macroId);
|
||||
@ -3884,7 +3869,7 @@ define('tools.querytool', [
|
||||
* confirm with the user for unsaved changes.
|
||||
*/
|
||||
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?'),
|
||||
function() {
|
||||
// User do not want to save, just continue
|
||||
@ -3893,10 +3878,7 @@ define('tools.querytool', [
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('Yes'),
|
||||
cancel: gettext('No'),
|
||||
});
|
||||
);
|
||||
} else {
|
||||
self._open_select_file_manager();
|
||||
}
|
||||
@ -4161,7 +4143,7 @@ define('tools.querytool', [
|
||||
// Refresh the sql grid
|
||||
queryToolActions.executeQuery(self);
|
||||
} 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
|
||||
);
|
||||
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
|
||||
queryToolActions.executeQuery(self);
|
||||
} else {
|
||||
alertify.alert(gettext('Filter Exclude Selection Error'), res.data.result);
|
||||
Notify.alert(gettext('Filter Exclude Selection Error'), res.data.result);
|
||||
}
|
||||
}, 10
|
||||
);
|
||||
@ -4232,7 +4214,7 @@ define('tools.querytool', [
|
||||
pgAdmin, self, e, '_exclude_filter', [], true
|
||||
);
|
||||
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
|
||||
queryToolActions.executeQuery(self);
|
||||
} 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
|
||||
);
|
||||
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
|
||||
queryToolActions.executeQuery(self);
|
||||
} else {
|
||||
alertify.alert(gettext('Change limit Error'), res.data.result);
|
||||
Notify.alert(gettext('Change limit Error'), res.data.result);
|
||||
}
|
||||
}, 10
|
||||
);
|
||||
@ -4439,7 +4421,7 @@ define('tools.querytool', [
|
||||
pgAdmin, self, e, '_set_limit', [], true
|
||||
);
|
||||
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) {
|
||||
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);
|
||||
is_query_running = false;
|
||||
@ -4594,7 +4576,7 @@ define('tools.querytool', [
|
||||
pgAdmin, self, e, '_cancel_query', [], false
|
||||
);
|
||||
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
|
||||
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) {
|
||||
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) {
|
||||
|
||||
@ -4716,7 +4698,7 @@ define('tools.querytool', [
|
||||
pgAdmin, self, e, '_auto_rollback', [], true
|
||||
);
|
||||
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) {
|
||||
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) {
|
||||
let msg = httpErrorHandler.handleQueryToolAjaxError(
|
||||
pgAdmin, self, e, '_auto_commit', [], true
|
||||
);
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Warning'),
|
||||
gettext('The current transaction has been rolled back because the server was disconnected.'),
|
||||
function() {
|
||||
@ -5095,10 +5077,10 @@ define('tools.querytool', [
|
||||
},
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
).set('labels', {
|
||||
ok: gettext('OK')
|
||||
});
|
||||
},
|
||||
gettext('OK'),
|
||||
gettext('Cancel')
|
||||
);
|
||||
}
|
||||
}).fail(function() {
|
||||
/* failure should be ignored */
|
||||
|
@ -698,7 +698,7 @@ define([
|
||||
e.cancel = true; // Do not close dialog
|
||||
let newOwnershipModel = this.ownershipModel.toJSON();
|
||||
if (newOwnershipModel.user == '' || newOwnershipModel.user == undefined) {
|
||||
alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Delete user?'),
|
||||
gettext('The shared servers owned by <b>'+ self.model.get('username') +'</b> will be deleted. Do you wish to continue?'),
|
||||
function() {
|
||||
@ -751,7 +751,7 @@ define([
|
||||
},
|
||||
deleteUser: function() {
|
||||
let self = this;
|
||||
alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Delete user?'),
|
||||
gettext('Are you sure you wish to delete this user?'),
|
||||
function() {
|
||||
@ -777,7 +777,7 @@ define([
|
||||
e.preventDefault();
|
||||
|
||||
if (self.model.get('id') == userInfo['id']) {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Cannot delete user.'),
|
||||
gettext('Cannot delete currently logged in user.'),
|
||||
function() {
|
||||
@ -819,7 +819,7 @@ define([
|
||||
|
||||
}
|
||||
} else {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
gettext('This user cannot be deleted.'),
|
||||
function() {
|
||||
@ -1071,7 +1071,7 @@ define([
|
||||
})
|
||||
.fail(function() {
|
||||
setTimeout(function() {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
gettext('Cannot load user roles.')
|
||||
);
|
||||
@ -1088,7 +1088,7 @@ define([
|
||||
})
|
||||
.fail(function() {
|
||||
setTimeout(function() {
|
||||
alertify.alert(
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
gettext('Cannot load user Sources.')
|
||||
);
|
||||
@ -1162,7 +1162,7 @@ define([
|
||||
var self = this;
|
||||
if (!_.all(this.userCollection.pluck('id')) || !_.isEmpty(this.userCollection.invalidUsers)) {
|
||||
e.cancel = true;
|
||||
alertify.confirm(
|
||||
Notify.confirm(
|
||||
gettext('Discard unsaved changes?'),
|
||||
gettext('Are you sure you want to close the dialog? Any unsaved changes will be lost.'),
|
||||
function() {
|
||||
|
@ -80,14 +80,22 @@ class PgadminPage:
|
||||
except TimeoutException:
|
||||
pass
|
||||
|
||||
def click_modal(self, button_text):
|
||||
def click_modal(self, button_text, react_dialog=False):
|
||||
time.sleep(0.5)
|
||||
# Find active alertify dialog in case of multiple alertify dialog
|
||||
# & click on that dialog
|
||||
modal_button = self.find_by_xpath(
|
||||
"//div[contains(@class, 'alertify') and "
|
||||
"not(contains(@class, 'ajs-hidden'))]//button[.='%s']"
|
||||
% button_text)
|
||||
|
||||
# In case of react dialog we use different xpath
|
||||
if react_dialog:
|
||||
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)
|
||||
|
||||
def add_server(self, server_config):
|
||||
@ -214,7 +222,8 @@ class PgadminPage:
|
||||
self.click_element(
|
||||
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):
|
||||
self.fill_codemirror_area_with(query)
|
||||
@ -322,7 +331,7 @@ class PgadminPage:
|
||||
self.click_element(object_menu_item)
|
||||
delete_menu_item = self.find_by_partial_link_text("Remove Server")
|
||||
self.click_element(delete_menu_item)
|
||||
self.click_modal('Yes')
|
||||
self.click_modal('Yes', True)
|
||||
time.sleep(1)
|
||||
else:
|
||||
print("%s Server is not removed", server_config['name'],
|
||||
|
@ -16,6 +16,7 @@ import pgAdmin from 'sources/pgadmin';
|
||||
import {messages} from '../fake_messages';
|
||||
import SchemaView from '../../../pgadmin/static/js/SchemaView';
|
||||
import * as legacyConnector from 'sources/helpers/legacyConnector';
|
||||
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
const initData = {
|
||||
id: 1,
|
||||
@ -58,6 +59,7 @@ describe('SchemaView', ()=>{
|
||||
/* https://material-ui.com/guides/testing/#api */
|
||||
beforeAll(()=>{
|
||||
mount = createMount();
|
||||
spyOn(Notify, 'alert');
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
@ -242,7 +244,6 @@ describe('SchemaView', ()=>{
|
||||
|
||||
it('onSave click', (done)=>{
|
||||
simulateValidData();
|
||||
let alertSpy = spyOn(legacyConnector.pgAlertify(), 'alert');
|
||||
onSave.calls.reset();
|
||||
ctrl.find('PrimaryButton[data-test="Save"]').simulate('click');
|
||||
setTimeout(()=>{
|
||||
@ -257,7 +258,7 @@ describe('SchemaView', ()=>{
|
||||
{field3: null, field4: null, field5: 'rval52'},
|
||||
]
|
||||
});
|
||||
expect(alertSpy).toHaveBeenCalledWith('Warning', 'some inform text');
|
||||
expect(Notify.alert).toHaveBeenCalledWith('Warning', 'some inform text');
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
@ -266,7 +267,7 @@ describe('SchemaView', ()=>{
|
||||
it('with confirm check and yes click', (done)=>{
|
||||
simulateValidData();
|
||||
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');
|
||||
/* Press OK */
|
||||
confirmSpy.calls.argsFor(0)[2]();
|
||||
@ -281,7 +282,7 @@ describe('SchemaView', ()=>{
|
||||
|
||||
it('with confirm check and cancel click', (done)=>{
|
||||
simulateValidData();
|
||||
let confirmSpy = spyOn(legacyConnector.pgAlertify(), 'confirm').and.callThrough();
|
||||
let confirmSpy = spyOn(Notify, 'confirm').and.callThrough();
|
||||
ctrl.find('DefaultButton[data-test="Reset"]').simulate('click');
|
||||
/* Press cancel */
|
||||
confirmSpy.calls.argsFor(0)[3]();
|
||||
@ -301,7 +302,7 @@ describe('SchemaView', ()=>{
|
||||
ctrl.update();
|
||||
simulateValidData();
|
||||
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');
|
||||
setTimeout(()=>{
|
||||
ctrl.update();
|
||||
@ -380,7 +381,6 @@ describe('SchemaView', ()=>{
|
||||
ctrl.update();
|
||||
simulateChanges();
|
||||
|
||||
let alertSpy = spyOn(legacyConnector.pgAlertify(), 'alert');
|
||||
onSave.calls.reset();
|
||||
ctrl.find('PrimaryButton[data-test="Save"]').simulate('click');
|
||||
setTimeout(()=>{
|
||||
@ -402,7 +402,7 @@ describe('SchemaView', ()=>{
|
||||
]
|
||||
}
|
||||
});
|
||||
expect(alertSpy).toHaveBeenCalledWith('Warning', 'some inform text');
|
||||
expect(Notify.alert).toHaveBeenCalledWith('Warning', 'some inform text');
|
||||
done();
|
||||
}, 0);
|
||||
}, 0);
|
||||
@ -413,7 +413,7 @@ describe('SchemaView', ()=>{
|
||||
ctrl.update();
|
||||
simulateChanges();
|
||||
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');
|
||||
/* Press OK */
|
||||
confirmSpy.calls.argsFor(0)[2]();
|
||||
|
@ -11,6 +11,7 @@ import {showDataGrid} from '../../../pgadmin/tools/datagrid/static/js/show_data'
|
||||
import {TreeFake} from '../tree/tree_fake';
|
||||
import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes';
|
||||
import {pgBrowser} from 'pgadmin.browser.preferences';
|
||||
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
const context = describe;
|
||||
|
||||
@ -31,6 +32,8 @@ describe('#show_data', () => {
|
||||
beforeEach(() => {
|
||||
pgBrowser.preferences_cache = dummy_cache;
|
||||
alertify = jasmine.createSpyObj('alertify', ['alert', 'error']);
|
||||
spyOn(Notify, 'error');
|
||||
spyOn(Notify, 'alert');
|
||||
datagrid = {
|
||||
launch_grid: jasmine.createSpy('launch_grid'),
|
||||
};
|
||||
@ -114,7 +117,7 @@ describe('#show_data', () => {
|
||||
|
||||
it('display alert', () => {
|
||||
showDataGrid(datagrid, pgBrowser, alertify, {}, [{id: '10'}], transId);
|
||||
expect(alertify.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Data Grid Error',
|
||||
'No object selected.'
|
||||
);
|
||||
|
@ -11,6 +11,7 @@ import {TreeFake} from '../tree/tree_fake';
|
||||
import {showQueryTool} from '../../../pgadmin/tools/datagrid/static/js/show_query_tool';
|
||||
import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes';
|
||||
import {pgBrowser} from 'pgadmin.browser.preferences';
|
||||
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
const context = describe;
|
||||
|
||||
@ -26,11 +27,10 @@ var dummy_cache = [
|
||||
|
||||
describe('#showQueryTool', () => {
|
||||
let queryTool;
|
||||
let alertify;
|
||||
let transId = 98765432;
|
||||
beforeEach(() => {
|
||||
pgBrowser.preferences_cache = dummy_cache;
|
||||
alertify = jasmine.createSpyObj('alertify', ['alert']);
|
||||
spyOn(Notify, 'alert');
|
||||
queryTool = {
|
||||
launch_grid: jasmine.createSpy('launch_grid'),
|
||||
};
|
||||
@ -77,14 +77,14 @@ describe('#showQueryTool', () => {
|
||||
|
||||
context('cannot find the tree node', () => {
|
||||
beforeEach(() => {
|
||||
showQueryTool(queryTool, pgBrowser, alertify, '', [{id: '10'}], transId);
|
||||
showQueryTool(queryTool, pgBrowser, '', [{id: '10'}], transId);
|
||||
});
|
||||
it('does not create a transaction', () => {
|
||||
expect(queryTool.launch_grid).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('display alert', () => {
|
||||
expect(alertify.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Query Tool Error',
|
||||
'No object selected.'
|
||||
);
|
||||
@ -93,19 +93,19 @@ describe('#showQueryTool', () => {
|
||||
|
||||
context('current node is not underneath a server', () => {
|
||||
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();
|
||||
});
|
||||
|
||||
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 not underneath a database', () => {
|
||||
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(
|
||||
98765432,
|
||||
'/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', () => {
|
||||
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(
|
||||
98765432,
|
||||
'/panel/98765432?is_query_tool=true&sgid=1&sid=2&server_type=pg&did=3',
|
||||
|
@ -11,6 +11,8 @@ import erdPref from './erd_preferences';
|
||||
import BodyWidget from 'pgadmin.tools.erd/erd_tool/ui_components/BodyWidget';
|
||||
import * as ERDSqlTool from 'tools/datagrid/static/js/show_query_tool';
|
||||
import { FakeLink, FakeNode } from '../fake_item';
|
||||
import Notify from '../../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
|
||||
let pgAdmin = {
|
||||
Browser: {
|
||||
@ -104,7 +106,7 @@ describe('ERD BodyWidget', ()=>{
|
||||
spyOn(ERDCore.prototype, 'deserializeData');
|
||||
spyOn(ERDCore.prototype, 'addNode').and.returnValue(newNode);
|
||||
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();
|
||||
});
|
||||
|
||||
|
@ -10,6 +10,7 @@ import {TreeFake} from '../tree/tree_fake';
|
||||
import {RestoreDialog} from '../../../pgadmin/tools/restore/static/js/restore_dialog';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import axios from 'axios/index';
|
||||
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
const context = describe;
|
||||
|
||||
@ -44,6 +45,7 @@ describe('RestoreDialog', () => {
|
||||
pgBrowser.Nodes.database.hasId = true;
|
||||
jquerySpy = jasmine.createSpy('jquerySpy');
|
||||
restoreModelSpy = jasmine.createSpy('restoreModelSpy');
|
||||
spyOn(Notify, 'alert');
|
||||
|
||||
const hierarchy = {
|
||||
children: [
|
||||
@ -145,7 +147,7 @@ describe('RestoreDialog', () => {
|
||||
|
||||
it('display an alert with a Restore Error', () => {
|
||||
restoreDialog.draw(null, [{id: 'root'}], null);
|
||||
expect(alertifySpy.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Restore Error',
|
||||
'Please select server or child node from the browser tree.'
|
||||
);
|
||||
@ -161,7 +163,7 @@ describe('RestoreDialog', () => {
|
||||
context('server is a PostgreSQL server', () => {
|
||||
it('display an alert with "Preferences Error"', () => {
|
||||
restoreDialog.draw(null, [{id: 'serverTreeNode'}], null);
|
||||
expect(alertifySpy.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Preferences Error',
|
||||
'Failed to load preference pg_bin_dir of module paths'
|
||||
);
|
||||
@ -171,7 +173,7 @@ describe('RestoreDialog', () => {
|
||||
context('server is a EPAS server', () => {
|
||||
it('display an alert with "Preferences Error"', () => {
|
||||
restoreDialog.draw(null, [{id: 'ppasServer'}], null);
|
||||
expect(alertifySpy.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Preferences Error',
|
||||
'Failed to load preference ppas_bin_dir of module paths'
|
||||
);
|
||||
@ -188,7 +190,7 @@ describe('RestoreDialog', () => {
|
||||
context('server is a PostgreSQL server', () => {
|
||||
it('display an alert with "Configuration required"', () => {
|
||||
restoreDialog.draw(null, [{id: 'serverTreeNodeWrongPath'}], null);
|
||||
expect(alertifySpy.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Configuration required',
|
||||
'Please configure the PostgreSQL Binary Path in the Preferences dialog.'
|
||||
);
|
||||
@ -270,7 +272,7 @@ describe('RestoreDialog', () => {
|
||||
context('server is a EPAS server', () => {
|
||||
it('display an alert with "Configuration required"', () => {
|
||||
restoreDialog.draw(null, [{id: 'ppasServerTreeNodeWrongPath'}], null);
|
||||
expect(alertifySpy.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Configuration required',
|
||||
'Please configure the EDB Advanced Server Binary Path in the Preferences dialog.'
|
||||
);
|
||||
|
@ -12,6 +12,7 @@ import MockAdapter from 'axios-mock-adapter';
|
||||
import axios from 'axios/index';
|
||||
import {FakeModel} from '../fake_model';
|
||||
import {TreeNode} from '../../../pgadmin/static/js/tree/tree_nodes';
|
||||
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
let context = describe;
|
||||
|
||||
@ -91,6 +92,8 @@ describe('RestoreDialogWrapper', () => {
|
||||
return jasmine.createSpyObj('obj', ['appendTo']);
|
||||
}
|
||||
});
|
||||
spyOn(Notify, 'success');
|
||||
spyOn(Notify, 'alert');
|
||||
});
|
||||
|
||||
describe('#prepare', () => {
|
||||
@ -404,7 +407,7 @@ describe('RestoreDialogWrapper', () => {
|
||||
it('create an success alert box', (done) => {
|
||||
restoreDialogWrapper.callback(event);
|
||||
setTimeout(() => {
|
||||
expect(alertifySpy.success).toHaveBeenCalledWith(
|
||||
expect(Notify.success).toHaveBeenCalledWith(
|
||||
'Restore job created.',
|
||||
5
|
||||
);
|
||||
@ -445,7 +448,7 @@ describe('RestoreDialogWrapper', () => {
|
||||
it('creates an alert box', (done) => {
|
||||
restoreDialogWrapper.callback(event);
|
||||
setTimeout(() => {
|
||||
expect(alertifySpy.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
'Restore job failed.',
|
||||
undefined
|
||||
);
|
||||
|
@ -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 _ from 'lodash';
|
||||
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 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 {
|
||||
constructor(schemaObj) {
|
||||
@ -259,7 +259,7 @@ describe('ExclusionConstraintSchema', ()=>{
|
||||
beforeEach(()=>{
|
||||
spyOn(schemaObj.exColumnSchema, 'setOperClassOptions').and.callThrough();
|
||||
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;
|
||||
});
|
||||
|
||||
|
@ -16,8 +16,8 @@ import {messages} from '../fake_messages';
|
||||
import SchemaView, { SCHEMA_STATE_ACTIONS } from '../../../pgadmin/static/js/SchemaView';
|
||||
import _ from 'lodash';
|
||||
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 Notify from '../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
function getFieldDepChange(schema, id) {
|
||||
return _.find(schema.fields, (f)=>f.id==id)?.depChange;
|
||||
@ -154,7 +154,7 @@ describe('TableSchema', ()=>{
|
||||
beforeEach(()=>{
|
||||
spyOn(schemaObj,'changeColumnOptions').and.callThrough();
|
||||
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;
|
||||
schemaObj.ofTypeTables = [
|
||||
{label: 'type1', oftype_columns: oftypeColumns}
|
||||
|
@ -11,6 +11,7 @@ import {TreeFake} from '../tree/tree_fake';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import axios from 'axios/index';
|
||||
import gettext from 'sources/gettext';
|
||||
import Notify from '../../../pgadmin/static/js/helpers/Notifier';
|
||||
|
||||
const context = describe;
|
||||
|
||||
@ -67,6 +68,7 @@ describe('SearchObjectsDialog', () => {
|
||||
pgBrowser.Nodes.server.hasId = true;
|
||||
pgBrowser.Nodes.database.hasId = true;
|
||||
jquerySpy = jasmine.createSpy('jquerySpy');
|
||||
spyOn(Notify, 'alert');
|
||||
|
||||
const hierarchy = {
|
||||
children: [
|
||||
@ -143,7 +145,7 @@ describe('SearchObjectsDialog', () => {
|
||||
|
||||
it('display an alert with a Search object Error', () => {
|
||||
soDialog.draw(null, [{id: 'serverTreeNode'}], null);
|
||||
expect(alertifySpy.alert).toHaveBeenCalledWith(
|
||||
expect(Notify.alert).toHaveBeenCalledWith(
|
||||
gettext('Search Objects Error'),
|
||||
gettext('Please select a database or its child node from the browser.')
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user