MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / iterItem

Function iterItem

web/pgadmin/static/js/QuickSearch/menuitems_help.js:23–50  ·  view source on GitHub ↗
(subMenus, path, parentPath)

Source from the content-addressed store, hash-verified

21 let result = [];
22
23 const iterItem = (subMenus, path, parentPath) => {
24 subMenus.forEach((subMenu) =>{
25 if(subMenu instanceof NewMenuItem) {
26 if(subMenu.type != 'separator' && subMenu?.label?.toLowerCase().indexOf(param.toLowerCase()) != -1){
27 let localPath = path;
28 if(parentPath) {
29 localPath = `${parentPath} > ${path} `;
30 }
31 subMenu.path = localPath;
32 let selectedNode = pgAdmin.Browser.tree.selected();
33 if(subMenu.path == 'Object') {
34 if(selectedNode && selectedNode._metadata.data._type == subMenu.module.parent_type) {
35 result.push(subMenu);
36 }
37 } else {
38 result.push(subMenu);
39 }
40 }
41 if(subMenu.getMenuItems()) {
42 iterItem(subMenu.getMenuItems(), getMenuName(subMenu), path);
43 }
44 } else if(typeof(subMenu) == 'object' && !(subMenu instanceof NewMenuItem)) {
45 iterItem(Object.values(subMenu), path, parentPath);
46 } else {
47 iterItem(subMenu, path, parentPath);
48 }
49 });
50 };
51
52 const mainMenus = pgAdmin.Browser.MainMenus;
53 mainMenus.forEach((menu) => {

Callers 1

menuSearchFunction · 0.85

Calls 3

getMenuNameFunction · 0.85
selectedMethod · 0.45
getMenuItemsMethod · 0.45

Tested by

no test coverage detected