diff --git a/src/Aspire.Dashboard/Components/Dialogs/NotificationEntryComponent.razor.cs b/src/Aspire.Dashboard/Components/Dialogs/NotificationEntryComponent.razor.cs index 3ee4f90d268..a5774f0946f 100644 --- a/src/Aspire.Dashboard/Components/Dialogs/NotificationEntryComponent.razor.cs +++ b/src/Aspire.Dashboard/Components/Dialogs/NotificationEntryComponent.razor.cs @@ -16,6 +16,9 @@ public partial class NotificationEntryComponent : ComponentBase [Parameter] public EventCallback OnDismiss { get; set; } + [CascadingParameter] + public FluentDialog Dialog { get; set; } = default!; + private string IntentClass => Entry.Intent switch { MessageIntent.Success => "intent-success", @@ -49,7 +52,15 @@ private async Task HandlePrimaryAction() { if (Entry.PrimaryAction is { } primaryAction) { - await primaryAction.OnClick(); + try + { + Dialog.Hide(); + await primaryAction.OnClick(); + } + finally + { + Dialog.Show(); + } } } } diff --git a/src/Aspire.Dashboard/Components/Dialogs/TextVisualizerDialog.razor.cs b/src/Aspire.Dashboard/Components/Dialogs/TextVisualizerDialog.razor.cs index b4a563cc018..0dfc6a479df 100644 --- a/src/Aspire.Dashboard/Components/Dialogs/TextVisualizerDialog.razor.cs +++ b/src/Aspire.Dashboard/Components/Dialogs/TextVisualizerDialog.razor.cs @@ -114,7 +114,7 @@ internal MarkdownProcessor GetMarkdownProcessor() return _markdownProcessor ??= new MarkdownProcessor(ControlsStringsLoc, safeUrlSchemes: MarkdownHelpers.SafeUrlSchemes, extensions: []); } - public static async Task OpenDialogAsync(OpenTextVisualizerDialogOptions options) + public static async Task OpenDialogAsync(OpenTextVisualizerDialogOptions options) { var width = options.DialogService.IsDesktop ? "75vw" : "100vw"; var parameters = new DialogParameters @@ -126,7 +126,7 @@ public static async Task OpenDialogAsync(OpenTextVisualizerDialogOptions options PreventScroll = true, }; - await options.DialogService.ShowDialogAsync( + return await options.DialogService.ShowDialogAsync( new TextVisualizerDialogViewModel(options.Value, options.ValueDescription, options.ContainsSecret, options.DownloadFileName, options.FixedFormat), parameters); } diff --git a/src/Aspire.Dashboard/Model/DashboardCommandExecutor.cs b/src/Aspire.Dashboard/Model/DashboardCommandExecutor.cs index 66021ac1013..8780a7ced8d 100644 --- a/src/Aspire.Dashboard/Model/DashboardCommandExecutor.cs +++ b/src/Aspire.Dashboard/Model/DashboardCommandExecutor.cs @@ -292,12 +292,15 @@ private async Task OpenViewResponseDialogAsync(CommandViewModel command, Resourc _ => null }; - await TextVisualizerDialog.OpenDialogAsync(new OpenTextVisualizerDialogOptions + var reference = await TextVisualizerDialog.OpenDialogAsync(new OpenTextVisualizerDialogOptions { DialogService = dialogService, ValueDescription = command.GetDisplayName(), Value = response.Result.Value, FixedFormat = fixedFormat - }).ConfigureAwait(false); + }).ConfigureAwait(true); + + // Await the result to wait here until the dialog is closed. + await reference.Result.ConfigureAwait(true); } }