-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from timheuer/secrets
- Loading branch information
Showing
9 changed files
with
202 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Window x:Class="GitHubActionsVS.UserControls.AddEditSecret" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:GitHubActionsVS.Helpers" | ||
Title="Add/Edit Secret" Height="220" Width="500" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" | ||
xmlns:toolkit="clr-namespace:Community.VisualStudio.Toolkit;assembly=Community.VisualStudio.Toolkit" | ||
toolkit:Themes.UseVsTheme="True" Icon="{x:Null}"> | ||
<Grid Margin="0,10,0,0"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="auto" /> | ||
<RowDefinition Height="auto" /> | ||
<RowDefinition Height="auto" /> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="auto" /> | ||
<ColumnDefinition /> | ||
</Grid.ColumnDefinitions> | ||
<Label Grid.Row="0" Grid.Column="0" Content="Name:" HorizontalAlignment="Right" VerticalAlignment="Top" FontWeight="SemiBold" /> | ||
<TextBox Margin="0,0,10,0" Grid.Row="0" Grid.Column="1" Name="txtName" VerticalAlignment="Top" HorizontalAlignment="Stretch" MinWidth="150"/> | ||
<Label Margin="0,5,0,0" Grid.Row="1" Grid.Column="0" Content="Secret:" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="SemiBold" /> | ||
<TextBox Margin="0,5,10,0" Grid.Row="1" Grid.Column="1" Name="txtSecret" AcceptsReturn="True" VerticalContentAlignment="Top" Height="100" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Stretch" MinWidth="210" /> | ||
|
||
<StackPanel Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,5,0,0"> | ||
<Button Content="Save" Margin="10,0,0,0" VerticalAlignment="Center" Width="75" Height="23" Name="btnCreate" Click="Save_Click" /> | ||
<Button Content="Cancel" Margin="10,0" VerticalAlignment="Center" Width="75" Height="23" IsDefault="True" Name="btnCancel" Click="Cancel_Click" /> | ||
</StackPanel> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Text.RegularExpressions; | ||
using System.Windows; | ||
|
||
namespace GitHubActionsVS.UserControls; | ||
/// <summary> | ||
/// Interaction logic for AddEditSecret.xaml | ||
/// </summary> | ||
public partial class AddEditSecret : Window | ||
{ | ||
public AddEditSecret(string secretName) | ||
{ | ||
InitializeComponent(); | ||
txtName.Text = secretName; | ||
txtName.IsEnabled = string.IsNullOrWhiteSpace(secretName); | ||
Title = string.IsNullOrWhiteSpace(secretName) ? "Add Secret" : "Edit Secret"; | ||
btnCreate.Content = string.IsNullOrWhiteSpace(secretName) ? "Create" : "Update"; | ||
} | ||
|
||
public string SecretName => txtName.Text.Trim(); | ||
public string SecretValue => txtSecret.Text.Trim(); | ||
|
||
private void Save_Click(object sender, RoutedEventArgs e) | ||
{ | ||
// Secret names can only contain alphanumeric characters ([a-z], [A-Z], [0-9]) or underscores (_). Spaces are not allowed. Must start with a letter ([a-z], [A-Z]) or underscores (_). | ||
Regex rx = new Regex("^[a-zA-Z_][a-zA-Z0-9_]*$"); | ||
if (rx.IsMatch(txtName.Text)) | ||
{ | ||
DialogResult = true; | ||
Close(); | ||
} | ||
else | ||
{ | ||
Community.VisualStudio.Toolkit.MessageBox mb = new(); | ||
mb.ShowError("Secret names can only contain alphanumeric characters ([a-z], [A-Z], [0-9]) or underscores (_). Spaces are not allowed. Must start with a letter ([a-z], [A-Z]) or underscores (_).", "Invalid Secret Name"); | ||
} | ||
} | ||
|
||
private void Cancel_Click(object sender, RoutedEventArgs e) | ||
{ | ||
DialogResult = false; | ||
Close(); | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.