Skip to content

Chore: Refactor profile views into a reusable control#3537

Merged
mergify[bot] merged 3 commits into
mainfrom
chore/profile_refactoring
Jul 18, 2026
Merged

Chore: Refactor profile views into a reusable control#3537
mergify[bot] merged 3 commits into
mainfrom
chore/profile_refactoring

Conversation

@BornToBeRoot

Copy link
Copy Markdown
Owner

Changes proposed in this pull request

  • Refactor profile views into a reusable control

Related issue(s)

Copilot generated summary

Provide a Copilot generated summary of the changes in this pull request.

Copilot summary

This pull request introduces a reusable profile panel control (ProfileExpanderPanel) to unify and simplify the profile-related UI across all tool views. It adds supporting interfaces and shared state management, and removes duplicated event handler code from individual host views, centralizing profile panel logic for consistency and maintainability.

Key changes include:

Introduction of reusable profile panel and supporting interfaces:

  • Added the ProfileExpanderPanel control, which encapsulates common profile panel UI and behavior, with dependency properties for tool-specific customization (ProfileExpanderPanel.xaml.cs).
  • Introduced the IProfileHostViewModel interface to define the contract for view models hosting the shared profile panel, including properties and commands for profile selection, searching, filtering, and group expansion (IProfileHostViewModel.cs).
  • Added a project reference to NETworkManager.Controls to enable use of shared controls in the profiles project (NETworkManager.Profiles.csproj).

Centralization and sharing of profile panel state:

  • Implemented the ProfileViewState class to manage the expanded/collapsed state and width of the profile panel, ensuring all tools reflect changes consistently via a shared instance (ProfileViewState.cs).

Code cleanup and removal of duplication:

  • Removed redundant event handlers for context menu data context assignment and double-click profile actions from all host views (DNSLookupHostView.xaml.cs, IPGeolocationHostView.xaml.cs, IPScannerHostView.xaml.cs, NetworkInterfaceView.xaml.cs, PingMonitorHostView.xaml.cs, PortScannerHostView.xaml.cs, PowerShellHostView.xaml.cs, PuTTYHostView.xaml.cs). These responsibilities are now handled by the reusable profile panel. [1] [2] [3] [4] [5] [6] [7] [8] [9]

These changes streamline the codebase, improve maintainability, and ensure a consistent user experience across all tools hosting profiles.

To-Do

Contributing

By submitting this pull request, I confirm the following:

Copilot AI review requested due to automatic review settings July 18, 2026 21:47
@github-actions github-actions Bot added this to the next-release milestone Jul 18, 2026
@mergify

mergify Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Copilot AI 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.

Pull request overview

Refactors profile panels into shared UI and view-model infrastructure, preparing for profile grouping improvements in #3519.

Changes:

  • Adds reusable profile panel UI and shared view-model behavior.
  • Shares panel width and expansion state across tools.
  • Migrates 15 profile-hosting views and removes duplicated handlers.

Reviewed changes

Copilot reviewed 48 out of 53 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Source/NETworkManager.Profiles/IProfileHostViewModel.cs Defines the shared profile-host contract.
Source/NETworkManager.Profiles/NETworkManager.Profiles.csproj References the controls project.
Source/NETworkManager.Settings/ProfileViewState.cs Manages shared panel state.
Source/NETworkManager.Settings/SettingsInfo.cs Consolidates panel settings.
Source/NETworkManager/ViewModels/ProfileHostViewModelBase.cs Centralizes profile behavior.
Source/NETworkManager/ViewModels/DNSLookupHostViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/IPGeolocationHostViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/IPScannerHostViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/PingMonitorHostViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/PortScannerHostViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/PowerShellHostViewModel.cs Adopts shared behavior with focus hooks.
Source/NETworkManager/ViewModels/PuTTYHostViewModel.cs Adopts shared behavior with focus hooks.
Source/NETworkManager/ViewModels/RemoteDesktopHostViewModel.cs Adopts shared profile behavior.
Source/NETworkManager/ViewModels/SNMPHostViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/TigerVNCHostViewModel.cs Adopts shared behavior.
Source/NETworkManager/ViewModels/TracerouteHostViewModel.cs Adopts the shared base.
Source/NETworkManager/ViewModels/WakeOnLANViewModel.cs Preserves selection behavior on the shared base.
Source/NETworkManager/ViewModels/WebConsoleHostViewModel.cs Adopts shared behavior.
Source/NETworkManager/ViewModels/WhoisHostViewModel.cs Adopts the shared base.
Source/NETworkManager/Views/Controls/ProfileExpanderPanel.xaml Implements reusable profile UI.
Source/NETworkManager/Views/Controls/ProfileExpanderPanel.xaml.cs Implements reusable panel events and properties.
Source/NETworkManager/Views/DNSLookupHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/DNSLookupHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/IPGeolocationHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/IPGeolocationHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/IPScannerHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/IPScannerHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/NetworkInterfaceView.xaml Uses the reusable panel.
Source/NETworkManager/Views/NetworkInterfaceView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/PingMonitorHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/PingMonitorHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/PortScannerHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/PortScannerHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/PowerShellHostView.xaml Configures shared panel focus behavior.
Source/NETworkManager/Views/PowerShellHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/PuTTYHostView.xaml Configures shared panel focus behavior.
Source/NETworkManager/Views/PuTTYHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/RemoteDesktopHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/RemoteDesktopHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/SNMPHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/SNMPHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/TigerVNCHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/TigerVNCHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/TracerouteHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/TracerouteHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/WakeOnLANView.xaml Uses the reusable panel.
Source/NETworkManager/Views/WakeOnLANView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/WebConsoleHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/WebConsoleHostView.xaml.cs Removes duplicated handlers.
Source/NETworkManager/Views/WhoisHostView.xaml Uses the reusable panel.
Source/NETworkManager/Views/WhoisHostView.xaml.cs Removes duplicated handlers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to 24
public class RemoteDesktopHostViewModel : ProfileHostViewModelBase
{
/// tool-specific view. Holds all profile-panel state/commands that are identical across tools; derived
/// classes only need to describe how their tool's profiles are identified and searched.
/// </summary>
public abstract class ProfileHostViewModelBase : ViewModelBase, IProfileHostViewModel
@BornToBeRoot
BornToBeRoot requested a review from Copilot July 18, 2026 23:03

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@BornToBeRoot
BornToBeRoot requested a review from Copilot July 18, 2026 23:09

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mergify
mergify Bot merged commit edc839e into main Jul 18, 2026
5 checks passed
@mergify
mergify Bot deleted the chore/profile_refactoring branch July 18, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants