Skip to content

Commit 5dd6ca4

Browse files
committed
Modifying icons a bit for #6 and changing directory lookup
1 parent f7b0d06 commit 5dd6ca4

File tree

5 files changed

+23
-31
lines changed

5 files changed

+23
-31
lines changed

src/Converters/ConclusionIconConverter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
1919
{
2020
"success" => "\uEBB3 ",
2121
"completed" => "\uEBB3 ",
22-
"failure" => "\uEA87 ",
23-
"startup_failure" => "\uEA87 ",
24-
"cancelled" => "\uEABD ",
22+
"failure" => "\uEC13 ",
23+
"startup_failure" => "\uEC13 ",
24+
"cancelled" => "\uEC19 ",
2525
"skipped" => "\uEABD ",
26-
"pending" => "\uEBB5 ",
26+
"pending" => "\uEB81 ",
2727
"queued" => "\uEBA7 ",
2828
"requested" => "\uEBA7 ",
2929
"waiting" => "\uEA82 ",
3030
"inprogress" => "\uEA82 ",
3131
"in_progress" => "\uEA82 ",
32-
"warning" => "\uEA6C ",
32+
"warning" => "\uEB82 ",
3333
_ => "\uEA74 ",
3434
};
3535
}

src/Helpers/RepoInfo.cs

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,27 @@ internal class RepoInfo
1414
internal void FindGitFolder(string path, out string foundPath)
1515
{
1616
foundPath = null;
17-
// Check if the current directory contains a .git folder
18-
if (Directory.Exists(Path.Combine(path, ".git")))
17+
18+
while (!Directory.Exists(Path.Combine(path, ".git")))
1919
{
20-
foundPath = path;
21-
var repo = new LibGit2Sharp.Repository(foundPath);
22-
var remote = repo.Network.Remotes.FirstOrDefault();
23-
if (remote is not null)
24-
{
25-
var url = remote.Url;
26-
if (url.Contains("github.com"))
27-
{
28-
IsGitHub = true;
29-
var parts = url.Split('/');
30-
RepoOwner = parts[parts.Length - 2];
31-
RepoName = parts[parts.Length - 1].Replace(".git", "");
32-
RepoUrl = url.Replace(".git", "");
33-
CurrentBranch = repo.Head.FriendlyName;
34-
}
35-
}
36-
return;
20+
path = Path.GetFullPath(Path.Combine(path, ".."));
3721
}
38-
else
22+
foundPath = path;
23+
var repo = new LibGit2Sharp.Repository(foundPath);
24+
var remote = repo.Network.Remotes.FirstOrDefault();
25+
if (remote is not null)
3926
{
40-
// Climb up to the parent directory
41-
string parentPath = Directory.GetParent(path)?.FullName;
42-
if (!string.IsNullOrEmpty(parentPath))
27+
var url = remote.Url;
28+
if (url.Contains("github.com"))
4329
{
44-
FindGitFolder(parentPath, out foundPath); // Recursively search the parent directory
30+
IsGitHub = true;
31+
var parts = url.Split('/');
32+
RepoOwner = parts[parts.Length - 2];
33+
RepoName = parts[parts.Length - 1].Replace(".git", "");
34+
RepoUrl = url.Replace(".git", "");
35+
CurrentBranch = repo.Head.FriendlyName;
4536
}
4637
}
47-
4838
return;
4939
}
5040
}

src/Resources/codicon.ttf

2.04 KB
Binary file not shown.

src/ToolWindows/GHActionsToolWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<ProgressBar x:Name="refreshProgress" Height="5" Grid.Row="0" Visibility="Collapsed" />
6161
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Row="1" Margin="5,5,0,0">
6262
<StackPanel Orientation="Vertical">
63-
<Expander Header="Current Branch">
63+
<Expander Header="Current Branch" x:Name="CurrentBranchExpander">
6464
<TreeView BorderThickness="0" PreviewMouseWheel="HandlePreviewMouseWheel" MouseDoubleClick="JobItem_MouseDoubleClick" x:Name="tvCurrentBranch" ItemTemplate="{DynamicResource TreeViewRunNodeDataTemplate}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
6565
<TreeView.Resources>
6666
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">

src/ToolWindows/GHActionsToolWindow.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ private void ClearTreeViews()
8989
tvSecrets.Items.Clear();
9090
//tvWorkflows.Items.Clear();
9191
tvCurrentBranch.ItemsSource = null;
92+
CurrentBranchExpander.IsExpanded = false;
9293
tvEnvironments.Items.Clear();
9394
}
9495

@@ -190,6 +191,7 @@ private async Task LoadDataAsync()
190191
Console.WriteLine(ex);
191192
}
192193

194+
CurrentBranchExpander.IsExpanded = true;
193195
refreshProgress.Visibility = Visibility.Collapsed;
194196
refreshProgress.IsIndeterminate = false;
195197
}

0 commit comments

Comments
 (0)