Conversation
|
EDIT: Rebased from main, ignore message above. |
1d0e7ea to
e4f8c43
Compare
- Add helper functions to read/write namespaced pagination params per table
(e.g., servers_page, servers_size, servers_inactive)
- Update all 6 admin tables to use namespaced params for initial load
- Enhance pagination controls to sync browser URL on navigation
- Include include_inactive filter state in URL for full shareability
- Sync checkbox state from URL on page load (shareable links work correctly)
- Update URL when Show Inactive checkbox is toggled
- Fix checkbox ID mapping for -table-body targets
- Fix Jinja2 auto-escaping in partial templates for Alpine.js compatibility
URL parameter naming:
- Each table has its own namespace: {table}_page, {table}_size, {table}_inactive
- Example: ?servers_page=2&servers_size=50&servers_inactive=true
- URL state takes precedence over checkbox state for proper link sharing
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
e4f8c43 to
a8ebaee
Compare
Changes Made During ReviewThis PR has been significantly reworked to fix several issues discovered during review. Original Issues FoundThe original PR had critical bugs:
Fixed Implementation1. Namespaced URL ParametersEach table now has its own URL namespace for pagination state:
Example: 2. Shareable Links Now Work
3. Files Changed (148 additions, 10 deletions)
4. Key Functions Added// Read namespaced params from URL
getPaginationParams(tableName) → {page, perPage, includeInactive}
// Build table URL with namespaced params (URL state takes precedence)
buildTableUrl(tableName, baseUrl, additionalParams)
// Sync checkbox from URL on page load
syncCheckboxFromUrl(tableName, checkboxId)
// Update URL when checkbox toggled
updateInactiveUrlState(tableName, checked)Testing
|
Inline pagination_controls.html includes in admin.html were missing the table_name variable, causing Alpine.js to initialize them with empty tableName. This resulted in updateBrowserUrl() returning early and not writing the correct namespaced URL params for each table. Added table_name to all four inline includes: - servers: table_name = 'servers' - tools: table_name = 'tools' - gateways: table_name = 'gateways' - agents: table_name = 'agents' Also wrapped includes with autoescape false for Alpine.js compatibility. Closes #2108 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Latest Fix: Inline Pagination Includes Missing table_nameRoot CauseThe inline
Fix AppliedAdded
Also wrapped includes with Expected Behavior After FixEach table now maintains its own URL state:
Multiple tables can coexist in the URL, making links shareable with full pagination state preserved. Testing
|
1. admin.js: Update global include_inactive handler to support namespaced params with legacy fallback. Removed the change handler that wrote legacy include_inactive (conflicts with namespaced params). 2. admin.html: updateInactiveUrlState now resets *_page to 1 when toggling inactive checkbox, preventing stale page numbers in URL. 3. Add table_name to templates that were missing it: - users_partial.html: table_name = 'users' - teams_partial.html: table_name = 'teams' - tools_with_pagination.html: table_name = 'tools' - metrics_top_performers_partial.html: table_name = 'metrics_' + entity_type All templates now wrapped with autoescape false for Alpine.js compatibility. Closes #2108 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
ChatGPT Review Findings - All FixedFinding 1 (Medium): Global include_inactive in admin.jsStatus: FIXED The admin.js code at lines 17191-17221 was:
Fix:
Finding 2 (Medium): Stale page number when toggling inactiveStatus: FIXED When toggling "Show Inactive", HTMX reloads page 1, but Fix: browserUrl.searchParams.set(prefix + 'page', '1'); // Reset to page 1 when filter changesFinding 3 (Low): Other templates missing table_nameStatus: FIXED Added
All includes wrapped with ChatGPT's Question
Answer: Yes, for backwards compatibility. Old bookmarked URLs with Testing
|
|
@gcgoncalves please retest. |
* Fix pagination URL state management with namespaced params
- Add helper functions to read/write namespaced pagination params per table
(e.g., servers_page, servers_size, servers_inactive)
- Update all 6 admin tables to use namespaced params for initial load
- Enhance pagination controls to sync browser URL on navigation
- Include include_inactive filter state in URL for full shareability
- Sync checkbox state from URL on page load (shareable links work correctly)
- Update URL when Show Inactive checkbox is toggled
- Fix checkbox ID mapping for -table-body targets
- Fix Jinja2 auto-escaping in partial templates for Alpine.js compatibility
URL parameter naming:
- Each table has its own namespace: {table}_page, {table}_size, {table}_inactive
- Example: ?servers_page=2&servers_size=50&servers_inactive=true
- URL state takes precedence over checkbox state for proper link sharing
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
* fix: add table_name to inline pagination includes
Inline pagination_controls.html includes in admin.html were missing
the table_name variable, causing Alpine.js to initialize them with
empty tableName. This resulted in updateBrowserUrl() returning early
and not writing the correct namespaced URL params for each table.
Added table_name to all four inline includes:
- servers: table_name = 'servers'
- tools: table_name = 'tools'
- gateways: table_name = 'gateways'
- agents: table_name = 'agents'
Also wrapped includes with autoescape false for Alpine.js compatibility.
Closes IBM#2108
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* fix: address ChatGPT review findings for pagination
1. admin.js: Update global include_inactive handler to support namespaced
params with legacy fallback. Removed the change handler that wrote
legacy include_inactive (conflicts with namespaced params).
2. admin.html: updateInactiveUrlState now resets *_page to 1 when
toggling inactive checkbox, preventing stale page numbers in URL.
3. Add table_name to templates that were missing it:
- users_partial.html: table_name = 'users'
- teams_partial.html: table_name = 'teams'
- tools_with_pagination.html: table_name = 'tools'
- metrics_top_performers_partial.html: table_name = 'metrics_' + entity_type
All templates now wrapped with autoescape false for Alpine.js compatibility.
Closes IBM#2108
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
---------
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
🐛 Bug-fix PR
📌 Summary
Admin UI pagination was not functioning correctly - page size dropdown had no effect, page state was not preserved in URLs, and
the "Show Inactive" toggle was not synchronized with pagination requests. This prevented users from effectively browsing large
datasets and sharing filtered views.
🔁 Reproduction Steps
🐞 Root Cause
💡 Fix Description
Frontend-only changes (no backend modifications required):
admin.html):pagination_controls.html):🧪 Verification