From 9681f81905bab38ad40f448e5a613c004e6a2c65 Mon Sep 17 00:00:00 2001 From: Adam Ratzman Date: Mon, 29 Jan 2024 14:47:14 -0500 Subject: [PATCH 1/4] revert state column badge changes --- src/Aspire.Dashboard/Aspire.Dashboard.csproj | 10 +++- .../Components/Pages/Resources.razor | 6 +- .../Components/Pages/Resources.razor.css | 12 +++- .../ResourceNameDisplay.razor | 18 +----- .../ResourceNameDisplay.razor.cs | 25 --------- .../StateColumnDisplay.razor | 6 ++ .../UnreadLogErrorsBadge.razor | 20 +++++++ .../UnreadLogErrorsBadge.razor.cs | 55 +++++++++++++++++++ .../Resources/Columns.Designer.cs | 15 ++++- src/Aspire.Dashboard/Resources/Columns.resx | 11 ++-- .../Resources/xlf/Columns.cs.xlf | 11 +++- .../Resources/xlf/Columns.de.xlf | 11 +++- .../Resources/xlf/Columns.es.xlf | 11 +++- .../Resources/xlf/Columns.fr.xlf | 11 +++- .../Resources/xlf/Columns.it.xlf | 11 +++- .../Resources/xlf/Columns.ja.xlf | 11 +++- .../Resources/xlf/Columns.ko.xlf | 11 +++- .../Resources/xlf/Columns.pl.xlf | 11 +++- .../Resources/xlf/Columns.pt-BR.xlf | 11 +++- .../Resources/xlf/Columns.ru.xlf | 11 +++- .../Resources/xlf/Columns.tr.xlf | 11 +++- .../Resources/xlf/Columns.zh-Hans.xlf | 11 +++- .../Resources/xlf/Columns.zh-Hant.xlf | 11 +++- 23 files changed, 226 insertions(+), 95 deletions(-) delete mode 100644 src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor.cs create mode 100644 src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor create mode 100644 src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor.cs diff --git a/src/Aspire.Dashboard/Aspire.Dashboard.csproj b/src/Aspire.Dashboard/Aspire.Dashboard.csproj index 4e5c12eda5d..c255fab3e0a 100644 --- a/src/Aspire.Dashboard/Aspire.Dashboard.csproj +++ b/src/Aspire.Dashboard/Aspire.Dashboard.csproj @@ -1,4 +1,4 @@ - + @@ -175,4 +175,12 @@ + + + + + + <_ContentIncludedByDefault Remove="Components\ResourcesGridColumns\UnreadLogErrorsBadge.razor" /> + + diff --git a/src/Aspire.Dashboard/Components/Pages/Resources.razor b/src/Aspire.Dashboard/Components/Pages/Resources.razor index b645a92f24b..f99785ac588 100644 --- a/src/Aspire.Dashboard/Components/Pages/Resources.razor +++ b/src/Aspire.Dashboard/Components/Pages/Resources.razor @@ -48,14 +48,14 @@ OnDismiss="() => ClearSelectedResource()" ViewKey="ResourcesList"> - + - + - + diff --git a/src/Aspire.Dashboard/Components/Pages/Resources.razor.css b/src/Aspire.Dashboard/Components/Pages/Resources.razor.css index 44f9bf83284..baae5a46bfb 100644 --- a/src/Aspire.Dashboard/Components/Pages/Resources.razor.css +++ b/src/Aspire.Dashboard/Components/Pages/Resources.razor.css @@ -7,10 +7,16 @@ padding-left: calc(var(--design-unit) * 1px); } +::deep .unread-logs-errors-link { + vertical-align: middle; + --unread-logs-badge-color: #ffffff; +} + ::deep .unread-logs-errors-link::part(control) { - padding-left: 0; - padding-right: 0; - margin-left: 3px; + margin-left: 5px; + padding: 0; + flex-grow: 0; + color: #ffffff; } ::deep .error-counter-badge { diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor b/src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor index eef63618a1a..de6724bdc47 100644 --- a/src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor +++ b/src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor @@ -5,20 +5,7 @@ @using Aspire.Dashboard.Resources @inject IStringLocalizer Loc -@{ - var unviewedErrorCount = GetUnviewedErrorCount(Resource); -} - -@if (unviewedErrorCount > 0) -{ - - - -} -else -{ - -} + @code { [Parameter, EditorRequired] @@ -29,7 +16,4 @@ else [Parameter, EditorRequired] public required string FilterText { get; set; } - - [Parameter, EditorRequired] - public required Dictionary? UnviewedErrorCounts { get; set; } } diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor.cs b/src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor.cs deleted file mode 100644 index 9f394564e82..00000000000 --- a/src/Aspire.Dashboard/Components/ResourcesGridColumns/ResourceNameDisplay.razor.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Aspire.Dashboard.Model; -using Aspire.Dashboard.Otlp.Storage; -using Microsoft.AspNetCore.Components; - -namespace Aspire.Dashboard.Components; - -public partial class ResourceNameDisplay -{ - [Inject] - public required TelemetryRepository TelemetryRepository { get; init; } - - private int GetUnviewedErrorCount(ResourceViewModel resource) - { - if (UnviewedErrorCounts is null) - { - return 0; - } - - var application = TelemetryRepository.GetApplication(resource.Uid); - return application is null ? 0 : UnviewedErrorCounts.GetValueOrDefault(application, 0); - } -} diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor index ec54aaf7204..178604dc347 100644 --- a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor +++ b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor @@ -1,6 +1,7 @@ @using Aspire.Dashboard.Model @using Aspire.Dashboard.Otlp.Model @using Aspire.Dashboard.Resources + @inject IStringLocalizer Loc @if (Resource is { State: ResourceStates.ExitedState /* containers */ or ResourceStates.FinishedState /* executables */ or ResourceStates.FailedToStartState }) @@ -36,8 +37,13 @@ else } @Resource.State + @code { [Parameter, EditorRequired] public required ResourceViewModel Resource { get; set; } + + + [Parameter, EditorRequired] + public required Dictionary? UnviewedErrorCounts { get; set; } } diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor b/src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor new file mode 100644 index 00000000000..7c89330cd92 --- /dev/null +++ b/src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor @@ -0,0 +1,20 @@ +@using Aspire.Dashboard.Resources +@using Aspire.Dashboard.Model +@namespace Aspire.Dashboard.Components +@inject IStringLocalizer Loc + +@if (_unviewedCount > 0) +{ + + + @(_unviewedCount > 9 ? "9+" : _unviewedCount.ToString()) + + +} diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor.cs b/src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor.cs new file mode 100644 index 00000000000..bbaa107eae9 --- /dev/null +++ b/src/Aspire.Dashboard/Components/ResourcesGridColumns/UnreadLogErrorsBadge.razor.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Aspire.Dashboard.Model; +using Aspire.Dashboard.Otlp.Model; +using Aspire.Dashboard.Otlp.Storage; +using Microsoft.AspNetCore.Components; + +namespace Aspire.Dashboard.Components; + +public partial class UnreadLogErrorsBadge +{ + private int _unviewedCount; + + [Parameter, EditorRequired] + public required ResourceViewModel Resource { get; set; } + [Parameter, EditorRequired] + public required Dictionary? UnviewedErrorCounts { get; set; } + + [Inject] + public required TelemetryRepository TelemetryRepository { get; init; } + [Inject] + public required NavigationManager NavigationManager { get; init; } + + protected override void OnParametersSet() + { + _unviewedCount = GetUnviewedErrorCount(Resource); + } + + private int GetUnviewedErrorCount(ResourceViewModel resource) + { + if (UnviewedErrorCounts is null) + { + return 0; + } + + var application = TelemetryRepository.GetApplication(resource.Uid); + if (application is null) + { + return 0; + } + + if (!UnviewedErrorCounts.TryGetValue(application, out var count)) + { + return 0; + } + + return count; + } + + private static string GetResourceErrorStructuredLogsUrl(ResourceViewModel resource) + { + return $"/StructuredLogs/{resource.Uid}?level=error"; + } +} diff --git a/src/Aspire.Dashboard/Resources/Columns.Designer.cs b/src/Aspire.Dashboard/Resources/Columns.Designer.cs index aa8f873910f..800988bdeab 100644 --- a/src/Aspire.Dashboard/Resources/Columns.Designer.cs +++ b/src/Aspire.Dashboard/Resources/Columns.Designer.cs @@ -205,11 +205,20 @@ public static string StateColumnResourceExitedUnexpectedly { } /// - /// Looks up a localized string similar to {0} errors. + /// Looks up a localized string similar to {0} error logs. /// - public static string UnreadLogErrors { + public static string UnreadLogErrorsBadgeErrorLogs { get { - return ResourceManager.GetString("UnreadLogErrors", resourceCulture); + return ResourceManager.GetString("UnreadLogErrorsBadgeErrorLogs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1 error log. + /// + public static string UnreadLogErrorsBadgeOneErrorLog { + get { + return ResourceManager.GetString("UnreadLogErrorsBadgeOneErrorLog", resourceCulture); } } } diff --git a/src/Aspire.Dashboard/Resources/Columns.resx b/src/Aspire.Dashboard/Resources/Columns.resx index 6178190695d..45ca225de67 100644 --- a/src/Aspire.Dashboard/Resources/Columns.resx +++ b/src/Aspire.Dashboard/Resources/Columns.resx @@ -142,10 +142,6 @@ Copy image name and tag to clipboard - - {0} errors - {0} is a number - {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number @@ -157,4 +153,11 @@ Copy full command to clipboard + + 1 error log + + + {0} error logs + {0} is a number + diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf index ed5fd9da743..545e3ba6e66 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf index 6ca2b7b341b..8d627d1c177 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf index a1d94062d07..c9b59ed00e6 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf index 6af56b00cb7..f3edb415369 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf index 09002a535d9..244f00f279a 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf index 4ac08d06bc1..9ed9b23b6ca 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf index 22952791af5..d85c6b85387 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf index 35de11ec744..723306efdda 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf index 79d73e75961..a7d9086348e 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf index fed0c399531..f94edf0fc38 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf index 6aba4d36a2f..2d328ee374e 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf index 29f5adb1437..0ebdd7ffcbe 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf index 2835ce3f1c7..da2720fd25f 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf @@ -82,11 +82,16 @@ {0} exited unexpectedly with exit code {1} {0} is a resource type, {1} is a number - - {0} errors - {0} errors + + {0} error logs + {0} error logs {0} is a number + + 1 error log + 1 error log + + \ No newline at end of file From 25f6c3d2a6a2392ba61b41d5a7e613d3fada3d0a Mon Sep 17 00:00:00 2001 From: Adam Ratzman Date: Mon, 29 Jan 2024 14:53:04 -0500 Subject: [PATCH 2/4] Slightly darken error in dark theme --- src/Aspire.Dashboard/wwwroot/css/app.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Aspire.Dashboard/wwwroot/css/app.css b/src/Aspire.Dashboard/wwwroot/css/app.css index 591fd2d53d6..ce8861a5238 100644 --- a/src/Aspire.Dashboard/wwwroot/css/app.css +++ b/src/Aspire.Dashboard/wwwroot/css/app.css @@ -44,7 +44,7 @@ fluent-toolbar[orientation=horizontal] { --log-critical: #493634; --log-error: #493634; --log-warning: #3F3A2B; - --error: #F8040A !important; + --error: #E10B11 !important; --foreground-subtext-rest: #8D8D8D; --foreground-subtext-hover: #A1A1A1; From 63f8f3af1de0e1a89a7f87bff42ef986435c9dbd Mon Sep 17 00:00:00 2001 From: Adam Ratzman Date: Mon, 29 Jan 2024 14:54:54 -0500 Subject: [PATCH 3/4] Remove spurious VS-added itemgroups --- src/Aspire.Dashboard/Aspire.Dashboard.csproj | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Aspire.Dashboard/Aspire.Dashboard.csproj b/src/Aspire.Dashboard/Aspire.Dashboard.csproj index c255fab3e0a..0198401391f 100644 --- a/src/Aspire.Dashboard/Aspire.Dashboard.csproj +++ b/src/Aspire.Dashboard/Aspire.Dashboard.csproj @@ -174,13 +174,4 @@ - - - - - - - <_ContentIncludedByDefault Remove="Components\ResourcesGridColumns\UnreadLogErrorsBadge.razor" /> - - From 3fde12d1bac215c4ef81d9373f255fc17467a4b2 Mon Sep 17 00:00:00 2001 From: Adam Ratzman Date: Mon, 29 Jan 2024 14:55:30 -0500 Subject: [PATCH 4/4] Auto-close empty element --- .../Components/ResourcesGridColumns/StateColumnDisplay.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor index 178604dc347..e5984452b1e 100644 --- a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor +++ b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor @@ -37,7 +37,7 @@ else } @Resource.State - + @code { [Parameter, EditorRequired]