mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added native menu support in desktop mode. #5503
This commit is contained in:
parent
cddb24bc50
commit
2480d08e0f
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
@ -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})
|
||||
|
||||
|
@ -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'},
|
||||
}]);
|
||||
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
]);
|
||||
|
@ -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,
|
||||
},
|
||||
]);
|
||||
|
@ -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'},
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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'},
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
]);
|
||||
|
@ -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'},
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -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'},
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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',
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -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',
|
||||
}]);
|
||||
},
|
||||
|
@ -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',
|
||||
}]);
|
||||
|
||||
},
|
||||
|
@ -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',
|
||||
}]);
|
||||
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
|
@ -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},
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
@ -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'
|
||||
}
|
||||
]);
|
||||
},
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
@ -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) {
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
@ -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.'),
|
||||
},
|
||||
},{
|
||||
|
@ -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',
|
||||
}]);
|
||||
},
|
||||
|
@ -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'},
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -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',
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -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'},
|
||||
}]);
|
||||
},
|
||||
|
||||
|
@ -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.')},
|
||||
},
|
||||
]);
|
||||
|
@ -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',
|
||||
}]);
|
||||
},
|
||||
|
@ -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' &&
|
||||
|
@ -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',
|
||||
},
|
||||
]);
|
||||
|
@ -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(),
|
||||
|
@ -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 <Search closeModal={closeModal}/>;
|
||||
},
|
||||
{ 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('<div id="quick-search-component"></div>');
|
||||
$dropdown.append('<div class="menu-groups"><span class="fa fa-list" style="font-weight:900 !important;"></span> ' + gettext('SUGGESTED SITES') + '</div>');
|
||||
}
|
||||
|
||||
_.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('<div id="quick-search-component"></div>');
|
||||
$dropdown.append('<div class="menu-groups"><span class="fa fa-list" style="font-weight:900 !important;"></span> ' + gettext('SUGGESTED SITES') + '</div>');
|
||||
}
|
||||
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) {
|
||||
|
@ -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',
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
74
web/pgadmin/browser/static/js/main_menu.js
Normal file
74
web/pgadmin/browser/static/js/main_menu.js
Normal file
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
223
web/pgadmin/browser/static/js/new_menu.js
Normal file
223
web/pgadmin/browser/static/js/new_menu.js
Normal file
@ -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);
|
||||
}
|
@ -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,
|
||||
}]);
|
||||
});
|
||||
|
@ -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 <name> -> <link>
|
||||
console.warn('URL = ' + url);
|
||||
console.warn(data);
|
||||
};
|
||||
|
||||
setTimeout(function(){
|
||||
if (document.getElementById('quick-search-component')) {
|
||||
ReactDOM.render(
|
||||
<Search onResult={onResultFetch} />,
|
||||
document.getElementById('quick-search-component')
|
||||
);
|
||||
}
|
||||
},500);
|
@ -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,
|
||||
}));
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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( <li key={ 'li-menu-' + i }><a tabIndex='0' id={ 'li-menu-' + i } href={'#'} className={ (items[i]['element'].classList.contains('disabled') ? 'dropdown-item menu-groups-a disabled':'dropdown-item menu-groups-a')} key={ 'menu-' + i } onClick={() => {items[i]['element'].click(); toggleDropdownMenu();}}>
|
||||
{value}
|
||||
<span key={ 'menu-span-' + i }>{refactorPathToMenu(items[i][value])}</span>
|
||||
</a>
|
||||
{ ((items[i]['element'].classList.contains('disabled') && items[i]['element'].getAttribute('data-disabled') != undefined) ? <i className='fa fa-info-circle quick-search-tooltip' data-toggle='tooltip' title={items[i]['element'].getAttribute('data-disabled')} aria-label='Test data tooltip' aria-hidden='true'></i> : '' )}
|
||||
</li>);
|
||||
}
|
||||
});
|
||||
}
|
||||
items.forEach((i) => {
|
||||
menuItemsHtmlElement.push(
|
||||
<li key={ 'li-menu-' + i }><a tabIndex='0' id={ 'li-menu-' + i.label } href={'#'} className={ (i.is_disabled ? 'dropdown-item menu-groups-a disabled':'dropdown-item menu-groups-a')} key={ 'menu-' + i.label } onClick={
|
||||
() => {
|
||||
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}
|
||||
<span key={ 'menu-span-' + i.label }>{i.path}</span>
|
||||
</a>
|
||||
</li>);
|
||||
});
|
||||
$('[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(<span key={ 'menu-span-sub' + i }> {pathArray[i]} <i className='fa fa-angle-right' aria-hidden='true'></i> </span>);
|
||||
}
|
||||
}
|
||||
return spanElement;
|
||||
}
|
||||
};
|
||||
|
||||
const onInputValueChange = (value) => {
|
||||
let pooling = window.pooling;
|
||||
@ -210,13 +224,19 @@ export function Search() {
|
||||
return loading ? <div className='pad-12'><div className="search-icon">{gettext('Searching...')}</div></div> : '';
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
firstEleRef.current && firstEleRef.current.focus();
|
||||
}, 350);
|
||||
}, [firstEleRef.current]);
|
||||
|
||||
return (
|
||||
<div id='quick-search-container' onClick={setSearchTerm}></div>,
|
||||
<ul id='quick-search-container' ref={wrapperRef} className='test' role="menu">
|
||||
<ul id='quick-search-container' ref={wrapperRef} className={clsx('test', classes.setTop)} role="menu">
|
||||
<li>
|
||||
<ul id='myDropdown'>
|
||||
<li className='dropdown-item-input'>
|
||||
<input tabIndex='0' autoFocus type='text' autoComplete='off' className='form-control live-search-field'
|
||||
<input ref={firstEleRef} tabIndex='0' autoFocus type='text' autoComplete='off' className='form-control live-search-field'
|
||||
aria-label='live-search-field' id='live-search-field' placeholder={gettext('Quick Search')} onChange={(e) => {onInputValueChange(e.target.value);} } />
|
||||
</li>
|
||||
<div style={{marginBottom:0}}>
|
||||
@ -229,7 +249,6 @@ export function Search() {
|
||||
</div>)
|
||||
:''}
|
||||
<div >
|
||||
|
||||
{ (menuSearchResult.fetched && !(isMenuLoading??true) ) ?
|
||||
<div>
|
||||
<div className='menu-groups'>
|
||||
@ -269,3 +288,8 @@ export function Search() {
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Search.propTypes = {
|
||||
closeModal: PropTypes.func
|
||||
};
|
||||
|
@ -98,6 +98,7 @@ window.onload = function(e){
|
||||
<div class="row"><div class="col-12 pg-sp-text">{{ _('Loading {0} v{1}...').format(config.APP_NAME, config.APP_VERSION) }}</div></div>
|
||||
</div>
|
||||
</div>
|
||||
{% if current_app.PGADMIN_RUNTIME | string() == 'False' %}
|
||||
<nav class="navbar fixed-top navbar-expand-lg navbar-dark pg-navbar">
|
||||
<a class="navbar-brand pgadmin_header_logo" onClick="return false;" href="{{ '#' }}"
|
||||
title="{{ config.APP_NAME }} {{ _('logo') }}" aria-label="{ config.APP_NAME }} {{ _('logo') }}">
|
||||
@ -173,6 +174,9 @@ window.onload = function(e){
|
||||
</nav>
|
||||
|
||||
<div id="dockerContainer" class="pg-docker"></div>
|
||||
{% else %}
|
||||
<div id="dockerContainer" class="pg-docker pg-docker-native"></div>
|
||||
{% endif %}
|
||||
|
||||
{% include 'browser/messages.html' %}
|
||||
|
||||
|
@ -44,6 +44,8 @@ define('pgadmin.browser.utils',
|
||||
/* Add hooked-in panels by extensions */
|
||||
pgBrowser['panels_items'] = '{{ current_app.panels|tojson }}';
|
||||
|
||||
pgBrowser['MainMenus'] = [];
|
||||
|
||||
pgAdmin['csrf_token_header'] = '{{ current_app.config.get('WTF_CSRF_HEADERS')[0] }}';
|
||||
pgAdmin['csrf_token'] = '{{ csrf_token() }}';
|
||||
pgAdmin['server_mode'] = '{{ current_app.config.get('SERVER_MODE') }}';
|
||||
@ -104,7 +106,9 @@ define('pgadmin.browser.utils',
|
||||
{% for key in ('File', 'Edit', 'Object' 'Tools', 'Management', 'Help') %}
|
||||
obj.add_menus({{ MENU_ITEMS(key, current_app.menu_items['%s_items' % key.lower()])}});
|
||||
{% endfor %}
|
||||
obj.create_menus();
|
||||
if('{{current_app.PGADMIN_RUNTIME}}' == 'False') {
|
||||
obj.create_menus();
|
||||
}
|
||||
} else {
|
||||
//recall after some time
|
||||
setTimeout(function(){ self.addMenus(obj); }, 3000);
|
||||
|
@ -23,6 +23,12 @@ class HelpModule(PgAdminModule):
|
||||
"""Return a (set) of dicts of help menu items, with name, priority,
|
||||
URL, target and onclick code."""
|
||||
return {'help_items': [
|
||||
MenuItem(name='mnu_quick_search_help',
|
||||
label=gettext('Quick Search'),
|
||||
priority=99,
|
||||
target='pgadmin_help',
|
||||
icon='fa fa-question',
|
||||
url='#'),
|
||||
MenuItem(name='mnu_online_help',
|
||||
label=gettext('Online Help'),
|
||||
priority=100,
|
||||
|
@ -41,7 +41,6 @@ export default class Preferences {
|
||||
enable: true,
|
||||
priority: 3,
|
||||
label: gettext('Preferences'),
|
||||
icon: 'fa fa-cog',
|
||||
}];
|
||||
|
||||
this.pgBrowser.add_menus(menus);
|
||||
|
@ -8,6 +8,7 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import Notify from '../../../static/js/helpers/Notifier';
|
||||
import { getBrowser } from '../../../static/js/utils';
|
||||
|
||||
define('pgadmin.settings', [
|
||||
'jquery', 'sources/pgadmin',
|
||||
@ -51,6 +52,11 @@ define('pgadmin.settings', [
|
||||
window.onbeforeunload = null;
|
||||
// Now reload page
|
||||
location.reload(true);
|
||||
let {name: browser} = getBrowser();
|
||||
if(browser == 'Nwjs') {
|
||||
pgAdmin.Browser.create_menus();
|
||||
}
|
||||
|
||||
})
|
||||
.fail(function() {
|
||||
console.warn(
|
||||
|
@ -263,7 +263,7 @@ export const useModalStyles = makeStyles((theme) => ({
|
||||
}
|
||||
}));
|
||||
|
||||
function ModalContainer({ id, title, content, dialogHeight, dialogWidth, onClose, fullScreen = false, isFullWidth = false, showFullScreen = false, isResizeable = false, minHeight = MIN_HEIGHT, minWidth = MIN_WIDTH }) {
|
||||
function ModalContainer({ id, title, content, dialogHeight, dialogWidth, onClose, fullScreen = false, isFullWidth = false, showFullScreen = false, isResizeable = false, minHeight = MIN_HEIGHT, minWidth = MIN_WIDTH, showTitle=true }) {
|
||||
let useModalRef = useModal();
|
||||
const classes = useModalStyles();
|
||||
let closeModal = (_e, reason) => {
|
||||
@ -282,24 +282,27 @@ function ModalContainer({ id, title, content, dialogHeight, dialogWidth, onClose
|
||||
PaperProps={{ 'isfullscreen': isfullScreen.toString(), 'isresizeable': isResizeable.toString(), width: dialogWidth, height: dialogHeight, minHeight: minHeight, minWidth: minWidth }}
|
||||
fullScreen={isfullScreen}
|
||||
fullWidth={isFullWidth}
|
||||
disableBackdropClick
|
||||
disableBackdropClick={showTitle}
|
||||
disablePortal
|
||||
>
|
||||
<DialogTitle className='modal-drag-area'>
|
||||
<Box className={classes.titleBar}>
|
||||
<Box className={classes.title} marginRight="0.25rem" >{title}</Box>
|
||||
{
|
||||
showFullScreen && !isfullScreen &&
|
||||
<Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Maximize')} icon={<ExpandDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /></Box>
|
||||
}
|
||||
{
|
||||
showFullScreen && isfullScreen &&
|
||||
<Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Minimize')} icon={<MinimizeDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /></Box>
|
||||
}
|
||||
{ showTitle && <>
|
||||
<DialogTitle className='modal-drag-area'>
|
||||
<Box className={classes.titleBar}>
|
||||
<Box className={classes.title} marginRight="0.25rem" >{title}</Box>
|
||||
{
|
||||
showFullScreen && !isfullScreen &&
|
||||
<Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Maximize')} icon={<ExpandDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /></Box>
|
||||
}
|
||||
{
|
||||
showFullScreen && isfullScreen &&
|
||||
<Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Minimize')} icon={<MinimizeDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /></Box>
|
||||
}
|
||||
|
||||
<Box marginLeft="auto"><PgIconButton title={gettext('Close')} icon={<CloseIcon />} size="xs" noBorder onClick={closeModal} /></Box>
|
||||
</Box>
|
||||
</DialogTitle>
|
||||
<Box marginLeft="auto"><PgIconButton title={gettext('Close')} icon={<CloseIcon />} size="xs" noBorder onClick={closeModal} /></Box>
|
||||
</Box>
|
||||
</DialogTitle>
|
||||
</>
|
||||
}
|
||||
<DialogContent height="100%">
|
||||
{useMemo(()=>{ return content(closeModal); }, [])}
|
||||
</DialogContent>
|
||||
@ -320,4 +323,5 @@ ModalContainer.propTypes = {
|
||||
onClose: PropTypes.func,
|
||||
minWidth: PropTypes.number,
|
||||
minHeight: PropTypes.number,
|
||||
showTitle: PropTypes.bool,
|
||||
};
|
||||
|
@ -150,6 +150,10 @@
|
||||
top: $navbar-height !important;
|
||||
}
|
||||
|
||||
.pg-docker-native {
|
||||
top: 0px !important
|
||||
}
|
||||
|
||||
.pg-panel-content {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
|
@ -130,7 +130,6 @@ define([
|
||||
callback: 'backupObjects',
|
||||
priority: 3,
|
||||
label: gettext('Backup...'),
|
||||
icon: 'fa fa-save',
|
||||
enable: supportedNodes.enabled.bind(
|
||||
null, pgBrowser.tree, menuUtils.backupSupportedNodes
|
||||
),
|
||||
|
@ -65,7 +65,6 @@ export default class DebuggerModule {
|
||||
data: {
|
||||
object: 'function',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'canDebug',
|
||||
}, {
|
||||
name: 'global_debugger',
|
||||
@ -80,7 +79,6 @@ export default class DebuggerModule {
|
||||
object: 'function',
|
||||
debug_type: 'indirect',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'canDebug',
|
||||
}, {
|
||||
name: 'procedure_direct_debugger',
|
||||
@ -94,7 +92,6 @@ export default class DebuggerModule {
|
||||
data: {
|
||||
object: 'procedure',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'can_debug',
|
||||
}, {
|
||||
name: 'procedure_indirect_debugger',
|
||||
@ -109,7 +106,6 @@ export default class DebuggerModule {
|
||||
object: 'procedure',
|
||||
debug_type: 'indirect',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'can_debug',
|
||||
}, {
|
||||
name: 'trigger_function_indirect_debugger',
|
||||
@ -120,7 +116,6 @@ export default class DebuggerModule {
|
||||
priority: 10,
|
||||
label: gettext('Set Breakpoint'),
|
||||
category: gettext('Debugging'),
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
data: {
|
||||
object: 'trigger_function',
|
||||
debug_type: 'indirect',
|
||||
@ -135,7 +130,6 @@ export default class DebuggerModule {
|
||||
priority: 10,
|
||||
label: gettext('Set Breakpoint'),
|
||||
category: gettext('Debugging'),
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
data: {
|
||||
object: 'trigger',
|
||||
debug_type: 'indirect',
|
||||
@ -153,7 +147,6 @@ export default class DebuggerModule {
|
||||
data: {
|
||||
object: 'edbfunc',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'can_debug',
|
||||
}, {
|
||||
name: 'package_function_global_debugger',
|
||||
@ -168,7 +161,6 @@ export default class DebuggerModule {
|
||||
object: 'edbfunc',
|
||||
debug_type: 'indirect',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'can_debug',
|
||||
}, {
|
||||
name: 'package_procedure_direct_debugger',
|
||||
@ -182,7 +174,6 @@ export default class DebuggerModule {
|
||||
data: {
|
||||
object: 'edbproc',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'can_debug',
|
||||
}, {
|
||||
name: 'package_procedure_global_debugger',
|
||||
@ -197,7 +188,6 @@ export default class DebuggerModule {
|
||||
object: 'edbproc',
|
||||
debug_type: 'indirect',
|
||||
},
|
||||
icon: 'fa fa-arrow-circle-right',
|
||||
enable: 'can_debug',
|
||||
}
|
||||
]);
|
||||
|
@ -62,7 +62,6 @@ define([
|
||||
callback: 'start_grant_wizard',
|
||||
priority: 14,
|
||||
label: gettext('Grant Wizard...'),
|
||||
icon: 'fa fa-unlock',
|
||||
enable: supportedNodes.enabled.bind(
|
||||
null, pgBrowser.tree, menuUtils.supportedNodes
|
||||
),
|
||||
|
@ -47,7 +47,6 @@ define([
|
||||
category: 'import',
|
||||
priority: 3,
|
||||
label: gettext('Import/Export Data...'),
|
||||
icon: 'fa fa-shopping-cart',
|
||||
enable: supportedNodes.enabled.bind(
|
||||
null, pgBrowser.tree, ['table']
|
||||
),
|
||||
|
@ -38,7 +38,6 @@ export default class ImportExportServersModule {
|
||||
enable: true,
|
||||
priority: 3,
|
||||
label: gettext('Import/Export Servers...'),
|
||||
icon: 'fa fa-shopping-cart',
|
||||
}];
|
||||
|
||||
pgBrowser.add_menus(menus);
|
||||
|
@ -64,7 +64,6 @@ define([
|
||||
callback: 'callback_maintenance',
|
||||
priority: 10,
|
||||
label: gettext('Maintenance...'),
|
||||
icon: 'fa fa-wrench',
|
||||
enable: supportedNodes.enabled.bind(
|
||||
null, pgBrowser.tree, menuUtils.maintenanceSupportedNodes
|
||||
),
|
||||
|
@ -61,7 +61,6 @@ define('tools.restore', [
|
||||
callback: 'restoreObjects',
|
||||
priority: 2,
|
||||
label: gettext('Restore...'),
|
||||
icon: 'fa fa-upload',
|
||||
enable: supportedNodes.enabled.bind(
|
||||
null, pgBrowser.tree, menuUtils.restoreSupportedNodes
|
||||
),
|
||||
|
@ -123,7 +123,6 @@ export default class SQLEditor {
|
||||
enable: self.queryToolMenuEnabled,
|
||||
priority: 1,
|
||||
label: gettext('Query Tool'),
|
||||
icon: 'pg-font-icon icon-query_tool',
|
||||
data:{
|
||||
applies: 'tools',
|
||||
data_disabled: gettext('Please select a database from the browser tree to access Query Tool.'),
|
||||
|
@ -473,7 +473,6 @@ module.exports = [{
|
||||
options: {
|
||||
type: 'commonjs',
|
||||
imports: [
|
||||
'pure|pgadmin.browser.quick_search',
|
||||
'pure|pgadmin.tools.user_management',
|
||||
'pure|pgadmin.browser.bgprocessmanager',
|
||||
'pure|pgadmin.node.server_group',
|
||||
|
@ -133,7 +133,6 @@ let webpackShimConfig = {
|
||||
'pgadmin.browser.preferences': path.join(__dirname, './pgadmin/browser/static/js/preferences'),
|
||||
'pgadmin.browser.menu': path.join(__dirname, './pgadmin/browser/static/js/menu'),
|
||||
'pgadmin.browser.activity': path.join(__dirname, './pgadmin/browser/static/js/activity'),
|
||||
'pgadmin.browser.quick_search': path.join(__dirname, './pgadmin/browser/static/js/quick_search'),
|
||||
'pgadmin.browser.messages': '/browser/js/messages',
|
||||
'pgadmin.browser.node': path.join(__dirname, './pgadmin/browser/static/js/node'),
|
||||
'pgadmin.browser.panel': path.join(__dirname, './pgadmin/browser/static/js/panel'),
|
||||
|
Loading…
Reference in New Issue
Block a user