Skip to content

Commit bda841d

Browse files
committed
Add refresh button and deterministic sort
Add AuthService consent to avoid admins from manually adding permissions
1 parent c32b648 commit bda841d

16 files changed

Lines changed: 82 additions & 43 deletions

File tree

src/uno/AzureKeyVaultStudio.slnx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
<File Path="Directory.Packages.props" />
77
<File Path="global.json" />
88
</Folder>
9-
<Project Path="../../../AzureKeyVaultStudio/AzureKeyVaultStudio/AzureKeyVaultStudio.csproj">
10-
<Deploy />
11-
</Project>
9+
<Project Path="AzureKeyVaultStudio/AzureKeyVaultStudio/AzureKeyVaultStudio.csproj" />
1210
</Solution>

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/App.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
200200
new ("Main", View: views.FindByViewModel<MainViewModel>(), IsDefault:true),
201201
new ("SettingsPage", View: views.FindByViewModel<SettingsViewModel>()),
202202
new ("SubscriptionsPage", View: views.FindByViewModel<SubscriptionViewModel>()),
203-
//new ("Second", View: views.FindByViewModel<SecondViewModel>()),
204203
]
205204
)
206205
);
@@ -209,7 +208,7 @@ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
209208
private static void EnsureEarlyWindow(Window window)
210209
{
211210
#if WINDOWS && !HAS_UNO
212-
window.AppWindow.Resize(new SizeInt32 { Width = 1000, Height = 600 });
211+
window.AppWindow.Resize(new SizeInt32 { Width = 1100, Height = 640 });
213212
window.AppWindow.Move(new PointInt32 { X = 150, Y = 150 });
214213

215214
window.ExtendsContentIntoTitleBar = true;
@@ -218,10 +217,11 @@ private static void EnsureEarlyWindow(Window window)
218217
window.AppWindow.TitleBar.PreferredTheme = theme.Theme switch
219218
{
220219
AppTheme.Light => TitleBarTheme.Light,
221-
AppTheme.Dark => TitleBarTheme.Light,
220+
AppTheme.Dark => TitleBarTheme.Dark,
222221
_ => TitleBarTheme.UseDefaultAppMode,
223222
};
224223

224+
225225
//window.AppWindow.TitleBar.ButtonBackgroundColor = Microsoft.UI.Colors.Transparent;
226226

227227
window.SystemBackdrop = new MicaBackdrop()

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Models/KeyVaultValuesAmalgamation.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ public static KeyVaultItemProperties FromSecretProperties(SecretProperties prope
5353
properties.Enabled,
5454
properties.RecoverableDays,
5555
properties.RecoveryLevel,
56-
properties.Managed);
56+
KeyVaultItemType.Secret,
57+
properties.Managed
58+
);
5759

5860
public static IReadOnlyList<KeyVaultItemProperties> FromSecretProperties(IEnumerable<SecretProperties>? properties)
59-
=> properties is null ? Array.Empty<KeyVaultItemProperties>() : [.. properties.Select(FromSecretProperties)];
61+
=> properties is null ? [] : [.. properties.Select(FromSecretProperties)];
6062

6163
public static KeyVaultItemProperties FromKeyProperties(KeyProperties properties)
6264
=> Create(
@@ -73,10 +75,11 @@ public static KeyVaultItemProperties FromKeyProperties(KeyProperties properties)
7375
properties.Enabled,
7476
properties.RecoverableDays,
7577
properties.RecoveryLevel,
78+
KeyVaultItemType.Key,
7679
properties.Managed);
7780

7881
public static IReadOnlyList<KeyVaultItemProperties> FromKeyProperties(IEnumerable<KeyProperties>? properties)
79-
=> properties is null ? Array.Empty<KeyVaultItemProperties>() : [.. properties.Select(FromKeyProperties)];
82+
=> properties is null ?[] : [.. properties.Select(FromKeyProperties)];
8083

8184
public static KeyVaultItemProperties FromCertificateProperties(CertificateProperties properties)
8285
=> Create(
@@ -92,10 +95,12 @@ public static KeyVaultItemProperties FromCertificateProperties(CertificateProper
9295
properties.NotBefore,
9396
properties.Enabled,
9497
properties.RecoverableDays,
95-
properties.RecoveryLevel);
98+
properties.RecoveryLevel,
99+
KeyVaultItemType.Certificate);
100+
96101

97102
public static IReadOnlyList<KeyVaultItemProperties> FromCertificateProperties(IEnumerable<CertificateProperties>? properties)
98-
=> properties is null ? Array.Empty<KeyVaultItemProperties>() : [.. properties.Select(FromCertificateProperties)];
103+
=> properties is null ? [] : [.. properties.Select(FromCertificateProperties)];
99104

100105
public SecretProperties ToSecretProperties()
101106
{
@@ -134,12 +139,10 @@ public KeyProperties ToKeyProperties()
134139
return properties;
135140
}
136141

137-
138142
public CertificateProperties ToCertificateProperties()
139143
{
140144
var properties = new CertificateProperties(Id);
141145
properties.Enabled = Enabled;
142-
143146
if (Tags != null && Tags.Count > 0)
144147
{
145148
foreach (var tag in Tags)
@@ -165,7 +168,9 @@ private static KeyVaultItemProperties Create(
165168
bool? enabled,
166169
int? recoverableDays,
167170
string? recoveryLevel,
168-
bool? managed = null)
171+
KeyVaultItemType type,
172+
bool? managed = null
173+
)
169174
{
170175
return new KeyVaultItemProperties
171176
{
@@ -183,7 +188,8 @@ private static KeyVaultItemProperties Create(
183188
RecoverableDays = recoverableDays,
184189
RecoveryLevel = recoveryLevel,
185190
Managed = managed,
186-
Tags = tags is null ? new Dictionary<string, string>() : new Dictionary<string, string>(tags)
191+
Tags = tags is null ? new Dictionary<string, string>() : new Dictionary<string, string>(tags),
192+
Type = type
187193
};
188194
}
189195

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:uap18="http://schemas.microsoft.com/appx/manifest/uap/windows10/18"
77
IgnorableNamespaces="uap rescap uap18">
88

9-
<Identity Version="2.0.0.0" Publisher="CN=FE9032D7-9FA7-4DED-9087-469BC45B4D99" Name="ArthurThomasIV.AzureKeyVaultExplorer-forAzure"/>
9+
<Identity Version="2.0.1.0" Publisher="CN=FE9032D7-9FA7-4DED-9087-469BC45B4D99" Name="ArthurThomasIV.AzureKeyVaultExplorer-forAzure"/>
1010
<Properties>
1111
<DisplayName>Key Vault Explorer</DisplayName>
1212
<PublisherDisplayName>Arthur Thomas IV</PublisherDisplayName>

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Presentation/MainPage.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ private void MainPage_Loaded(object sender, RoutedEventArgs e)
3737

3838
try
3939
{
40-
currentWindow.SetTitleBar(DefaultOverrideTitleBar);
40+
//currentWindow.SetTitleBar(DefaultOverrideTitleBar);
41+
currentWindow.SetTitleBar(DefaultOverrideTitleBar.TitleBarElement);
42+
4143
}
4244
catch (Exception ex)
4345
{

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Presentation/ViewModels/VaultViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ await ExecuteOnDispatcherAsync(() =>
722722
}
723723

724724
[RelayCommand]
725-
private async void OpenInAzure(KeyVaultItemProperties keyVaultItem)
725+
private async Task OpenInAzure(KeyVaultItemProperties keyVaultItem)
726726
{
727727
if (keyVaultItem is null) return;
728728

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Services/AuthService.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,16 @@ public AuthService(ILocalSettingsService localSettings, ILogger<AuthService> log
113113
//.WithSystemWebViewOptions(options)
114114
//#endif
115115
authenticationResult = await authenticationClient.AcquireTokenInteractive(Constants.Scopes)
116-
//.WithExtraScopesToConsent(Constants.AzureRMScope)
117-
/*
118-
* Not including extra scopes allows personal accounts to sign in, however, this will be thrown.
119-
(Windows Azure Service Management API) is configured for use by Azure Active Directory users only.
120-
Please do not use the /consumers endpoint to serve this request. T
121-
122-
https://stackoverflow.com/questions/66470333/error-azure-key-vault-is-configured-for-use-by-azure-active-directory-users-on
123-
*/
124-
116+
//.WithExtraScopesToConsent(Constants.AzureRMScope)
117+
/*
118+
* Not including extra scopes allows personal accounts to sign in, however, this will be thrown.
119+
(Windows Azure Service Management API) is configured for use by Azure Active Directory users only.
120+
Please do not use the /consumers endpoint to serve this request. T
121+
122+
https://stackoverflow.com/questions/66470333/error-azure-key-vault-is-configured-for-use-by-azure-active-directory-users-on
123+
*/
124+
.WithPrompt(Prompt.Consent)
125+
.WithExtraScopesToConsent(Constants.AzureRMScope)
125126
.ExecuteAsync(cancellationToken);
126127

127128
IsAuthenticated = true;

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Strings/en/Resources.resw

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@
522522
<data name="ItemDetailsOpenAppBarButton.Label" xml:space="preserve">
523523
<value>Open</value>
524524
</data>
525+
<data name="ItemDetailsRefreshAppBarButton.Label" xml:space="preserve">
526+
<value>Refresh</value>
527+
</data>
525528
<data name="ItemDetailsCopyAppBarButton.Label" xml:space="preserve">
526529
<value>Copy</value>
527530
</data>
@@ -663,4 +666,4 @@
663666
<data name="SavedChangesMessage" xml:space="preserve">
664667
<value>Your changes have been saved.</value>
665668
</data>
666-
</root>
669+
</root>

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Strings/es/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@
522522
<data name="ItemDetailsOpenAppBarButton.Label" xml:space="preserve">
523523
<value>Abrir</value>
524524
</data>
525+
<data name="ItemDetailsRefreshAppBarButton.Label" xml:space="preserve">
526+
<value>Actualizar</value>
527+
</data>
525528
<data name="ItemDetailsCopyAppBarButton.Label" xml:space="preserve">
526529
<value>Copiar</value>
527530
</data>

src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio/Strings/fr/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@
522522
<data name="ItemDetailsOpenAppBarButton.Label" xml:space="preserve">
523523
<value>Ouvrir</value>
524524
</data>
525+
<data name="ItemDetailsRefreshAppBarButton.Label" xml:space="preserve">
526+
<value>Actualiser</value>
527+
</data>
525528
<data name="ItemDetailsCopyAppBarButton.Label" xml:space="preserve">
526529
<value>Copier</value>
527530
</data>

0 commit comments

Comments
 (0)