Skip to content

Commit

Permalink
Modifying icons a bit for #6 and changing directory lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
timheuer committed Jul 15, 2023
1 parent f7b0d06 commit 5dd6ca4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 31 deletions.
10 changes: 5 additions & 5 deletions src/Converters/ConclusionIconConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
"success" => "\uEBB3 ",
"completed" => "\uEBB3 ",
"failure" => "\uEA87 ",
"startup_failure" => "\uEA87 ",
"cancelled" => "\uEABD ",
"failure" => "\uEC13 ",
"startup_failure" => "\uEC13 ",
"cancelled" => "\uEC19 ",
"skipped" => "\uEABD ",
"pending" => "\uEBB5 ",
"pending" => "\uEB81 ",
"queued" => "\uEBA7 ",
"requested" => "\uEBA7 ",
"waiting" => "\uEA82 ",
"inprogress" => "\uEA82 ",
"in_progress" => "\uEA82 ",
"warning" => "\uEA6C ",
"warning" => "\uEB82 ",
_ => "\uEA74 ",
};
}
40 changes: 15 additions & 25 deletions src/Helpers/RepoInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,27 @@ internal class RepoInfo
internal void FindGitFolder(string path, out string foundPath)
{
foundPath = null;
// Check if the current directory contains a .git folder
if (Directory.Exists(Path.Combine(path, ".git")))

while (!Directory.Exists(Path.Combine(path, ".git")))
{
foundPath = path;
var repo = new LibGit2Sharp.Repository(foundPath);
var remote = repo.Network.Remotes.FirstOrDefault();
if (remote is not null)
{
var url = remote.Url;
if (url.Contains("github.com"))
{
IsGitHub = true;
var parts = url.Split('/');
RepoOwner = parts[parts.Length - 2];
RepoName = parts[parts.Length - 1].Replace(".git", "");
RepoUrl = url.Replace(".git", "");
CurrentBranch = repo.Head.FriendlyName;
}
}
return;
path = Path.GetFullPath(Path.Combine(path, ".."));
}
else
foundPath = path;
var repo = new LibGit2Sharp.Repository(foundPath);
var remote = repo.Network.Remotes.FirstOrDefault();
if (remote is not null)
{
// Climb up to the parent directory
string parentPath = Directory.GetParent(path)?.FullName;
if (!string.IsNullOrEmpty(parentPath))
var url = remote.Url;
if (url.Contains("github.com"))
{
FindGitFolder(parentPath, out foundPath); // Recursively search the parent directory
IsGitHub = true;
var parts = url.Split('/');
RepoOwner = parts[parts.Length - 2];
RepoName = parts[parts.Length - 1].Replace(".git", "");
RepoUrl = url.Replace(".git", "");
CurrentBranch = repo.Head.FriendlyName;
}
}

return;
}
}
Binary file modified src/Resources/codicon.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/ToolWindows/GHActionsToolWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<ProgressBar x:Name="refreshProgress" Height="5" Grid.Row="0" Visibility="Collapsed" />
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Row="1" Margin="5,5,0,0">
<StackPanel Orientation="Vertical">
<Expander Header="Current Branch">
<Expander Header="Current Branch" x:Name="CurrentBranchExpander">
<TreeView BorderThickness="0" PreviewMouseWheel="HandlePreviewMouseWheel" MouseDoubleClick="JobItem_MouseDoubleClick" x:Name="tvCurrentBranch" ItemTemplate="{DynamicResource TreeViewRunNodeDataTemplate}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">
Expand Down
2 changes: 2 additions & 0 deletions src/ToolWindows/GHActionsToolWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private void ClearTreeViews()
tvSecrets.Items.Clear();
//tvWorkflows.Items.Clear();
tvCurrentBranch.ItemsSource = null;
CurrentBranchExpander.IsExpanded = false;
tvEnvironments.Items.Clear();
}

Expand Down Expand Up @@ -190,6 +191,7 @@ private async Task LoadDataAsync()
Console.WriteLine(ex);
}

CurrentBranchExpander.IsExpanded = true;
refreshProgress.Visibility = Visibility.Collapsed;
refreshProgress.IsIndeterminate = false;
}
Expand Down

0 comments on commit 5dd6ca4

Please sign in to comment.