Ensure that refreshing a node also updates the Property list. Fixes #3461

This commit is contained in:
Akshay Joshi authored and Dave Page committed 2018-08-13 13:47:07 +01:00
1 parent ffd41009ea
commit 008359ad3a
6 files changed
+103 -30

No files matched your search

@@ -164,6 +164,9 @@ define('misc.statistics', [
pgBrowser.Events.on(
'pgadmin-browser:tree:selected', this.showStatistics
);
pgBrowser.Events.on(
'pgadmin-browser:tree:refreshing', this.refreshStatistics, this
);
}
}.bind(this)
);
@@ -173,12 +176,18 @@ define('misc.statistics', [
pgBrowser.Events.on(
'pgadmin-browser:tree:selected', this.showStatistics
);
pgBrowser.Events.on(
'pgadmin-browser:tree:refreshing', this.refreshStatistics, this
);
}
}
if (self.panel.length > 0 && self.panel[0].isVisible()) {
pgBrowser.Events.on(
'pgadmin-browser:tree:selected', this.showStatistics
);
pgBrowser.Events.on(
'pgadmin-browser:tree:refreshing', this.refreshStatistics, this
);
}
},
@@ -300,7 +309,19 @@ define('misc.statistics', [
$msgContainer.text(msg);
}
},
refreshStatistics: function(item, data, node) {
var that = this,
cache_flag = {
node_type: data._type,
url: node.generate_url(item, 'stats', data, true),
};
if (_.isEqual($(that.panel[0]).data('node-prop'), cache_flag)) {
// Reset the current item selection
$(that.panel[0]).data('node-prop', '');
that.showStatistics(item, data, node);
}
},
showStatistics: function(item, data, node) {
var self = this;
if (!node) {
@@ -395,12 +416,22 @@ define('misc.statistics', [
'pgadmin-browser:tree:selected',
pgBrowser.NodeStatistics.showStatistics
);
pgBrowser.Events.on(
'pgadmin-browser:tree:refreshing',
pgBrowser.NodeStatistics.refreshStatistics,
this
);
} else {
// We don't need to listen the tree item selection event.
pgBrowser.Events.off(
'pgadmin-browser:tree:selected',
pgBrowser.NodeStatistics.showStatistics
);
pgBrowser.Events.off(
'pgadmin-browser:tree:refreshing',
pgBrowser.NodeStatistics.refreshStatistics,
this
);
}
},
});