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

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

View File

@@ -48,15 +48,34 @@ define('misc.sql', [
pgBrowser.Events.on(
'pgadmin-browser:tree:selected', this.showSQL
);
pgBrowser.Events.on(
'pgadmin-browser:tree:refreshing', this.refreshSQL, this
);
}
}.bind(this)
);
} else {
if ((sqlPanels[0].isVisible()) || sqlPanels.length != 1) {
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showSQL);
pgBrowser.Events.on(
'pgadmin-browser:tree:refreshing', this.refreshSQL, this
);
}
}
},
refreshSQL: function(item, data, node) {
var that = this,
cache_flag = {
node_type: data._type,
url: node.generate_url(item, 'sql', data, true),
};
if (_.isEqual($(that.sqlPanels[0]).data('node-prop'), cache_flag)) {
// Reset the current item selection
$(that.sqlPanels[0]).data('node-prop', '');
that.showSQL(item, data, node);
}
},
showSQL: function(item, data, node) {
/**
* We can't start fetching the SQL immediately, it is possible - the user
@@ -149,9 +168,15 @@ define('misc.sql', [
// We will start listening the tree selection event.
pgBrowser.Events.on('pgadmin-browser:tree:selected', pgBrowser.ShowNodeSQL.showSQL);
pgBrowser.Events.on(
'pgadmin-browser:tree:refreshing', pgBrowser.ShowNodeSQL.refreshSQL, this
);
} else {
// We don't need to listen the tree item selection event.
pgBrowser.Events.off('pgadmin-browser:tree:selected', pgBrowser.ShowNodeSQL.showSQL);
pgBrowser.Events.off(
'pgadmin-browser:tree:refreshing', pgBrowser.ShowNodeSQL.refreshSQL, this
);
}
},
});