Skip to content

File manager: style fixes#2079

Merged
limetech merged 4 commits into
unraid:masterfrom
bergware:master
Mar 22, 2025
Merged

File manager: style fixes#2079
limetech merged 4 commits into
unraid:masterfrom
bergware:master

Conversation

@bergware

@bergware bergware commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores

    • Copyright notices have been updated to reflect the year 2025 in user-visible areas.
  • Style

    • The table display has been refined by removing the hover background effect on rows for a cleaner, more consistent visual experience.
    • Formatting adjustments have been made for improved readability, including spacing around operators and function parameters.
  • Bug Fixes

    • Enhanced error handling in the get_nvme_info function to prevent potential errors from accessing non-existent array elements.

@coderabbitai

coderabbitai Bot commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the copyright years from 2023 to 2025 across several PHP, JavaScript, and CSS files. The diffs introduce formatting improvements by adding spaces around operators, parameters, and in function calls, along with inserting blank lines to improve readability. A single CSS rule affecting the table row hover background has been removed. Additionally, the error handling in the get_nvme_info function has been improved. No modifications were made to the underlying logic or functionality of the code.

Changes

File(s) Change Summary
emhttp/.../Browse.page, emhttp/.../BrowseButton.page, emhttp/.../nchan/file_manager Updated copyright years from 2023 to 2025; applied consistent whitespace and formatting improvements in PHP and JavaScript functions, including adjustments in context menus and function call parameter spacing. In BrowseButton.page, the dialog class was updated from dialogClass: 'ui-dfm' to classes: {'ui-dialog': 'ui-dfm'}.
emhttp/.../include/Browse.php, emhttp/.../include/Control.php, emhttp/.../include/Templates.php Updated copyright years from 2023 to 2025 and added blank lines in PHP files to enhance readability without affecting functionality.
emhttp/.../sheets/Browse.css Removed the CSS rule setting the hover background color for table rows, altering the visual hover feedback on table cells.
emhttp/.../include/Wrappers.php Modified get_nvme_info function to enhance error handling for temperature data by checking the existence of array elements before accessing them.
emhttp/.../nchan/update_2 Updated copyright years from 2023 to 2025; replaced explode with my_explode in my_power function for string handling, and made minor formatting adjustments.

Poem

I'm a rabbit hopping through the code today,
Formatting tweaks keep the bugs at bay.
Copyrights now shine in a fresher light,
Whitespace and style making everything bright.
I nibble on clean code with delight – hop, skip, and play! 🐇


📜 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 b299a4f and cef6800.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/nchan/update_2 (13 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/nchan/update_2

🪧 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 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: 0

🧹 Nitpick comments (11)
emhttp/plugins/dynamix/include/Control.php (3)

24-27: Improved Function Separation
A blank line (or adjusted spacing) has been inserted before the my_age() function declaration. This subtle formatting improvement improves readability without impacting functionality.


36-39: Consistent Formatting in validname Function
The validname() function now uses consistent spacing and line breaks. This change enhances code clarity while preserving its original behavior.


41-42: Uniform Formatting for Helper Functions
The one-line definitions for escape() and quoted() have been reformatted for consistency. This improves readability without altering any functional logic.

emhttp/plugins/dynamix/include/Browse.php (1)

25-132: Consistent Function Formatting and Spacing
Multiple functions in this file (including validdir(), escapeQuote(), add(), age(), my_age(), parent_link(), my_devs(), and icon_class()) have been reformatted with consistent spacing and blank lines. These style fixes improve readability and maintainability without changing functionality.

emhttp/plugins/dynamix/nchan/file_manager (3)

24-25: Uniform Plugin Configuration Extraction
The call

extract(parse_plugin_cfg('dynamix', true));

has been reformatted (or repositioned) to fit the style guide. This change is purely stylistic and does not affect execution.


27-29: Consistent Translation Loading Setup
The insertion of

$login_locale = $display['locale'] ?? '';

after setting $_SERVER['REQUEST_URI'] brings consistency to the translation-loading block. This improvement enhances clarity without altering functionality.


31-44: Improved Function Declaration Formatting
Functions such as pool_only(), pools_filter(), and delete_file() now include well-defined spacing and blank lines. These non‐functional style changes support better readability and maintenance.

emhttp/plugins/dynamix/BrowseButton.page (4)

19-24: Consistent Array Formatting
The $dfm array now uses uniform spacing around keys and values. This improves readability and maintains consistency with the rest of the code base.


47-66: Enhanced dfm_footer Function Formatting
The dfm_footer() function’s case structure and spacing have been refined. These changes improve visual clarity and make the function easier to read, while the underlying logic remains intact.


293-294: Improved Dialog Initialization Flow
Minor spacing adjustments in dfm_openDialog() help improve code clarity when fetching dynamic data and constructing the dialog. The change is purely stylistic.


1-357: General Style and Readability Improvements
Overall, this file has received extensive style fixes—including spacing adjustments, consistent formatting of function definitions, and updated dialog options. These modifications enhance the readability and maintainability of the code without changing any of the underlying functionality.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3439b1f and fd3e5de.

📒 Files selected for processing (7)
  • emhttp/plugins/dynamix/Browse.page (43 hunks)
  • emhttp/plugins/dynamix/BrowseButton.page (15 hunks)
  • emhttp/plugins/dynamix/include/Browse.php (6 hunks)
  • emhttp/plugins/dynamix/include/Control.php (3 hunks)
  • emhttp/plugins/dynamix/include/Templates.php (1 hunks)
  • emhttp/plugins/dynamix/nchan/file_manager (7 hunks)
  • emhttp/plugins/dynamix/sheets/Browse.css (0 hunks)
💤 Files with no reviewable changes (1)
  • emhttp/plugins/dynamix/sheets/Browse.css
🧰 Additional context used
🧬 Code Definitions (1)
emhttp/plugins/dynamix/include/Browse.php (1)
emhttp/plugins/dynamix/include/Control.php (1) (1)
  • age (21-23)
🔇 Additional comments (46)
emhttp/plugins/dynamix/include/Templates.php (1)

2-3: Updated Copyright Notice
The copyright notice has been updated to use “2025” for both Lime Technology and Bergware International. This is a straightforward, non‐functional text change that aligns with similar updates across the code base.

emhttp/plugins/dynamix/include/Control.php (1)

2-3: Updated Copyright Notice
The header now reflects the new year range (“2005-2025” and “2012-2025”). This update is non‐functional and ensures consistency with other files.

emhttp/plugins/dynamix/include/Browse.php (1)

1-3: Updated Copyright Notice
The copyright annotations now use “2025” instead of “2023”. This update is cosmetic and does not affect any program logic.

emhttp/plugins/dynamix/nchan/file_manager (1)

3-4: Updated Copyright Notice
The header comments now reflect the updated year range (“2005-2025” and “2012-2025”) for copyright. This is a cosmetic update applied consistently across the codebase.

emhttp/plugins/dynamix/BrowseButton.page (2)

7-9: Updated Copyright Notice
The copyright header has been modified to reflect the updated years (“2025”) for both Lime Technology and Bergware International. This is a non‐functional, style-only change.


258-260: Dialog Class Assignment Update
The dialog configuration has been updated from using dialogClass: 'ui-dfm' to the modern approach:

classes: {'ui-dialog': 'ui-dfm'}

This change ensures better compatibility with current jQuery UI standards and enhances style management without affecting functionality.

emhttp/plugins/dynamix/Browse.page (40)

6-7: Copyright Years Updated Consistently
The header now reflects the updated years (2005-2025 for Lime Technology and 2012-2025 for Bergware International), which aligns with the overall update.


21-23: Improved Array-to-String Conversion Formatting
The dfm_array function now neatly uses implode with array_map and clear spacing, increasing readability without changing functionality.


26-29: Enhanced Readability in Directory Validation
The validdir function’s return statement now formats the in_array check (with the null-coalescing operator) in a clearer, concise manner.


30-34: Refined Directory Sanitization and Assignment
The updates to the directory sanitization (using htmlspecialchars_decode, my_explode, and str_replace) and the conditional assignment for $lock now follow a uniform style, which improves overall clarity.


38-38: Consistent Initialization for Editor Configuration
The one-line check that uses file_exists and file_put_contents with an array of file types has been reformatted for clarity.


47-47: Clean Embedding of PHP Variable into JavaScript
The assignment of dir using PHP shorthand (<?=$dir?>) is maintained with improved spacing.


52-56: Clearer Formatting in autoscale Function
The calculations in autoscale (unit array, logarithmic computation, and conditional check) now feature improved spacing and structure, which aids in readability while preserving the computation logic.


59-70: Uniform Style in folderContextMenu Function
The function signature and the setup of context menu options (including PHP conditionals) have been reformatted, yielding a cleaner and more consistent code style.


88-92: Consistent Formatting in fileContextMenu Function
The revised formatting of this function improves the clarity of the menu options without altering the intended behavior.


115-120: Neat Presentation in deviceFolderContextMenu
The formatting changes in the device folder context menu function ensure that option definitions are clearly indented and easy to follow.


145-148: Streamlined home Function Structure
The home function now exhibits improved formatting for its initialization and AJAX call (via $.ajax), which enhances the readability of its synchronous result retrieval.


157-159: Simplified resize Function
The slight formatting adjustments in the resize function make it immediately clear how the element height is determined relative to the window size.


196-200: Improved Input State Handling in selectOne
The changes in the selectOne function—especially the concise update of the disabled state for .extra and .rename inputs—result in a more understandable and consistent UI state update.


211-213: Refined Error Alert in errorTarget
The inline callback that re-enables the target field now has improved formatting, which clarifies the error handling process.


217-221: Conditional Return Formatting in data Function
The use of the PHP conditional block combined with a ternary return statement has been tidied up to clearly differentiate between share and non-share cases.


251-260: Enhanced Dialog Configuration in fileEdit
The configuration of the file editor dialog—especially the clear assignment of dialog classes, dimensions, and button actions—now features more readable spacing and structure.


291-300: Consistent Dialog Setup in doJobs (Part 1)
The initialization of the jobs dialog, including class settings and the AJAX call in the Start button, now follows uniform spacing conventions that elevate code readability.


317-324: Improved Cleanup Logic in doJobs (Part 2)
The conditional block that handles the deletion response—cleaning cookies and updating the UI—is now more legible with consistent indentation and spacing.


338-339: Clear Timeout Handling in File Monitor Event
The message event callback for the file monitor now clearly checks the running state and schedules a refresh with proper formatting, ensuring smooth asynchronous behavior.


342-343: Streamlined Start of doAction Function
The function signature and the initial variable assignment (e.g. determining if the ID represents a link) have been reformatted for a more intuitive reading experience.


367-367: Uniform Use of PHP Short Tag in doAction
The assignment of the hdlink variable using the PHP short tag syntax is now clearly presented, without affecting functionality.


495-496: Consistent Conditional Check for Moving Operations
The condition calling home(source,target) to decide whether to increment the action parameter is now uniformly formatted. This improves the clarity of decision points in the move folder/file actions.


565-566: Uniformity in Conditional Logic for Queue Actions
The repeated check using if (home(source,target) == 1) action++; inside the queue handling preserves consistency and enhances readability across similar action cases.


604-605: Clear Dialog Cancel Logic in doAction
The adjustments following the dialog setup (ensuring disabled button states are applied when necessary) now appear with improved spacing, which helps clarify the control flow immediately after dialog creation.


608-609: Crisp Initialization in doActions Function
The very start of doActions now cleanly declares variables and sets up preliminary conditions, aiding overall code legibility.


632-633: Consistent hdlink Assignment in doActions
The assignment of the hdlink variable is now synchronized with its usage elsewhere, reinforcing consistency across similar components.


691-695: Refined Callback Formatting in File Tree Attachment
Within doActions, the callback for attaching the file tree now clearly defines variable usage (such as the auto-appended share segment) with better spacing for enhanced understanding.


741-742: Robust Fallback for Source in doActions
The logic that filters and defaults the source if empty is now written more succinctly, mitigating potential edge case issues.


749-756: Uniform Dialog Configuration in doActions
The dialog initialization block inside doActions is now uniformly structured, with explicit definitions for classes, dimensions, and modal behavior, ensuring consistency with other dialog windows.


815-819: Clear Disabling of Permission Fields
The conditional block that disables the owner, group, and other fields when action 12 is in effect now appears clearly indented, improving maintainability.


887-888: Improved Button State Update in doActions
The final close-button handling and dialog focus adjustments have been reformatted for clarity, ensuring that UI focus is set appropriately after dialog creation.


891-893: Neat Cleanup in stopUpload Function
The stopUpload function’s logic for resetting the uploader state (cancelling pending uploads, re-enabling buttons, and cookie management) is now easier to follow with improved spacing.


911-919: Chunked File Uploads with Clear Logic in uploadFile
The uploadFile function now clearly slices the file into 2 MB chunks and proceeds with base64 encoding. The structured flow through error checking and progress reporting is much improved by the formatting changes.


920-922: Precise Response Handling in File Uploads
The checks for reply values of 'stop' and 'error' in the upload callback are now clearly distinguished, ensuring that upload interruptions are handled gracefully.


941-943: Consolidated Initialization for Upload Process
Declaring the reader and cancel variables together makes the initialization for the file upload process more coherent.


945-949: Improved Guard and Setup in startUpload
The startUpload function now first checks for empty file input and then properly sets up the FileReader, onbeforeunload, and button state. These changes enhance safety and user feedback during uploads.


955-957: Concise Filtering in filter Function
The filter function’s use of a jQuery each loop with a clear condition (hiding or showing rows based on the file type match) has been neatly formatted.


963-965: Tidy Toggle in toggleTime Function
The toggleTime function’s cookie check and toggle logic now appear more succinct, which enhances its readability.


987-997: Refined Document Ready Initialization
The jQuery ready block now builds dynamic breadcrumbs and sets up table references with improved clarity. The inline HTML generation has also been spaced for better maintainability.


1018-1022: Clean HTML Markup for File Manager Interface
The markup within the <div class="autoheight"> section (including table headers) has been tidied for clarity and consistency with the style improvements seen across the file.

@bergware

Copy link
Copy Markdown
Contributor Author

ccs styling in file manager was broken due to update to latest version of jQuery-UI

@limetech limetech merged commit e07a448 into unraid:master Mar 22, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Apr 10, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Aug 11, 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