Fix on-click handling of treeview nodes that wasn't refreshing SQL/Dependencies/Dependents in some circumstances. Fixes #3058
parent
e0da9c5a0c
commit
6ad44cb51e
|
@ -400,6 +400,7 @@ define('pgadmin.browser', [
|
|||
});
|
||||
|
||||
setTimeout(function() {
|
||||
obj.editor.setValue('-- ' + select_object_msg);
|
||||
obj.editor.refresh();
|
||||
}, 10);
|
||||
|
||||
|
|
|
@ -194,15 +194,19 @@ define('misc.depends', [
|
|||
$msgContainer = $container.find('.pg-panel-depends-message'),
|
||||
$gridContainer = $container.find('.pg-panel-depends-container'),
|
||||
treeHierarchy = node.getTreeNodeHierarchy(item),
|
||||
n_type = type;
|
||||
n_type = type,
|
||||
cache_flag = {
|
||||
node_type: n_type,
|
||||
url: url,
|
||||
};
|
||||
|
||||
// Avoid unnecessary reloads
|
||||
if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
|
||||
if (_.isEqual($(panel[0]).data('node-prop'), cache_flag)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache the current IDs for next time
|
||||
$(panel[0]).data('node-prop', treeHierarchy);
|
||||
$(panel[0]).data('node-prop', cache_flag);
|
||||
|
||||
// Hide the grid container and show the default message container
|
||||
if (!$gridContainer.hasClass('hidden'))
|
||||
|
@ -381,4 +385,4 @@ define('misc.depends', [
|
|||
});
|
||||
|
||||
return pgBrowser.ShowNodeDepends;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -69,24 +69,28 @@ define('misc.sql', [
|
|||
var that = this;
|
||||
this.timeout = setTimeout(
|
||||
function() {
|
||||
var sql = '';
|
||||
var sql = '-- ' + gettext('Please select an object in the tree view.');
|
||||
if (node) {
|
||||
sql = '-- ' + gettext('No SQL could be generated for the selected object.');
|
||||
var n_type = data._type,
|
||||
treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||
url = node.generate_url(item, 'sql', data, true),
|
||||
treeHierarchy = node.getTreeNodeHierarchy(item),
|
||||
cache_flag = {
|
||||
node_type: n_type,
|
||||
url: url,
|
||||
};
|
||||
|
||||
// Avoid unnecessary reloads
|
||||
if (_.isEqual($(that.sqlPanels[0]).data('node-prop'), treeHierarchy)) {
|
||||
if (_.isEqual($(that.sqlPanels[0]).data('node-prop'), cache_flag)) {
|
||||
return;
|
||||
}
|
||||
// Cache the current IDs for next time
|
||||
$(that.sqlPanels[0]).data('node-prop', treeHierarchy);
|
||||
$(that.sqlPanels[0]).data('node-prop', cache_flag);
|
||||
|
||||
if (node.hasSQL) {
|
||||
|
||||
sql = '';
|
||||
var url = node.generate_url(item, 'sql', data, true),
|
||||
timer;
|
||||
var timer;
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
|
@ -153,4 +157,4 @@ define('misc.sql', [
|
|||
});
|
||||
|
||||
return pgBrowser.ShowNodeSQL;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue