Skip to content

Commit

Permalink
Adding double-click to secrets for edit
Browse files Browse the repository at this point in the history
  • Loading branch information
timheuer committed Jul 31, 2023
1 parent b6bd818 commit 52b265c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ToolWindows/GHActionsToolWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
<TreeViewItem Header="{x:Static resx:UIStrings.HEADER_ENVIRONMENTS}" HeaderTemplate="{StaticResource EnvironmentHeaderTemplate}" x:Name="tvEnvironments" ItemTemplate="{StaticResource EnvironmentItemTemplate}" />
<TreeViewItem Header="{x:Static resx:UIStrings.HEADER_SECRETS}" HeaderTemplate="{StaticResource SecretsHeaderTemplate}">
<TreeViewItem x:Name="tvSecrets" HeaderTemplate="{StaticResource RepoSecretsHeaderTemplate}">
<TreeViewItem.Resources>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Static shell:VsResourceKeys.ThemedDialogTreeViewItemStyleKey}}">
<EventSetter Event="MouseDoubleClick" Handler="Secret_MouseDoubleClick"/>
</Style>
</TreeViewItem.Resources>
<TreeViewItem.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}">
Expand Down
16 changes: 16 additions & 0 deletions src/ToolWindows/GHActionsToolWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,5 +448,21 @@ private void RunWorkflow_Click(object sender, RoutedEventArgs e)
}
}
}

private async void Secret_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
// get the items Tag
if (sender is TreeViewItem item && item.Header is not null)
{
string header = item.Header.ToString();
string secretName = header.Substring(0, header.IndexOf(" ("));

if (secretName.ToLowerInvariant() != resx.NO_REPO_SECRETS.ToLowerInvariant() && secretName.ToLowerInvariant() != resx.HEADER_REPO_SECRETS.ToLowerInvariant())
{
await UpsertRepositorySecret(secretName);
e.Handled = true;
}
}
}
}

0 comments on commit 52b265c

Please sign in to comment.