Skip to content

Scale Device Dashboard host picker via AJAX callback; stop card header hover reflow - #70

Merged
TheWitness merged 2 commits into
developfrom
fix/dashboard-device-callback
Oct 12, 2026
Merged

TheWitness merged 2 commits into
developfrom
fix/dashboard-device-callback

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Description

Two targeted fixes to the merged per-device Host Dashboard.

1. Device picker now uses an AJAX callback (scales to very large installs)

The Dashboard's Device dropdown rendered every Host MIB host as an <option>. On installs with tens of thousands of devices (60k+ reported) that bloats the page and the DOM. It now uses a Cacti drop_callback (select2 AJAX) that searches devices server-side through the existing ?action=ajax_hosts endpoint — only the current device is materialized, and matches are fetched as you type. The endpoint now omits the "Any" entry (a dashboard always targets one real device).

2. Card header no longer resizes on hover

Hovering the drag handle (hamburger) or the header tool buttons reflowed/resized the card header: the buttons used border: 0, so an inherited button:hover border changed their box size. Fixed the same way as in plugin_syslog/plugin_intropage — reserve a transparent 1px border with box-sizing: border-box, keep border-color: transparent on hover/focus, and give the card header a min-height.

Related Issue

Follow-up to the per-device Host Dashboard (#68) and its fixes (#69). The 60k-host dropdown concern and the header-hover reflow were both reported after merge.

Motivation and Context

The materialized host dropdown is a real scalability problem on large installs, and the header jitter on hover was a visible UI defect that was already solved elsewhere in the fleet.

How Has This Been Tested?

php -l clean on hmib.php; tests/bin/validate-manifest.php passes; locales/po/cacti.pot regenerated. The device picker follows the same drop_callback/ajax_hosts pattern plugin_syslog uses for its device rules. Needs a quick browser check on a themed install to confirm the select2 AJAX dropdown and the (now steady) header hover.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation repository accordingly.

… header hover reflow

- Device picker: replace the <select> that materialized every Host MIB host as an <option> with a Cacti drop_callback (select2 AJAX) that searches devices server-side through the existing ?action=ajax_hosts endpoint. Installs with 60k+ hosts no longer render tens of thousands of options into the page. The endpoint drops the 'Any' entry (a dashboard always targets one device).
- Card header hover reflow: the drag handle and tool buttons used border:0, so an inherited button:hover border reflowed the header. Reserve a transparent 1px border with box-sizing:border-box, keep border-color transparent on hover/focus, and give the card header a min-height (same fix landed in plugin_syslog/plugin_intropage).
@TheWitness
TheWitness requested review from bmfmancini and xmacan and a balanced review from Copilot October 10, 2026 21:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The picker cannot switch devices in supported callback fallback modes, and the header sizing omits border-box sizing.

3 open findings
What changed in this PR

Improves Host Dashboard scalability and card-header stability.

Changes:

  • Replaces the full device list with an AJAX-backed picker.
  • Prevents hover borders from resizing card controls.
File Description
hmib.php Adds the callback-based device picker.
css/​hmib.css Stabilizes card-header dimensions.
locales/​po/​cacti.pot Adds picker help text.
CHANGELOG.md Documents both fixes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread hmib.php
Comment thread hmib.php Outdated
Comment thread css/hmib.css
…ce-callback

# Conflicts:
#	CHANGELOG.md
#	locales/po/cacti.pot
@TheWitness
TheWitness merged commit affbc00 into develop Oct 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants