Ensure ajax requests are sent on second click of an object. Fixes #1462
parent
417af3676d
commit
419ead9121
|
|
@ -1034,6 +1034,24 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
|
|||
cache: false,
|
||||
success: function() {
|
||||
onSaveFunc.call();
|
||||
// Removing the node-prop property of panel
|
||||
// so that we show updated data on panel
|
||||
var pnlProperties = pgBrowser.docker.findPanels('properties')[0],
|
||||
pnlSql = pgBrowser.docker.findPanels('sql')[0],
|
||||
pnlStats = pgBrowser.docker.findPanels('statistics')[0],
|
||||
pnlDependencies = pgBrowser.docker.findPanels('dependencies')[0],
|
||||
pnlDependents = pgBrowser.docker.findPanels('dependents')[0];
|
||||
|
||||
if(pnlProperties)
|
||||
$(pnlProperties).removeData('node-prop');
|
||||
if(pnlSql)
|
||||
$(pnlSql).removeData('node-prop');
|
||||
if(pnlStats)
|
||||
$(pnlStats).removeData('node-prop');
|
||||
if(pnlDependencies)
|
||||
$(pnlDependencies).removeData('node-prop');
|
||||
if(pnlDependents)
|
||||
$(pnlDependents).removeData('node-prop');
|
||||
},
|
||||
error: function(m, jqxhr) {
|
||||
Alertify.pgNotifier(
|
||||
|
|
|
|||
|
|
@ -185,20 +185,12 @@ define(
|
|||
n_type = type;
|
||||
|
||||
// Avoid unnecessary reloads
|
||||
if (_.isUndefined(treeHierarchy[n_type]) ||
|
||||
_.isUndefined(treeHierarchy[n_type]._id)) {
|
||||
n_value = -1;
|
||||
} else {
|
||||
n_value = treeHierarchy[n_type]._id;
|
||||
}
|
||||
|
||||
if (n_value == $(panel[0]).data(n_type)) {
|
||||
if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache the current IDs for next time
|
||||
$(panel[0]).data(n_type, n_value);
|
||||
|
||||
$(panel[0]).data('node-prop', treeHierarchy);
|
||||
|
||||
// Hide the grid container and show the default message container
|
||||
if (!$gridContainer.hasClass('hidden'))
|
||||
|
|
|
|||
|
|
@ -59,28 +59,20 @@ function(_, $, pgBrowser) {
|
|||
var sql = '';
|
||||
if (node) {
|
||||
sql = '-- ' + pgBrowser.messages.NODE_HAS_NO_SQL;
|
||||
var self = this,
|
||||
n_type = data._type,
|
||||
n_value = -1,
|
||||
treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||
|
||||
// Avoid unnecessary reloads
|
||||
if (_.isEqual($(this.sqlPanels[0]).data('node-prop'), treeHierarchy)) {
|
||||
return;
|
||||
}
|
||||
// Cache the current IDs for next time
|
||||
$(this.sqlPanels[0]).data('node-prop', treeHierarchy);
|
||||
|
||||
if (node.hasSQL) {
|
||||
|
||||
var self = this,
|
||||
n_type = data._type,
|
||||
n_value = -1,
|
||||
treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||
|
||||
// Avoid unnecessary reloads
|
||||
if (_.isUndefined(treeHierarchy[n_type]) ||
|
||||
_.isUndefined(treeHierarchy[n_type]._id)) {
|
||||
n_value = -1;
|
||||
} else {
|
||||
n_value = treeHierarchy[n_type]._id;
|
||||
}
|
||||
|
||||
if (n_value == $(sqlPanels[0]).data(n_type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache the current IDs for next time
|
||||
$(this.sqlPanels[0]).data(n_type, n_value);
|
||||
|
||||
sql = '';
|
||||
var url = node.generate_url(item, 'sql', data, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -154,25 +154,16 @@ function(_, $, pgBrowser, Backgrid) {
|
|||
/* We fetch the statistics only for those node who set the parameter
|
||||
* showStatistics function.
|
||||
*/
|
||||
if (node.hasStatistics) {
|
||||
|
||||
// Avoid unnecessary reloads
|
||||
var treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||
if (_.isUndefined(treeHierarchy[n_type]) ||
|
||||
_.isUndefined(treeHierarchy[n_type]._id)) {
|
||||
n_value = undefined,
|
||||
n_value = -1;
|
||||
} else {
|
||||
n_value = treeHierarchy[n_type]._id;
|
||||
}
|
||||
|
||||
if (n_value == $(this.panel[0]).data(n_type)) {
|
||||
if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache the current IDs for next time
|
||||
$(this.panel[0]).data(n_type, n_value);
|
||||
$(panel[0]).data('node-prop', treeHierarchy);
|
||||
|
||||
if (node.hasStatistics) {
|
||||
/* Set the message because ajax request may take time to
|
||||
* fetch the information from the server.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue