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
25 changes: 2 additions & 23 deletions .github/workflows/uno-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ on:
push:
branches:
- master
- release/**


pull_request:
types: [opened, synchronize, reopened]
branches:
- master
- release/**


permissions:
contents: write

Expand All @@ -22,25 +20,6 @@ env:
CONFIGURATION: Release
dotnetVersion: 10.0.x
jobs:
# smoke_test:
# name: Smoke Test (Debug Build of AzureKeyVaultStudio)
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Install Dependencies
# timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
# uses: "./.github/steps/install_dependencies"

# - name: Setup MSBuild
# uses: microsoft/setup-msbuild@v1.3.1

# - name: Build AzureKeyVaultStudio (Debug)
# shell: pwsh
# run: msbuild ./src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio.csproj /r

build_windows_x64:
name: Build Windows x64
runs-on: windows-latest
Expand Down Expand Up @@ -203,7 +182,7 @@ jobs:
name: Release Packages
needs: [build_windows_x64, build_windows_arm64, build_macos_x64, build_macos_arm64, build_linux]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ namespace AzureKeyVaultStudio.Models;

public static class FilterService
{
public static void ResetVisibility(IEnumerable<KvTreeNodeModel> nodes, bool isVisible = true)
{
foreach (var node in nodes)
{
node.IsVisible = isVisible;
ResetVisibility(node.Children, isVisible);
}
}
public static IList<KvSubscriptionModel> Filter(IList<KvSubscriptionModel> allSubscriptions, string query)
{
if (allSubscriptions == null || allSubscriptions.Count == 0)
Expand All @@ -14,6 +22,7 @@ public static IList<KvSubscriptionModel> Filter(IList<KvSubscriptionModel> allSu
}
if (string.IsNullOrWhiteSpace(query))
{
ResetVisibility(allSubscriptions);
return allSubscriptions;
}

Expand All @@ -30,7 +39,14 @@ static void SetSubscriptionExpanded(KvSubscriptionModel model, bool value)
model.IsExpanded = value;
}
}
static void SetResourceGroupVisible(KvResourceGroupModel model, bool value)
{
if (model.IsVisible != value)
{
model.IsVisible = value;
}

}
static void SetResourceGroupExpanded(KvResourceGroupModel model, bool value)
{
if (model.IsExpanded != value)
Expand Down Expand Up @@ -59,7 +75,6 @@ static void SetResourceGroupExpanded(KvResourceGroupModel model, bool value)
{
SetSubscriptionExpanded(subscription, true);
}

foreach (var resourceGroup in subscription.Children.OfType<KvResourceGroupModel>())
{
bool resourceGroupMatch = false;
Expand All @@ -70,6 +85,7 @@ static void SetResourceGroupExpanded(KvResourceGroupModel model, bool value)
SetSubscriptionExpanded(subscription, true);
resourceGroupMatch = true;
isMatch = true;
resourceGroup.Children.ForEach(x => x.IsVisible = true);
}
else
{
Expand All @@ -84,14 +100,22 @@ static void SetResourceGroupExpanded(KvResourceGroupModel model, bool value)
{
SetResourceGroupExpanded(resourceGroup, true);
SetSubscriptionExpanded(subscription, true);
SetResourceGroupVisible(resourceGroup, true);
resourceGroupMatch = true;
isMatch = true;
keyVault.IsVisible = true;
break;
}
else
{
SetResourceGroupVisible(resourceGroup, value: false);
keyVault.IsVisible = false;
}
}
}

SetResourceGroupExpanded(resourceGroup, true);
SetResourceGroupExpanded(resourceGroup, resourceGroupMatch);
SetResourceGroupVisible(resourceGroup, value: resourceGroupMatch);
}

if (isMatch)
Expand All @@ -101,6 +125,7 @@ static void SetResourceGroupExpanded(KvResourceGroupModel model, bool value)
else
{
SetSubscriptionExpanded(subscription, true);
ResetVisibility(subscription.Children, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public abstract partial class KvTreeNodeModel : ObservableObject
[ObservableProperty]
public partial bool IsExpanded { get; set; }

[ObservableProperty]
public partial bool IsVisible { get; set; } = true;

public string DisplayName { get; set; } = null!;

public ObservableCollection<KvTreeNodeModel> Children { get; } = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@
x:Uid="ItemDetailsEditAppBarButton"
Click="OnEditVersionClick"
Icon="Edit"
Visibility="{x:Bind ViewModel.ShowEditVersionButton, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=ViewModel.ShowEditVersionButton}" />
Visibility="{x:Bind ViewModel.ShowEditVersionButton, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
<AppBarButton
x:Uid="ItemDetailsNewVersionAppBarButton"
Click="OnNewVersionClick"
Icon="Add"
Visibility="{x:Bind ViewModel.ShowNewVersionButton, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=ViewModel.ShowNewVersionButton}" />
Visibility="{x:Bind ViewModel.ShowNewVersionButton, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />

<AppBarSeparator />
<AppBarButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
DoubleTapped="TreeViewItem_DoubleTapped"
IsExpanded="{x:Bind IsExpanded, Mode=TwoWay}"
IsSelected="{x:Bind IsSelected, Mode=TwoWay}"
ItemsSource="{x:Bind Children, Mode=OneWay}">
ItemsSource="{x:Bind Children, Mode=OneWay}"
Visibility="{x:Bind IsVisible, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<StackPanel IsHitTestVisible="False" Orientation="Horizontal">
<FontIcon
Margin="0,0,6,2"
Expand Down Expand Up @@ -154,9 +155,9 @@
</TextBox.KeyboardAccelerators>
</TextBox>
<ProgressBar
x:Name="ProgressbarRefresh"
Grid.Row="0"
Padding="0"
x:Name="ProgressbarRefresh"
VerticalAlignment="Top"
x:Load="{x:Bind ViewModel.RefreshCommand.IsRunning, Mode=OneWay}"
IsHitTestVisible="False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
ViewModel.SearchQuery = model.Text;
ViewModel.ExecuteSearchCommand.ExecuteAsync(null);
},
interval: TimeSpan.FromMilliseconds(120));
}, interval: TimeSpan.FromMilliseconds(200));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public ItemPropertiesViewModel(AuthService authService, VaultService vaultServic
private void UpdateVisibilityFlags()
{
ShowCopyButton = (IsKey || IsSecret) && !IsCertificate;
ShowEditVersionButton = IsSecret;
ShowEditVersionButton = IsSecret && !IsManaged;
ShowNewVersionButton = IsSecret;
EditEnabled = !IsManaged;
ShowDownloadKeyButton = IsKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using AzureKeyVaultStudio.Messages;
using AzureKeyVaultStudio.Services;
using CommunityToolkit.Mvvm.Messaging;
using Uno.Extensions.Specialized;
using Windows.System;
using static AzureKeyVaultStudio.Models.KvTreeNodeModel;

Expand Down Expand Up @@ -139,7 +140,7 @@ private async Task InitializeTreeDataSource(CancellationToken token)
IsBusy = true;
try
{
var subscriptionModel = new ObservableCollection<KvSubscriptionModel>();
var subscriptionModel = new List<KvSubscriptionModel>();

var resource = _vaultService.GetKeyVaultResourceBySubscription();
try
Expand All @@ -164,8 +165,8 @@ private async Task InitializeTreeDataSource(CancellationToken token)
};

var savedItems = DbContext.GetQuickAccessItemsAsyncEnumerable(_authService.TenantId ?? null);
var tokenString = await _authService.GetAzureArmTokenSilent();
var tokenCredential = new CustomTokenCredential(tokenString);
var tokenResult = await _authService.GetAzureArmTokenSilent();
var tokenCredential = new CustomTokenCredential(tokenResult);
var armClient = new ArmClient(tokenCredential);

await foreach (var item in savedItems)
Expand Down Expand Up @@ -213,7 +214,6 @@ private async Task InitializeTreeDataSource(CancellationToken token)
TreeDataSource = new ObservableCollection<KvSubscriptionModel>(subscriptionModel);
});
}

TreeDataSourceReadOnly = [.. subscriptionModel];
}
finally
Expand Down Expand Up @@ -321,21 +321,15 @@ private Task ExecuteSearch(CancellationToken token)
{
_dispatcher.TryEnqueue(() =>
{
SelectedItem = null;
TreeDataSource = [];
FilterService.ResetVisibility(TreeDataSourceReadOnly, true);
TreeDataSource = new ObservableCollection<KvSubscriptionModel>(TreeDataSourceReadOnly);
});
return Task.CompletedTask;
}

var source = TreeDataSourceReadOnly.Count > 0
? TreeDataSourceReadOnly
: [.. TreeDataSource];

var results = FilterService.Filter(source, SearchQuery);
var results = FilterService.Filter(TreeDataSourceReadOnly, SearchQuery);
_dispatcher.TryEnqueue(() =>
{
SelectedItem = null;
TreeDataSource = new ObservableCollection<KvSubscriptionModel>(results);
});

Expand All @@ -351,7 +345,7 @@ private async Task OpenInAzure(KeyVaultResource model)
}

[RelayCommand]
private void OpenInNewTab(KeyVaultResource model)
private static void OpenInNewTab(KeyVaultResource model)
{
if (model is KeyVaultResource)
{
Expand Down
Loading