From e18bb2812aef7ef176e0dc43a23f63c477350407 Mon Sep 17 00:00:00 2001 From: Tim Heuer Date: Fri, 21 Jul 2023 13:01:58 -0700 Subject: [PATCH] Adding links to logs - Added icons to menus - Added view log context menu --- src/Converters/NullToVisibilityConverter.cs | 17 +++++++++++ src/GitHubActionsVS.csproj | 10 +++++-- src/Resources/AddItem.png | Bin 0 -> 271 bytes src/Resources/Delete.png | Bin 0 -> 291 bytes src/Resources/Edit.png | Bin 0 -> 643 bytes src/Resources/OpenWebSite.png | Bin 0 -> 1396 bytes src/ToolWindows/GHActionsToolWindow.xaml | 31 +++++++++++++++++--- src/ToolWindows/GHActionsToolWindow.xaml.cs | 17 +++++++++-- 8 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 src/Converters/NullToVisibilityConverter.cs create mode 100644 src/Resources/AddItem.png create mode 100644 src/Resources/Delete.png create mode 100644 src/Resources/Edit.png create mode 100644 src/Resources/OpenWebSite.png diff --git a/src/Converters/NullToVisibilityConverter.cs b/src/Converters/NullToVisibilityConverter.cs new file mode 100644 index 0000000..87a1d69 --- /dev/null +++ b/src/Converters/NullToVisibilityConverter.cs @@ -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(); + } +} diff --git a/src/GitHubActionsVS.csproj b/src/GitHubActionsVS.csproj index ac42425..5bca954 100644 --- a/src/GitHubActionsVS.csproj +++ b/src/GitHubActionsVS.csproj @@ -49,6 +49,7 @@ + @@ -80,6 +81,7 @@ Always true + Always @@ -93,10 +95,12 @@ true Always - + + + + PreserveNewest - true - + diff --git a/src/Resources/AddItem.png b/src/Resources/AddItem.png new file mode 100644 index 0000000000000000000000000000000000000000..67b0658e48cf1ea93cd216fc55aa63bbd1781fd4 GIT binary patch literal 271 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!;1W+4$B+p3x6^w$8x#auedjDviP^}xh%?K@ zGJ|_#fXE^PBctCt`JebqiaQ^!#2L8#Ys#$MK5V6?(i#g2N}J>BUno@cJ8}rl6<%A) z%+UNYy|5wZ)^0t`b82_34_oTLJ>V#jym)1hm-YX@l0W*HH|9${D&$+xaJNPOXAYYg z-;es;L8~?~i#Nv~loDxR3Si(mp{KAzd`Viq{s#88BX>UbggczznO$fZ`_oU`9OzyK MPgg&ebxsLQ00rn?S^xk5 literal 0 HcmV?d00001 diff --git a/src/Resources/Delete.png b/src/Resources/Delete.png new file mode 100644 index 0000000000000000000000000000000000000000..1c633534bd475bba9d0813637d96566fa029d178 GIT binary patch literal 291 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!;0{k0$B+p3RY%=a+la$R)@+V}Xfd!}%fshNwK|C2GzUCJbC$T>l* z6N94N#sm{CH(7&M4T0=ERtZ-a7xPJ2@iA-_oOrvl<;Rhxiy9II><`|E2S`u2q(6gU h=}OLm87B`gFsv@IFYFgidJXgggQu&X%Q~loCIH!AVKx8& literal 0 HcmV?d00001 diff --git a/src/Resources/Edit.png b/src/Resources/Edit.png new file mode 100644 index 0000000000000000000000000000000000000000..0fdfdfa11b93402e3cebc346671f54c53a5ac718 GIT binary patch literal 643 zcmV-}0(||6P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0vJg|K~z{r?UuPq z13?srH=7Me2*E}OqB+FEfFRfjA(a-Qf{leB79QaLpoJEeRvuVd2o?%jiWUa6va(PN z#GG1KNH7pV$>s0uOoDL}cazLwlMfzm=1th|?aZI@WP3=H4a=Zgh*h)1GHy~0@G}M4-IbpZ~GvtJ!2F#KZ zx(zfa&mv~m`4hs zJ}N>^)I0)Qd>$8H;L{2a%ZNTvazb+iboY>~@@W-(2hJcL5g{iuM}UWK8iG?kRUt8& zIz)Xl7K=UcvJf;4csw5ZLmA-HPsBbRzO869`oc_R5#q dv@rom`UWtWY~pNOi>?3w002ovPDHLkV1iHL5orJb literal 0 HcmV?d00001 diff --git a/src/Resources/OpenWebSite.png b/src/Resources/OpenWebSite.png new file mode 100644 index 0000000000000000000000000000000000000000..830c7759a83e84e2eecd327675d78af5ebf64fdd GIT binary patch literal 1396 zcmV-)1&jKLP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1qn$+K~z{r~o?1Ba zIod>QKUJ*-N01v{i#-qguHU1;$H1zCw;?Tk3nR~m!JP{od-qh_De`?N5oR-+e}~xq z%<>CCIaNtX`ZA5rlhhI85A3oE9&kgb%gs5X%XOd51(IM0OKNZAY^dc+~kHB&dGZgAvQsOxJXrSn{(kF;#lM^xq{MuLqa_yZo;3rMsXU?G+fAjbSsS zo|wqN9gJCo)dyU_E38Jld&&?wzzDydk-Zpy4X2261?qgnOS(nt8a=?1-j=~vTcoSLcn4>qxLY5 z*vw%QU?dQT#wUO@*o=^_ASqAIWR_qA;rK1dPb#wz6K0c)Paq8*fK2x?12J`%RE2lhI#|0~?NP=kyI@Tb1T-F$U$dzi4-dD#GVILurxrfS5}8cHLm5D@qq z%kspkhwm&W;}byM+oYzRKveFV`9na)1L-F!#NMJZ3z0v(OlPQU1QSRa_%>NcuH3gD zi>TxSD+il-cc11#F*#_i97N{vG(72w6%TZ`(JiJod|gSLDi7|E4ML8e?hb`BboauM z6YR3NkxIY4#B^4jZrMk~Uu=RR_sh*A`eJ?_b^e-{)Lq*ns3uTo@1;cEjX- zYUQ?1`8YQ6xXMvsnMD%@t{NfOMai#AJD$adju#pXC;HeOIBLKu_BRCKL~|!3DBjfJy1w z>Iu#Lu-_Y*=e*3o$P;``qo=+^$sSWek-W+pp8M*-QIpfL{|ip z$qAM}rEU_}@-dP+;*Ha}$eTXaMLh32bSoPBlD2i{i%Hg^&=G8_F*X4Qm#U|wH(2s( ztHCLkJShfcoNq%MU!t2iIOf*Wlk@m#d1C@)boJlQ)!NF^tzIz>+>eRjKjkm^9h%NH zz&|5UhRbAZL^90zYVQmK{yE8h4qo^-zh?h;0Dl85X7F+5Ue_4_0000pack://application:,,,/GitHubActionsVS;component/Resources/#codicon + @@ -35,7 +36,11 @@ - + + + + + @@ -45,7 +50,17 @@ - + + + + + + + + + + + @@ -75,8 +90,16 @@ - - + + + + + + + + + + diff --git a/src/ToolWindows/GHActionsToolWindow.xaml.cs b/src/ToolWindows/GHActionsToolWindow.xaml.cs index aea0d7b..78c71a1 100644 --- a/src/ToolWindows/GHActionsToolWindow.xaml.cs +++ b/src/ToolWindows/GHActionsToolWindow.xaml.cs @@ -333,7 +333,7 @@ private async void EditSecret_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; TextBlock tvi = GetParentTreeViewItem(menuItem); - if (tvi is not null) + if (tvi is not null && tvi.Text.ToLowerInvariant() != "no repository secrets defined") // yes a hack { string header = tvi.Text.ToString(); string secretName = header.Substring(0, header.IndexOf(" (")); @@ -360,7 +360,7 @@ private async void DeleteSecret_Click(object sender, RoutedEventArgs e) MenuItem menuItem = (MenuItem)sender; TextBlock tvi = GetParentTreeViewItem(menuItem); - if (tvi is not null) + if (tvi is not null && tvi.Text.ToLowerInvariant() != "no repository secrets defined") // yes a hack { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // confirm the delete first @@ -405,5 +405,18 @@ private async Task UpsertRepositorySecret(string secretName) await RefreshSecretsAsync(client); } } + + private void ViewLog_Click(object sender, RoutedEventArgs e) + { + MenuItem menuItem = (MenuItem)sender; + TextBlock tvi = GetParentTreeViewItem(menuItem); + + // check the tag value to ensure it isn't null + if (tvi is not null && tvi.Tag is not null) + { + string logUrl = tvi.Tag.ToString(); + Process.Start(logUrl); + } + } }