mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1. Replace the current layout library wcDocker with ReactJS based rc-dock. #6479 2. Have close buttons on individual panel tabs instead of common. #2821 3. Changes in the context menu on panel tabs - Add close, close all and close others menu items. #5394 4. Allow closing all the tabs, including SQL and Properties. #4733 5. Changes in docking behaviour of different tabs based on user requests and remove lock layout menu. 6. Fix an issue where the scroll position of panels was not remembered on Firefox. #2986 7. Reset layout now will not require page refresh and is done spontaneously. 8. Use the zustand store for storing preferences instead of plain JS objects. This will help reflecting preferences immediately. 9. The above fix incorrect format (no indent) of SQL stored functions/procedures. #6720 10. New version check is moved to an async request now instead of app start to improve startup performance. 11. Remove jQuery and Bootstrap completely. 12. Replace jasmine and karma test runner with jest. Migrate all the JS test cases to jest. This will save time in writing and debugging JS tests. 13. Other important code improvements and cleanup.
128 lines
4.4 KiB
JavaScript
128 lines
4.4 KiB
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
import _ from 'lodash';
|
|
|
|
define([
|
|
'sources/gettext', 'sources/pgadmin',
|
|
'sources/browser/generate_url',
|
|
'pgadmin.browser.node',
|
|
], function(gettext, pgAdmin, generateUrl) {
|
|
|
|
let pgBrowser = pgAdmin.Browser = pgAdmin.Browser || {};
|
|
|
|
// It has already been defined.
|
|
// Avoid running this script again.
|
|
if (pgBrowser.Collection)
|
|
return pgBrowser.Collection;
|
|
|
|
pgBrowser.Collection = function() {/*This is intentional (SonarQube)*/};
|
|
|
|
_.extend(
|
|
pgBrowser.Collection,
|
|
_.clone(pgBrowser.Node), {
|
|
///////
|
|
// Initialization function
|
|
// Generally - used to register the menus for this type of node.
|
|
//
|
|
// Also, look at pgAdmin.Browser.add_menus(...) function.
|
|
//
|
|
// Collection will not have 'Properties' menu.
|
|
//
|
|
// NOTE: Override this for each node for initialization purpose
|
|
Init: function() {
|
|
if (this.node_initialized)
|
|
return;
|
|
this.node_initialized = true;
|
|
|
|
pgAdmin.Browser.add_menus([{
|
|
name: 'refresh', node: this.type, module: this,
|
|
applies: ['object', 'context'], callback: 'refresh',
|
|
priority: 2, label: gettext('Refresh'),
|
|
}]);
|
|
|
|
// show query tool only in context menu of supported nodes.
|
|
if (pgAdmin.unsupported_nodes && _.indexOf(pgAdmin.unsupported_nodes, this.type) == -1) {
|
|
if ((this.type == 'database' && this.allowConn) || this.type != 'database') {
|
|
pgAdmin.Browser.add_menus([{
|
|
name: 'show_query_tool', node: this.type, module: this,
|
|
applies: ['context'], callback: 'show_query_tool',
|
|
priority: 998, label: gettext('Query Tool'),
|
|
}]);
|
|
|
|
// show search objects same as query tool
|
|
pgAdmin.Browser.add_menus([{
|
|
name: 'search_objects', node: this.type, module: this,
|
|
applies: ['context'], callback: 'show_search_objects',
|
|
priority: 997, label: gettext('Search Objects...'),
|
|
}]);
|
|
|
|
// show psql tool same as query tool.
|
|
if(pgAdmin['enable_psql']) {
|
|
pgAdmin.Browser.add_menus([{
|
|
name: 'show_psql_tool', node: this.type, module: this,
|
|
applies: ['context'], callback: 'show_psql_tool',
|
|
priority: 998, label: gettext('PSQL Tool'),
|
|
}]);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
hasId: false,
|
|
is_collection: true,
|
|
collection_node: true,
|
|
// A collection will always have a collection of statistics, when the node
|
|
// it represent will have some statistics.
|
|
hasCollectiveStatistics: true,
|
|
canDrop: true,
|
|
canDropCascade: true,
|
|
selectParentNodeOnDelete: false,
|
|
generate_url: function(item, type) {
|
|
/*
|
|
* Using list, and collection functions of a node to get the nodes
|
|
* under the collection, and properties of the collection respectively.
|
|
*/
|
|
let opURL = {
|
|
'properties': 'obj',
|
|
'children': 'nodes',
|
|
'drop': 'obj',
|
|
},
|
|
self = this;
|
|
let collectionPickFunction = function (treeInfoValue, treeInfoKey) {
|
|
return (treeInfoKey != self.type);
|
|
};
|
|
let treeInfo = pgBrowser.tree.getTreeNodeHierarchy(item);
|
|
let actionType = type in opURL ? opURL[type] : type;
|
|
return generateUrl.generate_url(
|
|
pgAdmin.Browser.URL, treeInfo, actionType, self.node,
|
|
collectionPickFunction
|
|
);
|
|
},
|
|
show_query_tool: function() {
|
|
if(pgAdmin.Tools.SQLEditor) {
|
|
pgAdmin.Tools.SQLEditor.showQueryTool('', pgAdmin.Browser.tree.selected());
|
|
}
|
|
},
|
|
show_search_objects: function() {
|
|
if(pgAdmin.Tools.SearchObjects) {
|
|
pgAdmin.Tools.SearchObjects.show_search_objects('', pgAdmin.Browser.tree.selected());
|
|
}
|
|
},
|
|
show_psql_tool: function(args) {
|
|
let input = args || {},
|
|
t = pgBrowser.tree,
|
|
i = input.item || t.selected(),
|
|
d = i ? t.itemData(i) : undefined;
|
|
pgBrowser.psql.psql_tool(d, i, true);
|
|
},
|
|
});
|
|
|
|
return pgBrowser.Collection;
|
|
});
|