From 2480d08e0f6e39ffdd53786c1e1df02953946d48 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Tue, 6 Dec 2022 18:16:36 +0530 Subject: [PATCH] Added native menu support in desktop mode. #5503 --- runtime/src/js/pgadmin.js | 283 +++++++++++++++--- web/pgadmin/browser/__init__.py | 2 +- .../servers/databases/casts/static/js/cast.js | 6 +- .../event_triggers/static/js/event_trigger.js | 6 +- .../extensions/static/js/extension.js | 6 +- .../static/js/foreign_server.js | 6 +- .../user_mappings/static/js/user_mapping.js | 6 +- .../static/js/foreign_data_wrapper.js | 6 +- .../databases/languages/static/js/language.js | 6 +- .../publications/static/js/publication.js | 6 +- .../schemas/collations/static/js/collation.js | 9 +- .../static/js/domain_constraints.js | 9 +- .../schemas/domains/static/js/domain.js | 9 +- .../foreign_tables/static/js/foreign_table.js | 9 +- .../static/js/fts_configuration.js | 7 +- .../static/js/fts_dictionary.js | 7 +- .../fts_parsers/static/js/fts_parser.js | 9 +- .../fts_templates/static/js/fts_template.js | 9 +- .../schemas/functions/static/js/function.js | 9 +- .../schemas/functions/static/js/procedure.js | 9 +- .../functions/static/js/trigger_function.js | 9 +- .../schemas/packages/static/js/package.js | 6 +- .../schemas/sequences/static/js/sequence.js | 9 +- .../databases/schemas/static/js/schema.js | 7 +- .../schemas/synonyms/static/js/synonym.js | 6 +- .../tables/columns/static/js/column.js | 12 +- .../static/js/compound_trigger.js | 14 +- .../static/js/check_constraint.js | 5 +- .../static/js/exclusion_constraint.js | 3 +- .../foreign_key/static/js/foreign_key.js | 5 +- .../index_constraint/static/js/primary_key.js | 4 +- .../static/js/unique_constraint.js | 4 +- .../schemas/tables/indexes/static/js/index.js | 15 +- .../tables/partitions/static/js/partition.js | 11 +- .../static/js/row_security_policy.js | 9 +- .../schemas/tables/rules/static/js/rule.js | 19 +- .../schemas/tables/static/js/table.js | 18 +- .../tables/triggers/static/js/trigger.js | 14 +- .../databases/schemas/types/static/js/type.js | 6 +- .../schemas/views/static/js/mview.js | 13 +- .../databases/schemas/views/static/js/view.js | 6 +- .../servers/databases/static/js/database.js | 10 +- .../subscriptions/static/js/subscription.js | 6 +- .../schedules/static/js/pga_schedule.js | 6 +- .../servers/pgagent/static/js/pga_job.js | 5 +- .../pgagent/steps/static/js/pga_jobstep.js | 6 +- .../static/js/resource_group.js | 6 +- .../servers/roles/static/js/role.js | 7 +- .../server_groups/servers/static/js/server.js | 24 +- .../tablespaces/static/js/tablespace.js | 6 +- .../server_groups/static/js/server_group.js | 2 +- web/pgadmin/browser/static/js/browser.js | 260 ++++++++++++---- web/pgadmin/browser/static/js/collection.js | 4 - web/pgadmin/browser/static/js/main_menu.js | 74 +++++ web/pgadmin/browser/static/js/menu.js | 14 +- web/pgadmin/browser/static/js/new_menu.js | 223 ++++++++++++++ web/pgadmin/browser/static/js/node.js | 8 +- web/pgadmin/browser/static/js/quick_search.js | 29 -- .../static/js/quick_search/menuitems_help.js | 119 ++++---- .../static/js/quick_search/online_help.js | 60 ++-- .../static/js/quick_search/trigger_search.js | 84 ++++-- .../browser/templates/browser/index.html | 4 + .../browser/templates/browser/js/utils.js | 6 +- web/pgadmin/help/__init__.py | 6 + .../preferences/static/js/preferences.js | 1 - web/pgadmin/settings/static/js/settings.js | 6 + .../static/js/helpers/ModalProvider.jsx | 36 ++- web/pgadmin/static/scss/_pgadmin.style.scss | 4 + web/pgadmin/tools/backup/static/js/backup.js | 1 - .../debugger/static/js/DebuggerModule.js | 10 - .../grant_wizard/static/js/grant_wizard.js | 1 - .../import_export/static/js/import_export.js | 1 - .../static/js/import_export_servers.js | 1 - .../maintenance/static/js/maintenance.js | 1 - .../tools/restore/static/js/restore.js | 1 - .../sqleditor/static/js/SQLEditorModule.js | 1 - web/webpack.config.js | 1 - web/webpack.shim.js | 1 - 78 files changed, 1126 insertions(+), 523 deletions(-) create mode 100644 web/pgadmin/browser/static/js/main_menu.js create mode 100644 web/pgadmin/browser/static/js/new_menu.js delete mode 100644 web/pgadmin/browser/static/js/quick_search.js diff --git a/runtime/src/js/pgadmin.js b/runtime/src/js/pgadmin.js index 984b2e912..8e8ae865c 100644 --- a/runtime/src/js/pgadmin.js +++ b/runtime/src/js/pgadmin.js @@ -6,7 +6,6 @@ // This software is released under the PostgreSQL Licence // ////////////////////////////////////////////////////////////// - const axios = require('axios'); const fs = require('fs'); const path = require('path'); @@ -16,6 +15,8 @@ const spawn = require('child_process').spawn; let pgadminServerProcess = null; let startPageUrl = null; let serverCheckUrl = null; +let addMenuCompleted = false; +let pgAdminMainScreen = null; let serverPort = 5050; let appStartTime = (new Date()).getTime(); @@ -69,7 +70,7 @@ function startDesktopMode() { misc.writeServerLog('Webapp Path: "' + path.resolve(pgadminFile) + '"'); misc.writeServerLog('pgAdmin Command: "' + command + '"'); misc.writeServerLog('Environment: '); - Object.keys(process.env).forEach(function(key) { + Object.keys(process.env).forEach(function (key) { // Below code is included only for Mac OS as default path for azure CLI // installation path is not included in PATH variable while spawning // runtime environment. @@ -84,13 +85,13 @@ function startDesktopMode() { // Spawn the process to start pgAdmin4 server. let spawnStartTime = (new Date).getTime(); pgadminServerProcess = spawn(path.resolve(pythonPath), ['-s', path.resolve(pgadminFile)]); - pgadminServerProcess.on('error', function(err) { + pgadminServerProcess.on('error', function (err) { // Log the error into the log file if process failed to launch misc.writeServerLog('Failed to launch pgAdmin4. Error:'); misc.writeServerLog(err); }); let spawnEndTime = (new Date).getTime(); - misc.writeServerLog('Total spawn time to start the pgAdmin4 server: ' + (spawnEndTime - spawnStartTime)/1000 + ' Sec'); + misc.writeServerLog('Total spawn time to start the pgAdmin4 server: ' + (spawnEndTime - spawnStartTime) / 1000 + ' Sec'); pgadminServerProcess.stdout.setEncoding('utf8'); pgadminServerProcess.stdout.on('data', (chunk) => { @@ -125,7 +126,7 @@ function startDesktopMode() { misc.zoomIn(); } else if (chunk.indexOf('Runtime Zoom Out') >= 0) { misc.zoomOut(); - } else if (chunk.indexOf('Runtime Actual Size') >= 0) { + } else if (chunk.indexOf('Runtime Actual Size') >= 0) { misc.actualSize(); } else if (chunk.indexOf('Runtime Toggle Full Screen') >= 0) { misc.toggleFullScreen(); @@ -144,14 +145,14 @@ function startDesktopMode() { let connectionTimeout = misc.ConfigureStore.get('connectionTimeout', 90) * 1000; let currentTime = (new Date).getTime(); - let endTime = currentTime + connectionTimeout; - let midTime1 = currentTime + (connectionTimeout/2); - let midTime2 = currentTime + (connectionTimeout*2/3); + let endTime = currentTime + connectionTimeout; + let midTime1 = currentTime + (connectionTimeout / 2); + let midTime2 = currentTime + (connectionTimeout * 2 / 3); let pingInProgress = false; // ping pgAdmin server every 1 second. let pingStartTime = (new Date).getTime(); - let intervalID = setInterval(function() { + let intervalID = setInterval(function () { // If ping request is already send and response is not // received no need to send another request. if (pingInProgress) @@ -166,9 +167,9 @@ function startDesktopMode() { clearInterval(intervalID); let appEndTime = (new Date).getTime(); misc.writeServerLog('------------------------------------------'); - misc.writeServerLog('Total time taken to ping pgAdmin4 server: ' + (appEndTime - pingStartTime)/1000 + ' Sec'); + misc.writeServerLog('Total time taken to ping pgAdmin4 server: ' + (appEndTime - pingStartTime) / 1000 + ' Sec'); misc.writeServerLog('------------------------------------------'); - misc.writeServerLog('Total launch time of pgAdmin4: ' + (appEndTime - appStartTime)/1000 + ' Sec'); + misc.writeServerLog('Total launch time of pgAdmin4: ' + (appEndTime - appStartTime) / 1000 + ' Sec'); misc.writeServerLog('------------------------------------------'); launchPgAdminWindow(); }).catch(() => { @@ -192,7 +193,7 @@ function startDesktopMode() { } if (curTime > midTime1) { - if(curTime < midTime2) { + if (curTime < midTime2) { document.getElementById('loader-text-status').innerHTML = 'Taking longer than usual...'; } else { document.getElementById('loader-text-status').innerHTML = 'Almost there...'; @@ -223,7 +224,8 @@ function launchPgAdminWindow() { 'height': 768, 'focus': true, 'show': false, - }, (pgadminWindow)=> { + }, (pgadminWindow) => { + pgAdminMainScreen = pgadminWindow; // Set pgAdmin4 Windows Object misc.setPgAdminWindowObject(pgadminWindow); @@ -233,18 +235,18 @@ function launchPgAdminWindow() { // Set zoom in and out events. misc.setZoomEvents(); - pgadminWindow.on('closed', function() { + pgadminWindow.on('closed', function () { misc.cleanupAndQuitApp(); }); // set up handler for new-win-policy event. // Set the width and height for the new window. - pgadminWindow.on('new-win-policy', function(frame, url, policy) { - if(!frame) { + pgadminWindow.on('new-win-policy', function (frame, url, policy) { + if (!frame) { let openDocsInBrowser = misc.ConfigureStore.get('openDocsInBrowser', true); let isDocURL = false; - docsURLSubStrings.forEach(function(key) { - if(url.indexOf(key) >= 0) { + docsURLSubStrings.forEach(function (key) { + if (url.indexOf(key) >= 0) { isDocURL = true; } }); @@ -268,7 +270,7 @@ function launchPgAdminWindow() { } }); - pgadminWindow.on('loaded', function() { + pgadminWindow.on('loaded', function () { /* Make the new window opener to null as it is * nothing but a splash screen. We will have to make it null, * so that open in new browser tab will work. @@ -279,15 +281,39 @@ function launchPgAdminWindow() { pgadminWindow.show(); pgadminWindow.focus(); + nativeMenu = new gui.Menu({ type: 'menubar' }); + // Create Mac Builtin Menu + if (platform() === 'darwin') { + nativeMenu.createMacBuiltin('pgAdmin 4'); + pgAdminMainScreen.menu = nativeMenu; + } + + try { + pgAdminMainScreen.isCustomMenusAdded = false; + let addMenuInterval = setInterval(() => { + if (pgadminWindow?.window?.pgAdmin?.Browser?.Events && pgadminWindow?.window?.pgAdmin?.Browser?.MainMenus?.length > 0) { + pgadminWindow.window.pgAdmin.Browser.Events.on('pgadmin:nw-enable-disable-menu-items', enableDisableMenuItem); + pgadminWindow.window.pgAdmin.Browser.Events.on('pgadmin:nw-refresh-menu-item', refreshMenuItems); + // Add Main Menus to native menu. + pgadminWindow.window.pgAdmin.Browser.MainMenus.forEach((menu)=> { + addMenu(pgadminWindow.window.pgAdmin.Browser, menu) + }) + clearInterval(addMenuInterval); + } + }, 250) + } catch (e) { + console.error('Error in add native menus'); + } + // Hide the splash screen splashWindow.hide(); }); - pgadminWindow.on('blur', function() { + pgadminWindow.on('blur', function () { misc.unregisterZoomEvents(); }); - pgadminWindow.on('focus', function() { + pgadminWindow.on('focus', function () { misc.registerZoomEvents(); }); }); @@ -299,17 +325,17 @@ let splashWindow = gui.Window.get(); // Enable dragging on the splash screen. let isDragging = false; -let dragOrigin = {x:0, y:0}; -document.mouseleave = ()=> isDragging = false; -document.onmouseup = ()=> isDragging = false; +let dragOrigin = { x: 0, y: 0 }; +document.mouseleave = () => isDragging = false; +document.onmouseup = () => isDragging = false; -document.onmousedown = (e)=> { +document.onmousedown = (e) => { isDragging = true; dragOrigin.x = e.x; dragOrigin.y = e.y; }; -document.onmousemove = (e)=> { +document.onmousemove = (e) => { if (isDragging) { splashWindow.moveTo(e.screenX - dragOrigin.x, e.screenY - dragOrigin.y); } @@ -318,14 +344,9 @@ document.onmousemove = (e)=> { // Always clear the cache before starting the application. nw.App.clearCache(); -// Create Mac Builtin Menu -if (platform() === 'darwin') { - let macMenu = new gui.Menu({type: 'menubar'}); - macMenu.createMacBuiltin('pgAdmin 4'); - splashWindow.menu = macMenu; -} +let nativeMenu; -splashWindow.on('loaded', function() { +splashWindow.on('loaded', function () { // Initialize the ConfigureStore misc.ConfigureStore.init(); @@ -352,6 +373,200 @@ splashWindow.on('loaded', function() { } }); -splashWindow.on('close', function() { +splashWindow.on('close', function () { misc.cleanupAndQuitApp(); }); + + +function addCommonMenus(pgBrowser, menu) { + let _menu = new gui.Menu(); + + menu.menuItems.forEach((menuItem) => { + var submenu = getSubMenu(pgBrowser, menuItem); + + let _menuItem = new gui.MenuItem({ + label: menuItem.label, + enabled: !menuItem.is_disabled, + type: menuItem.type || 'normal', + priority: menuItem.priority, + ...(submenu.items.length > 0) && { + submenu: submenu, + }, + click: function () { + menuItem.callback(); + }, + }); + _menu.append(_menuItem); + }); + + if (menu.menuItems.length == 0) { + let _menuItem = new gui.MenuItem({ + label: 'No object selected', + enabled: false, + priority: 0, + }); + _menu.append(_menuItem); + } + + if (platform() == 'darwin') { + pgAdminMainScreen.menu.insert(new gui.MenuItem({ + label: menu.label, + name: menu.name, + submenu: _menu, + }), menu.index); + } else { + nativeMenu.append(new gui.MenuItem({ + label: menu.label, + name: menu.name, + submenu: _menu, + })); + pgAdminMainScreen.menu = nativeMenu; + } + +} + +function getSubMenu(pgBrowser, menuItem) { + var submenu = new gui.Menu(); + if (menuItem.menu_items) { + menuItem.menu_items.forEach((item) => { + let menuType = typeof item.checked == 'boolean' ? 'checkbox' : item.type || 'normal'; + submenu.append(new gui.MenuItem({ + label: item.label, + enabled: !item.is_disabled, + priority: item.priority, + type: menuType, + checked: item.checked, + click: function () { + if (menuType == 'checkbox') { + pgAdminMainScreen.menu.items.forEach(el => { + el.submenu.items.forEach((sub) => { + if (sub.submenu?.items?.length) { + sub.submenu.items.forEach((m) => { + if (m.type == 'checkbox') { + m.label == item.label ? m.checked = true : m.checked = false; + } + }); + } + }); + }); + } + item.callback(); + }, + })); + }); + } + return submenu; +} + +function addMacMenu(pgBrowser, menu) { + if (menu.name == 'file' && platform() === 'darwin') { + var rootMenu = nativeMenu.items[0].submenu; + let indx = 0; + menu.menuItems.forEach((menuItem) => { + let submenu = getSubMenu(pgBrowser, menuItem); + + rootMenu.insert( + new gui.MenuItem({ + label: menuItem.label, + type: menuItem.type || 'normal', + enabled: !menuItem.is_disabled, + priority: menuItem.priority, + ...(submenu.items.length > 0) && { + submenu: submenu, + }, + click: function () { + // Callback functions for actions + menuItem.callback(); + }, + }), indx); + indx++; + }); + let separator_menu = new nw.MenuItem({ type: 'separator' }); + rootMenu.insert(separator_menu, indx); + indx++; + + pgAdminMainScreen.menu = nativeMenu; + } else { + addCommonMenus(pgBrowser, menu) + } +} + +function addOtherOsMenu(pgBrowser, menu) { + addCommonMenus(pgBrowser, menu) +} + + +function addMenu(pgBrowser, menu) { + pgAdminMainScreen.isCustomMenusAdded = true; + if (platform() === 'darwin') { + addMacMenu(pgBrowser, menu); + } else { + addOtherOsMenu(pgBrowser, menu); + } + addMenuCompleted = true; +} + +function enableDisableMenuItem(menu, menuItem) { + if (addMenuCompleted) { + // Enable or Disabled specific menu item + pgAdminMainScreen.menu.items.forEach(el => { + if (el?.label == menu?.label) { + el.submenu.items.forEach((sub) => { + if (sub.label == menuItem.label) { + sub.enabled = !menuItem.is_disabled; + } + }); + } + }); + } +} + +function refreshMenuItems(menu) { + // Add menu item/option in specific menu. + pgAdminMainScreen.menu.items.forEach(el => { + if (el.label == menu.label) { + let totalSubItems = el.submenu.items.length; + + // Remove exisitng menu options to add new options. + for (let i = 0; i < totalSubItems; i++) { + el.submenu.removeAt(0); + } + menu.menuItems.forEach((item) => { + + var submenu = new gui.Menu(); + if (item.menu_items) { + item.menu_items.forEach((subItem) => { + submenu.append(new gui.MenuItem({ + label: subItem.label, + enabled: !subItem.is_disabled, + priority: subItem.priority, + type: [true, false].includes(subItem.checked) ? 'checkbox' : 'normal', + checked: subItem.checked, + click: function () { + subItem.callback(); + }, + })); + }); + } + let _menuItem = new gui.MenuItem({ + label: item.label, + enabled: !item.is_disabled, + priority: item.priority, + ...(submenu.items.length > 0) && { + submenu: submenu, + }, + click: function () { + item.callback(); + }, + }); + + el.submenu.append(_menuItem); + if (['create', 'register'].includes(item.category)) { + let separator_menu = new gui.MenuItem({ type: 'separator' }); + el.submenu.append(separator_menu); + } + }); + } + }); + +} \ No newline at end of file diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index c2a772f91..00732c2bc 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -683,7 +683,7 @@ def utils(): qt_default_placeholder=QT_DEFAULT_PLACEHOLDER, vw_edt_default_placeholder=VW_EDT_DEFAULT_PLACEHOLDER, enable_psql=config.ENABLE_PSQL, - pgadmin_server_locale=default_locale + pgadmin_server_locale=default_locale, ), 200, {'Content-Type': MIMETYPE_APP_JS}) diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js b/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js index 6aa229193..ba5e4a196 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js +++ b/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js @@ -52,18 +52,18 @@ define('pgadmin.node.cast', [ name: 'create_cast_on_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Cast...'), - icon: 'wcTabIcon icon-cast', data: {action: 'create'}, + data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow, },{ name: 'create_cast_on_coll', node: 'coll-cast', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Cast...'), - icon: 'wcTabIcon icon-cast', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_cast', node: 'cast', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Cast...'), - icon: 'wcTabIcon icon-cast', data: {action: 'create'}, + data: {action: 'create'}, }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js index e9889c787..2ca629142 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js @@ -51,17 +51,17 @@ define('pgadmin.node.event_trigger', [ name: 'create_event_trigger_on_coll', node: 'coll-event_trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Event Trigger...'), - icon: 'wcTabIcon icon-event_trigger', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_event_trigger', node: 'event_trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Event Trigger...'), - icon: 'wcTabIcon icon-event_trigger', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_event_trigger', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Event Trigger...'), - icon: 'wcTabIcon icon-event_trigger', data: {action: 'create'}, + data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow, }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js b/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js index 256de3beb..ab4f6ebd0 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js +++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js @@ -76,17 +76,17 @@ define('pgadmin.node.extension', [ name: 'create_extension_on_coll', node: 'coll-extension', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Extension...'), - icon: 'wcTabIcon icon-extension', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_extension', node: 'extension', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Extension...'), - icon: 'wcTabIcon icon-extension', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_extension', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Extension...'), - icon: 'wcTabIcon icon-extension', data: {action: 'create'}, + data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow, }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js index d15ddae86..d0167aca3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js @@ -55,17 +55,17 @@ define('pgadmin.node.foreign_server', [ name: 'create_foreign_server_on_coll', node: 'coll-foreign_server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Server...'), - icon: 'wcTabIcon icon-foreign_server', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_foreign_server', node: 'foreign_server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Server...'), - icon: 'wcTabIcon icon-foreign_server', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_foreign_server', node: 'foreign_data_wrapper', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Server...'), - icon: 'wcTabIcon icon-foreign_server', data: {action: 'create'}, + data: {action: 'create'}, }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js index 9c5768104..831d8c4db 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js @@ -55,17 +55,17 @@ define('pgadmin.node.user_mapping', [ name: 'create_user_mapping_on_coll', node: 'coll-user_mapping', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('User Mapping...'), - icon: 'wcTabIcon icon-user_mapping', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_user_mapping', node: 'user_mapping', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('User Mapping...'), - icon: 'wcTabIcon icon-user_mapping', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_user_mapping', node: 'foreign_server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('User Mapping...'), - icon: 'wcTabIcon icon-user_mapping', data: {action: 'create'}, + data: {action: 'create'}, }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js index 00cbe51ad..7ea4fbf55 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js @@ -55,17 +55,17 @@ define('pgadmin.node.foreign_data_wrapper', [ name: 'create_foreign_data_wrapper_on_coll', node: 'coll-foreign_data_wrapper', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Data Wrapper...'), - icon: 'wcTabIcon icon-foreign_data_wrapper', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_foreign_data_wrapper', node: 'foreign_data_wrapper', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Data Wrapper...'), - icon: 'wcTabIcon icon-foreign_data_wrapper', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_foreign_data_wrapper', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Data Wrapper...'), - icon: 'wcTabIcon icon-foreign_data_wrapper', data: {action: 'create'}, + data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow, }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js b/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js index 9378d6826..f897ddbc6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js +++ b/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js @@ -54,18 +54,18 @@ define('pgadmin.node.language', [ name: 'create_language_on_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Language...'), - icon: 'wcTabIcon icon-language', data: {action: 'create'}, + data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow, },{ name: 'create_language_on_coll', node: 'coll-language', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Language...'), - icon: 'wcTabIcon icon-language', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_language', node: 'language', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Language...'), - icon: 'wcTabIcon icon-language', data: {action: 'create'}, + data: {action: 'create'}, }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.js b/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.js index e3b7dd918..7b688c9db 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.js +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.js @@ -55,18 +55,18 @@ define('pgadmin.node.publication', [ name: 'create_publication_on_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Publication...'), - icon: 'wcTabIcon icon-publication', data: {action: 'create'}, + data: {action: 'create'}, enable: pgBrowser.Nodes['database'].canCreate, },{ name: 'create_publication_on_coll', node: 'coll-publication', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Publication...'), - icon: 'wcTabIcon icon-publication', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_publication', node: 'publication', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Publication...'), - icon: 'wcTabIcon icon-publication', data: {action: 'create'}, + data: {action: 'create'}, }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js index de0645e3d..597ba3611 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js @@ -51,20 +51,17 @@ define('pgadmin.node.collation', [ name: 'create_collation_on_coll', node: 'coll-collation', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Collation...'), - icon: 'wcTabIcon icon-collation', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_collation', node: 'collation', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Collation...'), - icon: 'wcTabIcon icon-collation', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_collation', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Collation...'), - icon: 'wcTabIcon icon-collation', data: {action: 'create', check: false}, - enable: 'canCreate', + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js index ebe8a0c8f..4b706aef6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js @@ -52,20 +52,17 @@ define('pgadmin.node.domain_constraints', [ name: 'create_domain_on_coll', node: 'coll-domain_constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 5, label: gettext('Domain Constraint...'), - icon: 'wcTabIcon icon-domain_constraints', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_domain_constraints', node: 'domain_constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 5, label: gettext('Domain Constraint...'), - icon: 'wcTabIcon icon-domain_constraints', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_domain_constraints', node: 'domain', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 5, label: gettext('Domain Constraint...'), - icon: 'wcTabIcon icon-domain_constraints', data: {action: 'create', check: false}, - enable: 'canCreate', + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.js index e20555593..0431f9136 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.js @@ -54,20 +54,17 @@ define('pgadmin.node.domain', [ name: 'create_domain_on_coll', node: 'coll-domain', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Domain...'), - icon: 'wcTabIcon icon-domain', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_domain', node: 'domain', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Domain...'), - icon: 'wcTabIcon icon-domain', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_domain', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Domain...'), - icon: 'wcTabIcon icon-domain', data: {action: 'create', check: false}, - enable: 'canCreate', + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js index 2f1f15135..42d19267c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js @@ -57,20 +57,17 @@ define('pgadmin.node.foreign_table', [ name: 'create_foreign_table_on_coll', node: 'coll-foreign_table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Table...'), - icon: 'wcTabIcon icon-foreign_table', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_foreign_table', node: 'foreign_table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Table...'), - icon: 'wcTabIcon icon-foreign_table', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_foreign_table', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign Table...'), - icon: 'wcTabIcon icon-foreign_table', data: {action: 'create', check: false}, - enable: 'canCreate', + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js index 44a616a9d..6df6af6c3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js @@ -55,20 +55,19 @@ define('pgadmin.node.fts_configuration', [ module: this, category: 'create', priority: 4, applies: ['object', 'context'], callback: 'show_obj_properties', label: gettext('FTS Configuration...'), - icon: 'wcTabIcon icon-fts_configuration', data: {action: 'create'}, - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', },{ name: 'create_fts_configuration_on_coll', module: this, priority: 4, node: 'coll-fts_configuration', applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', label: gettext('FTS Configuration...'), data: {action: 'create'}, - icon: 'wcTabIcon icon-fts_configuration', enable: 'canCreate', + enable: 'canCreate', },{ name: 'create_fts_configuration', node: 'fts_configuration', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Configuration...'), data: {action: 'create'}, - icon: 'wcTabIcon icon-fts_configuration', enable: 'canCreate', + enable: 'canCreate', }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js index 164df6a41..6a3aa3143 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js @@ -55,19 +55,18 @@ define('pgadmin.node.fts_dictionary', [ name: 'create_fts_dictionary_on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Dictionary...'), - icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'}, - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', },{ name: 'create_fts_dictionary_on_coll', node: 'coll-fts_dictionary', module: this, applies: ['object', 'context'], priority: 4, callback: 'show_obj_properties', category: 'create', label: gettext('FTS Dictionary...'), data: {action: 'create'}, - icon: 'wcTabIcon icon-fts_dictionary', enable: 'canCreate', + enable: 'canCreate', },{ name: 'create_fts_dictionary', node: 'fts_dictionary', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Dictionary...'), - icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'}, + data: {action: 'create'}, enable: 'canCreate', }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js index dde527839..fe4828155 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js @@ -52,20 +52,17 @@ define('pgadmin.node.fts_parser', [ name: 'create_fts_parser_on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Parser...'), - icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}, - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', },{ name: 'create_fts_parser_on_coll', node: 'coll-fts_parser', applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Parser...'), - icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}, - module: this, enable: 'canCreate', + data: {action: 'create'}, module: this, enable: 'canCreate', },{ name: 'create_fts_parser', node: 'fts_parser', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Parser...'), - icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}, - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js index f56e12941..41b439c7a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js @@ -52,20 +52,17 @@ define('pgadmin.node.fts_template', [ name: 'create_fts_template_on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Template...'), - icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}, - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', },{ name: 'create_fts_template_on_coll', node: 'coll-fts_template', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Template...'), - icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}, - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', },{ name: 'create_fts_template', node: 'fts_template', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('FTS Template...'), - icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}, - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js index a216222e6..30885432a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js @@ -58,20 +58,17 @@ define('pgadmin.node.function', [ name: 'create_function_on_coll', node: 'coll-function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Function...'), - icon: 'wcTabIcon icon-function', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_function', node: 'function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Function...'), - icon: 'wcTabIcon icon-function', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_function', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Function...'), - icon: 'wcTabIcon icon-function', data: {action: 'create', check: false}, - enable: 'canCreate', + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure.js index b09d680eb..3b92893c2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure.js @@ -59,20 +59,17 @@ define('pgadmin.node.procedure', [ this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Procedure...'), - icon: 'wcTabIcon icon-procedure', data: {action: 'create', check: - false}, enable: 'canCreateProc', + data: {action: 'create', check: false}, enable: 'canCreateProc', },{ name: 'create_procedure', node: 'procedure', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Procedure...'), - icon: 'wcTabIcon icon-procedure', data: {action: 'create', check: - true}, enable: 'canCreateProc', + data: {action: 'create', check: true}, enable: 'canCreateProc', },{ name: 'create_procedure', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Procedure...'), - icon: 'wcTabIcon icon-procedure', data: {action: 'create', check: - true}, enable: 'canCreateProc', + data: {action: 'create', check: true}, enable: 'canCreateProc', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js index afc1a3f33..229bcb5a5 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js @@ -65,20 +65,17 @@ define('pgadmin.node.trigger_function', [ name: 'create_trigger_function_on_coll', node: 'coll-trigger_function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger function...'), - icon: 'wcTabIcon icon-trigger_function', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_trigger_function', node: 'trigger_function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger function...'), - icon: 'wcTabIcon icon-trigger_function', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_trigger_function', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger function...'), - icon: 'wcTabIcon icon-trigger_function', data: {action: 'create', check: false}, - enable: 'canCreate', + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js index 0b46816c5..019648e6a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package.js @@ -52,21 +52,21 @@ define('pgadmin.node.package', [ name: 'create_package_on_coll', node: 'coll-package', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Package...'), - icon: 'wcTabIcon icon-package', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'create_package', node: 'package', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Package...'), - icon: 'wcTabIcon icon-package', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'create_package', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Package...'), - icon: 'wcTabIcon icon-package', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js index f6798b6be..b3d0966f9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js @@ -56,20 +56,17 @@ define('pgadmin.node.sequence', [ name: 'create_sequence_on_coll', node: 'coll-sequence', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Sequence...'), - icon: 'wcTabIcon icon-sequence', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_sequence', node: 'sequence', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Sequence...'), - icon: 'wcTabIcon icon-sequence', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_sequence', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Sequence...'), - icon: 'wcTabIcon icon-sequence', data: {action: 'create', check: false}, - enable: 'canCreate', + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js index 5f8cfc4f4..b1182bedf 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js @@ -50,18 +50,17 @@ define('pgadmin.node.schema', [ name: 'create_schema_on_coll', node: 'coll-schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Schema...'), - icon: 'wcTabIcon icon-schema', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Schema...'), - icon: 'wcTabIcon icon-schema', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_schema', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Schema...'), - icon: 'wcTabIcon icon-schema', data: {action: 'create'}, - enable: 'can_create_schema', + data: {action: 'create'}, enable: 'can_create_schema', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js index 721a9cafa..964a486a5 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js @@ -51,21 +51,21 @@ define('pgadmin.node.synonym', [ name: 'create_synonym_on_coll', node: 'coll-synonym', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Synonym...'), - icon: 'wcTabIcon icon-synonym', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'create_synonym', node: 'synonym', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Synonym...'), - icon: 'wcTabIcon icon-synonym', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'create_synonym', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Synonym...'), - icon: 'wcTabIcon icon-synonym', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js index aa0bdad9d..39b69f4d6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js @@ -71,26 +71,22 @@ define('pgadmin.node.column', [ name: 'create_column_on_coll', node: 'coll-column', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Column...'), - icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_column', node: 'column', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Column...'), - icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_column_onTable', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Column...'), - icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_column_onView', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Column...'), - icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js index ab29b46f1..cc795c0dc 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js @@ -55,45 +55,45 @@ define('pgadmin.node.compound_trigger', [ name: 'create_compound_trigger_on_coll', node: 'coll-compound_trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Compound Trigger...'), - icon: 'wcTabIcon icon-compound_trigger', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'create_compound_trigger', node: 'compound_trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Compound Trigger...'), - icon: 'wcTabIcon icon-compound_trigger', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'create_compound_trigger_onTable', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Compound Trigger...'), - icon: 'wcTabIcon icon-compound_trigger', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'create_compound_trigger_onPartition', node: 'partition', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Compound Trigger...'), - icon: 'wcTabIcon icon-compound_trigger', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', },{ name: 'enable_compound_trigger', node: 'compound_trigger', module: this, applies: ['object', 'context'], callback: 'enable_compound_trigger', category: 'connect', priority: 3, label: gettext('Enable compound trigger'), - icon: 'fa fa-check', enable : 'canCreate_with_compound_trigger_enable', + enable : 'canCreate_with_compound_trigger_enable', },{ name: 'disable_compound_trigger', node: 'compound_trigger', module: this, applies: ['object', 'context'], callback: 'disable_compound_trigger', category: 'drop', priority: 3, label: gettext('Disable compound trigger'), - icon: 'fa fa-times', enable : 'canCreate_with_compound_trigger_disable', + enable : 'canCreate_with_compound_trigger_disable', },{ name: 'create_compound_trigger_onView', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Compound Trigger...'), - icon: 'wcTabIcon icon-compound_trigger', data: {action: 'create', check: true, + data: {action: 'create', check: true, data_disabled: gettext('This option is only available on EPAS servers.')}, enable: 'canCreate', }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js index a3e136073..9f75f1ab4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js @@ -42,13 +42,12 @@ define('pgadmin.node.check_constraint', [ name: 'create_check_constraint_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 5, label: gettext('Check...'), - icon: 'wcTabIcon icon-check_constraint', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'validate_check_constraint', node: 'check_constraint', module: this, applies: ['object', 'context'], callback: 'validate_check_constraint', category: 'validate', priority: 4, label: gettext('Validate check constraint'), - icon: 'fa fa-link', enable : 'is_not_valid', data: {action: 'edit', check: true}, + enable : 'is_not_valid', data: {action: 'edit', check: true}, }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js index b0b114db0..d24a10804 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js @@ -45,8 +45,7 @@ define('pgadmin.node.exclusion_constraint', [ name: 'create_exclusion_constraint_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Exclusion constraint...'), - icon: 'wcTabIcon icon-exclusion_constraint', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', }]); }, is_not_valid: function(node) { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js index b2ccf7547..c78f8b862 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js @@ -43,13 +43,12 @@ define('pgadmin.node.foreign_key', [ name: 'create_foreign_key_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Foreign key...'), - icon: 'wcTabIcon icon-foreign_key', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'validate_foreign_key', node: 'foreign_key', module: this, applies: ['object', 'context'], callback: 'validate_foreign_key', category: 'validate', priority: 4, label: gettext('Validate foreign key'), - icon: 'fa fa-link', enable : 'is_not_valid', + enable : 'is_not_valid', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js index 51e3a544b..0c99f2274 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js @@ -45,9 +45,7 @@ define('pgadmin.node.primary_key', [ name: 'create_primary_key_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Primary key'), - icon: 'wcTabIcon icon-primary_key', data: {action: 'create', check: true}, - enable: 'canCreate', - + data: {action: 'create', check: true}, enable: 'canCreate', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js index 8102ce636..3239838ec 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js @@ -44,9 +44,7 @@ define('pgadmin.node.unique_constraint', [ name: 'create_unique_constraint_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Unique constraint'), - icon: 'wcTabIcon icon-unique_constraint', data: {action: 'create', check: true}, - enable: 'canCreate', - + data: {action: 'create', check: true}, enable: 'canCreate', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.js index 7c5198864..bbe5d0e2f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.js @@ -60,32 +60,27 @@ define('pgadmin.node.index', [ name: 'create_index_on_coll', node: 'coll-index', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Index...'), - icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_index', node: 'index', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Index...'), - icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_index_onTable', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Index...'), - icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_index_onPartition', node: 'partition', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Index...'), - icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_index_onMatView', node: 'mview', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 5, label: gettext('Index...'), - icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js index 10c8f0eb4..0c192a0b3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js @@ -64,18 +64,18 @@ function( name: 'truncate_table', node: 'partition', module: this, applies: ['object', 'context'], callback: 'truncate_table', category: gettext('Truncate'), priority: 3, label: gettext('Truncate'), - icon: 'fa fa-eraser', enable : 'canCreate', + enable : 'canCreate', },{ name: 'truncate_table_cascade', node: 'partition', module: this, applies: ['object', 'context'], callback: 'truncate_table_cascade', category: gettext('Truncate'), priority: 3, label: gettext('Truncate Cascade'), - icon: 'fa fa-eraser', enable : 'canCreate', + enable : 'canCreate', },{ // To enable/disable all triggers for the table name: 'enable_all_triggers', node: 'partition', module: this, applies: ['object', 'context'], callback: 'enable_triggers_on_table', category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'), - icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable', + enable : 'canCreate_with_trigger_enable', data: { data_disabled: gettext('The selected tree node does not support this option.'), }, @@ -83,7 +83,7 @@ function( name: 'disable_all_triggers', node: 'partition', module: this, applies: ['object', 'context'], callback: 'disable_triggers_on_table', category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'), - icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable', + enable : 'canCreate_with_trigger_disable', data: { data_disabled: gettext('The selected tree node does not support this option.'), }, @@ -91,12 +91,11 @@ function( name: 'reset_table_stats', node: 'partition', module: this, applies: ['object', 'context'], callback: 'reset_table_stats', category: 'Reset', priority: 4, label: gettext('Reset Statistics'), - icon: 'fa fa-chart-bar', enable : 'canCreate', + enable : 'canCreate', },{ name: 'detach_partition', node: 'partition', module: this, applies: ['object', 'context'], callback: 'detach_partition', priority: 2, label: gettext('Detach Partition'), - icon: 'fa fa-remove', },{ name: 'count_table_rows', node: 'partition', module: pgBrowser.Nodes['table'], applies: ['object', 'context'], callback: 'count_table_rows', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/static/js/row_security_policy.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/static/js/row_security_policy.js index 97595517e..a0a817eba 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/static/js/row_security_policy.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/static/js/row_security_policy.js @@ -55,21 +55,18 @@ define('pgadmin.node.row_security_policy', [ name: 'create_row_security_policy_on_coll', node: 'coll-row_security_policy', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('RLS Policy...'), - icon: 'wcTabIcon icon-row_security_policy', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_row_security_policy', node: 'row_security_policy', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('RLS Policy...'), - icon: 'wcTabIcon icon-row_security_policy', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', }, { name: 'create_row_security_policy_on_coll', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 6, label: gettext('RLS Policy...'), - icon: 'wcTabIcon icon-row_security_policy', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', }, ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js index 6e8bf1b18..8c76ae31c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js @@ -86,43 +86,38 @@ define('pgadmin.node.rule', [ name: 'create_rule_on_coll', node: 'coll-rule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Rule...'), - icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_rule_onView', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 5, label: gettext('Rule...'), - icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_rule', node: 'rule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Rule...'), - icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_rule', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Rule...'), - icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_rule', node: 'partition', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Rule...'), - icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, - enable: 'canCreate', + data: {action: 'create', check: true}, enable: 'canCreate', }, { name: 'enable_rule', node: 'rule', module: this, applies: ['object', 'context'], callback: 'enable_rule', category: 'connect', priority: 3, label: gettext('Enable'), - icon: 'fa fa-check', enable: 'canCreate_with_rule_enable', + enable: 'canCreate_with_rule_enable', },{ name: 'disable_rule', node: 'rule', module: this, applies: ['object', 'context'], callback: 'disable_rule', category: 'drop', priority: 3, label: gettext('Disable'), - icon: 'fa fa-times', enable: 'canCreate_with_rule_disable' + enable: 'canCreate_with_rule_disable' } ]); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js index c3509bd60..0f7aa670e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js @@ -65,41 +65,41 @@ define('pgadmin.node.table', [ name: 'create_table_on_coll', node: 'coll-table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Table...'), - icon: 'wcTabIcon icon-table', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_table', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Table...'), - icon: 'wcTabIcon icon-table', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_table__on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Table...'), - icon: 'wcTabIcon icon-table', data: {action: 'create', check: false}, + data: {action: 'create', check: false}, enable: 'canCreate', },{ name: 'truncate_table', node: 'table', module: this, applies: ['object', 'context'], callback: 'truncate_table', category: gettext('Truncate'), priority: 3, label: gettext('Truncate'), - icon: 'fa fa-eraser', enable : 'canCreate', + enable : 'canCreate', },{ name: 'truncate_table_cascade', node: 'table', module: this, applies: ['object', 'context'], callback: 'truncate_table_cascade', category: gettext('Truncate'), priority: 3, label: gettext('Truncate Cascade'), - icon: 'fa fa-eraser', enable : 'canCreate', + enable : 'canCreate', },{ name: 'truncate_table_identity', node: 'table', module: this, applies: ['object', 'context'], callback: 'truncate_table_identity', category: gettext('Truncate'), priority: 3, label: gettext('Truncate Restart Identity'), - icon: 'fa fa-eraser', enable : 'canCreate', + enable : 'canCreate', },{ // To enable/disable all triggers for the table name: 'enable_all_triggers', node: 'table', module: this, applies: ['object', 'context'], callback: 'enable_triggers_on_table', category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'), - icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable', + enable : 'canCreate_with_trigger_enable', data: { data_disabled: gettext('The selected tree node does not support this option.'), }, @@ -107,7 +107,7 @@ define('pgadmin.node.table', [ name: 'disable_all_triggers', node: 'table', module: this, applies: ['object', 'context'], callback: 'disable_triggers_on_table', category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'), - icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable', + enable : 'canCreate_with_trigger_disable', data: { data_disabled: gettext('The selected tree node does not support this option.'), }, @@ -115,7 +115,7 @@ define('pgadmin.node.table', [ name: 'reset_table_stats', node: 'table', module: this, applies: ['object', 'context'], callback: 'reset_table_stats', category: 'Reset', priority: 4, label: gettext('Reset Statistics'), - icon: 'fa fa-chart-bar', enable : 'canCreate', + enable : 'canCreate', },{ name: 'count_table_rows', node: 'table', module: this, applies: ['object', 'context'], callback: 'count_table_rows', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js index 37000b9f6..38aec6b57 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js @@ -56,41 +56,41 @@ define('pgadmin.node.trigger', [ name: 'create_trigger_on_coll', node: 'coll-trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger...'), - icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_trigger', node: 'trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger...'), - icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_trigger_onTable', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger...'), - icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_trigger_onPartition', node: 'partition', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger...'), - icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'enable_trigger', node: 'trigger', module: this, applies: ['object', 'context'], callback: 'enable_trigger', category: 'connect', priority: 3, label: gettext('Enable'), - icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable', + enable : 'canCreate_with_trigger_enable', },{ name: 'disable_trigger', node: 'trigger', module: this, applies: ['object', 'context'], callback: 'disable_trigger', category: 'drop', priority: 3, label: gettext('Disable'), - icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable', + enable : 'canCreate_with_trigger_disable', },{ name: 'create_trigger_onView', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Trigger...'), - icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js index 54a05ad1d..fcdcf06e4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js @@ -53,19 +53,19 @@ define('pgadmin.node.type', [ name: 'create_type_on_coll', node: 'coll-type', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Type...'), - icon: 'wcTabIcon icon-type', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_type', node: 'type', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Type...'), - icon: 'wcTabIcon icon-type', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_type', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Type...'), - icon: 'wcTabIcon icon-type', data: {action: 'create', check: false}, + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js index 7c2577949..d12e95c28 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js @@ -86,46 +86,45 @@ define('pgadmin.node.mview', [ pgBrowser.add_menus([{ name: 'create_mview_on_coll', node: 'coll-mview', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, icon: 'wcTabIcon icon-mview', + category: 'create', priority: 1, data: {action: 'create', check: true}, enable: 'canCreate', label: gettext('Materialized View...'), },{ name: 'create_mview', node: 'mview', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, icon: 'wcTabIcon icon-mview', + category: 'create', priority: 1, data: {action: 'create', check: true}, enable: 'canCreate', label: gettext('Materialized View...'), },{ name: 'create_mview', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 18, icon: 'wcTabIcon icon-mview', + category: 'create', priority: 18, data: {action: 'create', check: false}, enable: 'canCreate', label: gettext('Materialized View...'), },{ name: 'refresh_mview_data', node: 'mview', module: this, priority: 1, callback: 'refresh_mview', category: 'refresh_mview', applies: ['object', 'context'], label: gettext('With data'), - data: {concurrent: false, with_data: true}, icon: 'fa fa-recycle', + data: {concurrent: false, with_data: true}, },{ name: 'refresh_mview_nodata', node: 'mview', callback: 'refresh_mview', priority: 2, module: this, category: 'refresh_mview', applies: ['object', 'context'], label: gettext('With no data'), data: { concurrent: false, with_data: false, - }, icon: 'fa fa-sync-alt', + }, },{ name: 'refresh_mview_concurrent', node: 'mview', module: this, category: 'refresh_mview', enable: 'is_version_supported', data: {concurrent: true, with_data: true}, priority: 3, applies: ['object', 'context'], callback: 'refresh_mview', - label: gettext('With data (concurrently)'), icon: 'fa fa-recycle', + label: gettext('With data (concurrently)'), },{ name: 'refresh_mview_concurrent_nodata', node: 'mview', module: this, category: 'refresh_mview', enable: 'is_version_supported', data: {concurrent: true, with_data: false}, priority: 4, applies: ['object', 'context'], callback: 'refresh_mview', label: gettext('With no data (concurrently)'), - icon: 'fa fa-sync-alt', }]); }, getSchema: function(treeNodeInfo, itemNodeData) { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view.js index aad666035..582bfd4fc 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view.js @@ -76,19 +76,19 @@ define('pgadmin.node.view', [ name: 'create_view_on_coll', node: 'coll-view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('View...'), - icon: 'wcTabIcon icon-view', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_view', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('View...'), - icon: 'wcTabIcon icon-view', data: {action: 'create', check: true}, + data: {action: 'create', check: true}, enable: 'canCreate', },{ name: 'create_view', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 17, label: gettext('View...'), - icon: 'wcTabIcon icon-view', data: {action: 'create', check: false}, + data: {action: 'create', check: false}, enable: 'canCreate', }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js index 0ef60e5ef..6dcdf8f20 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js +++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js @@ -67,32 +67,32 @@ define('pgadmin.node.database', [ name: 'create_database_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Database...'), - icon: 'wcTabIcon pg-icon-database', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_database', },{ name: 'create_database_on_coll', node: 'coll-database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Database...'), - icon: 'wcTabIcon pg-icon-database', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_database', },{ name: 'create_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Database...'), - icon: 'wcTabIcon pg-icon-database', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_database', },{ name: 'connect_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'connect_database', category: 'connect', priority: 4, label: gettext('Connect Database'), - icon: 'fa fa-link', enable : 'is_not_connected', data: { + enable : 'is_not_connected', data: { data_disabled: gettext('Selected database is already connected.'), }, },{ name: 'disconnect_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'disconnect_database', category: 'drop', priority: 5, label: gettext('Disconnect from database'), - icon: 'fa fa-unlink', enable : 'is_connected',data: { + enable : 'is_connected',data: { data_disabled: gettext('Selected database is already disconnected.'), }, },{ diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js index 3c3d20b8b..95f59e94c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js +++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js @@ -58,19 +58,19 @@ define('pgadmin.node.subscription', [ name: 'create_subscription_on_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Subscription...'), - icon: 'wcTabIcon icon-subscription', data: {action: 'create'}, + data: {action: 'create'}, enable: pgBrowser.Nodes['database'].canCreate, },{ name: 'create_subscription_on_coll', node: 'coll-subscription', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Subscription...'), - icon: 'wcTabIcon icon-subscription', data: {action: 'create'}, + data: {action: 'create'}, enable: 'canCreate', },{ name: 'create_subscription', node: 'subscription', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Subscription...'), - icon: 'wcTabIcon icon-subscription', data: {action: 'create'}, + data: {action: 'create'}, enable: 'canCreate', }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js index 158c1064b..a2d2c5a9f 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js @@ -49,17 +49,17 @@ define('pgadmin.node.pga_schedule', [ name: 'create_pga_schedule_on_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Schedule...'), - icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_pga_schedule_on_coll', node: 'coll-pga_schedule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Schedule...'), - icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_pga_schedule', node: 'pga_schedule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Schedule...'), - icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'}, + data: {action: 'create'}, }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js b/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js index 69d20a2d6..8a7449e66 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.js @@ -57,17 +57,16 @@ define('pgadmin.node.pga_job', [ name: 'create_pga_job_on_coll', node: 'coll-pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('pgAgent Job...'), - icon: 'wcTabIcon icon-pga_job', data: {action: 'create'}, + data: {action: 'create'}, },{ name: 'create_pga_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('pgAgent Job...'), - icon: 'wcTabIcon icon-pga_job', data: {action: 'create'}, + data: {action: 'create'}, }, { name: 'run_now_pga_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'run_pga_job_now', priority: 4, label: gettext('Run now'), data: {action: 'create'}, - icon: 'fa fa-play-circle', }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js b/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js index ebb9b3760..7ded2d51c 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js @@ -55,17 +55,17 @@ define('pgadmin.node.pga_jobstep', [ name: 'create_pga_jobstep_on_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Job Step...'), - data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep', + data: {'action': 'create'}, },{ name: 'create_pga_jobstep_on_coll', node: 'coll-pga_jobstep', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Job Step...'), - data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobsFtep', + data: {'action': 'create'}, },{ name: 'create_pga_jobstep', node: 'pga_jobstep', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Job Step...'), - data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep', + data: {'action': 'create'}, }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js b/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js index be0b66198..c80eb1ad0 100644 --- a/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js +++ b/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js @@ -51,7 +51,7 @@ define('pgadmin.node.resource_group', [ name: 'create_resourcegroup_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Resource Group...'), - icon: 'wcTabIcon icon-resource_group', data: {action: 'create', + data: {action: 'create', data_disabled: gettext('This option is only available on EPAS servers.')}, /* Function is used to check the server type and version. * Resource Group only supported in PPAS 9.4 and above. @@ -66,13 +66,13 @@ define('pgadmin.node.resource_group', [ name: 'create_resource_group_on_coll', node: 'coll-resource_group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Resource Group...'), - icon: 'wcTabIcon icon-resource_group', data: {action: 'create', + data: {action: 'create', data_disabled: gettext('This option is only available on EPAS servers.')}, },{ name: 'create_resource_group', node: 'resource_group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Resource Group...'), - icon: 'wcTabIcon icon-resource_group', data: {action: 'create', + data: {action: 'create', data_disabled: gettext('This option is only available on EPAS servers.')}, }, ]); diff --git a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js index 099e69864..65d077bf8 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js +++ b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js @@ -88,26 +88,25 @@ define('pgadmin.node.role', [ name: 'create_role_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Login/Group Role...'), - icon: 'wcTabIcon icon-role', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_role', },{ name: 'create_role_on_roles', node: 'coll-role', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Login/Group Role...'), - icon: 'wcTabIcon icon-role', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_role', },{ name: 'create_role', node: 'role', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Login/Group Role...'), - icon: 'wcTabIcon icon-role', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_role', }, { name: 'reassign_role', node: 'role', module: this, applies: ['object', 'context'], callback: 'reassign_role', category: 'role', priority: 5, label: gettext('Reassign/Drop Owned...'), - icon: 'wcTabIcon icon-role', enable: 'can_reassign_role', }]); }, diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js index 1eb9a34d4..ad018e150 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js @@ -51,26 +51,24 @@ define('pgadmin.node.server', [ name: 'create_server_on_sg', node: 'server_group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'register', priority: 1, label: gettext('Server...'), - data: {action: 'create'}, icon: 'wcTabIcon icon-server', - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', },{ name: 'create_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'register', priority: 3, label: gettext('Server...'), - data: {action: 'create'}, icon: 'wcTabIcon icon-server', - enable: 'canCreate', + data: {action: 'create'}, enable: 'canCreate', },{ name: 'connect_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'connect_server', category: 'connect', priority: 4, label: gettext('Connect Server'), - icon: 'fa fa-link', enable : 'is_not_connected',data: { + enable : 'is_not_connected',data: { data_disabled: gettext('Database server is already connected.'), }, },{ name: 'disconnect_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'disconnect_server', category: 'drop', priority: 5, label: gettext('Disconnect from server'), - icon: 'fa fa-unlink', enable : 'is_connected',data: { + enable : 'is_connected',data: { data_disabled: gettext('Database server is already disconnected.'), }, }, @@ -78,41 +76,41 @@ define('pgadmin.node.server', [ name: 'reload_configuration', node: 'server', module: this, applies: ['tools', 'context'], callback: 'reload_configuration', category: 'reload', priority: 10, label: gettext('Reload Configuration'), - icon: 'fa fa-redo-alt', enable : 'enable_reload_config',data: { + enable : 'enable_reload_config',data: { data_disabled: gettext('Please select a server from the browser tree to reload the configuration files.'), }, },{ name: 'restore_point', node: 'server', module: this, applies: ['tools', 'context'], callback: 'restore_point', category: 'restore', priority: 7, label: gettext('Add Named Restore Point...'), - icon: 'fa fa-anchor', enable : 'is_applicable',data: { + enable : 'is_applicable',data: { data_disabled: gettext('Please select any server from the browser tree to Add Named Restore Point.'), }, },{ name: 'change_password', node: 'server', module: this, applies: ['object'], callback: 'change_password', label: gettext('Change Password...'), priority: 10, - icon: 'fa fa-lock', enable : 'is_connected',data: { + enable : 'is_connected',data: { data_disabled: gettext('Please connect server to enable change password.'), }, },{ name: 'wal_replay_pause', node: 'server', module: this, applies: ['tools', 'context'], callback: 'pause_wal_replay', category: 'wal_replay_pause', priority: 8, label: gettext('Pause Replay of WAL'), - icon: 'fa fa-pause-circle', enable : 'wal_pause_enabled',data: { + 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.'), }, },{ name: 'wal_replay_resume', node: 'server', module: this, applies: ['tools', 'context'], callback: 'resume_wal_replay', category: 'wal_replay_resume', priority: 9, label: gettext('Resume Replay of WAL'), - icon: 'fa fa-play-circle', enable : 'wal_resume_enabled',data: { + 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.'), }, },{ name: 'clear_saved_password', node: 'server', module: this, applies: ['object', 'context'], callback: 'clear_saved_password', - label: gettext('Clear Saved Password'), icon: 'fa fa-eraser', + label: gettext('Clear Saved Password'), priority: 11, enable: function(node) { return (node && node._type === 'server' && @@ -121,7 +119,7 @@ define('pgadmin.node.server', [ },{ name: 'clear_sshtunnel_password', node: 'server', module: this, applies: ['object', 'context'], callback: 'clear_sshtunnel_password', - label: gettext('Clear SSH Tunnel Password'), icon: 'fa fa-eraser', + label: gettext('Clear SSH Tunnel Password'), priority: 12, enable: function(node) { return (node && node._type === 'server' && diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js b/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js index a03396ff6..b59b8be28 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js @@ -57,19 +57,19 @@ define('pgadmin.node.tablespace', [ name: 'create_tablespace_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Tablespace...'), - icon: 'wcTabIcon icon-tablespace', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_tablespace', },{ name: 'create_tablespace_on_coll', node: 'coll-tablespace', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Tablespace...'), - icon: 'wcTabIcon icon-tablespace', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_tablespace', },{ name: 'create_tablespace', node: 'tablespace', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, label: gettext('Tablespace...'), - icon: 'wcTabIcon icon-tablespace', data: {action: 'create'}, + data: {action: 'create'}, enable: 'can_create_tablespace', }, ]); diff --git a/web/pgadmin/browser/server_groups/static/js/server_group.js b/web/pgadmin/browser/server_groups/static/js/server_group.js index 797e805cc..c9ea56c1a 100644 --- a/web/pgadmin/browser/server_groups/static/js/server_group.js +++ b/web/pgadmin/browser/server_groups/static/js/server_group.js @@ -34,7 +34,7 @@ define('pgadmin.node.server_group', [ name: 'create_server_group', node: 'server_group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, label: gettext('Server Group...'), - data: {'action': 'create'}, icon: 'wcTabIcon icon-server_group', + data: {'action': 'create'}, }]); }, getSchema: ()=>new ServerGroupSchema(), diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index b29b5ea04..974790f8d 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -7,11 +7,16 @@ // ////////////////////////////////////////////////////////////// +import React from 'react'; import { generateNodeUrl } from './node_ajax'; +import { getBrowser } from '../../../static/js/utils'; +import createMainMenus, {refreshMainMenuItems, MainMenuItemFactory} from './main_menu'; +import { getContextMenu} from './new_menu'; import _ from 'lodash'; import Notify, {initializeModalProvider, initializeNotifier} from '../../../static/js/helpers/Notifier'; import { checkMasterPassword } from '../../../static/js/Dialogs/index'; import { pgHandleItemError } from '../../../static/js/utils'; +import { Search } from './quick_search/trigger_search'; define('pgadmin.browser', [ 'sources/gettext', 'sources/url_for', 'require', 'jquery', @@ -304,6 +309,8 @@ define('pgadmin.browser', [ // Help menus help: {}, }, + native_context_menus: {}, + add_panels: function() { /* Add hooked-in panels by extensions */ let panels = JSON.parse(pgBrowser.panels_items); @@ -366,6 +373,77 @@ define('pgadmin.browser', [ scripts[n].push({'name': m, 'path': p, loaded: false}); }, masterpass_callback_queue: [], + getMenuList: function(name, item, d, skipDisabled=false) { + let obj = this; + let category = { + 'common': [] + }; + for(let _key of Object.keys(obj.menus[name][d._type])){ + let menuCategory = obj.menus[name][d._type][_key].category; + let menuItem = obj.menus[name][d._type][_key]; + + if(menuCategory in this.menu_categories) { + category[menuCategory] ? category[menuCategory].push(menuItem): category[menuCategory] = [menuItem]; + } else if (!_.isUndefined(menuCategory)) { + category[menuCategory] ? category[menuCategory].push(menuItem): category[menuCategory] = [menuItem]; + } else { + category['common'].push(menuItem); + } + } + let menuItemList = []; + + for(let c in category) { + + if((c in obj.menu_categories || category[c].length > 1) && c != 'common' ) { + let is_all_option_dis = true; + category[c].forEach((c)=> { + c.is_disabled = c.disabled(d, item); + if(is_all_option_dis) + is_all_option_dis = c.is_disabled; + }); + + let label = c in obj.menu_categories ? obj.menu_categories[c].label : c; + let priority = c in obj.menu_categories ? obj.menu_categories[c].priority || 10 : 10; + if(!is_all_option_dis && skipDisabled){ + let _menuItem = MainMenuItemFactory.create({ + name: c, + label: label, + module:c, + category: c, + menu_items: category[c], + priority: priority + }); + + menuItemList.push(_menuItem); + } else if(!skipDisabled){ + let _menuItem = MainMenuItemFactory.create({ + name: c, + label: label, + module:c, + category: c, + menu_items: category[c], + priority: priority + }); + + menuItemList.push(_menuItem); + } + } else { + category[c].forEach((c)=> { + c.is_disabled = c.disabled(d, item); + }); + + category[c].forEach((m)=> { + if(!skipDisabled) { + menuItemList.push(m); + } else if(skipDisabled && !m.is_disabled){ + menuItemList.push(m); + } + }); + } + } + + return menuItemList; + }, // Enable/disable menu options enable_disable_menus: function(item) { // Mechanism to enable/disable menus depending on the condition. @@ -376,12 +454,13 @@ define('pgadmin.browser', [ $obj_mnu = navbar.find('li#mnu_obj .dropdown-menu').first(), // data for current selected object d = item ? obj.tree.itemData(item) : undefined, - update_menuitem = function(m) { + update_menuitem = function(m, o) { if (m instanceof pgAdmin.Browser.MenuItem) { m.update(d, item); - } else { + } + else { for (let key in m) { - update_menuitem(m[key]); + update_menuitem(m[key], o); } } }; @@ -396,19 +475,38 @@ define('pgadmin.browser', [ // All menus (except for the object menus) are already present. // They will just require to check, wheather they are // enabled/disabled. - _.each([ - {m: 'file', id: '#mnu_file'}, - {m: 'management', id: '#mnu_management'}, - {m: 'tools', id: '#mnu_tools'}, - {m: 'help', id:'#mnu_help'}], function(o) { - _.each( obj.menus[o.m], function(m) { update_menuitem(m); }); - }); + let {name: browser} = getBrowser(); + if(browser == 'Nwjs') { + pgBrowser.MainMenus.forEach((menu) => { + menu.menuItems.forEach((item) => { + item.setDisabled(item.disabled(d, item)); + }); + }); + }else { + _.each([ + {name: 'file', id: '#mnu_file', label: gettext('File')}, + {name: 'management', id: '#mnu_management', label: gettext('Management')}, + {name: 'tools', id: '#mnu_tools', label: gettext('Tools')}, + {name: 'help', id:'#mnu_help', label: gettext('Help')}], function(o) { + _.each( obj.menus[o.name], function(m) { + update_menuitem(m, o); + }); + }); + } // Create the object menu dynamically if (item && obj.menus['object'] && obj.menus['object'][d._type]) { - pgAdmin.Browser.MenuCreator( - obj.Nodes, $obj_mnu, obj.menus['object'][d._type], obj.menu_categories, d, item - ); + if(browser == 'Nwjs') { + let menuItemList = obj.getMenuList('object', item, d); + let objectMenu = pgBrowser.MainMenus.filter((menu) => menu.name == 'object'); + objectMenu.length > 0 && refreshMainMenuItems(objectMenu[0], menuItemList); + let ctxMenuList = obj.getMenuList('context', item, d, true); + obj.native_context_menus = getContextMenu(ctxMenuList, item, d); + } else { + pgAdmin.Browser.MenuCreator( + obj.Nodes, $obj_mnu, obj.menus['object'][d._type], obj.menu_categories, d, item + ); + } } else { // Create a dummy 'no object seleted' menu let create_submenu = pgAdmin.Browser.MenuGroup( @@ -465,7 +563,6 @@ define('pgadmin.browser', [ initializeModalProvider(); initializeNotifier(); - // Syntax highlight the SQL Pane if(document.getElementById('sql-textarea')){ obj.editor = CodeMirror.fromTextArea( @@ -517,9 +614,14 @@ define('pgadmin.browser', [ context_menu = {}; if(item) obj.tree.select(item); - pgAdmin.Browser.MenuCreator( - obj.Nodes, $div, menus, obj.menu_categories, d, item, context_menu - ); + let {name: browser} = getBrowser(); + if(browser == 'Nwjs'){ + context_menu = obj.native_context_menus; + } else { + pgAdmin.Browser.MenuCreator( + obj.Nodes, $div, menus, obj.menu_categories, d, item, context_menu + ); + } return { autoHide: false, @@ -677,12 +779,15 @@ define('pgadmin.browser', [ let self = this, pgMenu = this.menus, MenuItem = pgAdmin.Browser.MenuItem; + let {name: browser} = getBrowser(); + // MenuItem = pgAdmin.Browser.MenuItem; _.each(menus, function(m) { _.each(m.applies, function(a) { /* We do support menu type only from this list */ - if ($.inArray(a, [ - 'context', 'file', 'edit', 'object', - 'management', 'tools', 'help']) >= 0) { + // if ($.inArray(a, [ + // 'context', 'file', 'edit', 'object', + // 'management', 'tools', 'help']) >= 0) { + if(['context', 'file', 'edit', 'object','management', 'tools', 'help'].indexOf(a) > -1){ let _menus; // If current node is not visible in browser tree @@ -714,14 +819,55 @@ define('pgadmin.browser', [ } else if(_.isString(_m.enable) && _m.enable.toLowerCase() == 'false') { enable = false; } - return new MenuItem({ - name: _m.name, label: _m.label, module: _m.module, - category: _m.category, callback: _m.callback, - priority: _m.priority, data: _m.data, url: _m.url || '#', - target: _m.target, icon: _m.icon, - enable, - node: _m.node, checked: _m.checked, below: _m.below, - }); + + // This is to handel quick search callback + if(gettext(_m.label) == gettext('Quick Search')) { + _m.callback = () => { + // Render Search component + Notify.showModal(gettext('Quick Search'), (closeModal) => { + return ; + }, + { isFullScreen: false, isResizeable: false, showFullScreen: false, isFullWidth: false, showTitle: false} + ); + }; + } + + if(browser == 'Nwjs') { + return MainMenuItemFactory.create({ + name: _m.name, + label: _m.label, + module: _m.module, + category: _m.category, + callback: typeof _m.module == 'object' && _m.module[_m.callback] && _m.callback in _m.module[_m.callback] ? _m.module[_m.callback] : _m.callback, + priority: _m.priority, + data: _m.data, + url: _m.url || '#', + target: _m.target, + icon: _m.icon, + enable: enable ? enable : true, + node: _m.node, + checked: _m.checked, + below: _m.below, + applies: _m.applies, + }); + } else { + return new MenuItem({ + name: _m.name, + label: _m.label, + module: _m.module, + category: _m.category, + callback: _m.callback, + priority: _m.priority, + data: _m.data, + url: _m.url || '#', + target: _m.target, + icon: _m.icon, + enable, + node: _m.node, + checked: _m.checked, + below: _m.below, + }); + } }; if (!_.has(_menus, m.name)) { @@ -747,35 +893,41 @@ define('pgadmin.browser', [ }); }, // Create the menus - create_menus: function() { + create_menus: function () { + let { name: browser } = getBrowser(); + // Add Native menus if NWjs app + if (browser == 'Nwjs') { + createMainMenus(); + this.enable_disable_menus(); + } else { + /* Create menus */ + let navbar = $('#navbar-menu > ul').first(); + let obj = this; - /* Create menus */ - let navbar = $('#navbar-menu > ul').first(); - let obj = this; + _.each([ + { menu: 'file', id: '#mnu_file' }, + { menu: 'management', id: '#mnu_management' }, + { menu: 'tools', id: '#mnu_tools' }, + { menu: 'help', id: '#mnu_help' }], + function (o) { + let $mnu = navbar.children(o.id).first(), + $dropdown = $mnu.children('.dropdown-menu').first(); + $dropdown.empty(); + if (o.menu == 'help') { + $dropdown.append('
'); + $dropdown.append(''); + } - _.each([ - {menu: 'file', id: '#mnu_file'}, - {menu: 'management', id: '#mnu_management'}, - {menu: 'tools', id: '#mnu_tools'}, - {menu: 'help', id:'#mnu_help'}], - function(o) { - let $mnu = navbar.children(o.id).first(), - $dropdown = $mnu.children('.dropdown-menu').first(); - $dropdown.empty(); - if(o.menu == 'help'){ - $dropdown.append('
'); - $dropdown.append(''); - } + if (pgAdmin.Browser.MenuCreator( + obj.Nodes, $dropdown, obj.menus[o.menu], obj.menu_categories + )) { + $mnu.removeClass('d-none'); + } + }); - if (pgAdmin.Browser.MenuCreator( - obj.Nodes, $dropdown, obj.menus[o.menu], obj.menu_categories - )) { - $mnu.removeClass('d-none'); - } - }); - - navbar.children('#mnu_obj').removeClass('d-none'); - obj.enable_disable_menus(); + navbar.children('#mnu_obj').removeClass('d-none'); + obj.enable_disable_menus(); + } }, // General function to handle callbacks for object or dialog help. showHelp: function(type, url, node, item) { diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js index a66acb12e..fd60bcf67 100644 --- a/web/pgadmin/browser/static/js/collection.js +++ b/web/pgadmin/browser/static/js/collection.js @@ -45,7 +45,6 @@ define([ name: 'refresh', node: this.type, module: this, applies: ['object', 'context'], callback: 'refresh', priority: 2, label: gettext('Refresh'), - icon: 'fa fa-sync-alt', }]); // show query tool only in context menu of supported nodes. @@ -55,7 +54,6 @@ define([ name: 'show_query_tool', node: this.type, module: this, applies: ['context'], callback: 'show_query_tool', priority: 998, label: gettext('Query Tool'), - icon: 'pg-font-icon icon-query_tool', }]); // show search objects same as query tool @@ -63,7 +61,6 @@ define([ name: 'search_objects', node: this.type, module: this, applies: ['context'], callback: 'show_search_objects', priority: 997, label: gettext('Search Objects...'), - icon: 'fa fa-search', }]); // show psql tool same as query tool. @@ -72,7 +69,6 @@ define([ name: 'show_psql_tool', node: this.type, module: this, applies: ['context'], callback: 'show_psql_tool', priority: 998, label: gettext('PSQL Tool'), - icon: 'fas fa-terminal', }]); } } diff --git a/web/pgadmin/browser/static/js/main_menu.js b/web/pgadmin/browser/static/js/main_menu.js new file mode 100644 index 000000000..98bd8a4cb --- /dev/null +++ b/web/pgadmin/browser/static/js/main_menu.js @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2022, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// +import gettext from 'sources/gettext'; +import pgAdmin from 'sources/pgadmin'; +import { getBrowser } from '../../../static/js/utils'; +import Menu, { MenuItem } from './new_menu'; + +export let MainMenus = [ + { label: gettext('File'), name: 'file', id: 'mnu_file', index: 0, addSepratior: true }, + { label: gettext('Object'), name: 'object', id: 'mnu_obj', index: 1, addSepratior: true }, + { label: gettext('Tools'), name: 'tools', id: 'mnu_tools', index: 2, addSepratior: true }, + { label: gettext('Help'), name: 'help', id: 'mnu_help', index: 5, addSepratior: false } +]; + +let {name: browser} = getBrowser(); + +export default function createMainMenus() { + pgAdmin.Browser.MainMenus = []; + MainMenus.forEach((_menu) => { + let menuObj = Menu.create(_menu.name, _menu.label, _menu.id, _menu.index, _menu.addSepratior); + pgAdmin.Browser.MainMenus.push(menuObj); + // Don't add menuItems for Object menu as it's menuItems get changed on tree selection. + if(_menu.name !== 'object') { + menuObj.addMenuItems(Object.values(pgAdmin.Browser.menus[_menu.name])); + let priority = null; + menuObj.menuItems.forEach((menuItem, index)=> { + if(index == 0) { + priority = menuItem.priority; + } + + if(priority !== menuItem.priority) { + let separateMenuItem = new MenuItem({type: 'separator'}); + menuObj.addMenuItem(separateMenuItem, index); + } + + }); + } + }); +} + +export function refreshMainMenuItems(menu, menuItems) { + if(browser == 'Nwjs') { + menu.setMenuItems(menuItems); + pgAdmin.Browser.Events.trigger('pgadmin:nw-refresh-menu-item', menu); + } +} + +// Factory to create menu items for main menu. +export class MainMenuItemFactory { + static create(options) { + return new MenuItem({...options, callback: () => { + // Some callbacks registered in 'callbacks' check and call specifiec callback function + if (options.module && 'callbacks' in options.module && options.module.callbacks[options.callback]) { + options.module.callbacks[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree.selected()]); + } else if (options.module && options.module[options.callback]) { + options.module[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree.selected()]); + } else if (options?.callback) { + options.callback(options); + } else { + if (options.url != '#') { + window.open(options.url); + } + } + }}, (menu, item)=> { + pgAdmin.Browser.Events.trigger('pgadmin:nw-enable-disable-menu-items', menu, item); + }); + } +} diff --git a/web/pgadmin/browser/static/js/menu.js b/web/pgadmin/browser/static/js/menu.js index 3e7b11931..97de93e97 100644 --- a/web/pgadmin/browser/static/js/menu.js +++ b/web/pgadmin/browser/static/js/menu.js @@ -7,6 +7,7 @@ // ////////////////////////////////////////////////////////////// import _ from 'lodash'; +import {MenuItem as NewMenuItem} from './new_menu'; define([ 'sources/pgadmin', 'jquery', 'sources/utils', 'sources/gettext', @@ -334,7 +335,17 @@ define([ let group = groups[m.category || 'common'] = groups[m.category || 'common'] || []; group.push(m); - } else { + } else if(m instanceof NewMenuItem) { + if (m.$el) { + m.$el.remove(); + delete m.$el; + } + m.generate(this, self, this.context_menu_callback, item); + let group = groups[m.category || 'common'] = + groups[m.category || 'common'] || []; + group.push(m); + } + else { for (let key in m) { update_menuitem(m[key]); } @@ -431,6 +442,7 @@ define([ let d = this.$element.data('pgMenu'); if (d.cb) { let cb = d.module && d.module['callbacks'] && d.module['callbacks'][d.cb] || d.module && d.module[d.cb]; + cb = cb || d.cb; if (cb) { cb.apply(d.module, [d.data, pgAdmin.Browser.tree.selected()]); ev.preventDefault(); diff --git a/web/pgadmin/browser/static/js/new_menu.js b/web/pgadmin/browser/static/js/new_menu.js new file mode 100644 index 000000000..27e6ab54f --- /dev/null +++ b/web/pgadmin/browser/static/js/new_menu.js @@ -0,0 +1,223 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2022, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// +import _ from 'lodash'; +import gettext from 'sources/gettext'; + +export default class Menu { + constructor(name, label, id, index, addSepratior) { + this.label = label; + this.name = name; + this.id = id; + this.index = index || 1; + this.menuItems = [], + this.addSepratior = addSepratior || false; + } + + static create(name, label, id, index, addSepratior) { + let menuObj = new Menu(name, label, id, index, addSepratior); + return menuObj; + } + + addMenuItem(menuItem, index=null) { + if (menuItem instanceof MenuItem) { + menuItem.parentMenu = this; + if(index) { + this.menuItems.splice(index, 0, menuItem); + } else { + this.menuItems.push(menuItem); + + // Sort by alphanumeric ordered first + this.menuItems.sort(function (a, b) { + return a.label.localeCompare(b.label); + }); + + // Sort by priority + this.menuItems.sort(function (a, b) { + return a.priority - b.priority; + }); + } + } else { + throw new Error(gettext('Invalid MenuItem instance')); + } + + + } + + addMenuItems(menuItems) { + menuItems.forEach((item) => { + if (item instanceof MenuItem) { + item.parentMenu = this; + this.menuItems.push(item); + } else { + let subItems = Object.values(item); + subItems.forEach((subItem)=> { + if (subItem instanceof MenuItem) { + subItem.parentMenu = this; + this.menuItems.push(subItem); + } else { + throw new Error(gettext('Invalid MenuItem instance')); + } + }); + } + }); + + // Sort by alphanumeric ordered first + this.menuItems.sort(function (a, b) { + return a.label.localeCompare(b.label); + }); + + // Sort by priority + this.menuItems.sort(function (a, b) { + return a.priority - b.priority; + }); + + } + + setMenuItems(menuItems) { + this.menuItems = menuItems; + // Sort by alphanumeric ordered first + this.menuItems.sort(function (a, b) { + return a.label.localeCompare(b.label); + }); + + // Sort by priority + this.menuItems.sort(function (a, b) { + return a.priority - b.priority; + }); + + } + + getMenuItems() { + return this.menuItems; + } + + static getContextMenus(menuList, item, node) { + // Sort by alphanumeric ordered first + menuList.sort(function (a, b) { + return a.label.localeCompare(b.label); + }); + + // Sort by priority + menuList.sort(function (a, b) { + return a.priority - b.priority; + }); + + let ctxMenus = {}; + let ctxIndex = 1; + menuList.forEach(ctx => { + let ctx_uid = _.uniqueId('ctx_'); + let sub_ctx_item = {}; + ctx.is_disabled = ctx.disabled(node, item); + if ('menu_items' in ctx && ctx.menu_items) { + ctx.menu_items.forEach((c) => { + c.is_disabled = c.disabled(node, item); + if (!c.is_disabled) { + sub_ctx_item[ctx_uid + _.uniqueId('_sub_')] = c.getContextItem(c.label, c.is_disabled); + } + }); + } + if (!ctx.is_disabled) { + ctxMenus[ctx_uid + '_' + ctx.priority + '_' + + ctxIndex + '_itm'] = ctx.getContextItem(ctx.label, ctx.is_disabled, sub_ctx_item); + + if (_.size(sub_ctx_item) > 0 && ['register', 'create'].includes(ctx.category)) { + ctxMenus[ctx_uid + '_' + ctx.priority + '_' + + ctxIndex + '_sep'] = '----'; + } + } + ctxIndex++; + }); + + return ctxMenus; + } +} + + +export class MenuItem { + constructor(options, onDisableChange) { + let menu_opts = [ + 'name', 'label', 'priority', 'module', 'callback', 'data', 'enable', + 'category', 'target', 'url', 'node', + 'checked', 'below', 'menu_items', 'is_checkbox', 'action', 'applies', 'is_native_only', 'type' + ]; + let defaults = { + url: '#', + target: '_self', + enable: true, + type: 'normal' + }; + _.extend(this, defaults, _.pick(options, menu_opts)); + if (!this.callback) { + this.callback = (item) => { + if (item.url != '#') { + window.open(item.url); + } + }; + } + this.onDisableChange = onDisableChange; + } + + static create(options) { + return MenuItem(options); + } + + contextMenuCallback(self) { + self.callback(); + } + + getContextItem(label, is_disabled, sub_ctx_item) { + let self = this; + return { + name: label, + disabled: is_disabled, + callback: () => { this.contextMenuCallback(self); }, + ...(sub_ctx_item && Object.keys(sub_ctx_item).length > 0) && { items: sub_ctx_item } + }; + } + + setDisabled(disabled) { + this.is_disabled = disabled; + this.onDisableChange?.(this.parentMenu, this); + } + + /* + * Checks this menu enable/disable state based on the selection. + */ + disabled(node, item) { + if (this.enable == undefined) { + return false; + } + + if (this.node) { + if (!node) { + return true; + } + if (_.isArray(this.node) ? ( + _.indexOf(this.node, node) == -1 + ) : (this.node != node._type)) { + return true; + } + } + + if (_.isBoolean(this.enable)) return !this.enable; + if (_.isFunction(this.enable)) { + return !this.enable.apply(this.module, [node, item, this.data]); + } + if (this.module && _.isBoolean(this.module[this.enable])) { + return !this.module[this.enable]; + } + if (this.module && _.isFunction(this.module[this.enable])) { + return !(this.module[this.enable]).apply(this.module, [node, item, this.data]); + } + + return false; + } +} + +export function getContextMenu(menu, item, node) { + return Menu.getContextMenus(menu, item, node); +} diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js index 0ed38cca4..36fc76ec3 100644 --- a/web/pgadmin/browser/static/js/node.js +++ b/web/pgadmin/browser/static/js/node.js @@ -111,7 +111,7 @@ define('pgadmin.browser.node', [ callback: 'refresh', priority: 2, label: gettext('Refresh...'), - icon: 'fa fa-sync-alt', + enable: true, }]); if (self.canEdit) { @@ -126,7 +126,6 @@ define('pgadmin.browser.node', [ data: { 'action': 'edit', }, - icon: 'fa fa-edit', enable: _.isFunction(self.canEdit) ? function() { return !!(self.canEdit.apply(self, arguments)); @@ -147,7 +146,6 @@ define('pgadmin.browser.node', [ 'url': 'drop', data_disabled: gettext('The selected tree node does not support this option.'), }, - icon: 'fa fa-trash-alt', enable: _.isFunction(self.canDrop) ? function() { return !!(self.canDrop.apply(self, arguments)); @@ -166,7 +164,6 @@ define('pgadmin.browser.node', [ data: { 'url': 'delete', }, - icon: 'fa fa-trash-alt', enable: _.isFunction(self.canDropCascade) ? function() { return self.canDropCascade.apply(self, arguments); @@ -193,7 +190,6 @@ define('pgadmin.browser.node', [ callback: 'show_query_tool', priority: 998, label: gettext('Query Tool'), - icon: 'pg-font-icon icon-query_tool', enable: enable, }]); @@ -211,7 +207,6 @@ define('pgadmin.browser.node', [ name: 'show_psql_tool', node: this.type, module: this, applies: ['context'], callback: 'show_psql_tool', priority: 998, label: gettext('PSQL Tool'), - icon: 'fas fa-terminal', }]); } } @@ -240,7 +235,6 @@ define('pgadmin.browser.node', [ 'script': stype, data_disabled: gettext('The selected tree node does not support this option.'), }, - icon: 'fa fa-pencil-alt', enable: self.check_user_permission, }]); }); diff --git a/web/pgadmin/browser/static/js/quick_search.js b/web/pgadmin/browser/static/js/quick_search.js deleted file mode 100644 index c3f42429b..000000000 --- a/web/pgadmin/browser/static/js/quick_search.js +++ /dev/null @@ -1,29 +0,0 @@ -///////////////////////////////////////////////////////////// -// -// pgAdmin 4 - PostgreSQL Tools -// -// Copyright (C) 2013 - 2022, The pgAdmin Development Team -// This software is released under the PostgreSQL Licence -// -////////////////////////////////////////////////////////////// - -import React from 'react'; -import ReactDOM from 'react-dom'; -import {Search} from './quick_search/trigger_search'; - -// TODO: GUI, Add the logic to show loading screen while fetching result -const onResultFetch = (url, data) => { - // URL can be used for displaying all the result in new page - // data will be array of search -> - console.warn('URL = ' + url); - console.warn(data); -}; - -setTimeout(function(){ - if (document.getElementById('quick-search-component')) { - ReactDOM.render( - , - document.getElementById('quick-search-component') - ); - } -},500); diff --git a/web/pgadmin/browser/static/js/quick_search/menuitems_help.js b/web/pgadmin/browser/static/js/quick_search/menuitems_help.js index ef3f0b744..28ac57b43 100644 --- a/web/pgadmin/browser/static/js/quick_search/menuitems_help.js +++ b/web/pgadmin/browser/static/js/quick_search/menuitems_help.js @@ -6,86 +6,79 @@ // This software is released under the PostgreSQL Licence // ////////////////////////////////////////////////////////////// -import gettext from 'sources/gettext'; - +import {MenuItem as NewMenuItem} from '../new_menu'; +import { MainMenus } from '../main_menu'; +import pgAdmin from 'sources/pgadmin'; +import { getBrowser } from '../../../../static/js/utils'; // Allow us to const getMenuName = (item) => { - let aLinks = item.getElementsByTagName('a'); - let name; - if (aLinks.length > 0) { - name = (aLinks[0].text).trim(); - name = name.replace(/\.+$/g, ''); - } - return name; + return item.label; }; export function menuSearch(param, props) { - let LAST_MENU; param = param.trim(); const setState = props.setState; let result = []; - if (window.pgAdmin.Browser.utils.app_name) { - LAST_MENU = gettext('About '+ window.pgAdmin.Browser.utils.app_name); - } - - // Here we will add the matches - const parseLI = (_menu, path) => { - let _name = getMenuName(_menu); - if (_name && _name.toLowerCase().indexOf(param.toLowerCase()) != -1) { - let _res = {}; - _res[_name] = path; - _res['element'] = _menu.children[0]; - result.push(_res); - } - // Check if last menu then update the parent component's state - if (_name === LAST_MENU) { - setState(state => ({ - ...state, - fetched: true, - data: result, - })); - } - }; - - // Recursive function to search in UL - const parseUL = (menu, path) => { - const menus = Array.from(menu.children); - menus.forEach((_menu) => { - let _name, _path; - if (_menu.tagName == 'UL') { - _name = getMenuName(_menu); - _path = `${path}/${_name}`; - iterItem(_menu, _path); - } else if (_menu.tagName == 'LI') { - if (_menu.classList.contains('dropdown-submenu')) { - _name = getMenuName(_menu); - _path = `${path}/${_name}`; - iterItem(_menu, _path); + const iterItem = (subMenus, path, parentPath) => { + subMenus.forEach((subMenu) =>{ + if(subMenu instanceof NewMenuItem || subMenu instanceof pgAdmin.Browser.MenuItem) { + if(subMenu.type != 'separator' && subMenu?.label?.toLowerCase().indexOf(param.toLowerCase()) != -1){ + let localPath = path; + if(parentPath) { + localPath = `${parentPath} > ${path} `; + } + subMenu.path = localPath; + let selectedNode = pgAdmin.Browser.tree.selected(); + if(subMenu.path == 'Object') { + if(selectedNode && selectedNode._metadata.data._type == subMenu.module.parent_type) { + result.push(subMenu); + } + } else { + result.push(subMenu); + } + } + if(subMenu.menu_items) { + iterItem(subMenu.menu_items, getMenuName(subMenu), path); + } + } else { + if(typeof(subMenu) == 'object' && !(subMenu instanceof NewMenuItem || subMenu instanceof pgAdmin.Browser.MenuItem)) { + iterItem(Object.values(subMenu), path, parentPath); } else { - parseLI(_menu, path); + iterItem(subMenu, path, parentPath); } } }); }; - // Expects LI of menus which contains A & UL - const iterItem = (menu, path) => { - const subMenus = Array.from(menu.children); - subMenus.forEach((_menu) => { - if (_menu.tagName == 'UL') { - parseUL(_menu, path); - } - }); - }; - // Starting Point - const navbar = document.querySelector('.navbar-nav'); - const mainMenus = Array.from(navbar.children); + let {name: browser} = getBrowser(); + const mainMenus = browser == 'Nwjs' ?pgAdmin.Browser.MainMenus : MainMenus; + if(browser == 'Nwjs') { + mainMenus.forEach((menu) => { + let subMenus = menu.menuItems; + iterItem(subMenus, getMenuName(menu)); + }); + } else { + mainMenus.forEach((menu) => { + let subMenus = []; + if(menu.name == 'object') { + let selectedNode = pgAdmin.Browser.tree.selected(); + if(selectedNode) { + subMenus = pgAdmin.Browser.menus[menu.name][selectedNode._metadata.data._type]; + } + } else { + subMenus = pgAdmin.Browser.menus[menu.name]; + } + iterItem(Object.values(subMenus), getMenuName(menu)); + }); + } - mainMenus.forEach((menu) => { - iterItem(menu, getMenuName(menu)); - }); + setState(state => ({ + ...state, + fetched: true, + data: result, + })); } diff --git a/web/pgadmin/browser/static/js/quick_search/online_help.js b/web/pgadmin/browser/static/js/quick_search/online_help.js index 852807e25..97424607a 100644 --- a/web/pgadmin/browser/static/js/quick_search/online_help.js +++ b/web/pgadmin/browser/static/js/quick_search/online_help.js @@ -51,43 +51,47 @@ export function onlineHelpSearch(param, props) { let iframeHTML = content.document; window.pooling = setInterval(() => { let resultEl = iframeHTML.getElementById('search-results'); - let searchResultsH2Tags = resultEl.getElementsByTagName('h2'); - let list = resultEl && resultEl.getElementsByTagName('LI'); let pooling = window.pooling; - if ((list && list.length > 0 )) { - let res = extractSearchResult(list); - // After getting the data, we need to call the Parent component function - // which will render the data on the screen - if (searchResultsH2Tags[0]['childNodes'][0]['textContent'] != 'Searching') { - window.clearInterval(pooling); + if(resultEl) { + let searchResultsH2Tags = resultEl.getElementsByTagName('h2'); + let list = resultEl && resultEl.getElementsByTagName('LI'); + if ((list && list.length > 0 )) { + let res = extractSearchResult(list); + // After getting the data, we need to call the Parent component function + // which will render the data on the screen + if (searchResultsH2Tags[0]['childNodes'][0]['textContent'] != 'Searching') { + window.clearInterval(pooling); + setState(state => ({ + ...state, + fetched: true, + clearedPooling: true, + url: srcURL, + data: res, + })); + isIFrameLoaded = false; + ReactDOM.unmountComponentAtNode(document.getElementById('quick-search-iframe-container')); + } else { + setState(state => ({ + ...state, + fetched: true, + clearedPooling: false, + url: srcURL, + data: res, + })); + } + } else if(searchResultsH2Tags[0]['childNodes'][0]['textContent'] == 'Search Results') { setState(state => ({ ...state, fetched: true, clearedPooling: true, url: srcURL, - data: res, + data: {}, })); - isIFrameLoaded = false; ReactDOM.unmountComponentAtNode(document.getElementById('quick-search-iframe-container')); - } else { - setState(state => ({ - ...state, - fetched: true, - clearedPooling: false, - url: srcURL, - data: res, - })); + isIFrameLoaded = false; + window.clearInterval(pooling); } - } else if(searchResultsH2Tags[0]['childNodes'][0]['textContent'] == 'Search Results') { - setState(state => ({ - ...state, - fetched: true, - clearedPooling: true, - url: srcURL, - data: {}, - })); - ReactDOM.unmountComponentAtNode(document.getElementById('quick-search-iframe-container')); - isIFrameLoaded = false; + } else { window.clearInterval(pooling); } }, 500); diff --git a/web/pgadmin/browser/static/js/quick_search/trigger_search.js b/web/pgadmin/browser/static/js/quick_search/trigger_search.js index 2c11c9ad9..0ee332014 100644 --- a/web/pgadmin/browser/static/js/quick_search/trigger_search.js +++ b/web/pgadmin/browser/static/js/quick_search/trigger_search.js @@ -7,12 +7,16 @@ // ////////////////////////////////////////////////////////////// import React, {useRef,useState, useEffect} from 'react'; +import { makeStyles } from '@material-ui/core'; +import clsx from 'clsx'; import {useDelayDebounce} from 'sources/custom_hooks'; import {onlineHelpSearch} from './online_help'; import {menuSearch} from './menuitems_help'; import $ from 'jquery'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; +import pgAdmin from 'sources/pgadmin'; +import { getBrowser } from '../../../../static/js/utils'; function HelpArticleContents({isHelpLoading, isMenuLoading, helpSearchResult}) { return (isHelpLoading && !(isMenuLoading??true)) ? ( @@ -39,8 +43,17 @@ HelpArticleContents.propTypes = { isMenuLoading: PropTypes.bool }; -export function Search() { +const useModalStyles = makeStyles(() => ({ + setTop: { + marginTop: '-20px', + } +})); + +export function Search({closeModal}) { + let {name: browser} = getBrowser(); + const classes = useModalStyles(); const wrapperRef = useRef(null); + const firstEleRef = useRef(); const [searchTerm, setSearchTerm] = useState(''); const [isShowMinLengthMsg, setIsShowMinLengthMsg] = useState(false); const [isMenuLoading, setIsMenuLoading] = useState(false); @@ -64,6 +77,7 @@ export function Search() { fetched: false, data: [], })); + setHelpSearchResult(state => ({ ...state, fetched: false, @@ -120,37 +134,37 @@ export function Search() { const refactorMenuItems = (items) => { if(items.length > 0){ let menuItemsHtmlElement = []; - for(let i=0; i < items.length; i++){ - Object.keys(items[i]).forEach( (value) => { - if(value != 'element' && value != 'No object selected'){ - menuItemsHtmlElement.push(
  • {items[i]['element'].click(); toggleDropdownMenu();}}> - {value} - {refactorPathToMenu(items[i][value])} - - { ((items[i]['element'].classList.contains('disabled') && items[i]['element'].getAttribute('data-disabled') != undefined) ? : '' )} -
  • ); - } - }); - } + items.forEach((i) => { + menuItemsHtmlElement.push( +
  • { + closeModal(); + if(browser == 'Nwjs') { + i.callback(); + } else { + // Some callbacks registered in 'callbacks' check and call specifiec callback function + if (i.module && 'callbacks' in i.module && i.module.callbacks[i.callback]) { + i.module.callbacks[i.callback].apply(i.module, [i.data, pgAdmin.Browser.tree.selected()]); + } else if (i.module && i.module[i.callback]) { + i.module[i.callback].apply(i.module, [i.data, pgAdmin.Browser.tree.selected()]); + } else if (i.callback) { + i.callback(i); + } else { + window.open(i.url); + } + } + } + }> + {i.label} + {i.path} + +
  • ); + }); $('[data-toggle="tooltip"]').tooltip(); return menuItemsHtmlElement; } }; - const refactorPathToMenu = (path) => { - if(path){ - let pathArray = path.split('/'); - let spanElement = []; - for(let i = 0; i < pathArray.length; i++ ){ - if(i == (pathArray.length -1)){ - spanElement.push(pathArray[i]); - }else{ - spanElement.push( {pathArray[i]} ); - } - } - return spanElement; - } - }; const onInputValueChange = (value) => { let pooling = window.pooling; @@ -210,13 +224,19 @@ export function Search() { return loading ?
    {gettext('Searching...')}
    : ''; }; + useEffect(() => { + setTimeout(() => { + firstEleRef.current && firstEleRef.current.focus(); + }, 350); + }, [firstEleRef.current]); + return (
    , -