diff --git a/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor b/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor
index ca4f15cec7..a01ba84fea 100644
--- a/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor
+++ b/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor
@@ -1,3 +1,3 @@
@namespace Aspire.Dashboard.Components
-@_applicationName
+@_pageTitle
diff --git a/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor.cs b/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor.cs
index 26ef81728e..0c7397fc66 100644
--- a/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor.cs
+++ b/src/Aspire.Dashboard/Components/Controls/ApplicationName.razor.cs
@@ -13,15 +13,18 @@ public sealed partial class ApplicationName : ComponentBase, IDisposable
private CancellationTokenSource? _disposalCts;
[Parameter]
- public string? ResourceName { get; init; }
+ public string? AdditionalText { get; set; }
[Parameter]
- public IStringLocalizer? Loc { get; init; }
+ public string? ResourceName { get; set; }
+
+ [Parameter]
+ public IStringLocalizer? Loc { get; set; }
[Inject]
public required IDashboardClient DashboardClient { get; init; }
- private string? _applicationName;
+ private string? _pageTitle;
protected override async Task OnInitializedAsync()
{
@@ -31,15 +34,24 @@ protected override async Task OnInitializedAsync()
_disposalCts = new CancellationTokenSource();
await DashboardClient.WhenConnected.WaitAsync(_disposalCts.Token);
}
+ }
+
+ protected override void OnParametersSet()
+ {
+ string applicationName;
if (ResourceName is not null && Loc is not null)
{
- _applicationName = string.Format(CultureInfo.InvariantCulture, Loc[ResourceName], DashboardClient.ApplicationName);
+ applicationName = string.Format(CultureInfo.InvariantCulture, Loc[ResourceName], DashboardClient.ApplicationName);
}
else
{
- _applicationName = DashboardClient.ApplicationName;
+ applicationName = DashboardClient.ApplicationName;
}
+
+ _pageTitle = string.IsNullOrEmpty(AdditionalText)
+ ? applicationName
+ : $"{applicationName} ({AdditionalText})";
}
public void Dispose()
diff --git a/src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor b/src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor
index 3624efff22..69447df45d 100644
--- a/src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor
+++ b/src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor
@@ -5,7 +5,12 @@
@using Aspire.Dashboard.Resources
@namespace Aspire.Dashboard.Components.Pages
-