mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-23 07:34:35 -06:00
Ensure that refreshing a node also updates the Property list. Fixes #3461
This commit is contained in:
parent
ffd41009ea
commit
008359ad3a
@ -16,4 +16,5 @@ Bug fixes
|
||||
*********
|
||||
|
||||
| `Bug #3407 <https://redmine.postgresql.org/issues/3407>`_ - Fix keyboard shortcuts layout in the preferences panel.
|
||||
| `Bug #3461 <https://redmine.postgresql.org/issues/3461>`_ - Ensure that refreshing a node also updates the Property list.
|
||||
| `Bug #3528 <https://redmine.postgresql.org/issues/3528>`_ - Handle connection errors properly in the query tool.
|
||||
|
@ -1494,6 +1494,8 @@ define('pgadmin.browser', [
|
||||
isOpen,
|
||||
idx = -1;
|
||||
|
||||
this.Events.trigger('pgadmin-browser:tree:refreshing', _i, d, n);
|
||||
|
||||
if (!n) {
|
||||
_i = null;
|
||||
ctx.i = null;
|
||||
|
@ -903,34 +903,6 @@ define('pgadmin.browser.node', [
|
||||
// is active).
|
||||
this.showProperties(item, d, b.panels['properties'].panel);
|
||||
}
|
||||
if ('sql' in b.panels &&
|
||||
b.panels['sql'] &&
|
||||
b.panels['sql'].panel &&
|
||||
b.panels['sql'].panel.isVisible()) {
|
||||
// TODO:: Show reverse engineered query for this object (when 'sql'
|
||||
// tab is active.)
|
||||
}
|
||||
if ('statistics' in b.panels &&
|
||||
b.panels['statistics'] &&
|
||||
b.panels['statistics'].panel &&
|
||||
b.panels['statistics'].panel.isVisible()) {
|
||||
// TODO:: Show statistics for this object (when the 'statistics'
|
||||
// tab is active.)
|
||||
}
|
||||
if ('dependencies' in b.panels &&
|
||||
b.panels['dependencies'] &&
|
||||
b.panels['dependencies'].panel &&
|
||||
b.panels['dependencies'].panel.isVisible()) {
|
||||
// TODO:: Show dependencies for this object (when the
|
||||
// 'dependencies' tab is active.)
|
||||
}
|
||||
if ('dependents' in b.panels &&
|
||||
b.panels['dependents'] &&
|
||||
b.panels['dependents'].panel &&
|
||||
b.panels['dependents'].panel.isVisible()) {
|
||||
// TODO:: Show dependents for this object (when the 'dependents'
|
||||
// tab is active.)
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -974,9 +946,17 @@ define('pgadmin.browser.node', [
|
||||
}
|
||||
},
|
||||
refresh: function(cmd, _item) {
|
||||
var self = this,
|
||||
t = pgBrowser.tree,
|
||||
data = _item && t.itemData(_item);
|
||||
|
||||
$(pgBrowser.panels['properties'].panel).removeData('node-prop');
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:browser:tree:refresh', _item || pgBrowser.tree.selected()
|
||||
);
|
||||
'pgadmin:browser:tree:refresh', _item || pgBrowser.tree.selected(), {
|
||||
success: function() {
|
||||
self.callbacks.selected.apply(self, [_item, data, pgBrowser]);
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
/**********************************************************************
|
||||
|
@ -152,6 +152,7 @@ define('misc.depends', [
|
||||
// If Dependencies panel exists and is focused then we need to listen the browser tree selection events.
|
||||
if ((dependenciesPanels[0].isVisible()) || dependenciesPanels.length != 1) {
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showDependencies);
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:refreshing', this.refreshDependencies, this);
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
@ -161,6 +162,7 @@ define('misc.depends', [
|
||||
// If Dependencies panel exists and is focused then we need to listen the browser tree selection events.
|
||||
if ((dependenciesPanels[0].isVisible()) || dependenciesPanels.length != 1) {
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showDependencies);
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:refreshing', this.refreshDependencies, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,6 +176,7 @@ define('misc.depends', [
|
||||
// If Dependents panel exists and is focused then we need to listen the browser tree selection events.
|
||||
if ((dependentsPanels[0].isVisible()) || dependentsPanels.length != 1) {
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showDependents);
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:refreshing', this.refreshDependents, this);
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
@ -183,6 +186,7 @@ define('misc.depends', [
|
||||
// If Dependents panel exists and is focused then we need to listen the browser tree selection events.
|
||||
if ((dependentsPanels[0].isVisible()) || dependentsPanels.length != 1) {
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showDependents);
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:refreshing', this.refreshDependents, this);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -297,6 +301,19 @@ define('misc.depends', [
|
||||
$msgContainer.text(msg);
|
||||
}
|
||||
},
|
||||
refreshDependents: function(item, data, node) {
|
||||
var that = this,
|
||||
cache_flag = {
|
||||
node_type: data._type,
|
||||
url: node.generate_url(item, 'dependent', data, true),
|
||||
};
|
||||
|
||||
if (_.isEqual($(that.dependentsPanels[0]).data('node-prop'), cache_flag)) {
|
||||
// Reset the current item selection
|
||||
$(that.dependentsPanels[0]).data('node-prop', '');
|
||||
that.showDependents(item, data, node);
|
||||
}
|
||||
},
|
||||
showDependents: function(item, data, node) {
|
||||
/**
|
||||
* We can't start fetching the Dependents immediately, it is possible the user
|
||||
@ -333,10 +350,25 @@ define('misc.depends', [
|
||||
|
||||
// We will start listening the tree selection event.
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:selected', pgBrowser.ShowNodeDepends.showDependents);
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:refreshing', pgBrowser.ShowNodeDepends.refreshDependents, this);
|
||||
} else {
|
||||
|
||||
// We don't need to listen the tree item selection event.
|
||||
pgBrowser.Events.off('pgadmin-browser:tree:selected', pgBrowser.ShowNodeDepends.showDependents);
|
||||
pgBrowser.Events.off('pgadmin-browser:tree:refreshing', pgBrowser.ShowNodeDepends.refreshDependents, this);
|
||||
}
|
||||
},
|
||||
refreshDependencies: function(item, data, node) {
|
||||
var that = this,
|
||||
cache_flag = {
|
||||
node_type: data._type,
|
||||
url: node.generate_url(item, 'dependency', data, true),
|
||||
};
|
||||
|
||||
if (_.isEqual($(that.dependenciesPanels[0]).data('node-prop'), cache_flag)) {
|
||||
// Reset the current item selection
|
||||
$(that.dependenciesPanels[0]).data('node-prop', '');
|
||||
that.showDependencies(item, data, node);
|
||||
}
|
||||
},
|
||||
showDependencies: function(item, data, node) {
|
||||
@ -377,9 +409,11 @@ define('misc.depends', [
|
||||
|
||||
// We will start listening the tree selection event.
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:selected', pgBrowser.ShowNodeDepends.showDependencies);
|
||||
pgBrowser.Events.on('pgadmin-browser:tree:refreshing', pgBrowser.ShowNodeDepends.refreshDependencies, this);
|
||||
} else {
|
||||
// We don't need to listen the tree item selection event.
|
||||
pgBrowser.Events.off('pgadmin-browser:tree:selected', pgBrowser.ShowNodeDepends.showDependencies);
|
||||
pgBrowser.Events.off('pgadmin-browser:tree:refreshing', pgBrowser.ShowNodeDepends.refreshDependencies, this);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -164,6 +164,9 @@ define('misc.statistics', [
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin-browser:tree:selected', this.showStatistics
|
||||
);
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin-browser:tree:refreshing', this.refreshStatistics, this
|
||||
);
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
@ -173,12 +176,18 @@ define('misc.statistics', [
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin-browser:tree:selected', this.showStatistics
|
||||
);
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin-browser:tree:refreshing', this.refreshStatistics, this
|
||||
);
|
||||
}
|
||||
}
|
||||
if (self.panel.length > 0 && self.panel[0].isVisible()) {
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin-browser:tree:selected', this.showStatistics
|
||||
);
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin-browser:tree:refreshing', this.refreshStatistics, this
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
@ -300,7 +309,19 @@ define('misc.statistics', [
|
||||
$msgContainer.text(msg);
|
||||
}
|
||||
},
|
||||
refreshStatistics: function(item, data, node) {
|
||||
var that = this,
|
||||
cache_flag = {
|
||||
node_type: data._type,
|
||||
url: node.generate_url(item, 'stats', data, true),
|
||||
};
|
||||
|
||||
if (_.isEqual($(that.panel[0]).data('node-prop'), cache_flag)) {
|
||||
// Reset the current item selection
|
||||
$(that.panel[0]).data('node-prop', '');
|
||||
that.showStatistics(item, data, node);
|
||||
}
|
||||
},
|
||||
showStatistics: function(item, data, node) {
|
||||
var self = this;
|
||||
if (!node) {
|
||||
@ -395,12 +416,22 @@ define('misc.statistics', [
|
||||
'pgadmin-browser:tree:selected',
|
||||
pgBrowser.NodeStatistics.showStatistics
|
||||
);
|
||||
pgBrowser.Events.on(
|
||||
'pgadmin-browser:tree:refreshing',
|
||||
pgBrowser.NodeStatistics.refreshStatistics,
|
||||
this
|
||||
);
|
||||
} else {
|
||||
// We don't need to listen the tree item selection event.
|
||||
pgBrowser.Events.off(
|
||||
'pgadmin-browser:tree:selected',
|
||||
pgBrowser.NodeStatistics.showStatistics
|
||||
);
|
||||
pgBrowser.Events.off(
|
||||
'pgadmin-browser:tree:refreshing',
|
||||
pgBrowser.NodeStatistics.refreshStatistics,
|
||||
this
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user