feature: show tags count in tags tree (#1306)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-13 22:50:10 +08:00
parent 5b72b15cf2
commit 6bf930a9e0
No known key found for this signature in database
3 changed files with 24 additions and 6 deletions

View file

@ -26,6 +26,7 @@ namespace SourceGit.ViewModels
public Models.Tag Tag { get; private set; } = null;
public TagTreeNodeToolTip ToolTip { get; private set; } = null;
public List<TagTreeNode> Children { get; private set; } = [];
public int Counter { get; set; } = 0;
public bool IsFolder
{
@ -38,6 +39,11 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _isExpanded, value);
}
public string TagsCount
{
get => Counter > 0 ? $"({Counter})" : string.Empty;
}
public TagTreeNode(Models.Tag t, int depth)
{
FullPath = t.Name;
@ -52,6 +58,7 @@ namespace SourceGit.ViewModels
FullPath = path;
Depth = depth;
IsExpanded = isExpanded;
Counter = 1;
}
public static List<TagTreeNode> Build(IList<Models.Tag> tags, HashSet<string> expaneded)
@ -77,6 +84,7 @@ namespace SourceGit.ViewModels
if (folders.TryGetValue(folder, out var value))
{
lastFolder = value;
lastFolder.Counter++;
}
else if (lastFolder == null)
{