From 75e9f1e9a4b711cce7ebb47f26d48bfcfb430471 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 4 Dec 2024 19:14:48 +0800 Subject: [PATCH] feature: show track status in `Delete Multiple Branches` panel (#785) --- src/Models/Branch.cs | 2 ++ src/ViewModels/DeleteBranch.cs | 7 ------- src/Views/DeleteBranch.axaml | 4 ++-- src/Views/DeleteMultipleBranches.axaml | 15 ++++++++++++++- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Models/Branch.cs b/src/Models/Branch.cs index ac6b8c67..0ba320c1 100644 --- a/src/Models/Branch.cs +++ b/src/Models/Branch.cs @@ -7,6 +7,8 @@ namespace SourceGit.Models public List Ahead { get; set; } = new List(); public List Behind { get; set; } = new List(); + public bool IsVisible => Ahead.Count > 0 || Behind.Count > 0; + public override string ToString() { if (Ahead.Count == 0 && Behind.Count == 0) diff --git a/src/ViewModels/DeleteBranch.cs b/src/ViewModels/DeleteBranch.cs index e23f4201..e7136a0d 100644 --- a/src/ViewModels/DeleteBranch.cs +++ b/src/ViewModels/DeleteBranch.cs @@ -10,12 +10,6 @@ namespace SourceGit.ViewModels private set; } - public string TrackStatus - { - get; - private set; - } - public Models.Branch TrackingRemoteBranch { get; @@ -38,7 +32,6 @@ namespace SourceGit.ViewModels { _repo = repo; Target = branch; - TrackStatus = branch.TrackStatus.ToString(); if (branch.IsLocal && !string.IsNullOrEmpty(branch.Upstream)) { diff --git a/src/Views/DeleteBranch.axaml b/src/Views/DeleteBranch.axaml index bdaa9d8a..05ec6e26 100644 --- a/src/Views/DeleteBranch.axaml +++ b/src/Views/DeleteBranch.axaml @@ -22,11 +22,11 @@ VerticalAlignment="Center" CornerRadius="9" Background="{DynamicResource Brush.Badge}" - IsVisible="{Binding TrackStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{Binding Target.TrackStatus.IsVisible}"> + Text="{Binding Target.TrackStatus}"/> diff --git a/src/Views/DeleteMultipleBranches.axaml b/src/Views/DeleteMultipleBranches.axaml index 2a888118..cf084e14 100644 --- a/src/Views/DeleteMultipleBranches.axaml +++ b/src/Views/DeleteMultipleBranches.axaml @@ -42,9 +42,22 @@ - + + + +