Repository navigation
fix/feat(hmib): status guards, centered/pilled statuses, theme-aware glyphs, Hardware status legend+filter - #65
Merged
Conversation
…lign glyphs Guard hrSWRunStatus/hrDeviceStatus lookups to stop Undefined array key warnings; center the Devices tab Status pills; replace hardcoded inline glyph colors with per-theme CSS classes (new css/ dir); fix a malformed fa-archive glyph.
TheWitness
requested review from
bmfmancini and
xmacan
and
a balanced review from Copilot
October 8, 2026 23:03
There was a problem hiding this comment.
🟡 Changes recommended
The active theme must be allowlisted before constructing filesystem and stylesheet paths.
1 open finding
What changed in this PR
Fixes HMIB status warnings, UI alignment, malformed markup, and theme-specific glyph styling.
Changes:
- Guards unknown process/device status lookups.
- Centers device status pills and fixes glyph markup.
- Adds base and dark-theme glyph CSS.
| File | Description |
|---|---|
hmib.php |
Updates status handling and UI rendering. |
css/hmib.css |
Adds base glyph colors. |
css/dark.css |
Adds dark-theme overrides. |
css/deepness.css |
Adds Deepness overrides. |
css/midwinter.css |
Adds Midwinter overrides. |
css/paper-plane.css |
Adds Paper Plane overrides. |
css/sunrise.css |
Adds Sunrise overrides. |
manifest.json |
Registers the CSS directory. |
tests/bin/patch-coverage.php |
Allowlists the web controller. |
CHANGELOG.md |
Documents the fixes. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Render hrDeviceStatus as title-case colored pills (deviceXXX palette), add a clickable status legend and a Status filter dropdown; clicking any pill sets the dropdown and filters. Regenerated cacti.pot.
- Validate get_selected_theme() against the five shipped override names before using it in the css filesystem/URL path, closing the traversal the reviewer flagged (older Cacti can return an unvalidated session theme). - Remove hmib.php from phpunit.xml <source>: being in <source> forced php-code- coverage to measure it at count=0, so its allowlist entry in patch-coverage.php was ignored and all 59 changed lines failed the 100% gate. Dropping it makes the file absent from Clover so the existing allowlist entry applies (same as hmib_types.php).
bmfmancini
approved these changes
Oct 9, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Addresses a set of issues and adds a Status feature on the Host MIB (hmib) views:
Bug fixes & polish
Undefined array keywarnings (hmib.php:893viahmib_running(), and the same pattern inhmib_hardware()): status-code lookups indexed the label arrays directly, so any code outside the known set (e.g.0) raised a warning on every row. Both now use theisset(...) ? ... : __('Unknown')guard already used for the adjacent type column.host_statuscolumn header and theget_colored_device_status()cell are nowcenteraligned.style='color:...'. These are replaced with CSS classes (.hmibHardware,.hmibProcess,.hmibGraph) backed by a newcss/directory (basecss/hmib.cssfor light themes plus per-theme overrides for the dark themes), loaded viaget_md5_include_css()on the active theme.fas fa-archiveglyph on the Summary tab (missing closing quote).New: Hardware tab device-status pills + legend + filter
The Hardware tab's Status column reflects the Host Resources MIB
hrDeviceStatusobject (RFC 2790, OID1.3.6.1.2.1.25.3.2.1.5):unknown(1),running(2),warning(3),testing(4),down(5)— plus this plugin's non-standard0 => Presentdefault.deviceXXX) family: Running = green, Down = red, Warning = amber, Testing = orange, Unknown = grey, Present = muted blue. Solid pills carry their own background + white text, so one palette reads correctly on every theme (no per-theme override needed).applyFilter()and session-stored like the other filters.hmibSetStatus()).Motivation and Context
Stops the recurring PHP warnings, corrects the Devices tab layout, makes action-glyph colors theme-aware, and makes the Hardware Status column readable and filterable.
How Has This Been Tested?
php -lclean on all changed PHP.tests/bin/validate-manifest.phppasses (newcss/dir recorded inmanifest.json).tests/bin/check-i18n-pot.phppasses — the one new translatable string (Click to filter by this status) is reflected in a regeneratedlocales/po/cacti.pot(only the template committed; per-language.po/.moreverted).hmib.phpis in thetests/bin/patch-coverage.phpunmeasured allowlist (top-level web controller, not unit-loadable — same rationale ashmib_types.php).Types of changes
Checklist: