Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AssemblyName>AzureKeyVaultStudio</AssemblyName>
<ApplicationId>io.github.cricketthomas.AzureKeyVaultExplorer</ApplicationId>

<ApplicationDisplayVersion>2.1.1.0</ApplicationDisplayVersion>
<ApplicationDisplayVersion>2.2.0.0</ApplicationDisplayVersion>
<ApplicationVersion>2</ApplicationVersion>

<ApplicationPublisher>cricketthomas</ApplicationPublisher>
Expand Down Expand Up @@ -85,6 +85,7 @@
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" />
<PackageReference Include="DeviceId" />
<PackageReference Include="Humanizer" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" />
Expand Down
47 changes: 6 additions & 41 deletions src/uno/AzureKeyVaultStudio/Models/KeyVaultValuesAmalgamation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Azure.Security.KeyVault.Certificates;
using Azure.Security.KeyVault.Keys;
using Azure.Security.KeyVault.Secrets;
using Humanizer;

namespace AzureKeyVaultStudio.Models;

Expand Down Expand Up @@ -34,11 +35,13 @@ public sealed class KeyVaultItemProperties
public string[] TagValues => Tags is not null ? [.. Tags.Values] : [];
public string[] TagKeys => Tags is not null ? [.. Tags.Keys] : [];
public string TagValuesString => string.Join(", ", Tags?.Values ?? []);
public ObservableCollection<TagItem> EditableTags { get; set; } = new ObservableCollection<TagItem>();
public ObservableCollection<TagItem> EditableTags { get; set; } = [];

public DateTimeOffset? LastModifiedDate => UpdatedOn.HasValue ? UpdatedOn.Value.ToLocalTime() : CreatedOn?.ToLocalTime();
public string? WhenLastModified => LastModifiedDate.HasValue ? FormatRelativeDate(LastModifiedDate.Value, true) : null;
public string? WhenExpires => ExpiresOn.HasValue ? FormatRelativeDate(ExpiresOn.Value) : null;
public string? WhenLastModified => LastModifiedDate.HasValue ? LastModifiedDate.Value.Humanize() : null;
public string? WhenExpires => ExpiresOn.HasValue ? ExpiresOn.Value.Humanize() : null;
Comment thread
cricketthomas marked this conversation as resolved.

public bool IsExpired => ExpiresOn.HasValue && (ExpiresOn.Value < DateTimeOffset.Now);

public static KeyVaultItemProperties FromSecretProperties(SecretProperties properties)
=> Create(
Expand Down Expand Up @@ -172,44 +175,6 @@ private static KeyVaultItemProperties Create(
};
}

internal static string? FormatRelativeDate(DateTimeOffset dateTimeOffset, bool isPast = false)
{
DateTimeOffset now = DateTimeOffset.Now;

if (dateTimeOffset < now && !isPast)
{
return "Expired";
}

TimeSpan timeSpan = isPast ? now.Subtract(dateTimeOffset) : dateTimeOffset.Subtract(now);
int dayDifference = (int)timeSpan.TotalDays;
int secondDifference = (int)timeSpan.TotalSeconds;
var weeks = Math.Ceiling((double)dayDifference / 7);
var months = Math.Ceiling((double)dayDifference / 30);
var years = Math.Round((double)dayDifference / 365);

if (dayDifference < 0 || dayDifference >= 5000) return null;

return (dayDifference, secondDifference) switch
{
(0, < 60) when isPast => "just now",
(0, < 120) when isPast => "1 minute ago",
(0, < 3600) when isPast => $"{Math.Floor((double)secondDifference / 60)} minutes ago",
(0, < 7200) when isPast => "1 hour ago",
(0, < 86400) when isPast => $"{Math.Floor((double)secondDifference / 3600)} hours ago",
(0, < 86400) when !isPast => "in less than a day",
(1, _) when isPast => "yesterday",
(1, _) when !isPast => "tomorrow",
( < 7, _) => $"{(isPast ? string.Empty : "in ")}{dayDifference} days{(isPast ? " ago" : string.Empty)}",
( < 30, _) => $"{(isPast ? string.Empty : "in ")}{weeks} {(weeks == 1 ? "week" : "weeks")}{(isPast ? " ago" : string.Empty)}",
( < 366, _) => $"{(isPast ? string.Empty : "in ")}{months} {(months == 1 ? "month" : "months")}{(isPast ? " ago" : string.Empty)}",
(_, _) => $"{(isPast ? string.Empty : "in ")}{years} {(years == 1 ? "year" : "years")}{(isPast ? " ago" : string.Empty)}"
};



}

public void ApplyEditableTags(IDictionary<string, string> targetTags)
{
targetTags.Clear();
Expand Down
2 changes: 1 addition & 1 deletion src/uno/AzureKeyVaultStudio/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:uap18="http://schemas.microsoft.com/appx/manifest/uap/windows10/18"
IgnorableNamespaces="uap rescap uap18">

<Identity Version="2.1.1.0" Publisher="CN=FE9032D7-9FA7-4DED-9087-469BC45B4D99" Name="ArthurThomasIV.AzureKeyVaultExplorer-forAzure"/>
<Identity Version="2.2.0.0" Publisher="CN=FE9032D7-9FA7-4DED-9087-469BC45B4D99" Name="ArthurThomasIV.AzureKeyVaultExplorer-forAzure"/>
<Properties>
<DisplayName>Key Vault Explorer</DisplayName>
<PublisherDisplayName>Arthur Thomas IV</PublisherDisplayName>
Expand Down
25 changes: 20 additions & 5 deletions src/uno/AzureKeyVaultStudio/Presentation/VaultTabContentPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:AzureKeyVaultStudio.Models"
xmlns:primitives="using:CommunityToolkit.WinUI.UI.Controls.Primitives"
xmlns:skia="http://uno.ui/not_win"
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
Expand Down Expand Up @@ -254,12 +255,26 @@
CanUserSort="True"
Tag="UpdatedOn" />

<controls:DataGridTextColumn
<controls:DataGridTemplateColumn
x:Uid="DataGridTextColumnWhenExpires"
Width="150"
Binding="{Binding WhenExpires}"
CanUserSort="True"
Tag="ExpiresOn" />
Tag="ExpiresOn">
<controls:DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="models:KeyVaultItemProperties">
<toolkit:SwitchPresenter
Margin="8,0,0,0"
TargetType="x:Boolean"
Value="{x:Bind IsExpired}">
<toolkit:Case Value="True">
<TextBlock x:Uid="ExpiredTextBlock" FontWeight="Medium" />
</toolkit:Case>
<toolkit:Case IsDefault="True" Value="False">
<TextBlock Text="{x:Bind WhenExpires}" />
</toolkit:Case>
</toolkit:SwitchPresenter>
</DataTemplate>
</controls:DataGridTemplateColumn.CellTemplate>
</controls:DataGridTemplateColumn>

<controls:DataGridTemplateColumn
x:Uid="DataGridTextColumnTags"
Expand All @@ -268,7 +283,7 @@
Tag="TagValuesString">
<controls:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ItemsRepeater ItemsSource="{Binding TagValues}">
<ItemsRepeater Margin="8,0,0,0" ItemsSource="{Binding TagValues}">
<ItemsRepeater.Layout>
<StackLayout Orientation="Horizontal" Spacing="2" />
</ItemsRepeater.Layout>
Expand Down
5 changes: 4 additions & 1 deletion src/uno/AzureKeyVaultStudio/Strings/de/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -720,4 +720,7 @@
<data name="PropertiesExpirationLabel.Text" xml:space="preserve">
<value>Ablauf:</value>
</data>
</root>
<data name="ExpiredTextBlock.Text" xml:space="preserve">
<value>Abgelaufen</value>
</data>
</root>
5 changes: 4 additions & 1 deletion src/uno/AzureKeyVaultStudio/Strings/en/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -720,4 +720,7 @@
<data name="PropertiesExpirationLabel.Text" xml:space="preserve">
<value>Expiration:</value>
</data>
</root>
<data name="ExpiredTextBlock.Text" xml:space="preserve">
<value>Expired</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/uno/AzureKeyVaultStudio/Strings/es/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -720,4 +720,7 @@
<data name="PropertiesExpirationLabel.Text" xml:space="preserve">
<value>Expiración:</value>
</data>
<data name="ExpiredTextBlock.Text" xml:space="preserve">
<value>Expirado</value>
</data>
</root>
5 changes: 4 additions & 1 deletion src/uno/AzureKeyVaultStudio/Strings/fr/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -720,4 +720,7 @@
<data name="PropertiesExpirationLabel.Text" xml:space="preserve">
<value>Expiration:</value>
</data>
</root>
<data name="ExpiredTextBlock.Text" xml:space="preserve">
<value>Expiré</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/uno/AzureKeyVaultStudio/Strings/pt-BR/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -720,4 +720,7 @@
<data name="PropertiesExpirationLabel.Text" xml:space="preserve">
<value>Expiração:</value>
</data>
<data name="ExpiredTextBlock.Text" xml:space="preserve">
<value>Expirado</value>
</data>
</root>
15 changes: 8 additions & 7 deletions src/uno/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
-->
<ItemGroup>
<PackageVersion Include="FluentAssertions" Version="[7.0.0]" />
<PackageVersion Include="Humanizer" Version="3.0.10" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Tmds.DBus.Protocol" Version="0.93.0" />
<PackageVersion Include="Tmds.DBus.Protocol" Version="0.94.2" />
<PackageVersion Include="Uno.UITest.Helpers" Version="1.1.0-dev.70" />
<PackageVersion Include="Azure.Core" Version="1.50.0" />
<PackageVersion Include="Azure.ResourceManager" Version="1.13.2" />
<PackageVersion Include="Azure.ResourceManager.KeyVault" Version="1.4.0" />
<PackageVersion Include="Azure.Security.KeyVault.Certificates" Version="4.8.0" />
<PackageVersion Include="Azure.Security.KeyVault.Certificates" Version="4.9.0" />
<PackageVersion Include="Azure.Security.KeyVault.Keys" Version="4.10.0" />
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.11.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.10" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="10.0.8" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="10.0.10" />
<PackageVersion Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.11" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.8" />
<PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.84.1" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.10" />
<PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.87.0" />
<PackageVersion Include="DeviceId" Version="6.11.0" />
<PackageVersion Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.251219" />
<PackageVersion Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.2.251219" />
Expand All @@ -32,13 +33,13 @@
<PackageVersion Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.251219" />
<PackageVersion Include="System.Text.Json" Version="10.0.3" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="Uno.WinUI.MSAL" Version="6.5.237" />
<PackageVersion Include="Uno.WinUI.MSAL" Version="6.6.184" />
<PackageVersion Include="DevToolsUno" Version="0.1.0" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
<PackageVersion Include="Uno.CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.205" />
<PackageVersion Include="Uno.CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.206" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/uno/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.6.0-dev.232"
"Uno.Sdk": "6.6.42"
},
"sdk": {
"allowPrerelease": false
Expand Down
Loading