Wireless: add wifi info to dashboard and info button#2038
Conversation
WalkthroughThis pull request refactors the network interface status reporting logic. It replaces the previous Changes
Possibly Related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
emhttp/plugins/dynamix/nchan/update_3 (1)
113-127: Add error handling for theiwcommand.While the wireless interface support is well-implemented, the
execcall toiwshould include error handling in case the command fails or is not available.- exec("iw $port link | awk '/^\s+[rt]x bitrate: /{print $1,$2,$3,$4}'",$speed); + $ret = 0; + exec("command -v iw >/dev/null 2>&1 && iw $port link | awk '/^\s+[rt]x bitrate: /{print $1,$2,$3,$4}'",$speed,$ret); + if ($ret !== 0) { + $echo['mode'][] = _('unable to get wireless info'); + break; + }emhttp/plugins/dynamix/scripts/system_information (2)
38-40: Consider moving shared functions to a common utility file.The
port_get_contentsfunction is duplicated between this file andupdate_3. Consider moving it to a shared utility file to maintain DRY principles.
185-199: Add consistent error handling for theiwcommand.Similar to the update_3 file, add error handling for the
iwcommand to ensure robustness.- exec("iw $port link | awk '/^\s+[rt]x bitrate: /{print $1,$2,$3,$4}'",$speed); + $ret = 0; + exec("command -v iw >/dev/null 2>&1 && iw $port link | awk '/^\s+[rt]x bitrate: /{print $1,$2,$3,$4}'",$speed,$ret); + if ($ret !== 0) { + echo "<tr class='$more'><td>$name</td><td>$port: ",_('unable to get wireless info'),"</td></tr>"; + break; + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
emhttp/plugins/dynamix/nchan/update_3(2 hunks)emhttp/plugins/dynamix/scripts/system_information(3 hunks)
🔇 Additional comments (3)
emhttp/plugins/dynamix/nchan/update_3 (2)
58-60: Good addition of the helper function!The
port_get_contentsfunction improves code maintainability by centralizing file reading logic and handling non-existent files gracefully.
104-140: Well-structured refactoring using switch statement!The switch statement improves code organization and makes it easier to add support for new interface types in the future.
emhttp/plugins/dynamix/scripts/system_information (1)
167-167: LGTM: Network interface pattern correctly updated!The grep pattern has been properly updated to include wireless interfaces alongside bonded and ethernet interfaces.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
emhttp/plugins/dynamix.vm.manager/sheets/AddVM.css (1)
49-49: Enhance Text Truncation in LabelsThe update to the
span.labelclass now includesoverflow:hiddenandtext-overflow:ellipsis, ensuring that excessively long text is gracefully truncated. Consider, as a future enhancement, adding a tooltip to reveal the full label text on hover for better accessibility.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
emhttp/plugins/dynamix.vm.manager/sheets/AddVM.css(1 hunks)emhttp/plugins/dynamix.vm.manager/sheets/UpdateVM.css(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- emhttp/plugins/dynamix.vm.manager/sheets/UpdateVM.css
🔇 Additional comments (1)
emhttp/plugins/dynamix.vm.manager/sheets/AddVM.css (1)
53-53: Reintroduce Alignment for Wireless Interface InfoRestoring the
div.wlan0style withtext-align:leftis consistent with similar adjustments in related CSS files (e.g., UpdateVM.css) and ensures that wireless interface details display with proper alignment. This is a welcome change given the PR’s focus on incorporating WiFi info.
Summary by CodeRabbit
New Features
Refactor
Style
Chores