Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion web/pgadmin/browser/server_groups/servers/static/js/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,30 @@ define('pgadmin.node.server', [

return false;
},
/* Refresh the server */
refresh: function(args, i) {
let obj = this,
tree = pgBrowser.tree,
item = i || tree.selected(),
data = item && tree.itemData(item);
// Fetch connection status.
fetch_connection_status(obj, data, tree, item);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had discussed not to call this function on refresh and use the node endpoint instead. The fix will be generic and will apply to all nodes.

setTimeout(function() {
pgAdmin.Browser.Node.callbacks.refresh.apply(obj, [null, item]);
}, 10);
// Fetch Node and check if the server is connected or not.
const url = obj.generate_url(item, 'nodes', data, true);
getApiInstance().get(url)
.then(({ data: { result } }) => {
if (!result.connected) {
setTimeout(function() {
tree.close(item);
}, 10);
tree.setInode(item);
}
})
.catch((error) => pgAdmin.Browser.notifier.pgRespErrorNotify(error));
},
/* Add restore point */
restore_point: function(args) {
let input = args || {},
Expand Down Expand Up @@ -778,7 +802,6 @@ define('pgadmin.node.server', [

getApiInstance().get(url)
.then(({data: res})=>{
tree.setInode(item);
if (res?.data) {
if (typeof res.data.icon == 'string') {
tree.removeIcon(item);
Expand Down
Loading