-
Notifications
You must be signed in to change notification settings - Fork 80
7.3 Refactor fixed listing height processing #2427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughReplaces immediate inline table-header resize handling in VMMachines.page with a debounced (150ms) window-resize workflow, adds Focus="tableHeaderResize" to page metadata, and moves the resizing logic into a global Changes
Sequence DiagramsequenceDiagram
participant User
participant Window as Window<br/>(resize events)
participant Debouncer as Debounce<br/>(150ms, namespaced)
participant Handler as tableHeaderResize()<br/>(global)
User->>Window: Resize browser window
Window->>Debouncer: Emit resize events (many)
Debouncer->>Debouncer: Reset 150ms timer on each event
Note over Debouncer: Replaces immediate per-event calls with debounce
Debouncer->>Handler: Timer elapses (150ms quiet)
activate Handler
Handler->>Handler: call fillAvailableHeight(selectors, 50)
Handler->>Handler: clear/apply fixed-header & set column widths
deactivate Handler
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
emhttp/plugins/dynamix.vm.manager/VMMachines.page(2 hunks)
🔇 Additional comments (2)
emhttp/plugins/dynamix.vm.manager/VMMachines.page (2)
6-6: LGTM! Good addition for handling focus events.The Focus attribute correctly enables the framework to call
tableHeaderResize()when the page regains focus, addressing the edge case where the browser is resized while viewing other tabs.
479-501: LGTM! Well-structured global function.The
tableHeaderResize()function is properly extracted to global scope (required for the Focus attribute) and implements the fixed header resizing logic correctly:
- Calculates available height using appropriate selectors
- Removes and re-applies the 'fixed' class to handle layout changes
- Sets explicit column widths to maintain fixed table layout
The refactoring improves maintainability by consolidating the resize logic in a single, reusable function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
emhttp/plugins/dynamix.vm.manager/VMMachines.page (1)
468-476: Resolved: resize handler accumulation; debounced and namespaced.Using
off('resize.vmTableResize').on('resize.vmTableResize', ...)with 150ms debounce prevents duplicate handlers and addresses the earlier concern.If desired, bind this once outside
loadlist()to avoid repeated off/on churn. Current approach is acceptable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
emhttp/plugins/dynamix.vm.manager/VMMachines.page(2 hunks)
🔇 Additional comments (1)
emhttp/plugins/dynamix.vm.manager/VMMachines.page (1)
6-6: Good: Focus wired to a global function.Matches the global
tableHeaderResizeand allows external triggers. Looks correct.
Not important for 7.2
Due to merge of #2418, this is a simplification of #2415
Also adds in debouncing on resizing and handles edge cases of browser resized when on the VM Usage tab
Summary by CodeRabbit