-
Notifications
You must be signed in to change notification settings - Fork 727
Revert state column badge changes #1957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @using Aspire.Dashboard.Resources | ||
| @using Aspire.Dashboard.Model | ||
| @namespace Aspire.Dashboard.Components | ||
| @inject IStringLocalizer<Columns> Loc | ||
|
|
||
| @if (_unviewedCount > 0) | ||
| { | ||
| <FluentAnchor aria-label="@(_unviewedCount == 1 ? nameof(Columns.UnreadLogErrorsBadgeOneErrorLog) : string.Format(Loc[nameof(Columns.UnreadLogErrorsBadgeErrorLogs)], _unviewedCount))" | ||
| Href="@GetResourceErrorStructuredLogsUrl(Resource)" | ||
| Appearance="Appearance.Stealth" | ||
| Class="unread-logs-errors-link"> | ||
| <FluentBadge | ||
| Appearance="Appearance.Accent" | ||
| Circular="true" | ||
| Fill="error" | ||
| Color="var(--unread-logs-badge-color)"> | ||
| @(_unviewedCount > 9 ? "9+" : _unviewedCount.ToString()) | ||
| </FluentBadge> | ||
| </FluentAnchor> | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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<OtlpApplication, int>? 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"; | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking accessibility into consideration with the fix!