Modernize console view with bootstrap-table and AJAX data loading #4504
+625
−336
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 console view generated monitor lists using static PHP loops during page render, requiring full page reloads to update monitor status. This replaces it with bootstrap-table and AJAX loading, matching the pattern used in the events view.
Changes
AJAX Endpoint (
web/ajax/console.php)queryRequest()handling server-side pagination, search, and sortingView Template (
web/skins/classic/views/console.php)Client JavaScript (
web/skins/classic/views/js/console.js)ajaxRequest()fetches monitor data from endpointprocessRows()formats data (status indicators, links, thumbnails, groups)reloadWindow()now callstable.bootstrapTable('refresh')instead of full page reload_idfield to preserve numeric IDs separately from formatted HTMLVariables (
web/skins/classic/views/js/console.js.php)canView/canEditpermission objects andZM_WEB_EVENTS_VIEWvariableExample
Before: Full page reload every refresh interval
After: Table refresh only
Features Added
Original prompt
Problem Statement
The console view (web/skins/classic/views/console.php) currently generates the monitor 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 with automatic refreshes, similar to how the events view works.
Current Implementation
Currently, in
web/skins/classic/views/console.php, the monitor list is generated using a static PHP loop that creates table rows during page load. The table starts around line 215 and the monitor rows are generated starting around line 277-446 with a PHP foreach loop.The current implementation:
consoleRefreshTimeoutthat reloads the entire pageDesired Implementation
Update the console view to use bootstrap-table with the following features:
Files to Modify/Create
1. web/skins/classic/views/console.php
data-ajax="ajaxRequest"to load data dynamicallydata-refresh-intervalfor automatic updatesExample configuration to add:
2. web/skins/classic/views/js/console.js
table.bootstrapTable('refresh')instead ofwindow.location.reload()reloadWindowfunction or replace with table refreshsetButtonStates,manageFunctionModal,sortMonitors, etc.initPageto initialize bootstrap-table3. Create/Update AJAX endpoint
web/ajax/console.phpor similar?view=request&request=console&task=query{ "total": 100, "totalNotFiltered": 100, "rows": [...] }4. web/skins/classic/views/js/console.js.php
Reference Implementations
Events View (web/skins/classic/views/events.php lines 114-167):
Events JavaScript (web/skins/classic/views/js/events.js lines 249-341):
Watch View (web/skins/classic/views/watch.php lines 465-538):
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.