From 0a8d7a37b9b1edea4be6db400b2b3763d769682f Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Tue, 14 Aug 2018 10:17:50 +0530 Subject: [PATCH] Changed the icon, label, inode, etc. propely while refreshing the browser tree item. Refs #3461 --- web/pgadmin/browser/static/js/browser.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index 0f975f88f..7951f4ac6 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -1544,21 +1544,25 @@ define('pgadmin.browser', [ }) .done(function(res) { // Node information can come as result/data - var data = res.result || res.data; + var newData = res.result || res.data; - data._label = data.label; - data.label = _.escape(data.label); - var d = ctx.t.itemData(ctx.i); - _.extend(d, data); - ctx.t.setLabel(ctx.i, {label: _d.label}); - ctx.t.addIcon(ctx.i, {icon: _d.icon}); - ctx.t.setId(ctx.i, {id: _d.id}); - ctx.t.setInode(ctx.i, {inode: data.inode}); + newData._label = newData.label; + newData.label = _.escape(newData.label); + + ctx.t.setLabel(ctx.i, {label: newData.label}); + ctx.t.addIcon(ctx.i, {icon: newData.icon}); + ctx.t.setId(ctx.i, {id: newData.id}); + if (newData.inode) + ctx.t.setInode(ctx.i, {inode: true}); + + // This will update the tree item data. + var itemData = ctx.t.itemData(ctx.i); + _.extend(itemData, newData); if ( _n.can_expand && typeof(_n.can_expand) == 'function' ) { - if (!_n.can_expand(d)) { + if (!_n.can_expand(itemData)) { ctx.t.unload(ctx.i); return; }