1) Browser panel turns blank on connecting disconnected database & server has multiple databases. Fixes #6817

2) The object is not selected/properties panel is not updated when the user moves to object with arrow keys. Fixes #6821
3) Object gets deselected after editing. Fixes #6824
This commit is contained in:
Khushboo Vashi
2021-09-29 17:18:55 +05:30
committed by Akshay Joshi
parent c57fc74e18
commit aa8854db53
5 changed files with 38 additions and 49 deletions

View File

@@ -135,7 +135,7 @@
"path-fx": "^2.0.0", "path-fx": "^2.0.0",
"pathfinding": "^0.4.18", "pathfinding": "^0.4.18",
"paths-js": "^0.4.9", "paths-js": "^0.4.9",
"pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#76d7801ae6c179a5efd3c826c1bd91446a2436fb", "pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#c66e5e0533cfc622915e85eed0adc3ac38305c61",
"postcss": "^8.2.15", "postcss": "^8.2.15",
"raf": "^3.4.1", "raf": "^3.4.1",
"react": "^17.0.1", "react": "^17.0.1",

View File

@@ -282,7 +282,8 @@ define('pgadmin.node.database', [
} }
pgBrowser.tree.addIcon(item, {icon: data.icon}); pgBrowser.tree.addIcon(item, {icon: data.icon});
if (!data.connected && data.allowConn) { if (!data.connected && data.allowConn && !data.is_connecting) {
data.is_connecting = true;
connect_to_database(this, data, pgBrowser.tree, item, true); connect_to_database(this, data, pgBrowser.tree, item, true);
return false; return false;
} }
@@ -295,7 +296,8 @@ define('pgadmin.node.database', [
} }
pgBrowser.tree.addIcon(item, {icon: data.icon}); pgBrowser.tree.addIcon(item, {icon: data.icon});
if (!data.connected && data.allowConn) { if (!data.connected && data.allowConn && !data.is_connecting) {
data.is_connecting = true;
connect_to_database(this, data, pgBrowser.tree, item, false); connect_to_database(this, data, pgBrowser.tree, item, false);
return false; return false;
} }
@@ -416,6 +418,7 @@ define('pgadmin.node.database', [
onFailure = function( onFailure = function(
xhr, status, error, _model, _data, _tree, _item, _status xhr, status, error, _model, _data, _tree, _item, _status
) { ) {
data.is_connecting = false;
if (xhr.status != 200 && xhr.responseText.search('Ticket expired') !== -1) { if (xhr.status != 200 && xhr.responseText.search('Ticket expired') !== -1) {
tree.addIcon(_item, {icon: 'icon-server-connecting'}); tree.addIcon(_item, {icon: 'icon-server-connecting'});
let fetchTicket = Kerberos.fetch_ticket(); let fetchTicket = Kerberos.fetch_ticket();
@@ -454,10 +457,6 @@ define('pgadmin.node.database', [
res, model, _data, _tree, _item, _connected res, model, _data, _tree, _item, _connected
) { ) {
_data.is_connecting = false; _data.is_connecting = false;
if (!_connected) {
_tree.deselect(_item);
_tree.setInode(_item);
}
if (res && res.data) { if (res && res.data) {
if(typeof res.data.connected == 'boolean') { if(typeof res.data.connected == 'boolean') {
_data.connected = res.data.connected; _data.connected = res.data.connected;

View File

@@ -1075,23 +1075,19 @@ define('pgadmin.browser', [
}; };
if (binarySearch()) { if (binarySearch()) {
__ctx.t.before(i, { __ctx.t.before(i, _data).then(() => {
itemData: _data, if (
success: function() { __ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function'
if ( ) {
__ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function' __ctx.o.success.apply(__ctx.t, [i, _data]);
) { }
__ctx.o.success.apply(__ctx.t, [i, _data]); }, () => {
} console.warn('Failed to add before...', arguments);
}, if (
fail: function() { __ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function'
console.warn('Failed to add before...', arguments); ) {
if ( __ctx.o.fail.apply(__ctx.t, [i, _data]);
__ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function' }
) {
__ctx.o.fail.apply(__ctx.t, [i, _data]);
}
},
}); });
} else { } else {
var _append = function() { var _append = function() {
@@ -1570,32 +1566,26 @@ define('pgadmin.browser', [
}; };
if (binarySearch()) { if (binarySearch()) {
__ctx.t.before(i, { __ctx.t.before(i, _new).then((new_item) => {
itemData: _new, __ctx.t.openPath(new_item);
success: function() { __ctx.t.select(new_item);
var new_item = $(arguments[1].items[0]); if (
__ctx.t.openPath(new_item); __ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function'
__ctx.t.select(new_item); ) {
if ( __ctx.o.success.apply(__ctx.t, [i, _old, _new]);
__ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function' }
) { }, () => {
__ctx.o.success.apply(__ctx.t, [i, _old, _new]); console.warn('Failed to add before..', arguments);
} if (
}, __ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function'
fail: function() { ) {
console.warn('Failed to add before..', arguments); __ctx.o.fail.apply(__ctx.t, [i, _old, _new]);
if ( }
__ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function'
) {
__ctx.o.fail.apply(__ctx.t, [i, _old, _new]);
}
},
}); });
} else { } else {
var _appendNode = function() { var _appendNode = function() {
__ctx.t.append(__ctx.i, _new).then( __ctx.t.append(__ctx.i, _new).then(
() => { (new_item) => {
var new_item = $(arguments[1].items[0]);
__ctx.t.openPath(new_item); __ctx.t.openPath(new_item);
__ctx.t.select(new_item); __ctx.t.select(new_item);
if ( if (

View File

@@ -77,7 +77,7 @@ export class Tree {
} }
async before(item, data) { async before(item, data) {
await this.tree.create(item.parent, data.itemData); return await this.tree.create(item.parent, data);
} }
async update(item, data) { async update(item, data) {

View File

@@ -7582,9 +7582,9 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
"pgadmin4-tree@git+https://github.com/EnterpriseDB/pgadmin4-treeview/#76d7801ae6c179a5efd3c826c1bd91446a2436fb": "pgadmin4-tree@git+https://github.com/EnterpriseDB/pgadmin4-treeview/#c66e5e0533cfc622915e85eed0adc3ac38305c61":
version "1.0.0" version "1.0.0"
resolved "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#76d7801ae6c179a5efd3c826c1bd91446a2436fb" resolved "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#c66e5e0533cfc622915e85eed0adc3ac38305c61"
dependencies: dependencies:
"@types/classnames" "^2.2.6" "@types/classnames" "^2.2.6"
"@types/react" "^16.7.18" "@types/react" "^16.7.18"