Skip to content

Commit

Permalink
Minor styling
Browse files Browse the repository at this point in the history
  • Loading branch information
timheuer committed Jul 28, 2023
2 parents ce39297 + e9e45f9 commit e9cf39a
Show file tree
Hide file tree
Showing 18 changed files with 394 additions and 57 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,17 @@ You can manually refresh the view by clicking the refresh icon in the toolbar:

![image](https://github.com/timheuer/GitHubActionsVS/assets/4821/865d424d-29e1-40e8-96c4-1eeffb458682)

### Edit GitHub secrets (Coming soon...)
### Edit GitHub secrets
The limitation currently is this lists and enables editing of Repository-level secrets (not org or deployment environments yet).

To add a secret right-click on the Repository Secrets node and select `Add Secret`

![image](https://github.com/timheuer/GitHubActionsVS/assets/4821/264acf44-509b-4442-a9b9-80f93ff5cad5)

This will launch a modal dialog to add the repository secret. This is the same for edit (right-click on an existing secret) which will enable you to edit an existing one or delete.

![image](https://github.com/timheuer/GitHubActionsVS/assets/4821/ba12fe8b-9f33-46b7-a4a4-1ae343a0ce34)

Update or Add repo secrets directly from within Visual Studio.

## Contributors

Expand Down
1 change: 1 addition & 0 deletions src/Converters/ConclusionColorConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
"success" => new SolidColorBrush(Colors.Green),
"failure" => new SolidColorBrush(Colors.Red),
"startup_failure" => new SolidColorBrush(Colors.Red),
"waiting" => new SolidColorBrush(Color.FromRgb(154, 103, 0)),
_ => new SolidColorBrush(Colors.Black),
};
}
17 changes: 17 additions & 0 deletions src/Converters/NullToVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace GitHubActionsVS.Converters;
public class NullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? Visibility.Hidden: Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
28 changes: 20 additions & 8 deletions src/GitHubActionsVS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@
<Compile Include="Commands\RefreshRepoCommand.cs" />
<Compile Include="Converters\ConclusionColorConverter.cs" />
<Compile Include="Converters\ConclusionIconConverter.cs" />
<Compile Include="Converters\NullToVisibilityConverter.cs" />
<Compile Include="Helpers\CredentialManager.cs" />
<Compile Include="Helpers\RepoInfo.cs" />
<Compile Include="Models\BaseWorkflowType.cs" />
<Compile Include="Models\SimpleEnvironment.cs" />
<Compile Include="Models\SimpleJob.cs" />
<Compile Include="Models\SimpleRun.cs" />
<Compile Include="Options\ExtensionOptions.cs" />
Expand All @@ -65,13 +67,21 @@
<Compile Include="ToolWindows\MessagePayload.cs" />
<Compile Include="ToolWindows\MessageCommand.cs" />
<Compile Include="ToolWindows\ToolWindowMessenger.cs" />
<Compile Include="UserControls\AddEditSecret.xaml.cs">
<DependentUpon>AddEditSecret.xaml</DependentUpon>
</Compile>
<Compile Include="VSCommandTable.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>VSCommandTable.vsct</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="libsodium.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Resource Include="Resources\OpenWebSite.png" />
<Resource Include="Resources\codicon.ttf" />
<Content Include="LICENSE">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand All @@ -81,18 +91,13 @@
<SubType>Designer</SubType>
<Generator>VsixManifestGenerator</Generator>
</None>
<Content Include="lib\win32\arm64\git2-e632535.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="lib\win32\x64\git2-e632535.dll">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="lib\win32\x86\git2-e632535.dll">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\AddItem.png" />
<Resource Include="Resources\Delete.png" />
<Resource Include="Resources\Edit.png" />
<Content Include="Resources\Icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
Expand All @@ -111,6 +116,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControls\AddEditSecret.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -150,6 +159,9 @@
<PackageReference Include="Octokit">
<Version>7.0.1</Version>
</PackageReference>
<PackageReference Include="Sodium.Core">
<Version>1.3.3</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
Expand Down
10 changes: 10 additions & 0 deletions src/Models/SimpleEnvironment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;

namespace GitHubActionsVS.Models;
public class SimpleEnvironment
{
public string Name { get; set; }
public string Url { get; set; }
}


12 changes: 12 additions & 0 deletions src/Options/ExtensionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public class ExtensionOptions : BaseOptionModel<ExtensionOptions>
[Description("The maximum number of runs to retrieve")]
[DefaultValue(10)]
public int MaxRuns { get; set; } = 10;

[Category("Query Settings")]
[DisplayName("Refresh Active Jobs")]
[Description("Whether to poll/refresh when pending/active jobs are going")]
[DefaultValue(false)]
public bool RefreshActiveJobs { get; set; } = false;

[Category("Query Settings")]
[DisplayName("Refresh Interval (in seconds)")]
[Description("The interval (in seconds) to poll/refresh when pending/active jobs are going")]
[DefaultValue(5)]
public int RefreshInterval { get; set; } = 5;
}
1 change: 1 addition & 0 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[assembly: ComVisible(false)]

[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\LibGit2Sharp.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Sodium.Core.dll")]

namespace System.Runtime.CompilerServices;
public class IsExternalInit { }
Binary file added src/Resources/AddItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Resources/Delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Resources/Edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Resources/OpenWebSite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 65 additions & 10 deletions src/ToolWindows/GHActionsToolWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<FontFamily x:Key="CodiconFont">pack://application:,,,/GitHubActionsVS;component/Resources/#codicon</FontFamily>
<ivc:ConclusionIconConverter x:Key="ConclusionIconConverter" />
<ivc:ConclusionColorConverter x:Key="ConclusionColorConverter" />
<ivc:NullToVisibilityConverter x:Key="NullVisibilityConverter" />
<Style TargetType="{x:Type Expander}">
<Setter Property="toolkit:Themes.UseVsTheme" Value="True" />
</Style>
Expand All @@ -31,37 +32,91 @@
<TextBlock Text="{Binding}" Margin="5,0" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="EnvironmentHeaderTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="{StaticResource CodiconFont}" Text="&#xEBA3;" VerticalAlignment="Center" />
<TextBlock Text="{Binding}" Margin="5,0" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="RepoSecretsHeaderTemplate">
<TextBlock Text="{Binding}">
<TextBlock.ContextMenu>
<ContextMenu>
<MenuItem Header="Add Secret" Click="AddSecret_Click">
<MenuItem.Icon>
<Image Source="pack://application:,,,/GitHubActionsVS;component/Resources/AddItem.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>
</DataTemplate>
<HierarchicalDataTemplate x:Key="TreeViewRunNodeDataTemplate" ItemsSource="{Binding Jobs}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock VerticalAlignment="Center" FontFamily="{StaticResource CodiconFont}"
Foreground="{Binding Path=Conclusion, Converter={StaticResource ConclusionColorConverter}}"
Text="{Binding Path=Conclusion, Converter={StaticResource ConclusionIconConverter}}"/>
<emoji:TextBlock Text="{Binding DisplayName}" VerticalAlignment="Bottom" />
<emoji:TextBlock Text="{Binding DisplayName}" VerticalAlignment="Bottom" Tag="{Binding Url}">
<TextBlock.ContextMenu>
<ContextMenu Visibility="{Binding Url, Converter={StaticResource NullVisibilityConverter}}">
<MenuItem Header="View Log" Click="ViewLog_Click" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/GitHubActionsVS;component/Resources/OpenWebSite.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TextBlock.ContextMenu>
</emoji:TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate x:Key="EnvironmentItemTemplate">
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</UserControl.Resources>
<Grid VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ProgressBar x:Name="refreshProgress" Height="5" Grid.Row="0" Visibility="Collapsed" />
<StackPanel Grid.Row="1">
<ProgressBar x:Name="refreshProgress" Height="5" Grid.Row="0" Visibility="Hidden"/>
<Grid Grid.Row="1">
<TextBlock HorizontalAlignment="Center" x:Name="MessageArea" />
<ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="5,5,0,0" x:Name="ActionsInfoPanel" Visibility="Collapsed">
<StackPanel Orientation="Vertical" VerticalAlignment="Stretch">
<ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="5,5,0,0" x:Name="ActionsInfoPanel">
<StackPanel Orientation="Vertical">
<Expander Header="Current Branch" x:Name="CurrentBranchExpander" FontWeight="Bold">
<TreeView FontWeight="Normal" BorderThickness="0" PreviewMouseWheel="HandlePreviewMouseWheel" x:Name="tvCurrentBranch" ItemTemplate="{DynamicResource TreeViewRunNodeDataTemplate}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
<TreeView BorderThickness="0" FontWeight="Normal" PreviewMouseWheel="HandlePreviewMouseWheel" x:Name="tvCurrentBranch" ItemTemplate="{StaticResource TreeViewRunNodeDataTemplate}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
</Expander>
<Expander Header="Settings" FontWeight="Bold">
<TreeView BorderThickness="0" FontWeight="Normal">
<TreeViewItem Header="Secrets" HeaderTemplate="{DynamicResource SecretsHeaderTemplate}">
<TreeViewItem Header="Repository Secrets" x:Name="tvSecrets"/>
<TreeView BorderThickness="0" PreviewMouseWheel="HandlePreviewMouseWheel" FontWeight="Normal">
<TreeViewItem Header="Environments" HeaderTemplate="{StaticResource EnvironmentHeaderTemplate}" x:Name="tvEnvironments" ItemTemplate="{StaticResource EnvironmentItemTemplate}" />
<TreeViewItem Header="Secrets" HeaderTemplate="{StaticResource SecretsHeaderTemplate}">
<TreeViewItem x:Name="tvSecrets" HeaderTemplate="{StaticResource RepoSecretsHeaderTemplate}">
<TreeViewItem.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}">
<TextBlock.ContextMenu>
<ContextMenu>
<MenuItem Header="Edit Secret" Click="EditSecret_Click" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/GitHubActionsVS;component/Resources/Edit.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Delete Secret" Click="DeleteSecret_Click" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/GitHubActionsVS;component/Resources/Delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>
</DataTemplate>
</TreeViewItem.ItemTemplate>
</TreeViewItem>
</TreeViewItem>
</TreeView>
</Expander>
</StackPanel>
</ScrollViewer>
</StackPanel>
</Grid>
</Grid>
</UserControl>
Loading

0 comments on commit e9cf39a

Please sign in to comment.