Skip to content

fix: Sort and widen VM network source dropdown#2656

Open
ljm42 wants to merge 1 commit into
masterfrom
fix/vm-network-source-dropdown
Open

fix: Sort and widen VM network source dropdown#2656
ljm42 wants to merge 1 commit into
masterfrom
fix/vm-network-source-dropdown

Conversation

@ljm42
Copy link
Copy Markdown
Member

@ljm42 ljm42 commented Jun 1, 2026

Summary

  • Sort libvirt VM network source entries naturally, while keeping default first
  • Widen the VM Network Source select using the existing VM form width wrapper
  • Apply the same class to existing NIC rows and newly added NIC template rows

Testing

  • git diff --check
  • git diff --cached --check
  • php -l emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php
  • php -l emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php
  • Verified live on titan under /usr/local/emhttp

Summary by CodeRabbit

Release Notes

  • Style

    • Network source dropdown elements now span the full available width in the virtual machine editor, improving visibility and user interaction during network configuration
  • Bug Fixes

    • Network lists are now consistently sorted with natural ordering to ensure predictable results and improved usability when selecting networks for virtual machines

Sort libvirt network source options using natural, case-insensitive order while preserving default as the first libvirt option.

Widen the VM Network Source select by giving it a scoped network_source class that fills the existing VM form width wrapper.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ddc83877-d418-417a-a118-74943f4e0cb8

📥 Commits

Reviewing files that changed from the base of the PR and between 982b3c2 and 31c5323.

📒 Files selected for processing (3)
  • emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php
  • emhttp/plugins/dynamix.vm.manager/styles/edit.css
  • emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php

Walkthrough

This PR improves the presentation and behavior of network source dropdowns in the VM manager plugin. It sorts the libvirt network list alphabetically in the backend, adds CSS styling to display dropdowns at full width, and applies that styling class to both statically rendered and dynamically generated network selection elements.

Changes

Network Source Dropdown UX

Layer / File(s) Summary
Network list sorting
emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php
The getValidNetworks() function now sorts the retrieved libvirt network list using natural case-insensitive ordering before removing and re-inserting the default entry.
Dropdown styling
emhttp/plugins/dynamix.vm.manager/styles/edit.css
A new CSS rule for select.network_source sets width: 100% to expand dropdowns to full container width, with a stylesheet structure adjustment.
Apply CSS class to template dropdowns
emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php
Both server-rendered and client-side template network source dropdowns receive the network_source CSS class to apply the full-width styling; script tag closing is adjusted.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🐰 Networks sorted with care,
Dropdowns now styled fair and wide,
Templates dancing in the air!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: Sort and widen VM network source dropdown' accurately summarizes the main changes: sorting libvirt networks and widening the network source dropdown component.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vm-network-source-dropdown

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.06.01.2206
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2656/webgui-pr-2656.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php
emhttp/plugins/dynamix.vm.manager/styles/edit.css
emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2656, or run:

plugin remove webgui-pr-2656

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@ljm42 ljm42 changed the title Sort and widen VM network source dropdown fix: Sort and widen VM network source dropdown Jun 1, 2026
@ljm42 ljm42 marked this pull request as ready for review June 1, 2026 22:22
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.

1 participant