Fixed an issue with the properties tab not getting updated if the user updates the selected node. #6158

This commit is contained in:
Nikhil Mohite 2023-04-24 14:54:52 +05:30 committed by GitHub
parent 39a0f46159
commit 625508e32a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 5 deletions

View File

@ -18,6 +18,7 @@ import { Search } from './quick_search/trigger_search';
import { send_heartbeat, stop_heartbeat } from './heartbeat';
import getApiInstance from '../../../static/js/api_instance';
import { copyToClipboard } from '../../../static/js/clipboard';
import { TAB_CHANGE } from './constants';
define('pgadmin.browser', [
'sources/gettext', 'sources/url_for', 'jquery',
@ -64,7 +65,7 @@ define('pgadmin.browser', [
if (d && obj.Nodes[d._type].callbacks['selected'] &&
_.isFunction(obj.Nodes[d._type].callbacks['selected'])) {
return obj.Nodes[d._type].callbacks['selected'].apply(
obj.Nodes[d._type], [i, d, obj]);
obj.Nodes[d._type], [i, d, obj, [], '', TAB_CHANGE]);
}
}
};

View File

@ -0,0 +1,2 @@
export const TAB_CHANGE = 'TAB_CHANGE';

View File

@ -11,6 +11,8 @@ import {getNodeView, removeNodeView} from './node_view';
import Notify from '../../../static/js/helpers/Notifier';
import _ from 'lodash';
import getApiInstance from '../../../static/js/api_instance';
import { removePanelView } from './panel_view';
import { TAB_CHANGE } from './constants';
define('pgadmin.browser.node', [
'sources/gettext', 'sources/pgadmin',
@ -857,7 +859,7 @@ define('pgadmin.browser.node', [
pgBrowser.Node.callbacks.change_server_background(item, data);
},
// Callback called - when a node is selected in browser tree.
selected: function(item, data, browser) {
selected: function(item, data, browser, _argsList, _event, actionSource) {
// Show the information about the selected node in the below panels,
// which are visible at this time:
// + Properties
@ -873,12 +875,24 @@ define('pgadmin.browser.node', [
pgAdmin.Browser.enable_disable_menus.apply(b, [item]);
if (d && b) {
if ('properties' in b.panels &&
b.panels['properties'] &&
b.panels['properties'].panel &&
b.panels['properties'].panel.isVisible()) {
this.showProperties(item, d, b.panels['properties'].panel);
b.panels['properties'].panel) {
if (actionSource != TAB_CHANGE) {
const propertiesPanel = b.panels['properties'].panel.$container.find('.obj_properties').first();
if (propertiesPanel) {
removePanelView(propertiesPanel[0]);
}
}
if (b.panels['properties'].panel.isVisible()) {
this.showProperties(item, d, b.panels['properties'].panel);
}
}
}
pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state',