Skip to content

Miscellaneous fixes#2144

Merged
limetech merged 6 commits into
unraid:masterfrom
bergware:master
Apr 10, 2025
Merged

Miscellaneous fixes#2144
limetech merged 6 commits into
unraid:masterfrom
bergware:master

Conversation

@bergware

@bergware bergware commented Apr 10, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor

    • Improved processing logic for handling shared directories and file lists to deliver more consistent and reliable performance, leading to a smoother user experience.
    • Enhanced code readability and maintainability through formatting adjustments and the introduction of new functions.
  • Bug Fixes

    • Enhanced disk status monitoring to generate warnings that accurately reflect current conditions, minimizing erroneous notifications.
  • New Features

    • Upgraded network connectivity checks to ensure dependable interface performance under varying conditions.
    • Added firmware configuration directory to diagnostics for comprehensive monitoring.
    • Introduced a new variable for managing user shares more effectively.
    • Streamlined carrier status checks for network interfaces to improve performance.

@coderabbitai

coderabbitai Bot commented Apr 10, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This 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 ($udShares) is introduced. The disk status array in the device list is simplified, and a new carrier() function is added in the Docker startup script to encapsulate network interface carrier checks.

Changes

File(s) Change Summary
emhttp/plugins/dynamix/Browse.page Updated doAction and doActions functions: reformatted share conditions and refined regex to include rootshare in share matching logic.
emhttp/plugins/dynamix/include/FileTree.php
emhttp/plugins/dynamix/nchan/device_list
Adjusted whitespace and operator formatting; added new variable $udShares in FileTree.php; updated disk status array in device_list by removing an element.
etc/rc.d/rc.docker Introduced a new carrier() function to centralize network interface carrier status checks, replacing direct file reads for enhanced clarity.
emhttp/plugins/dynamix/scripts/diagnostics Added '/boot/config/firmware' to the $folders array for diagnostics, expanding the directories considered during execution.

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
Loading

Possibly related PRs

  • File manager: style fixes #2079: Addresses similar formatting and logic adjustments in the doAction and doActions functions, indicating a direct code-level connection.

Suggested reviewers

  • ljm42
  • elibosley

Poem

I’m a little rabbit in a code-filled glen,
Hopping through regex and functions again.
I nibble on spaces and format with delight,
Enhancing the code by day and by night.
Celebrate these changes with a joyful byte!
🐇💻


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 21dba08 and 8118243.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/include/FileTree.php (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/include/FileTree.php

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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

📥 Commits

Reviewing files that changed from the base of the PR and between ef772c6 and da91923.

📒 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 status

The 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 logic

The carrier status check has been updated to use the new carrier() function and the comparison has been changed from == 0 to != 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() function

This 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 user

The 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 function

Similar 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 spacing

Spaces have been added around the equality operator for better readability.


53-56: Added support for unassigned devices shares

The excluded folders list now uses single quotes for consistency, and a new $udShares variable has been introduced to track special share types ('addons', 'disks', 'remotes').


65-68: Enhanced directory listing to include unassigned devices

This 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 pattern

This 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'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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?

@limetech limetech merged commit 1d4d6e6 into unraid:master Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants