Skip to content

Commit a48120c

Browse files
authored
Docs: Update screenshots & profile docs (#3187)
* Docs: Update screenshots * Update profiles--overview-feature.png * Fix: Filter was reset on refresh * Docs: #3187
1 parent cf9df38 commit a48120c

File tree

7 files changed

+28
-15
lines changed

7 files changed

+28
-15
lines changed

Source/NETworkManager/ViewModels/ProfilesViewModel.cs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public ProfilesViewModel()
2525
ListSortDirection.Ascending));
2626

2727
SetGroupsView();
28-
28+
2929
ProfileManager.OnProfilesUpdated += ProfileManager_OnProfilesUpdated;
3030

3131
_searchDispatcherTimer.Interval = GlobalStaticConfiguration.SearchDispatcherTimerTimeSpan;
@@ -35,7 +35,7 @@ public ProfilesViewModel()
3535
#endregion
3636

3737
#region Variables
38-
38+
3939
private readonly DispatcherTimer _searchDispatcherTimer = new();
4040
private bool _searchDisabled;
4141

@@ -56,6 +56,8 @@ private set
5656
}
5757
}
5858

59+
private bool _disableProfileRefresh;
60+
5961
private ProfileInfo _lastSelectedProfileOnRefresh;
6062

6163
private GroupInfo _selectedGroup = new();
@@ -70,21 +72,22 @@ public GroupInfo SelectedGroup
7072

7173
_selectedGroup = value;
7274

73-
// NullReferenceException occurs if profile file is changed
74-
if (value != null)
75+
// Check for null, because a NullReferenceException can occur when a profile file is changed
76+
// Temporarily disable profile refresh to avoid multiple refreshes and prevent the filter from being reset.
77+
if (value != null && !_disableProfileRefresh)
7578
{
7679
// Set/update tags based on current group
7780
CreateTags();
78-
81+
7982
var filter = new ProfileFilterInfo
8083
{
8184
Search = Search,
8285
Tags = [.. ProfileFilterTags.Where(x => x.IsSelected).Select(x => x.Name)],
8386
TagsFilterMatch = ProfileFilterTagsMatchAny ? ProfileFilterTagsMatch.Any : ProfileFilterTagsMatch.All
8487
};
85-
86-
SetProfilesView(filter ,value, _lastSelectedProfileOnRefresh);
87-
88+
89+
SetProfilesView(filter, value, _lastSelectedProfileOnRefresh);
90+
8891
IsProfileFilterSet = !string.IsNullOrEmpty(filter.Search) || filter.Tags.Any();
8992
}
9093
else
@@ -95,7 +98,7 @@ public GroupInfo SelectedGroup
9598
OnPropertyChanged();
9699
}
97100
}
98-
101+
99102
private ICollectionView _profiles;
100103

101104
public ICollectionView Profiles
@@ -266,7 +269,7 @@ private void DeleteGroupAction()
266269
{
267270
ProfileDialogManager.ShowDeleteGroupDialog(Application.Current.MainWindow, this, SelectedGroup).ConfigureAwait(false);
268271
}
269-
272+
270273
public ICommand AddProfileCommand => new RelayCommand(_ => AddProfileAction());
271274

272275
private void AddProfileAction()
@@ -358,14 +361,19 @@ public void OnViewHide()
358361

359362
private void SetGroupsView(GroupInfo group = null)
360363
{
364+
_disableProfileRefresh = true;
365+
361366
Groups = new CollectionViewSource
362367
{
363368
Source = ProfileManager.Groups.Where(x => !x.IsDynamic).OrderBy(x => x.Name)
364369
}.View;
365-
366-
// Set specific group or first if null
370+
371+
// Set to null, so even when the same group is selected, the profiles get refreshed
367372
SelectedGroup = null;
368373

374+
_disableProfileRefresh = false;
375+
376+
// Set specific group or first if null
369377
if (group != null)
370378
SelectedGroup = Groups.SourceCollection.Cast<GroupInfo>().FirstOrDefault(x => x.Equals(group)) ??
371379
Groups.SourceCollection.Cast<GroupInfo>().MinBy(x => x.Name);
@@ -378,7 +386,7 @@ private void CreateTags()
378386
// Get all tags from profiles in the selected group
379387
var tags = ProfileManager.Groups.First(x => x.Name == SelectedGroup.Name).Profiles
380388
.SelectMany(x => x.TagsCollection).Distinct().ToList();
381-
389+
382390
var tagSet = new HashSet<string>(tags);
383391

384392
for (var i = ProfileFilterTags.Count - 1; i >= 0; i--)
@@ -394,7 +402,7 @@ private void CreateTags()
394402
ProfileFilterTags.Add(new ProfileFilterTagsInfo(false, tag));
395403
}
396404
}
397-
405+
398406
private void SetProfilesView(ProfileFilterInfo filter, GroupInfo group, ProfileInfo profile = null)
399407
{
400408
Profiles = new CollectionViewSource

Website/docs/changelog/next-release.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Release date: **xx.xx.2025**
2121

2222
**Profiles**
2323

24-
- Added the ability to filter profiles by tags using the filter button next to the search field. [#3144](https://github.com/BornToBeRoot/NETworkManager/pull/3144)
24+
- Added the ability to filter profiles by tags using the filter button next to the search field. [#3144](https://github.com/BornToBeRoot/NETworkManager/pull/3144) [#3187](https://github.com/BornToBeRoot/NETworkManager/pull/3187)
2525
- Introduced a context menu for profile groups to collapse or expand all groups at once. [#3171](https://github.com/BornToBeRoot/NETworkManager/pull/3171)
2626

2727
## Improvements
@@ -46,6 +46,7 @@ Release date: **xx.xx.2025**
4646

4747
## Dependencies, Refactoring & Documentation
4848

49+
- Documentation updated [#3187](https://github.com/BornToBeRoot/NETworkManager/pull/3187)
4950
- Code cleanup & refactoring
5051
- Language files updated via [#transifex](https://github.com/BornToBeRoot/NETworkManager/pulls?q=author%3Aapp%2Ftransifex-integration)
5152
- Dependencies updated via [#dependabot](https://github.com/BornToBeRoot/NETworkManager/pulls?q=author%3Aapp%2Fdependabot)

Website/docs/groups-and-profiles.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Right-click on a selected profile to `edit`, `copy` or `delete` it.
3434

3535
You can also use the Hotkeys `F2` (`edit`) or `Del` (`delete`) on a selected profile.
3636

37+
Right-click on a group header to `expand` or `collapse` all groups. The button to edit the group will be shown when hovering over the group header.
38+
3739
:::
3840

3941
## Group
@@ -50,6 +52,8 @@ In the profile settings you can define general settings and feature specific set
5052

5153
Profiles are only displayed in the specific features if they have been enabled via the checkbox. The [`Profiles` tab in the `Settings`](#overview) will show all profiles.
5254

55+
Use `tags` to organize profiles and filter by them. For example, tag profiles as `prod` or `dns` to group related ones. You can filter by `any` or `all` tags.
56+
5357
:::
5458

5559
:::tip
2.85 KB
Loading
38.9 KB
Loading
12.9 KB
Loading
-12 KB
Loading

0 commit comments

Comments
 (0)