Skip to content

Commit

Permalink
#66 wip adding key regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
cricketthomas committed Jul 17, 2024
1 parent 01c521b commit f3651e2
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 3 deletions.
4 changes: 2 additions & 2 deletions KeyVaultExplorer/ViewModels/CreateNewKeyVersionViewModel .cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class CreateNewKeyVersionViewModel : ViewModelBase
public bool HasExpirationDate => KeyVaultKeyModel is not null && KeyVaultKeyModel.ExpiresOn.HasValue;

[ObservableProperty]
private string secretValue;
private string value;

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(Location))]
Expand Down Expand Up @@ -69,7 +69,7 @@ public async Task EditDetails()
[RelayCommand]
public async Task NewVersion()
{
var newSecret = new KeyVaultSecret(KeyVaultKeyModel.Name, SecretValue);
var newSecret = new KeyVaultSecret(KeyVaultKeyModel.Name, Value);
if (KeyVaultKeyModel.NotBefore.HasValue)
newSecret.Properties.NotBefore = KeyVaultKeyModel.NotBefore.Value.Date + (NotBeforeTimespan.HasValue ? NotBeforeTimespan.Value : TimeSpan.Zero);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,99 @@
d:DesignWidth="800"
x:DataType="vm:CreateNewKeyVersionViewModel"
mc:Ignorable="d">
Welcome to Avalonia!



<ScrollViewer>
<StackPanel MinWidth="400" Margin="10">

<Grid ColumnDefinitions="*" RowDefinitions="*,*,*,*,*,*,*,*,*,*">

<StackPanel Grid.Row="0" Orientation="Vertical">
<TextBlock
Margin="0,0,10,0"
VerticalAlignment="Center"
Text="Name" />
<TextBox IsEnabled="{Binding Identifier, Converter={x:Static ObjectConverters.IsNull}}" Text="{Binding KeyVaultKeyModel.Name}" />
</StackPanel>


<StackPanel
Grid.Row="1"
Orientation="Vertical"
ToolTip.Tip="Type of key to create.">
<TextBlock
Margin="0,0,10,0"
VerticalAlignment="Center"
Text="Key type" />
<RadioButton Content="RSA" GroupName="keyType" />
<RadioButton Content="EC" GroupName="keyType" />
</StackPanel>

<StackPanel Grid.Row="2" Orientation="Vertical">
<TextBlock
Margin="0,0,10,0"
VerticalAlignment="Center"
Text="Key type" />
<RadioButton Content="2048" GroupName="keySize" />
<RadioButton Content="3072" GroupName="keySize" />
<RadioButton Content="4096" GroupName="keySize" />

</StackPanel>


<StackPanel Grid.Row="3">
<CheckBox
Name="SetActivationDateCheckbox"
IsChecked="{Binding HasActivationDate}"
ToolTip.Tip="Sets when this resource will become active. This sets the 'nbf' property on the resource. A new current but inactive version will still be created after this operation.">
Set Activation Date
</CheckBox>
<StackPanel
IsVisible="{Binding #SetActivationDateCheckbox.IsChecked}"
Orientation="Vertical"
Spacing="5">
<DatePicker
MinWidth="400"
HorizontalAlignment="Left"
SelectedDate="{Binding KeyVaultKeyModel.NotBefore}" />
<TimePicker MinWidth="400" SelectedTime="{Binding NotBeforeTimespan}" />
</StackPanel>
<CheckBox
Name="SetExpirationDateCheckbox"
IsChecked="{Binding HasExpirationDate}"
ToolTip.Tip="Sets when this resource will become inactive. This sets the 'exp' property on the resource.">
Set Expiration Date
</CheckBox>
<StackPanel
IsVisible="{Binding #SetExpirationDateCheckbox.IsChecked}"
Orientation="Vertical"
Spacing="5">
<DatePicker MinWidth="400" SelectedDate="{Binding KeyVaultKeyModel.ExpiresOn}" />
<TimePicker MinWidth="400" SelectedTime="{Binding ExpiresOnTimespan, Mode=TwoWay}" />
</StackPanel>
</StackPanel>


<StackPanel
Grid.Row="4"
Orientation="Horizontal"
Spacing="5">
<TextBlock
Margin="0,4,0,0"
VerticalAlignment="Center"
Text="Enabled" />
<ToggleSwitch
IsChecked="{Binding KeyVaultKeyModel.Enabled}"
OffContent="No"
OnContent="Yes" />
</StackPanel>




</Grid>

</StackPanel>
</ScrollViewer>
</UserControl>
2 changes: 2 additions & 0 deletions KeyVaultExplorer/Views/Pages/PropertiesPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
Command="{Binding EditVersionCommand}"
IconSource="Edit"
IsEnabled="{Binding !IsManaged}"
IsVisible="{Binding IsSecret}"
Label="Edit"
ToolTip.Tip="Edit Current Version"
ToolTip.VerticalOffset="10" />
Expand All @@ -92,6 +93,7 @@
Command="{Binding NewVersionCommand}"
IconSource="Add"
IsEnabled="{Binding !IsManaged}"
IsVisible="{Binding IsSecret}"
Label="New Version"
ToolTip.Tip="Create New Version"
ToolTip.VerticalOffset="10" />
Expand Down

0 comments on commit f3651e2

Please sign in to comment.