mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Make Statistics, Dependencies, Dependants tabs closable and the user can add them back using the 'Add panel' option. Fixes #5091
This commit is contained in:
committed by
Akshay Joshi
parent
18f055fa5e
commit
73b6b95fbc
@@ -251,8 +251,9 @@ define('pgadmin.browser', [
|
||||
title: gettext('Statistics'),
|
||||
icon: '',
|
||||
width: 500,
|
||||
isCloseable: false,
|
||||
isPrivate: true,
|
||||
isCloseable: true,
|
||||
isPrivate: false,
|
||||
canHide: true,
|
||||
content: '<div class="negative-space p-2"><div role="status" class="pg-panel-message pg-panel-statistics-message">' + select_object_msg + '</div><div class="pg-panel-statistics-container d-none"></div></div>',
|
||||
events: panelEvents,
|
||||
}),
|
||||
@@ -272,8 +273,9 @@ define('pgadmin.browser', [
|
||||
title: gettext('Dependencies'),
|
||||
icon: '',
|
||||
width: 500,
|
||||
isCloseable: false,
|
||||
isPrivate: true,
|
||||
isCloseable: true,
|
||||
isPrivate: false,
|
||||
canHide: true,
|
||||
content: '<div class="negative-space p-2"><div role="status" class="pg-panel-message pg-panel-depends-message">' + select_object_msg + '</div><div class="pg-panel-dependencies-container d-none"></div></div>',
|
||||
events: panelEvents,
|
||||
}),
|
||||
@@ -283,8 +285,9 @@ define('pgadmin.browser', [
|
||||
title: gettext('Dependents'),
|
||||
icon: '',
|
||||
width: 500,
|
||||
isCloseable: false,
|
||||
isPrivate: true,
|
||||
isCloseable: true,
|
||||
isPrivate: false,
|
||||
canHide: true,
|
||||
content: '<div class="negative-space p-2"><div role="status" class="pg-panel-message pg-panel-depends-message">' + select_object_msg + '</div><div class="pg-panel-dependents-container d-none"></div></div>',
|
||||
events: panelEvents,
|
||||
}),
|
||||
|
||||
@@ -183,26 +183,26 @@ define(
|
||||
}
|
||||
},
|
||||
handleVisibility: function(eventName) {
|
||||
// Currently this function only works with dashboard panel but
|
||||
// as per need it can be extended
|
||||
if (this._type != 'dashboard' || _.isUndefined(pgAdmin.Dashboard))
|
||||
// Supported modules
|
||||
let type_module = {
|
||||
'dashboard': pgAdmin.Dashboard,
|
||||
'statistics': pgBrowser.NodeStatistics,
|
||||
'dependencies': pgBrowser.NodeDependencies,
|
||||
'dependents': pgBrowser.NodeDependents,
|
||||
};
|
||||
|
||||
let module = type_module[this._type];
|
||||
if(_.isUndefined(module))
|
||||
return;
|
||||
|
||||
if(_.isUndefined(module.toggleVisibility))
|
||||
return;
|
||||
|
||||
if (eventName == 'panelClosed') {
|
||||
/* Pass the closed flag also */
|
||||
pgAdmin.Dashboard.toggleVisibility(false, true);
|
||||
module.toggleVisibility.call(module, [false, true]);
|
||||
} else if (eventName == 'panelVisibilityChanged') {
|
||||
if (pgBrowser.tree) {
|
||||
var selectedNode = pgBrowser.tree.selected();
|
||||
if (!_.isUndefined(pgAdmin.Dashboard)) {
|
||||
pgAdmin.Dashboard.toggleVisibility(pgBrowser.panels.dashboard.panel.isVisible());
|
||||
}
|
||||
// Explicitly trigger tree selected event when we add the tab.
|
||||
if(selectedNode.length) {
|
||||
pgBrowser.Events.trigger('pgadmin-browser:tree:selected', selectedNode,
|
||||
pgBrowser.tree.itemData(selectedNode), pgBrowser.Node);
|
||||
}
|
||||
}
|
||||
module.toggleVisibility.call(module, [pgBrowser.docker.findPanels(this._type)[0].isVisible()]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user