1) Fix network disconnect issue while establishing the connection via SSH Tunnel and it impossible to expand the Servers node. Fixes #4724.

2) Fix server connection drops out issue in query tool. Fixes #4818
3) Fix VPN network disconnect issue where pgAdmin4 hangs on expanding the Servers node. Fixes #4926.
4) Ensure that the Servers collection node should expand independently of server connections. Fixes #4933.

Set the default connection timeout to 10 seconds instead of 0.
This commit is contained in:
Aditya Toshniwal
2019-11-26 09:04:41 +05:30
committed by Akshay Joshi
parent 700e01708b
commit 4ed2d74d9c
15 changed files with 272 additions and 135 deletions

View File

@@ -292,6 +292,10 @@ define('pgadmin.node.server', [
// Call added method of node.js
pgAdmin.Browser.Node.callbacks.added.apply(this, arguments);
if(data.was_connected) {
fetch_connection_status(this, data, pgBrowser.tree, item);
}
return true;
},
/* Reload configuration */
@@ -732,7 +736,7 @@ define('pgadmin.node.server', [
tunnel_password: undefined,
tunnel_authentication: 0,
save_tunnel_password: false,
connect_timeout: 0,
connect_timeout: 10,
},
// Default values!
initialize: function(attrs, args) {
@@ -1273,7 +1277,14 @@ define('pgadmin.node.server', [
}
};
/* Wait till the existing request completes */
if(data.is_connecting) {
return;
}
data.is_connecting = true;
tree.setLeaf(item);
tree.removeIcon(item);
tree.addIcon(item, {icon: 'icon-server-connecting'});
var url = obj.generate_url(item, 'connect', data, true);
$.post(url)
.done(function(res) {
@@ -1287,6 +1298,40 @@ define('pgadmin.node.server', [
return onFailure(
xhr, status, error, obj, data, tree, item, wasConnected
);
})
.always(function(){
data.is_connecting = false;
});
};
var fetch_connection_status = function(obj, data, tree, item) {
var url = obj.generate_url(item, 'connect', data, true);
tree.setLeaf(item);
tree.removeIcon(item);
tree.addIcon(item, {icon: 'icon-server-connecting'});
$.get(url)
.done(function(res) {
tree.setInode(item);
if (res && res.data) {
if (typeof res.data.icon == 'string') {
tree.removeIcon(item);
data.icon = res.data.icon;
tree.addIcon(item, {icon: data.icon});
}
_.extend(data, res.data);
var serverInfo = pgBrowser.serverInfo = pgBrowser.serverInfo || {};
serverInfo[data._id] = _.extend({}, data);
if(data.errmsg) {
Alertify.error(data.errmsg);
}
}
})
.fail(function(xhr, status, error) {
tree.setInode(item);
tree.addIcon(item, {icon: 'icon-server-not-connected'});
Alertify.pgRespErrorNotify(xhr, error);
});
};
}