diff --git a/Desktop/Desktop.csproj b/Desktop/Desktop.csproj index 8fc1c663..775fb140 100644 --- a/Desktop/Desktop.csproj +++ b/Desktop/Desktop.csproj @@ -42,7 +42,7 @@ - + diff --git a/KeyVaultExplorer/Exceptions/KvExceptions.cs b/KeyVaultExplorer/Exceptions/KvExceptions.cs index 88a5577b..8e7fa132 100644 --- a/KeyVaultExplorer/Exceptions/KvExceptions.cs +++ b/KeyVaultExplorer/Exceptions/KvExceptions.cs @@ -17,4 +17,38 @@ public KeyVaultItemNotFoundException(string message, Exception inner) : base(message, inner) { } +} + +public class KeyVaultItemNotFailedToUpdate : Exception +{ + public KeyVaultItemNotFailedToUpdate() + { + } + + public KeyVaultItemNotFailedToUpdate(string message) + : base(message) + { + } + + public KeyVaultItemNotFailedToUpdate(string message, Exception inner) + : base(message, inner) + { + } +} + +public class KeyVaultInSufficientPrivileges : Exception +{ + public KeyVaultInSufficientPrivileges() + { + } + + public KeyVaultInSufficientPrivileges(string message) + : base(message) + { + } + + public KeyVaultInSufficientPrivileges(string message, Exception inner) + : base(message, inner) + { + } } \ No newline at end of file diff --git a/KeyVaultExplorer/KeyVaultExplorer.csproj b/KeyVaultExplorer/KeyVaultExplorer.csproj index 74a60f77..30c65270 100644 --- a/KeyVaultExplorer/KeyVaultExplorer.csproj +++ b/KeyVaultExplorer/KeyVaultExplorer.csproj @@ -42,16 +42,16 @@ - - + + - + - - - + + + - + @@ -93,5 +93,11 @@ + + + CreateNewSecretVersion.axaml + + + diff --git a/KeyVaultExplorer/Models/AppSettings.cs b/KeyVaultExplorer/Models/AppSettings.cs index 81fd6acf..b480cf2b 100644 --- a/KeyVaultExplorer/Models/AppSettings.cs +++ b/KeyVaultExplorer/Models/AppSettings.cs @@ -12,4 +12,6 @@ public class AppSettings [AllowedValues("Inline", "Overlay")] public string SplitViewDisplayMode { get; set; } = "Inline"; + public string PanePlacement { get; set; } = "Left"; + } \ No newline at end of file diff --git a/KeyVaultExplorer/Models/KeyVaultValuesAmalgamation.cs b/KeyVaultExplorer/Models/KeyVaultValuesAmalgamation.cs index 4e9bdf80..e487d4a5 100644 --- a/KeyVaultExplorer/Models/KeyVaultValuesAmalgamation.cs +++ b/KeyVaultExplorer/Models/KeyVaultValuesAmalgamation.cs @@ -29,8 +29,8 @@ public class KeyVaultContentsAmalgamation public DateTimeOffset? LastModifiedDate => UpdatedOn.HasValue ? UpdatedOn.Value.ToLocalTime() : CreatedOn!.Value.ToLocalTime(); - public string? WhenLastModified => GetRelativeDateString(LastModifiedDate!.Value.UtcDateTime, true); - public string? WhenExpires => ExpiresOn.HasValue ? GetRelativeDateString(ExpiresOn!.Value.UtcDateTime) : ""; + public string? WhenLastModified => GetRelativeDateString(LastModifiedDate!.Value, true); + public string? WhenExpires => ExpiresOn.HasValue ? GetRelativeDateString(ExpiresOn!.Value) : ""; public SecretProperties SecretProperties { get; set; } = null!; public KeyProperties KeyProperties { get; set; } = null!; @@ -45,9 +45,16 @@ public class KeyVaultContentsAmalgamation public string TagValuesString => string.Join(", ", Tags?.Values ?? []); - private string? GetRelativeDateString(DateTime dateTime, bool isPast = false) + private string? GetRelativeDateString(DateTimeOffset dateTimeOffset, bool isPast = false) { - TimeSpan timeSpan = isPast ? DateTime.Now.Subtract(dateTime) : dateTime.Subtract(DateTime.Now); + 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); @@ -68,10 +75,11 @@ public class KeyVaultContentsAmalgamation (1, _) when !isPast => "tomorrow", ( < 7, _) => $"{(isPast ? "" : "in ")}{dayDifference} days{(isPast ? " ago" : "")}", ( < 30, _) => $"{(isPast ? "" : "in ")}{weeks} {(weeks == 1 ? "week" : "weeks")}{(isPast ? " ago" : "")}", - ( < 366, _) => $"{(isPast ? "" : "in ")}{months} {(months == 1 ? "month" : "months")}{(isPast ? " ago" : "")}", + ( < 366, _) => $"{(isPast ? "" : "in ")}{months} {(months == 1 ? "month" : "months")}{(isPast ? " ago" : "")}", (_, _) => $"{(isPast ? "" : "in ")}{years} {(years == 1 ? "year" : "years")}{(isPast ? " ago" : "")}" }; } + } public enum KeyVaultItemType diff --git a/KeyVaultExplorer/Resources/Resources.axaml b/KeyVaultExplorer/Resources/Resources.axaml index 0464c7d1..49ddddc7 100644 --- a/KeyVaultExplorer/Resources/Resources.axaml +++ b/KeyVaultExplorer/Resources/Resources.axaml @@ -4,7 +4,10 @@ xmlns:ui="using:FluentAvalonia.UI.Controls"> - + + + + diff --git a/KeyVaultExplorer/Resources/Styles.axaml b/KeyVaultExplorer/Resources/Styles.axaml index b0910296..08f75a67 100644 --- a/KeyVaultExplorer/Resources/Styles.axaml +++ b/KeyVaultExplorer/Resources/Styles.axaml @@ -5,7 +5,7 @@ xmlns:uip="using:FluentAvalonia.UI.Controls.Primitives"> - + + + + + + @@ -57,13 +68,34 @@ ToolTip.VerticalOffset="10" /> + + + + + @@ -154,12 +186,13 @@ BorderThickness="1" CornerRadius="4"> - + + VerticalAlignment="Stretch" + ColumnDefinitions="250,*" + RowDefinitions="*,*,*,*,*,*,*"> + +