Modernize user view monitor permissions with bootstrap-table and AJAX pagination #4502
+322
−31
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.
The user view monitor permissions table was statically generated in PHP, limiting scalability and user experience. This replaces it with bootstrap-table using server-side AJAX pagination, matching the pattern used in the events view.
Changes
New AJAX endpoint (
web/ajax/user_monitors.php)total(filtered) andtotalNotFilteredcounts for accurate paginationUpdated user view (
web/skins/classic/views/user.php)monitorPermissionsTable(was duplicatecontentTable)Enhanced JavaScript (
web/skins/classic/views/js/user.js)ajaxRequest()fetches monitor data:?view=request&request=user_monitors&task=query&uid={userId}processRows()dynamically renders permission radio buttons with unique IDspost-body.bs.tableevent handler to re-binddata-on-changehandlers after each table renderPHP-to-JS bridge (
web/skins/classic/views/js/user.js.php)userIdandpermissionOptionsfor JavaScriptupdateEffectivePermissions()function requires access to all monitors)Implementation Notes
Radio button HTML is generated client-side to avoid form serialization issues:
The
data-on-changehandlers are re-bound viapost-body.bs.tableevent after each table render, ensuring permission changes trigger effective permission recalculation.Cookie persistence (
zmUserMonitorsTable, 2y expiry) maintains table state across sessions.Original prompt
Problem Statement
The console user view (web/skins/classic/views/user.php) currently generates the monitor permissions list using a static PHP loop that outputs HTML table rows directly. This should be modernized to use bootstrap-table with an AJAX call to fetch monitor data dynamically, similar to how the events view works.
Current Implementation
Currently, in
web/skins/classic/views/user.php(lines 262-296), the monitor permissions section uses a static table that loops through monitors in PHP:Desired Implementation
Update the user view to use bootstrap-table with the following features:
Files to Modify/Create
web/skins/classic/views/user.php (lines 262-296)
web/skins/classic/views/js/user.js or web/skins/classic/views/js/user.js.php
Create new AJAX endpoint (similar to existing request handlers)
Reference Implementations
Events View (web/skins/classic/views/events.php lines 114-167):
data-ajax="ajaxRequest"Events JavaScript (web/skins/classic/views/js/events.js lines 249-341):
Watch View (web/skins/classic/views/watch.php lines 465-538):
Frames View (web/skins/classic/views/frames.php lines 19-89):
Requirements
Maintain all existing functionality including:
updateEffectivePermissionsfunctionAdd new functionality:
Follow existing code patterns:
Testing considerations:
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.