Rearrange tools menu on the basis of usability and form groups of similar sub-menus.

This commit is contained in:
Akshay Joshi 2021-12-16 18:29:44 +05:30
parent 8cfdfd898d
commit 92a997b16a
16 changed files with 77 additions and 64 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -96,40 +96,40 @@ Use the *Tools* menu to access the following options (in alphabetical order):
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| Option | Action | | Option | Action |
+===========================+===========================================================================================================================================+ +===========================+===========================================================================================================================================+
| *Add named restore point* | Click to open the :ref:`Add named restore point... <add_restore_point_dialog>` dialog to take a point-in-time snapshot of the current | | *ERD Tool* | Click to open the :ref:`ERD Tool <erd_tool>` and start designing your database. |
| | server state. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Backup...* | Click to open the :ref:`Backup... <backup_dialog>` dialog to backup database objects. | | *Grant Wizard...* | Click to access the :ref:`Grant Wizard <grant_wizard>` tool. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *PSQL Tool* | Click to open the :ref:`PSQL Tool <psql_tool>` and start PSQL in the current database context. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Query tool* | Click to open the :ref:`Query tool <query_tool>` for the currently selected object. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Schema Diff* | Click to open the :ref:`Schema Diff <schema_diff_feature>` and start comparing two database or two schema. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Backup Globals...* | Click to open the :ref:`Backup Globals... <backup_globals_dialog>` dialog to backup cluster objects. | | *Backup Globals...* | Click to open the :ref:`Backup Globals... <backup_globals_dialog>` dialog to backup cluster objects. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Backup Server...* | Click to open the :ref:`Backup Server... <backup_server_dialog>` dialog to backup a server. | | *Backup Server...* | Click to open the :ref:`Backup Server... <backup_server_dialog>` dialog to backup a server. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Grant Wizard...* | Click to access the :ref:`Grant Wizard <grant_wizard>` tool. | | *Backup...* | Click to open the :ref:`Backup... <backup_dialog>` dialog to backup database objects. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Import/Export...* | Click to open the :ref:`Import/Export data... <import_export_data>` dialog to import or export data from a table. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Maintenance...* | Click to open the :ref:`Maintenance... <maintenance_dialog>` dialog to VACUUM, ANALYZE, REINDEX, or CLUSTER. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Pause replay of WAL* | Click to pause the replay of the WAL log. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Query tool* | Click to open the :ref:`Query tool <query_tool>` for the currently selected object. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Reload Configuration...* | Click to update configuration files without restarting the server. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Restore...* | Click to access the :ref:`Restore <restore_dialog>` dialog to restore database files from a backup. | | *Restore...* | Click to access the :ref:`Restore <restore_dialog>` dialog to restore database files from a backup. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Resume replay of WAL* | Click to resume the replay of the WAL log. | | *Import/Export Data...* | Click to open the :ref:`Import/Export data... <import_export_data>` dialog to import or export data from a table. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Storage Manager* | Click to open the :ref:`Storage Manager <storage_manager>` to upload, delete, or download the backup files. | | *Maintenance...* | Click to open the :ref:`Maintenance... <maintenance_dialog>` dialog to VACUUM, ANALYZE, REINDEX, or CLUSTER. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *New ERD Project* | Click to open the :ref:`ERD Tool <erd_tool>` and start designing your database. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Schema Diff* | Click to open the :ref:`Schema Diff <schema_diff_feature>` and start comparing two database or two schema. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Search Objects...* | Click to open the :ref:`Search Objects... <search_objects>` and start searching any kind of objects in a database. | | *Search Objects...* | Click to open the :ref:`Search Objects... <search_objects>` and start searching any kind of objects in a database. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *PSQL Tool* | Click to open the :ref:`PSQL Tool <psql_tool>` and start PSQL in the current database context. | | *Add named restore point* | Click to open the :ref:`Add named restore point... <add_restore_point_dialog>` dialog to take a point-in-time snapshot of the current |
| | server state. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Pause replay of WAL* | Click to pause the replay of the WAL log. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Resume replay of WAL* | Click to resume the replay of the WAL log. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Reload Configuration...* | Click to update configuration files without restarting the server. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| *Storage Manager* | Click to open the :ref:`Storage Manager <storage_manager>` to upload, delete, or download the backup files. |
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
The Help Menu The Help Menu

View File

@ -105,14 +105,14 @@ define('pgadmin.node.server', [
{ {
name: 'reload_configuration', node: 'server', module: this, name: 'reload_configuration', node: 'server', module: this,
applies: ['tools', 'context'], callback: 'reload_configuration', applies: ['tools', 'context'], callback: 'reload_configuration',
category: 'reload', priority: 6, label: gettext('Reload Configuration'), category: 'reload', priority: 10, label: gettext('Reload Configuration'),
icon: 'fa fa-redo-alt', enable : 'enable_reload_config',data: { icon: 'fa fa-redo-alt', enable : 'enable_reload_config',data: {
data_disabled: gettext('Please select a server from the browser tree to reload the configuration files.'), data_disabled: gettext('Please select a server from the browser tree to reload the configuration files.'),
}, },
},{ },{
name: 'restore_point', node: 'server', module: this, name: 'restore_point', node: 'server', module: this,
applies: ['tools', 'context'], callback: 'restore_point', applies: ['tools', 'context'], callback: 'restore_point',
category: 'restore', priority: 9, label: gettext('Add Named Restore Point...'), category: 'restore', priority: 7, label: gettext('Add Named Restore Point...'),
icon: 'fa fa-anchor', enable : 'is_applicable',data: { icon: 'fa fa-anchor', enable : 'is_applicable',data: {
data_disabled: gettext('Please select any server from the browser tree to Add Named Restore Point.'), data_disabled: gettext('Please select any server from the browser tree to Add Named Restore Point.'),
}, },
@ -126,14 +126,14 @@ define('pgadmin.node.server', [
},{ },{
name: 'wal_replay_pause', node: 'server', module: this, name: 'wal_replay_pause', node: 'server', module: this,
applies: ['tools', 'context'], callback: 'pause_wal_replay', applies: ['tools', 'context'], callback: 'pause_wal_replay',
category: 'wal_replay_pause', priority: 7, label: gettext('Pause Replay of WAL'), category: 'wal_replay_pause', priority: 8, label: gettext('Pause Replay of WAL'),
icon: 'fa fa-pause-circle', enable : 'wal_pause_enabled',data: { icon: 'fa fa-pause-circle', enable : 'wal_pause_enabled',data: {
data_disabled: gettext('Please select a connected database as a Super user and run in Recovery mode to Pause Replay of WAL.'), data_disabled: gettext('Please select a connected database as a Super user and run in Recovery mode to Pause Replay of WAL.'),
}, },
},{ },{
name: 'wal_replay_resume', node: 'server', module: this, name: 'wal_replay_resume', node: 'server', module: this,
applies: ['tools', 'context'], callback: 'resume_wal_replay', applies: ['tools', 'context'], callback: 'resume_wal_replay',
category: 'wal_replay_resume', priority: 8, label: gettext('Resume Replay of WAL'), category: 'wal_replay_resume', priority: 9, label: gettext('Resume Replay of WAL'),
icon: 'fa fa-play-circle', enable : 'wal_resume_enabled',data: { icon: 'fa fa-play-circle', enable : 'wal_resume_enabled',data: {
data_disabled: gettext('Please select a connected database as a Super user and run in Recovery mode to Resume Replay of WAL.'), data_disabled: gettext('Please select a connected database as a Super user and run in Recovery mode to Resume Replay of WAL.'),
}, },

View File

@ -498,7 +498,7 @@ define('pgadmin.browser.node', [
return null; return null;
}, },
addUtilityPanel: function() { addUtilityPanel: function(width, height) {
var body = window.document.body, var body = window.document.body,
el = document.createElement('div'); el = document.createElement('div');
@ -506,10 +506,10 @@ define('pgadmin.browser.node', [
var new_panel = pgBrowser.docker.addPanel( var new_panel = pgBrowser.docker.addPanel(
'utility_props', window.wcDocker.DOCK.FLOAT, undefined, { 'utility_props', window.wcDocker.DOCK.FLOAT, undefined, {
w: (screen.width < 700 ? w: (!_.isUndefined(width) && !_.isNull(width)) ? width :
screen.width * 0.95 : screen.width * 0.5), (screen.width < 700 ? screen.width * 0.95 : screen.width * 0.5),
h: (screen.height < 500 ? h: (!_.isUndefined(height) && !_.isNull(height)) ? height :
screen.height * 0.95 : screen.height * 0.5), (screen.height < 500 ? screen.height * 0.95 : screen.height * 0.5),
x: (screen.width < 700 ? '2%' : '25%'), x: (screen.width < 700 ? '2%' : '25%'),
y: (screen.height < 500 ? '2%' : '25%'), y: (screen.height < 500 ? '2%' : '25%'),
} }

View File

@ -14,14 +14,11 @@ import Notify from '../../../../static/js/helpers/Notifier';
// Backup dialog // Backup dialog
define([ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'sources/pgadmin', 'sources/gettext', 'sources/url_for', 'underscore', 'pgadmin.browser',
'backbone', 'pgadmin.backgrid',
'pgadmin.backform', 'pgadmin.browser', 'sources/utils',
'tools/backup/static/js/menu_utils', 'tools/backup/static/js/menu_utils',
'sources/nodes/supported_database_node', 'sources/nodes/supported_database_node',
], function( ], function(
gettext, url_for, $, _, pgAdmin, Backbone, Backgrid, Backform, pgBrowser, gettext, url_for, _, pgBrowser, menuUtils, supportedNodes
commonUtils, menuUtils, supportedNodes
) { ) {
// if module is already initialized, refer to that. // if module is already initialized, refer to that.
@ -61,7 +58,7 @@ define([
module: this, module: this,
applies: ['tools'], applies: ['tools'],
callback: 'startBackupGlobal', callback: 'startBackupGlobal',
priority: 12, priority: 2,
label: gettext('Backup Globals...'), label: gettext('Backup Globals...'),
icon: 'fa fa-save', icon: 'fa fa-save',
enable: menuUtils.menuEnabledServer, enable: menuUtils.menuEnabledServer,
@ -73,7 +70,7 @@ define([
module: this, module: this,
applies: ['tools'], applies: ['tools'],
callback: 'startBackupServer', callback: 'startBackupServer',
priority: 12, priority: 2,
label: gettext('Backup Server...'), label: gettext('Backup Server...'),
icon: 'fa fa-save', icon: 'fa fa-save',
enable: menuUtils.menuEnabledServer, enable: menuUtils.menuEnabledServer,
@ -86,7 +83,7 @@ define([
node: 'server', node: 'server',
applies: ['context'], applies: ['context'],
callback: 'startBackupGlobal', callback: 'startBackupGlobal',
priority: 12, priority: 2,
label: gettext('Backup Globals...'), label: gettext('Backup Globals...'),
icon: 'fa fa-save', icon: 'fa fa-save',
enable: menuUtils.menuEnabledServer, enable: menuUtils.menuEnabledServer,
@ -99,7 +96,7 @@ define([
node: 'server', node: 'server',
applies: ['context'], applies: ['context'],
callback: 'startBackupServer', callback: 'startBackupServer',
priority: 12, priority: 2,
label: gettext('Backup Server...'), label: gettext('Backup Server...'),
icon: 'fa fa-save', icon: 'fa fa-save',
enable: menuUtils.menuEnabledServer, enable: menuUtils.menuEnabledServer,
@ -111,7 +108,7 @@ define([
module: this, module: this,
applies: ['tools'], applies: ['tools'],
callback: 'backupObjects', callback: 'backupObjects',
priority: 11, priority: 2,
label: gettext('Backup...'), label: gettext('Backup...'),
icon: 'fa fa-save', icon: 'fa fa-save',
enable: supportedNodes.enabled.bind( enable: supportedNodes.enabled.bind(
@ -129,7 +126,7 @@ define([
module: this, module: this,
applies: ['context'], applies: ['context'],
callback: 'backupObjects', callback: 'backupObjects',
priority: 11, priority: 2,
label: gettext('Backup...'), label: gettext('Backup...'),
icon: 'fa fa-save', icon: 'fa fa-save',
enable: supportedNodes.enabled.bind( enable: supportedNodes.enabled.bind(

View File

@ -1,3 +1,11 @@
/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui'; import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import { isEmptyString } from 'sources/validators'; import { isEmptyString } from 'sources/validators';

View File

@ -1,3 +1,11 @@
/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui'; import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import { isEmptyString } from 'sources/validators'; import { isEmptyString } from 'sources/validators';

View File

@ -37,7 +37,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, pgBrowser
applies: ['tools'], applies: ['tools'],
callback: 'showErdTool', callback: 'showErdTool',
priority: 1, priority: 1,
label: gettext('New ERD Project'), label: gettext('ERD Tool'),
enable: this.erdToolEnabled, enable: this.erdToolEnabled,
data: { data: {
data_disabled: gettext('The selected tree node does not support this option.'), data_disabled: gettext('The selected tree node does not support this option.'),

View File

@ -13,19 +13,19 @@ import url_for from 'sources/url_for';
import React from 'react'; import React from 'react';
import { Box } from '@material-ui/core'; import { Box } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import Wizard from '../helpers/wizard/Wizard'; import Wizard from '../../../../static/js/helpers/wizard/Wizard';
import WizardStep from '../helpers/wizard/WizardStep'; import WizardStep from '../../../../static/js/helpers/wizard/WizardStep';
import PgTable from 'sources/components/PgTable'; import PgTable from 'sources/components/PgTable';
import { getNodePrivilegeRoleSchema } from '../../../browser/server_groups/servers/static/js/privilege.ui.js'; import { getNodePrivilegeRoleSchema } from '../../../../../pgadmin/browser/server_groups/servers/static/js/privilege.ui.js';
import { InputSQL, InputText, FormFooterMessage, MESSAGE_TYPE } from './FormComponents'; import { InputSQL, InputText, FormFooterMessage, MESSAGE_TYPE } from '../../../../static/js/components/FormComponents';
import getApiInstance from '../api_instance'; import getApiInstance from '../../../../static/js/api_instance';
import SchemaView from '../SchemaView'; import SchemaView from '../../../../static/js/SchemaView';
import clsx from 'clsx'; import clsx from 'clsx';
import Loader from 'sources/components/Loader'; import Loader from 'sources/components/Loader';
import Alertify from 'pgadmin.alertifyjs'; import Alertify from 'pgadmin.alertifyjs';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import PrivilegeSchema from '../../../tools/grant_wizard/static/js/privilege_schema.ui'; import PrivilegeSchema from './privilege_schema.ui';
import Notify from '../../../static/js/helpers/Notifier'; import Notify from '../../../../static/js/helpers/Notifier';
const useStyles = makeStyles(() => const useStyles = makeStyles(() =>
({ ({

View File

@ -9,23 +9,20 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import Theme from 'sources/Theme'; import Theme from 'sources/Theme';
import GrantWizard from 'sources/components/GrantWizard'; import GrantWizard from './GrantWizard';
// Grant Wizard // Grant Wizard
define([ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone', 'sources/gettext', 'jquery', 'underscore',
'pgadmin.alertifyjs', 'pgadmin.backgrid', 'pgadmin.backform', 'pgadmin.alertifyjs', 'pgadmin.browser',
'pgadmin.browser', 'pgadmin.browser.node',
'tools/grant_wizard/static/js/menu_utils', 'tools/grant_wizard/static/js/menu_utils',
'sources/utils',
'sources/nodes/supported_database_node', 'sources/nodes/supported_database_node',
'backgrid.select.all', 'backgrid.select.all',
'backgrid.filter', 'pgadmin.browser.server.privilege', 'backgrid.filter', 'pgadmin.browser.server.privilege',
'pgadmin.browser.wizard', 'pgadmin.browser.wizard',
], function( ], function(
gettext, url_for, $, _, Backbone, Alertify, Backgrid, Backform, pgBrowser, gettext, $, _, Alertify, pgBrowser, menuUtils, supportedNodes
pgNode, menuUtils, commonUtils, supportedNodes
) { ) {
// if module is already initialized, refer to that. // if module is already initialized, refer to that.
@ -48,7 +45,7 @@ define([
module: this, module: this,
applies: ['tools'], applies: ['tools'],
callback: 'start_grant_wizard', callback: 'start_grant_wizard',
priority: 14, priority: 1,
label: gettext('Grant Wizard...'), label: gettext('Grant Wizard...'),
icon: 'fa fa-unlock', icon: 'fa fa-unlock',
enable: supportedNodes.enabled.bind( enable: supportedNodes.enabled.bind(

View File

@ -408,8 +408,8 @@ define([
applies: ['tools', 'context'], applies: ['tools', 'context'],
callback: 'callback_import_export', callback: 'callback_import_export',
category: 'import', category: 'import',
priority: 10, priority: 3,
label: gettext('Import/Export...'), label: gettext('Import/Export Data...'),
icon: 'fa fa-shopping-cart', icon: 'fa fa-shopping-cart',
enable: supportedNodes.enabled.bind( enable: supportedNodes.enabled.bind(
null, pgBrowser.tree, ['table'] null, pgBrowser.tree, ['table']

View File

@ -165,7 +165,7 @@ define([
module: this, module: this,
applies: ['tools'], applies: ['tools'],
callback: 'callback_maintenance', callback: 'callback_maintenance',
priority: 10, priority: 3,
label: gettext('Maintenance...'), label: gettext('Maintenance...'),
icon: 'fa fa-wrench', icon: 'fa fa-wrench',
enable: supportedNodes.enabled.bind( enable: supportedNodes.enabled.bind(

View File

@ -392,9 +392,10 @@ define('tools.restore', [
module: this, module: this,
applies: ['tools'], applies: ['tools'],
callback: 'restore_objects', callback: 'restore_objects',
priority: 13, priority: 2,
label: gettext('Restore...'), label: gettext('Restore...'),
icon: 'fa fa-upload', icon: 'fa fa-upload',
below: true,
enable: supportedNodes.enabled.bind( enable: supportedNodes.enabled.bind(
null, pgBrowser.tree, menuUtils.restoreSupportedNodes null, pgBrowser.tree, menuUtils.restoreSupportedNodes
), ),

View File

@ -39,6 +39,7 @@ define('pgadmin.schemadiff', [
priority: 1, priority: 1,
label: gettext('Schema Diff'), label: gettext('Schema Diff'),
enable: true, enable: true,
below: true,
}]; }];
pgBrowser.add_menus(menus); pgBrowser.add_menus(menus);

View File

@ -34,8 +34,9 @@ define([
applies: ['tools'], applies: ['tools'],
callback: 'show_search_objects', callback: 'show_search_objects',
enable: this.search_objects_enabled, enable: this.search_objects_enabled,
priority: 1, priority: 3,
label: gettext('Search Objects...'), label: gettext('Search Objects...'),
below: true,
data: { data: {
data_disabled: gettext('Please select a database from the browser tree to search the database objects.'), data_disabled: gettext('Please select a database from the browser tree to search the database objects.'),
}, },

View File

@ -49,7 +49,7 @@ define([
module: this, module: this,
applies: ['tools'], applies: ['tools'],
callback: 'callback_storage_manager', callback: 'callback_storage_manager',
priority: 2, priority: 11,
label: gettext('Storage Manager...'), label: gettext('Storage Manager...'),
enable: true, enable: true,
}]; }];