Miscellaneous fixes#2144
Conversation
WalkthroughThis pull request refines code logic and formatting across multiple modules. In the JavaScript for user shares, formatting changes and updates to regular expressions now include the "rootshare" user. In PHP files, whitespace and concatenation adjustments improve readability, and a new variable ( Changes
Sequence Diagram(s)sequenceDiagram
participant DockerScript as "RC Docker Script"
participant CarrierFunc as "carrier()"
participant FS as "File System"
DockerScript->>CarrierFunc: Call carrier(interface)
CarrierFunc->>FS: Read interface status from $SYSTEM directory
FS-->>CarrierFunc: Return carrier status
CarrierFunc-->>DockerScript: Return status value
DockerScript->>DockerScript: Evaluate carrier status and set active port
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
emhttp/plugins/dynamix/Browse.page(2 hunks)emhttp/plugins/dynamix/include/FileTree.php(2 hunks)emhttp/plugins/dynamix/nchan/device_list(1 hunks)etc/rc.d/rc.docker(2 hunks)
🔇 Additional comments (9)
etc/rc.d/rc.docker (3)
38-40: Good function encapsulation for carrier statusThe new
carrier()function encapsulates the logic for retrieving a network interface's carrier status by reading from the corresponding system file. This is a good refactoring that improves code readability and maintainability.
45-45: Improved network interface carrier check logicThe carrier status check has been updated to use the new
carrier()function and the comparison has been changed from== 0to!= 1. This makes the code more robust by handling cases where the carrier file might not exist or return unexpected values.
257-257: Consistent use of carrier() functionThis change applies the same improvement as on line 45, using the carrier() function for checking network interface status in a more robust way.
emhttp/plugins/dynamix/Browse.page (2)
363-366: Enhanced regex to support rootshare userThe regular expression has been updated to include 'rootshare' in the pattern, and formatting improvements have been made to improve code readability. This change enables proper handling of the rootshare user alongside regular user shares.
628-631: Consistent regex updates for rootshare in doActions functionSimilar to the changes in the doAction function, this section has been updated to include 'rootshare' in the regex pattern with improved formatting. This ensures consistent handling of the rootshare user throughout the code.
emhttp/plugins/dynamix/include/FileTree.php (4)
50-50: Improved code formatting with consistent spacingSpaces have been added around the equality operator for better readability.
53-56: Added support for unassigned devices sharesThe excluded folders list now uses single quotes for consistency, and a new
$udSharesvariable has been introduced to track special share types ('addons', 'disks', 'remotes').
65-68: Enhanced directory listing to include unassigned devicesThis new block of code ensures that unassigned devices top-level shares are included in the directory listing even if they're not directly returned by scandir. This improves the completeness of the file tree navigation.
87-89: Added directory filtering by patternThis modification ensures directories are only shown when they match the specified pattern or when no pattern is defined. This enhances the file tree's filtering capabilities.
| $disk['power'] ??= (_var($display,'power') && _var($disk,'transport')=='nvme' ? get_nvme_info(_var($disk,'device'),'power') : 0); | ||
| $echo = []; $warning = ''; | ||
| $status = ['DISK_DSBL','DISK_INVALID','DISK_DSBL_NEW','DISK_WRONG']; | ||
| $status = ['DISK_INVALID','DISK_DSBL_NEW','DISK_WRONG']; |
There was a problem hiding this comment.
Status array has been simplified
The $status array has been modified to remove 'DISK_DSBL' from the list of disk statuses that trigger warnings about data being overwritten. This change will affect how warnings are displayed for disks with the 'DISK_DSBL' status.
I recommend documenting the reasoning for this change to clarify why 'DISK_DSBL' is now excluded from generating overwrite warnings. Was this status intentionally removed because it doesn't pose the same risk of data loss as the other statuses?
Summary by CodeRabbit
Refactor
Bug Fixes
New Features