(subMenus, path, parentPath)
| 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) => { |
no test coverage detected