From 1508d94da8ef23f48c3dd8b3d301b896ec5a9224 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Sun, 11 Oct 2026 16:50:58 -0400 Subject: [PATCH 1/3] Make the Fleet Dashboard the first tab and the default landing view The Fleet (Summary) Dashboard is now always present as the first tab and is the default action, so the Host MIB interface opens on it. The per-device Dashboard tab remains gated on being opened from its Devices-tab glyph. --- CHANGELOG.md | 1 + hmib.php | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a14c06..e38a18a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ChangeLog --- develop --- +* feature: Make the Fleet Dashboard the first tab and the default landing view on the Host MIB interface * feature: Add a Fleet (Summary) Dashboard reached by a dashboard glyph on the Summary tab's Device Type rows: a draggable, add/remove card grid scoped to all devices or one OS type, with min/avg/max bullet charts (CPU/memory/swap/processes/uptime), a device-status stacked bar, OS type distribution, storage utilization, fleet stat tiles, and top processes by CPU and by memory; scope, card order, expanded state and refresh interval persist per user * issue: Fix 'Uncaught TypeError: runCollector(): Argument #2 ($lastrun) must be of type float, null given' in the poller when a collector's *_lastrun/*_freq setting has never been written (e.g. a task's first run); runCollector() now accepts null and normalizes it * issue: Fix the per-device Dashboard Storage, Per-Processor Load, Hardware and Installed Software cards rendering empty because they filtered on 'present = 1' while the underlying Storage/Hardware/Inventory tabs never did, and add a Process Use History card diff --git a/hmib.php b/hmib.php index 81cb03a..d8e8c68 100644 --- a/hmib.php +++ b/hmib.php @@ -25,7 +25,7 @@ chdir('../../'); include('./include/auth.php'); -set_default_action('summary'); +set_default_action('summary_dashboard'); if (get_request_var('action') == 'ajax_hosts') { get_allowed_ajax_hosts(true, false, 'h.id IN (SELECT host_id FROM plugin_hmib_hrSystem)'); @@ -2923,6 +2923,7 @@ function hmib_tabs(): void { // present a tabbed interface $tabs = [ + 'summary_dashboard' => __esc('Fleet Dashboard', 'hmib'), 'summary' => __esc('Summary', 'hmib'), 'devices' => __esc('Devices', 'hmib'), 'storage' => __esc('Storage', 'hmib'), @@ -2936,9 +2937,8 @@ function hmib_tabs(): void { // set the default tab $current_tab = get_request_var('action'); - // The stateful Dashboard tabs only appear once opened from their glyph: the - // Fleet Dashboard from the Summary tab, the per-device Dashboard from Devices. - $show_fleet = ($current_tab == 'summary_dashboard' || read_user_setting('hmib_summary_type', '') !== ''); + // The Fleet Dashboard is the landing tab and is always present. The per-device + // Dashboard tab only appears once opened from its glyph on the Devices tab. $show_device = ($current_tab == 'dashboard' || (int) read_user_setting('hmib_dashboard_host', 0) > 0); $ordered = []; @@ -2946,10 +2946,6 @@ function hmib_tabs(): void { foreach ($tabs as $tab_key => $tab_label) { $ordered[$tab_key] = $tab_label; - if ($tab_key == 'summary' && $show_fleet) { - $ordered['summary_dashboard'] = __esc('Fleet Dashboard', 'hmib'); - } - if ($tab_key == 'devices' && $show_device) { $ordered['dashboard'] = __esc('Dashboard', 'hmib'); } @@ -2975,8 +2971,8 @@ function hmib_tabs(): void { * Renders the Host MIB dashboard/summary view: an overview of monitored * device counts by status/OS type, top running processes, and other * aggregate statistics, driven by this view's filter request - * variables. Called from this script's main request-dispatch switch as - * the default view (action=summary or no action). + * variables. Called from this script's main request-dispatch switch + * when action=summary. * * @return void * @@ -5431,7 +5427,8 @@ function hmib_summary_card_ajax(): string { * uptime, OS type distribution and top processes by CPU/memory) scoped to all * devices or a single OS type. Card order, expanded state, the selected OS type * and the auto-refresh interval persist per user. Called from this script's main - * request-dispatch switch when action=summary_dashboard. + * request-dispatch switch when action=summary_dashboard, and as the default + * landing view when no action is supplied. * * @return void * From 72adb6910decd77d98accacf6a9d9d1663b06183 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Sun, 11 Oct 2026 18:37:37 -0400 Subject: [PATCH 2/3] Register summary_dashboard/dashboard navigation entries; update tabs/nav PHPDoc and test --- hmib.php | 3 ++- setup.php | 7 +++++-- tests/Unit/HmibNavigationTest.php | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hmib.php b/hmib.php index d8e8c68..16e0e80 100644 --- a/hmib.php +++ b/hmib.php @@ -2909,7 +2909,8 @@ function clearFilter() { /** * Renders the top tabbed navigation bar for this page's views - * (summary/devices/storage/hardware/running/history/software/graphs), + * (summary_dashboard/summary/devices/storage/hardware/running/history/software/graphs, + * plus the conditional per-device dashboard tab), * highlighting whichever tab corresponds to the current action. Called * from this script's main flow at the top of every rendered view. * diff --git a/setup.php b/setup.php index 604e2df..f6cfcb4 100644 --- a/setup.php +++ b/setup.php @@ -536,16 +536,19 @@ function hmib_config_arrays(): void { /** * Draw_navigation_text hook: registers the breadcrumb/navigation title * entries for this plugin's hmib.php and hmib_types.php pages and their - * sub-views. Called by Cacti's navigation framework via the - * 'draw_navigation_text' hook. + * sub-views (including the Fleet Dashboard landing view + * summary_dashboard and the per-device dashboard). Called by Cacti's + * navigation framework via the 'draw_navigation_text' hook. * * @param array $nav The navigation entries array being built up. * * @return array The $nav array with this plugin's entries added. */ function hmib_draw_navigation_text($nav): array { + $nav['hmib.php:summary_dashboard'] = ['title' => __('Host MIB Fleet Dashboard', 'hmib'), 'mapping' => '', 'url' => 'hmib.php', 'level' => '0']; $nav['hmib.php:summary'] = ['title' => __('Host MIB Inventory Summary', 'hmib'), 'mapping' => '', 'url' => 'hmib.php', 'level' => '0']; $nav['hmib.php:devices'] = ['title' => __('Host MIB Details', 'hmib'), 'mapping' => '', 'url' => '', 'level' => '0']; + $nav['hmib.php:dashboard'] = ['title' => __('Host MIB Device Dashboard', 'hmib'), 'mapping' => '', 'url' => '', 'level' => '0']; $nav['hmib.php:storage'] = ['title' => __('Host MIB Storage', 'hmib'), 'mapping' => '', 'url' => '', 'level' => '0']; $nav['hmib.php:hardware'] = ['title' => __('Host MIB Hardware', 'hmib'), 'mapping' => '', 'url' => '', 'level' => '0']; $nav['hmib.php:running'] = ['title' => __('Host MIB Running Processes', 'hmib'), 'mapping' => '', 'url' => '', 'level' => '0']; diff --git a/tests/Unit/HmibNavigationTest.php b/tests/Unit/HmibNavigationTest.php index 0cc595f..4faf4ea 100644 --- a/tests/Unit/HmibNavigationTest.php +++ b/tests/Unit/HmibNavigationTest.php @@ -18,9 +18,10 @@ expect($nav)->toHaveKey('other.php:'); - foreach (array('hmib.php:summary', 'hmib.php:devices', 'hmib_types.php:', 'hmib_types.php:edit') as $key) { + foreach (array('hmib.php:summary_dashboard', 'hmib.php:summary', 'hmib.php:devices', 'hmib.php:dashboard', 'hmib_types.php:', 'hmib_types.php:edit') as $key) { expect($nav)->toHaveKey($key); } + expect($nav['hmib.php:summary_dashboard']['url'])->toBe('hmib.php'); expect($nav['hmib_types.php:']['url'])->toBe('hmib_types.php'); }); From c4d81f7e24594a674b8dd0b925fc11ba2c15fe56 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Sun, 11 Oct 2026 18:57:21 -0400 Subject: [PATCH 3/3] Add Fleet/Device Dashboard nav titles to cacti.pot --- locales/po/cacti.pot | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/locales/po/cacti.pot b/locales/po/cacti.pot index 1928286..6c05e39 100644 --- a/locales/po/cacti.pot +++ b/locales/po/cacti.pot @@ -1297,6 +1297,14 @@ msgstr "" msgid "Host MIB Inventory Summary" msgstr "" +#: setup.php +msgid "Host MIB Device Dashboard" +msgstr "" + +#: setup.php +msgid "Host MIB Fleet Dashboard" +msgstr "" + #: setup.php msgid "Host MIB Details" msgstr ""