From d3f5ffba843e188bfde81aa8069ce09eeb968715 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 5 Jul 2025 23:41:25 +0000 Subject: [PATCH] Move IInteractionService and related types to Aspire.Hosting namespace --- .../Dashboard/DashboardService.cs | 32 +++++++++---------- .../IInteractionService.cs | 2 +- .../InteractionService.cs | 2 +- .../Publishing/PublishingActivityReporter.cs | 1 - .../VersionChecking/VersionCheckService.cs | 1 - .../Dashboard/DashboardServiceTests.cs | 2 +- 6 files changed, 19 insertions(+), 21 deletions(-) rename src/Aspire.Hosting/{ApplicationModel => }/IInteractionService.cs (99%) rename src/Aspire.Hosting/{ApplicationModel => }/InteractionService.cs (99%) diff --git a/src/Aspire.Hosting/Dashboard/DashboardService.cs b/src/Aspire.Hosting/Dashboard/DashboardService.cs index 25d653491bb..fa43ff84447 100644 --- a/src/Aspire.Hosting/Dashboard/DashboardService.cs +++ b/src/Aspire.Hosting/Dashboard/DashboardService.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using static Aspire.Hosting.ApplicationModel.Interaction; +using static Aspire.Hosting.Interaction; namespace Aspire.Hosting.Dashboard; @@ -117,7 +117,7 @@ async Task WatchInteractionsInternal(CancellationToken cancellationToken) var inputInstances = inputs.Inputs.Select(input => { - var dto = new InteractionInput + var dto = new Aspire.DashboardService.Proto.V1.InteractionInput { InputType = MapInputType(input.InputType), Required = input.Required @@ -174,33 +174,33 @@ async Task WatchInteractionsInternal(CancellationToken cancellationToken) } #pragma warning disable ASPIREINTERACTION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. - private static MessageIntent MapMessageIntent(ApplicationModel.MessageIntent? intent) + private static Aspire.DashboardService.Proto.V1.MessageIntent MapMessageIntent(Aspire.Hosting.MessageIntent? intent) { if (intent is null) { - return MessageIntent.None; + return Aspire.DashboardService.Proto.V1.MessageIntent.None; } return intent.Value switch { - ApplicationModel.MessageIntent.Success => MessageIntent.Success, - ApplicationModel.MessageIntent.Warning => MessageIntent.Warning, - ApplicationModel.MessageIntent.Error => MessageIntent.Error, - ApplicationModel.MessageIntent.Information => MessageIntent.Information, - ApplicationModel.MessageIntent.Confirmation => MessageIntent.Confirmation, - _ => MessageIntent.None, + Aspire.Hosting.MessageIntent.Success => Aspire.DashboardService.Proto.V1.MessageIntent.Success, + Aspire.Hosting.MessageIntent.Warning => Aspire.DashboardService.Proto.V1.MessageIntent.Warning, + Aspire.Hosting.MessageIntent.Error => Aspire.DashboardService.Proto.V1.MessageIntent.Error, + Aspire.Hosting.MessageIntent.Information => Aspire.DashboardService.Proto.V1.MessageIntent.Information, + Aspire.Hosting.MessageIntent.Confirmation => Aspire.DashboardService.Proto.V1.MessageIntent.Confirmation, + _ => Aspire.DashboardService.Proto.V1.MessageIntent.None, }; } - private static InputType MapInputType(ApplicationModel.InputType inputType) + private static Aspire.DashboardService.Proto.V1.InputType MapInputType(Aspire.Hosting.InputType inputType) { return inputType switch { - ApplicationModel.InputType.Text => InputType.Text, - ApplicationModel.InputType.SecretText => InputType.SecretText, - ApplicationModel.InputType.Choice => InputType.Choice, - ApplicationModel.InputType.Boolean => InputType.Boolean, - ApplicationModel.InputType.Number => InputType.Number, + Aspire.Hosting.InputType.Text => Aspire.DashboardService.Proto.V1.InputType.Text, + Aspire.Hosting.InputType.SecretText => Aspire.DashboardService.Proto.V1.InputType.SecretText, + Aspire.Hosting.InputType.Choice => Aspire.DashboardService.Proto.V1.InputType.Choice, + Aspire.Hosting.InputType.Boolean => Aspire.DashboardService.Proto.V1.InputType.Boolean, + Aspire.Hosting.InputType.Number => Aspire.DashboardService.Proto.V1.InputType.Number, _ => throw new InvalidOperationException($"Unexpected input type: {inputType}"), }; } diff --git a/src/Aspire.Hosting/ApplicationModel/IInteractionService.cs b/src/Aspire.Hosting/IInteractionService.cs similarity index 99% rename from src/Aspire.Hosting/ApplicationModel/IInteractionService.cs rename to src/Aspire.Hosting/IInteractionService.cs index 73adc93c14c..a190f060e80 100644 --- a/src/Aspire.Hosting/ApplicationModel/IInteractionService.cs +++ b/src/Aspire.Hosting/IInteractionService.cs @@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis; -namespace Aspire.Hosting.ApplicationModel; +namespace Aspire.Hosting; #pragma warning disable ASPIREINTERACTION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. diff --git a/src/Aspire.Hosting/ApplicationModel/InteractionService.cs b/src/Aspire.Hosting/InteractionService.cs similarity index 99% rename from src/Aspire.Hosting/ApplicationModel/InteractionService.cs rename to src/Aspire.Hosting/InteractionService.cs index f3f12dd0f00..664144ca906 100644 --- a/src/Aspire.Hosting/ApplicationModel/InteractionService.cs +++ b/src/Aspire.Hosting/InteractionService.cs @@ -7,7 +7,7 @@ using System.Threading.Channels; using Microsoft.Extensions.Logging; -namespace Aspire.Hosting.ApplicationModel; +namespace Aspire.Hosting; #pragma warning disable ASPIREINTERACTION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. diff --git a/src/Aspire.Hosting/Publishing/PublishingActivityReporter.cs b/src/Aspire.Hosting/Publishing/PublishingActivityReporter.cs index 23c9239c614..fdb4c8cfce2 100644 --- a/src/Aspire.Hosting/Publishing/PublishingActivityReporter.cs +++ b/src/Aspire.Hosting/Publishing/PublishingActivityReporter.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.Threading.Channels; using Aspire.Hosting.Backchannel; -using Aspire.Hosting.ApplicationModel; namespace Aspire.Hosting.Publishing; diff --git a/src/Aspire.Hosting/VersionChecking/VersionCheckService.cs b/src/Aspire.Hosting/VersionChecking/VersionCheckService.cs index f2af68dfb2e..cb018881e4d 100644 --- a/src/Aspire.Hosting/VersionChecking/VersionCheckService.cs +++ b/src/Aspire.Hosting/VersionChecking/VersionCheckService.cs @@ -5,7 +5,6 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; -using Aspire.Hosting.ApplicationModel; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; diff --git a/tests/Aspire.Hosting.Tests/Dashboard/DashboardServiceTests.cs b/tests/Aspire.Hosting.Tests/Dashboard/DashboardServiceTests.cs index a67cafe4bfb..a0fd2fe0960 100644 --- a/tests/Aspire.Hosting.Tests/Dashboard/DashboardServiceTests.cs +++ b/tests/Aspire.Hosting.Tests/Dashboard/DashboardServiceTests.cs @@ -315,7 +315,7 @@ public async Task WatchInteractions_PromptInputAsync_CompleteOnCancelResponse() var resultTask = interactionService.PromptInputAsync( title: "Title!", message: "Message!", - new ApplicationModel.InteractionInput { InputType = ApplicationModel.InputType.Text, Label = "Input" }); + new Aspire.Hosting.InteractionInput { InputType = Aspire.Hosting.InputType.Text, Label = "Input" }); // Assert logger.LogInformation("Reading result from writer.");