Using better way to find the current object in the properties panel.

This commit is contained in:
Ashesh Vashi 2016-07-19 15:30:39 +05:30
parent 8b35a60c08
commit 417af3676d
2 changed files with 4 additions and 22 deletions

View File

@ -92,23 +92,12 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
if (view) {
// Avoid unnecessary reloads
var n_type = data._type,
n_value = -1,
treeHierarchy = n.getTreeNodeHierarchy(item);
if (_.isUndefined(treeHierarchy[n_type]) ||
_.isUndefined(treeHierarchy[n_type]._id)) {
n_value = -1;
} else {
n_value = treeHierarchy[n_type]._id;
}
if (n_value == $(panel).data(n_type)) {
if (_.isEqual($(panel).data('node-prop'), urlBase)) {
return;
}
// Cache the current IDs for next time
$(panel).data(n_type, n_value);
$(panel).data('node-prop', urlBase);
// Reset the data object
j.data('obj-view', null);

View File

@ -797,19 +797,12 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
n = i && d && pgBrowser.Nodes[d._type],
treeHierarchy = n.getTreeNodeHierarchy(i);
if (_.isUndefined(treeHierarchy[n_type]) ||
_.isUndefined(treeHierarchy[n_type]._id)) {
n_value = -1;
} else {
n_value = treeHierarchy[n_type]._id;
}
if (n_value == $(panel).data(n_type)) {
if (_.isEqual($(panel).data('node-prop'), treeHierarchy)) {
return;
}
// Cache the current IDs for next time
$(panel).data(n_type, n_value);
$(panel).data('node-prop', treeHierarchy);
if (!content.hasClass('has-pg-prop-btn-group'))
content.addClass('has-pg-prop-btn-group');