Skip to content

Commit ff88f16

Browse files
feat: add Quadra menu item to navigation menu system
Register getQuadraHTML in the menu item function map and Menu_Items table so it appears in both the top navbar and sidebar like other menu entries. Update the function signature to support custom labels and icon rendering consistent with other menu items. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8f50d7c commit ff88f16

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

db/zm_create.sql.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,7 @@ INSERT INTO `Menu_Items` (`MenuKey`, `Enabled`, `SortOrder`) VALUES
13791379
('Log', 1, 60),
13801380
('Devices', 1, 70),
13811381
('IntelGpu', 1, 80),
1382+
('Quadra', 1, 85),
13821383
('Groups', 1, 90),
13831384
('Filters', 1, 100),
13841385
('Snapshots', 1, 110),

db/zm_update-1.39.4.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--
2+
-- Add Quadra menu item for existing installs
3+
--
4+
5+
SET @s = (SELECT IF(
6+
(SELECT COUNT(*) FROM `Menu_Items` WHERE `MenuKey` = 'Quadra') > 0,
7+
"SELECT 'Quadra menu item already exists'",
8+
"INSERT INTO `Menu_Items` (`MenuKey`, `Enabled`, `SortOrder`) VALUES ('Quadra', 1, 85)"
9+
));
10+
11+
PREPARE stmt FROM @s;
12+
EXECUTE stmt;
13+
DEALLOCATE PREPARE stmt;

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.39.3
1+
1.39.4

web/skins/classic/includes/functions.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ function getMenuItemFunctions() {
245245
'Options' => 'getOptionsHTML',
246246
'Log' => 'getLogHTML',
247247
'Devices' => 'getDevicesHTML',
248+
'Quadra' => 'getQuadraHTML',
248249
'IntelGpu' => 'getIntelGpuHTML',
249250
'Groups' => 'getGroupsHTML',
250251
'Filters' => 'getFilterHTML',
@@ -266,7 +267,7 @@ function getMenuItems() {
266267

267268
// Functions that take only ($forLeftBar, $customLabel) - no $view parameter
268269
function getMenuFuncsNoView() {
269-
return ['getConsoleHTML', 'getOptionsHTML', 'getLogHTML', 'getDevicesHTML', 'getIntelGpuHTML'];
270+
return ['getConsoleHTML', 'getOptionsHTML', 'getLogHTML', 'getDevicesHTML', 'getQuadraHTML', 'getIntelGpuHTML'];
270271
}
271272

272273
function renderMenuItems($forLeftBar = false) {
@@ -1230,8 +1231,10 @@ function getDevicesHTML($forLeftBar = false, $customLabel = null) {
12301231
}
12311232

12321233
// Returns the html representing the Quadra status menu item
1233-
function getQuadraHTML($forLeftBar = false) {
1234+
function getQuadraHTML($forLeftBar = false, $customLabel = null) {
12341235
$result = '';
1236+
$label = $customLabel !== null ? $customLabel : 'Quadra';
1237+
$skipTranslate = $customLabel !== null;
12351238

12361239
// Only show if ni_rsrc_mon is available and user can view System
12371240
if (canView('System')) {
@@ -1242,14 +1245,14 @@ function getQuadraHTML($forLeftBar = false) {
12421245
$result .= buildMenuItem(
12431246
$viewItemName = 'quadra',
12441247
$id = 'getQuadraHTML',
1245-
$itemName = 'Quadra',
1248+
$itemName = $label,
12461249
$href = '?view=quadra',
12471250
$icon = 'memory',
12481251
$classNameForTag_A = '',
12491252
$subMenu = ''
12501253
);
12511254
} else {
1252-
$result .= '<li id="getQuadraHTML" class="nav-item"><a class="nav-link" href="?view=quadra">Quadra</a></li>'.PHP_EOL;
1255+
$result .= '<li id="getQuadraHTML" class="nav-item"><a class="nav-link" href="?view=quadra">'.getNavbarIcon().htmlspecialchars($skipTranslate ? $label : translate($label)).'</a></li>'.PHP_EOL;
12531256
}
12541257
}
12551258
}

0 commit comments

Comments
 (0)