From 7fc9d4934a309fad05e0163457ebd164f29b610f Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Mon, 4 Nov 2024 03:42:42 +0100 Subject: [PATCH 1/4] Feature: Profile description and tooltip --- .../Resources/StaticStrings.Designer.cs | 18 +++++----- .../Resources/StaticStrings.resx | 2 +- .../Resources/Strings.Designer.cs | 9 +++++ .../Resources/Strings.resx | 3 ++ Source/NETworkManager.Profiles/ProfileInfo.cs | 8 ++++- Source/NETworkManager/ProfileDialogManager.cs | 13 +++---- .../ViewModels/ProfileViewModel.cs | 23 ++++++++++-- .../Views/PingMonitorHostView.xaml | 20 ++++++++++- .../NETworkManager/Views/ProfileDialog.xaml | 36 +++++++++++++------ .../Views/RemoteDesktopConnectDialog.xaml | 2 +- 10 files changed, 101 insertions(+), 33 deletions(-) diff --git a/Source/NETworkManager.Localization/Resources/StaticStrings.Designer.cs b/Source/NETworkManager.Localization/Resources/StaticStrings.Designer.cs index d324a9d6a5..1b56f8da1b 100644 --- a/Source/NETworkManager.Localization/Resources/StaticStrings.Designer.cs +++ b/Source/NETworkManager.Localization/Resources/StaticStrings.Designer.cs @@ -500,6 +500,15 @@ public static string ExamplePowerShellPath { } } + /// + /// Looks up a localized string similar to Webserver. + /// + public static string ExampleProfileName { + get { + return ResourceManager.GetString("ExampleProfileName", resourceCulture); + } + } + /// /// Looks up a localized string similar to https://api.ipify.org. /// @@ -536,15 +545,6 @@ public static string ExamplePuTTYProfile { } } - /// - /// Looks up a localized string similar to Webserver. - /// - public static string ExampleRemoteDesktopProfileName { - get { - return ResourceManager.GetString("ExampleRemoteDesktopProfileName", resourceCulture); - } - } - /// /// Looks up a localized string similar to COM5. /// diff --git a/Source/NETworkManager.Localization/Resources/StaticStrings.resx b/Source/NETworkManager.Localization/Resources/StaticStrings.resx index d68e3c6c73..27db44d31a 100644 --- a/Source/NETworkManager.Localization/Resources/StaticStrings.resx +++ b/Source/NETworkManager.Localization/Resources/StaticStrings.resx @@ -227,7 +227,7 @@ 22; 80; 443; 500 - 999; 8080 - + Webserver diff --git a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs index fb8e687fb6..d3e62418b0 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs +++ b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs @@ -3653,6 +3653,15 @@ public static string Everything { } } + /// + /// Looks up a localized string similar to Ubuntu Server running Docker with Nextcloud and Traefik.... + /// + public static string ExampleProfileDescription { + get { + return ResourceManager.GetString("ExampleProfileDescription", resourceCulture); + } + } + /// /// Looks up a localized string similar to Customer 1. /// diff --git a/Source/NETworkManager.Localization/Resources/Strings.resx b/Source/NETworkManager.Localization/Resources/Strings.resx index eda46ad637..e6d8037ada 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.resx +++ b/Source/NETworkManager.Localization/Resources/Strings.resx @@ -3851,4 +3851,7 @@ Right-click for more options. Set default + + Ubuntu Server running Docker with Nextcloud and Traefik... + \ No newline at end of file diff --git a/Source/NETworkManager.Profiles/ProfileInfo.cs b/Source/NETworkManager.Profiles/ProfileInfo.cs index 79b46254ad..30d92c342e 100644 --- a/Source/NETworkManager.Profiles/ProfileInfo.cs +++ b/Source/NETworkManager.Profiles/ProfileInfo.cs @@ -31,6 +31,7 @@ public ProfileInfo(ProfileInfo profile) { Name = profile.Name; Host = profile.Host; + Description = profile.Description; Group = profile.Group; Tags = profile.Tags; @@ -248,11 +249,16 @@ public ProfileInfo(ProfileInfo profile) /// public string Host { get; set; } + /// + /// Description of the profile. + /// + public string Description { get; set; } + /// /// Name of the group. Profiles are grouped based on the name. /// public string Group { get; set; } - + /// /// Tags to classify the profiles and to filter by it. /// diff --git a/Source/NETworkManager/ProfileDialogManager.cs b/Source/NETworkManager/ProfileDialogManager.cs index cf3961742d..9d3610f7f9 100644 --- a/Source/NETworkManager/ProfileDialogManager.cs +++ b/Source/NETworkManager/ProfileDialogManager.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Security; -using System.Threading.Tasks; -using System.Windows; -using MahApps.Metro.Controls.Dialogs; +using MahApps.Metro.Controls.Dialogs; using NETworkManager.Localization.Resources; using NETworkManager.Models; using NETworkManager.Models.Network; @@ -12,6 +7,11 @@ using NETworkManager.Profiles; using NETworkManager.ViewModels; using NETworkManager.Views; +using System; +using System.Collections.Generic; +using System.Security; +using System.Threading.Tasks; +using System.Windows; namespace NETworkManager; @@ -31,6 +31,7 @@ private static ProfileInfo ParseProfileInfo(ProfileViewModel instance) { Name = instance.Name.Trim(), Host = instance.Host.Trim(), + Description = instance.Description?.Trim(), Group = instance.Group.Trim(), Tags = instance.Tags?.Trim(), diff --git a/Source/NETworkManager/ViewModels/ProfileViewModel.cs b/Source/NETworkManager/ViewModels/ProfileViewModel.cs index fabe509da4..eee492d6d6 100644 --- a/Source/NETworkManager/ViewModels/ProfileViewModel.cs +++ b/Source/NETworkManager/ViewModels/ProfileViewModel.cs @@ -43,16 +43,18 @@ public ProfileViewModel(Action saveCommand, Action 0 ? groups.OrderBy(x => x).First() : Strings.Default : profileInfo.Group); - - Tags = profileInfo.Tags; - + Groups = CollectionViewSource.GetDefaultView(groups); Groups.SortDescriptions.Add(new SortDescription()); + Tags = profileInfo.Tags; + // Network Interface NetworkInterface_Enabled = editMode == ProfileEditMode.Add ? applicationName == ApplicationName.NetworkInterface @@ -449,6 +451,21 @@ public bool ShowCouldNotResolveHostnameWarning OnPropertyChanged(); } } + + private string _description; + + public string Description + { + get => _description; + set + { + if (value == _description) + return; + + _description = value; + OnPropertyChanged(); + } + } private string _group; diff --git a/Source/NETworkManager/Views/PingMonitorHostView.xaml b/Source/NETworkManager/Views/PingMonitorHostView.xaml index 32c6070176..9ebc581bd9 100644 --- a/Source/NETworkManager/Views/PingMonitorHostView.xaml +++ b/Source/NETworkManager/Views/PingMonitorHostView.xaml @@ -370,7 +370,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/ProfileDialog.xaml b/Source/NETworkManager/Views/ProfileDialog.xaml index ae62f3507c..bb77099dc0 100644 --- a/Source/NETworkManager/Views/ProfileDialog.xaml +++ b/Source/NETworkManager/Views/ProfileDialog.xaml @@ -1286,6 +1286,8 @@ + + @@ -1296,7 +1298,7 @@ + mah:TextBoxHelper.Watermark="{x:Static localization:StaticStrings.ExampleProfileName}"> @@ -1364,8 +1366,20 @@ + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/DNSLookupHostView.xaml b/Source/NETworkManager/Views/DNSLookupHostView.xaml index a7e45fba9a..01ae728e6c 100644 --- a/Source/NETworkManager/Views/DNSLookupHostView.xaml +++ b/Source/NETworkManager/Views/DNSLookupHostView.xaml @@ -12,6 +12,7 @@ xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:DNSLookupHostViewModel}"> @@ -213,7 +214,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/IPGeolocationHostView.xaml b/Source/NETworkManager/Views/IPGeolocationHostView.xaml index 3859932f6e..aacd7279d8 100644 --- a/Source/NETworkManager/Views/IPGeolocationHostView.xaml +++ b/Source/NETworkManager/Views/IPGeolocationHostView.xaml @@ -12,6 +12,7 @@ xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:IPGeolocationHostViewModel}"> @@ -216,7 +217,7 @@ @@ -337,8 +338,26 @@ BasedOn="{StaticResource MahApps.Styles.ListBoxItem}"> + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/IPScannerHostView.xaml b/Source/NETworkManager/Views/IPScannerHostView.xaml index 963bfd717a..a58d214bd2 100644 --- a/Source/NETworkManager/Views/IPScannerHostView.xaml +++ b/Source/NETworkManager/Views/IPScannerHostView.xaml @@ -12,6 +12,7 @@ xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:IPScannerHostViewModel}"> @@ -215,7 +216,6 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/NetworkInterfaceView.xaml b/Source/NETworkManager/Views/NetworkInterfaceView.xaml index 79dee8fcc2..51feecc174 100644 --- a/Source/NETworkManager/Views/NetworkInterfaceView.xaml +++ b/Source/NETworkManager/Views/NetworkInterfaceView.xaml @@ -15,6 +15,7 @@ xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:controls="clr-namespace:NETworkManager.Controls" xmlns:liveChart="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialog:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:NetworkInterfaceViewModel}"> @@ -1252,7 +1253,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/PingMonitorHostView.xaml b/Source/NETworkManager/Views/PingMonitorHostView.xaml index 9ebc581bd9..da72b8ec1d 100644 --- a/Source/NETworkManager/Views/PingMonitorHostView.xaml +++ b/Source/NETworkManager/Views/PingMonitorHostView.xaml @@ -12,6 +12,7 @@ xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization" xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:PingMonitorHostViewModel}"> @@ -507,7 +508,7 @@ - + diff --git a/Source/NETworkManager/Views/PortScannerHostView.xaml b/Source/NETworkManager/Views/PortScannerHostView.xaml index 02aa9f4ef2..202e01f6ba 100644 --- a/Source/NETworkManager/Views/PortScannerHostView.xaml +++ b/Source/NETworkManager/Views/PortScannerHostView.xaml @@ -12,6 +12,7 @@ xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization" xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:PortScannerHostViewModel}"> @@ -215,7 +216,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/PowerShellHostView.xaml b/Source/NETworkManager/Views/PowerShellHostView.xaml index 3339a0606f..6efb2518a5 100644 --- a/Source/NETworkManager/Views/PowerShellHostView.xaml +++ b/Source/NETworkManager/Views/PowerShellHostView.xaml @@ -15,6 +15,7 @@ xmlns:interactivity="http://schemas.microsoft.com/xaml/behaviors" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="clr-namespace:NETworkManager.Controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" Loaded="UserControl_Loaded" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:PowerShellHostViewModel}"> @@ -344,7 +345,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/PuTTYHostView.xaml b/Source/NETworkManager/Views/PuTTYHostView.xaml index a31dbf8018..9e62bfef72 100644 --- a/Source/NETworkManager/Views/PuTTYHostView.xaml +++ b/Source/NETworkManager/Views/PuTTYHostView.xaml @@ -15,6 +15,7 @@ xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:interactivity="http://schemas.microsoft.com/xaml/behaviors" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" Loaded="UserControl_Loaded" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:PuTTYHostViewModel}"> @@ -357,7 +358,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/RemoteDesktopHostView.xaml b/Source/NETworkManager/Views/RemoteDesktopHostView.xaml index 354f3f88a4..c0c251a39e 100644 --- a/Source/NETworkManager/Views/RemoteDesktopHostView.xaml +++ b/Source/NETworkManager/Views/RemoteDesktopHostView.xaml @@ -14,6 +14,7 @@ xmlns:wpfHelpers="clr-namespace:NETworkManager.Utilities.WPF;assembly=NETworkManager.Utilities.WPF" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="clr-namespace:NETworkManager.Controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" Loaded="UserControl_Loaded" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:RemoteDesktopHostViewModel}"> @@ -359,7 +360,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/SNMPHostView.xaml b/Source/NETworkManager/Views/SNMPHostView.xaml index 5250f39f6c..a0570a5886 100644 --- a/Source/NETworkManager/Views/SNMPHostView.xaml +++ b/Source/NETworkManager/Views/SNMPHostView.xaml @@ -12,6 +12,7 @@ xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization" xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:SNMPHostViewModel}"> @@ -214,7 +215,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/TigerVNCHostView.xaml b/Source/NETworkManager/Views/TigerVNCHostView.xaml index 0636c65f67..7534efe5f5 100644 --- a/Source/NETworkManager/Views/TigerVNCHostView.xaml +++ b/Source/NETworkManager/Views/TigerVNCHostView.xaml @@ -14,6 +14,7 @@ xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="clr-namespace:NETworkManager.Controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" Loaded="UserControl_Loaded" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:TigerVNCHostViewModel}"> @@ -318,7 +319,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/TracerouteHostView.xaml b/Source/NETworkManager/Views/TracerouteHostView.xaml index 6a56c52d41..9253699360 100644 --- a/Source/NETworkManager/Views/TracerouteHostView.xaml +++ b/Source/NETworkManager/Views/TracerouteHostView.xaml @@ -12,6 +12,7 @@ xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:TracerouteHostViewModel}"> @@ -214,7 +215,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/WakeOnLANView.xaml b/Source/NETworkManager/Views/WakeOnLANView.xaml index 21057ac441..dfa7d10d46 100644 --- a/Source/NETworkManager/Views/WakeOnLANView.xaml +++ b/Source/NETworkManager/Views/WakeOnLANView.xaml @@ -12,6 +12,7 @@ xmlns:viewModels="clr-namespace:NETworkManager.ViewModels" xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization" xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:WakeOnLANViewModel}"> @@ -229,10 +230,10 @@ - + @@ -279,10 +280,6 @@ - @@ -304,7 +301,7 @@ - + + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/WebConsoleHostView.xaml b/Source/NETworkManager/Views/WebConsoleHostView.xaml index a71f7a2351..6e8550a1b8 100644 --- a/Source/NETworkManager/Views/WebConsoleHostView.xaml +++ b/Source/NETworkManager/Views/WebConsoleHostView.xaml @@ -15,6 +15,7 @@ xmlns:resources="clr-namespace:NETworkManager.Properties" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="clr-namespace:NETworkManager.Controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:WebConsoleHostViewModel}"> @@ -318,7 +319,7 @@ + + + + + + + + + + + + + + + + + + diff --git a/Source/NETworkManager/Views/WhoisHostView.xaml b/Source/NETworkManager/Views/WhoisHostView.xaml index 747027c83b..c05e8e80a7 100644 --- a/Source/NETworkManager/Views/WhoisHostView.xaml +++ b/Source/NETworkManager/Views/WhoisHostView.xaml @@ -12,6 +12,7 @@ xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" dialogs:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:WhoisHostViewModel}"> @@ -215,7 +216,7 @@ @@ -336,8 +337,26 @@ BasedOn="{StaticResource MahApps.Styles.ListBoxItem}"> + + + + + + + + + + + + + + + + + +