feature: show track status in Delete Multiple Branches panel (#785)
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions

This commit is contained in:
leo 2024-12-04 19:14:48 +08:00
parent 1ddd348a40
commit 75e9f1e9a4
No known key found for this signature in database
4 changed files with 18 additions and 10 deletions

View file

@ -7,6 +7,8 @@ namespace SourceGit.Models
public List<string> Ahead { get; set; } = new List<string>(); public List<string> Ahead { get; set; } = new List<string>();
public List<string> Behind { get; set; } = new List<string>(); public List<string> Behind { get; set; } = new List<string>();
public bool IsVisible => Ahead.Count > 0 || Behind.Count > 0;
public override string ToString() public override string ToString()
{ {
if (Ahead.Count == 0 && Behind.Count == 0) if (Ahead.Count == 0 && Behind.Count == 0)

View file

@ -10,12 +10,6 @@ namespace SourceGit.ViewModels
private set; private set;
} }
public string TrackStatus
{
get;
private set;
}
public Models.Branch TrackingRemoteBranch public Models.Branch TrackingRemoteBranch
{ {
get; get;
@ -38,7 +32,6 @@ namespace SourceGit.ViewModels
{ {
_repo = repo; _repo = repo;
Target = branch; Target = branch;
TrackStatus = branch.TrackStatus.ToString();
if (branch.IsLocal && !string.IsNullOrEmpty(branch.Upstream)) if (branch.IsLocal && !string.IsNullOrEmpty(branch.Upstream))
{ {

View file

@ -22,11 +22,11 @@
VerticalAlignment="Center" VerticalAlignment="Center"
CornerRadius="9" CornerRadius="9"
Background="{DynamicResource Brush.Badge}" Background="{DynamicResource Brush.Badge}"
IsVisible="{Binding TrackStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> IsVisible="{Binding Target.TrackStatus.IsVisible}">
<TextBlock Foreground="{DynamicResource Brush.BadgeFG}" <TextBlock Foreground="{DynamicResource Brush.BadgeFG}"
FontFamily="{DynamicResource Fonts.Monospace}" FontFamily="{DynamicResource Fonts.Monospace}"
FontSize="10" FontSize="10"
Text="{Binding TrackStatus}"/> Text="{Binding Target.TrackStatus}"/>
</Border> </Border>
</StackPanel> </StackPanel>

View file

@ -42,9 +42,22 @@
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate DataType="m:Branch"> <DataTemplate DataType="m:Branch">
<Grid Height="26" ColumnDefinitions="22,*"> <Grid Height="26" ColumnDefinitions="22,*,Auto">
<Path Grid.Column="0" Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Branch}" /> <Path Grid.Column="0" Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Branch}" />
<TextBlock Grid.Column="1" Text="{Binding FriendlyName}" Classes="primary" /> <TextBlock Grid.Column="1" Text="{Binding FriendlyName}" Classes="primary" />
<Border Grid.Column="2"
Height="18"
Margin="8,0"
Padding="8,0"
VerticalAlignment="Center"
CornerRadius="9"
Background="{DynamicResource Brush.Badge}"
IsVisible="{Binding TrackStatus.IsVisible}">
<TextBlock Foreground="{DynamicResource Brush.BadgeFG}"
FontFamily="{DynamicResource Fonts.Monospace}"
FontSize="10"
Text="{Binding TrackStatus}"/>
</Border>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>