From 55a89baedf732a96e422dbe720902ca232b88a04 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Sat, 1 Nov 2025 14:27:02 +1000 Subject: [PATCH] display results v1 --- .../Features/Nuget/NugetClientService.cs | 8 ++-- .../Features/Nuget/NugetPanel.cs | 16 +++++++ .../Features/Nuget/PackageEntry.cs | 48 +++++++++++++++++++ .../Features/Nuget/PackageEntry.cs.uid | 1 + .../Features/Nuget/PackageEntry.tscn | 15 ++++-- 5 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 src/SharpIDE.Godot/Features/Nuget/PackageEntry.cs create mode 100644 src/SharpIDE.Godot/Features/Nuget/PackageEntry.cs.uid diff --git a/src/SharpIDE.Application/Features/Nuget/NugetClientService.cs b/src/SharpIDE.Application/Features/Nuget/NugetClientService.cs index 217d1ed..1da327a 100644 --- a/src/SharpIDE.Application/Features/Nuget/NugetClientService.cs +++ b/src/SharpIDE.Application/Features/Nuget/NugetClientService.cs @@ -24,7 +24,7 @@ public class NugetClientService foreach (var source in packageSources) { var repository = Repository.Factory.GetCoreV3(source.Source); - var searchResource = await repository.GetResourceAsync(cancellationToken); + var searchResource = await repository.GetResourceAsync(cancellationToken).ConfigureAwait(false); if (searchResource == null) continue; @@ -36,7 +36,7 @@ public class NugetClientService skip: 0, take: 100, log: logger, - cancellationToken: cancellationToken); + cancellationToken: cancellationToken).ConfigureAwait(false); packagesResult.AddRange(results.Select(s => new IdePackageResult(s, [source]))); } @@ -55,7 +55,7 @@ public class NugetClientService foreach (var source in packageSources.Except(package.PackageSources).ToList()) { var repository = Repository.Factory.GetCoreV3(source.Source); - var searchResource = await repository.GetResourceAsync(cancellationToken); + var searchResource = await repository.GetResourceAsync(cancellationToken).ConfigureAwait(false); if (searchResource == null) continue; @@ -68,7 +68,7 @@ public class NugetClientService skip: 0, take: 2, log: logger, - cancellationToken: cancellationToken); + cancellationToken: cancellationToken).ConfigureAwait(false); var foundPackage = results.SingleOrDefault(r => r.Identity.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase)); if (foundPackage != null) { diff --git a/src/SharpIDE.Godot/Features/Nuget/NugetPanel.cs b/src/SharpIDE.Godot/Features/Nuget/NugetPanel.cs index 3831414..b96db24 100644 --- a/src/SharpIDE.Godot/Features/Nuget/NugetPanel.cs +++ b/src/SharpIDE.Godot/Features/Nuget/NugetPanel.cs @@ -13,6 +13,8 @@ public partial class NugetPanel : Control public SharpIdeSolutionModel? Solution { get; set; } [Inject] private readonly NugetClientService _nugetClientService = null!; + + private readonly PackedScene _packageEntryScene = ResourceLoader.Load("uid://cqc2xlt81ju8s"); public override void _Ready() { @@ -25,6 +27,20 @@ public partial class NugetPanel : Control await Task.Delay(300); var result = await _nugetClientService.GetTop100Results(Solution!.DirectoryPath); ; + await this.InvokeAsync(() => _availablePackagesItemList.QueueFreeChildren()); + var scenes = result.Select(s => + { + var scene = _packageEntryScene.Instantiate(); + scene.PackageResult = s; + return scene; + }).ToList(); + await this.InvokeAsync(() => + { + foreach (var scene in scenes) + { + _availablePackagesItemList.AddChild(scene); + } + }); }); } } \ No newline at end of file diff --git a/src/SharpIDE.Godot/Features/Nuget/PackageEntry.cs b/src/SharpIDE.Godot/Features/Nuget/PackageEntry.cs new file mode 100644 index 0000000..cee441c --- /dev/null +++ b/src/SharpIDE.Godot/Features/Nuget/PackageEntry.cs @@ -0,0 +1,48 @@ +using Godot; +using SharpIDE.Application.Features.Nuget; + +namespace SharpIDE.Godot.Features.Nuget; + +public partial class PackageEntry : MarginContainer +{ + private Label _packageNameLabel = null!; + private Label _currentVersionLabel = null!; + private Label _latestVersionLabel = null!; + private HBoxContainer _sourceNamesContainer = null!; + + private static readonly Color Source_NugetOrg_Color = new Color("629655"); + private static readonly Color Source_2_Color = new Color("008989"); + private static readonly Color Source_3_Color = new Color("8d75a8"); + private static readonly Color Source_4_Color = new Color("966a00"); + private static readonly Color Source_5_Color = new Color("efaeae"); + + public IdePackageResult PackageResult { get; set; } = null!; + public override void _Ready() + { + _packageNameLabel = GetNode