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

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

View File

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

View File

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