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

Function buildMenu

runtime/src/js/menu.js:115–181  ·  view source on GitHub ↗
(pgadminMenus, pgAdminMainScreen, configStore, callbacks)

Source from the content-addressed store, hash-verified

113// Builds the application menu template and binds menu click events.
114// Handles platform-specific menu structure and dynamic menu items.
115function buildMenu(pgadminMenus, pgAdminMainScreen, configStore, callbacks) {
116 const template = [];
117
118 pgadminMenus = bindMenuClicks(pgadminMenus, pgAdminMainScreen);
119
120 let menuFile = pgadminMenus.shift();
121
122 // macOS-specific menu modifications
123 if (isMac) {
124 handleAutoUpdateMenu(menuFile, configStore, callbacks);
125 moveAboutMenuToTop(pgadminMenus, menuFile);
126 }
127
128 template.push({
129 ...menuFile,
130 submenu: [
131 ...menuFile.submenu,
132 { type: 'separator' },
133 { label: 'View Logs...', click: callbacks['view_logs'] },
134 { label: 'Configure runtime...', click: callbacks['configure'] },
135 { type: 'separator' },
136 ...(isMac
137 ? [
138 { role: 'hide' },
139 { role: 'hideOthers' },
140 { role: 'unhide' },
141 { type: 'separator' },
142 ]
143 : []),
144 { role: 'quit' },
145 ],
146 });
147
148 if (isMac) {
149 template[0].label = app.name;
150 }
151
152 // push all except help
153 template.push(...pgadminMenus.slice(0, -1));
154
155 template.push(
156 { role: 'editMenu' },
157 {
158 label: 'View',
159 submenu: [
160 { label: 'Reload', click: callbacks['reloadApp'] },
161 {
162 label: 'Toggle Developer Tools',
163 click: () =>
164 BrowserWindow.getFocusedWindow().webContents.openDevTools({
165 mode: 'bottom',
166 }),
167 },
168 { type: 'separator' },
169 { role: 'resetZoom' },
170 { role: 'zoomIn' },
171 { role: 'zoomOut' },
172 { type: 'separator' },

Callers 1

buildAndSetMenusFunction · 0.85

Calls 3

bindMenuClicksFunction · 0.85
handleAutoUpdateMenuFunction · 0.85
moveAboutMenuToTopFunction · 0.85

Tested by

no test coverage detected