Ensure that deleting a database should not automatically connect to the next database. Fixes #6685

This commit is contained in:
Nikhil Mohite 2021-08-25 17:01:48 +05:30 committed by Akshay Joshi
parent c543930ac4
commit b30a42ab9e
4 changed files with 19 additions and 2 deletions

View File

@ -32,3 +32,4 @@ Bug fixes
| `Issue #6671 <https://redmine.postgresql.org/issues/6671>`_ - Fixed UnboundLocalError where local variable 'user_id' referenced before assignment.
| `Issue #6682 <https://redmine.postgresql.org/issues/6682>`_ - Renamed 'Auto rollback?' to 'Auto rollback on error?'.
| `Issue #6684 <https://redmine.postgresql.org/issues/6684>`_ - Fixed the JSON editor issue of hiding the first record.
| `Issue #6685 <https://redmine.postgresql.org/issues/6685>`_ - Ensure that deleting a database should not automatically connect to the next database.

View File

@ -24,7 +24,8 @@ define('pgadmin.node.database', [
columns: ['name', 'datowner', 'comments'],
hasStatistics: true,
canDrop: true,
canDropCascade: false,
selectParentNodeOnDelete: true,
canDropCascade: true,
statsPrettifyFields: [gettext('Size'), gettext('Size of temporary files')],
});
}
@ -43,6 +44,7 @@ define('pgadmin.node.database', [
canDrop: function(node) {
return node.canDrop;
},
selectParentNodeOnDelete: true,
label: gettext('Database'),
node_image: function() {
return 'pg-icon-database';

View File

@ -86,6 +86,7 @@ define([
hasCollectiveStatistics: true,
canDrop: true,
canDropCascade: true,
selectParentNodeOnDelete: false,
showProperties: function(item, data, panel) {
var that = this,
j = panel.$container.find('.obj_properties').first(),

View File

@ -569,6 +569,10 @@ define('pgadmin.browser.node', [
dropPriority is set to 2 by default, override it when change is required
*/
dropPriority: 2,
/******************************************************************************
select collection node on deletion.
*/
selectParentNodeOnDelete: false,
// List of common callbacks - that can be used for different
// operations!
callbacks: {
@ -835,7 +839,16 @@ define('pgadmin.browser.node', [
if (res.success == 0) {
pgBrowser.report_error(res.errormsg, res.info);
} else {
pgBrowser.removeTreeNode(i, true);
// Remove the node from tree and set collection node as selected.
var selectNextNode = true;
if(obj.selectParentNodeOnDelete) {
var prv_i = t.parent(i);
setTimeout(function() {
t.select(prv_i);
}, 10);
selectNextNode = false;
}
pgBrowser.removeTreeNode(i, selectNextNode);
}
return true;
})