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,
|
cache: false,
|
||||||
success: function() {
|
success: function() {
|
||||||
onSaveFunc.call();
|
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) {
|
error: function(m, jqxhr) {
|
||||||
Alertify.pgNotifier(
|
Alertify.pgNotifier(
|
||||||
|
|
|
||||||
|
|
@ -185,20 +185,12 @@ define(
|
||||||
n_type = type;
|
n_type = type;
|
||||||
|
|
||||||
// Avoid unnecessary reloads
|
// Avoid unnecessary reloads
|
||||||
if (_.isUndefined(treeHierarchy[n_type]) ||
|
if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
|
||||||
_.isUndefined(treeHierarchy[n_type]._id)) {
|
|
||||||
n_value = -1;
|
|
||||||
} else {
|
|
||||||
n_value = treeHierarchy[n_type]._id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n_value == $(panel[0]).data(n_type)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache the current IDs for next time
|
// 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
|
// Hide the grid container and show the default message container
|
||||||
if (!$gridContainer.hasClass('hidden'))
|
if (!$gridContainer.hasClass('hidden'))
|
||||||
|
|
|
||||||
|
|
@ -59,27 +59,19 @@ function(_, $, pgBrowser) {
|
||||||
var sql = '';
|
var sql = '';
|
||||||
if (node) {
|
if (node) {
|
||||||
sql = '-- ' + pgBrowser.messages.NODE_HAS_NO_SQL;
|
sql = '-- ' + pgBrowser.messages.NODE_HAS_NO_SQL;
|
||||||
if (node.hasSQL) {
|
|
||||||
|
|
||||||
var self = this,
|
var self = this,
|
||||||
n_type = data._type,
|
n_type = data._type,
|
||||||
n_value = -1,
|
n_value = -1,
|
||||||
treeHierarchy = node.getTreeNodeHierarchy(item);
|
treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||||
|
|
||||||
// Avoid unnecessary reloads
|
// Avoid unnecessary reloads
|
||||||
if (_.isUndefined(treeHierarchy[n_type]) ||
|
if (_.isEqual($(this.sqlPanels[0]).data('node-prop'), treeHierarchy)) {
|
||||||
_.isUndefined(treeHierarchy[n_type]._id)) {
|
|
||||||
n_value = -1;
|
|
||||||
} else {
|
|
||||||
n_value = treeHierarchy[n_type]._id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n_value == $(sqlPanels[0]).data(n_type)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache the current IDs for next time
|
// Cache the current IDs for next time
|
||||||
$(this.sqlPanels[0]).data(n_type, n_value);
|
$(this.sqlPanels[0]).data('node-prop', treeHierarchy);
|
||||||
|
|
||||||
|
if (node.hasSQL) {
|
||||||
|
|
||||||
sql = '';
|
sql = '';
|
||||||
var url = node.generate_url(item, 'sql', data, true);
|
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
|
/* We fetch the statistics only for those node who set the parameter
|
||||||
* showStatistics function.
|
* showStatistics function.
|
||||||
*/
|
*/
|
||||||
if (node.hasStatistics) {
|
|
||||||
|
|
||||||
// Avoid unnecessary reloads
|
// Avoid unnecessary reloads
|
||||||
var treeHierarchy = node.getTreeNodeHierarchy(item);
|
var treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||||
if (_.isUndefined(treeHierarchy[n_type]) ||
|
if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
|
||||||
_.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)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache the current IDs for next time
|
// 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
|
/* Set the message because ajax request may take time to
|
||||||
* fetch the information from the server.
|
* fetch the information from the server.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue