Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Aspire.Dashboard/Aspire.Dashboard.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<!-- This list of runtimes needs to match the set of runtimes specified in eng/workloads/workloads.csproj -->
Expand Down Expand Up @@ -174,5 +174,4 @@
<Compile Include="..\Aspire.Hosting\Utils\KnownResourceNames.cs" Link="Utils\KnownResourceNames.cs" />
<Compile Include="$(SharedDir)KnownFormats.cs" Link="Utils\KnownFormats.cs" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/Aspire.Dashboard/Components/Pages/Resources.razor
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
OnDismiss="() => ClearSelectedResource()"
ViewKey="ResourcesList">
<Summary>
<FluentDataGrid Items="@FilteredResources" ResizableColumns="true" GridTemplateColumns="1fr 2fr 1fr 2fr 2.5fr 2fr 1fr 1fr" RowClass="GetRowClass">
<FluentDataGrid Items="@FilteredResources" ResizableColumns="true" GridTemplateColumns="1fr 2fr 1.25fr 2fr 2.5fr 2fr 1fr 1fr" RowClass="GetRowClass">
<ChildContent>
<PropertyColumn Title="@Loc[nameof(Dashboard.Resources.Resources.ResourcesTypeColumnHeader)]" Property="@(c => c.ResourceType)" Sortable="true" />
<TemplateColumn Title="@ControlsStringsLoc[nameof(ControlsStrings.NameColumnHeader)]" Sortable="true" SortBy="@_nameSort">
<ResourceNameDisplay Resource="context" FilterText="@_filter" FormatName="GetResourceName" UnviewedErrorCounts="@_applicationUnviewedErrorCounts" />
<ResourceNameDisplay Resource="context" FilterText="@_filter" FormatName="GetResourceName" />
</TemplateColumn>
<TemplateColumn Title="@Loc[nameof(Dashboard.Resources.Resources.ResourcesStateColumnHeader)]" Sortable="true" SortBy="@_stateSort">
<StateColumnDisplay Resource="@context"/>
<StateColumnDisplay Resource="@context" UnviewedErrorCounts ="@_applicationUnviewedErrorCounts" />
</TemplateColumn>
<PropertyColumn Property="@(c => c.CreationTimeStamp)" Title="@Loc[nameof(Dashboard.Resources.Resources.ResourcesStartTimeColumnHeader)]" Sortable="true" Tooltip="true" />
<TemplateColumn Title="@Loc[nameof(Dashboard.Resources.Resources.ResourcesSourceColumnHeader)]">
Expand Down
12 changes: 9 additions & 3 deletions src/Aspire.Dashboard/Components/Pages/Resources.razor.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@
@using Aspire.Dashboard.Resources
@inject IStringLocalizer<Columns> Loc

@{
var unviewedErrorCount = GetUnviewedErrorCount(Resource);
}

@if (unviewedErrorCount > 0)
{
<FluentCounterBadge Class="error-counter-badge" Max="9" BackgroundColor="@Color.Error" Color="Color.Fill" Appearance="Appearance.Lightweight" Count="@unviewedErrorCount" HorizontalPosition="100">
<span title="@FormatName(Resource)"><FluentHighlighter HighlightedText="@FilterText" Text="@FormatName(Resource)"/></span>
</FluentCounterBadge>
}
else
{
<span title="@FormatName(Resource)"><FluentHighlighter HighlightedText="@FilterText" Text="@FormatName(Resource)"/></span>
}
<span title="@FormatName(Resource)"><FluentHighlighter HighlightedText="@FilterText" Text="@FormatName(Resource)"/></span>

@code {
[Parameter, EditorRequired]
Expand All @@ -29,7 +16,4 @@ else

[Parameter, EditorRequired]
public required string FilterText { get; set; }

[Parameter, EditorRequired]
public required Dictionary<OtlpApplication, int>? UnviewedErrorCounts { get; set; }
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@using Aspire.Dashboard.Model
@using Aspire.Dashboard.Otlp.Model
@using Aspire.Dashboard.Resources

@inject IStringLocalizer<Columns> Loc

@if (Resource is { State: ResourceStates.ExitedState /* containers */ or ResourceStates.FinishedState /* executables */ or ResourceStates.FailedToStartState })
Expand Down Expand Up @@ -36,8 +37,13 @@ else
}

@Resource.State
<UnreadLogErrorsBadge UnviewedErrorCounts="UnviewedErrorCounts" Resource="@Resource" />

@code {
[Parameter, EditorRequired]
public required ResourceViewModel Resource { get; set; }


[Parameter, EditorRequired]
public required Dictionary<OtlpApplication, int>? UnviewedErrorCounts { get; set; }
}
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))"
Copy link
Member

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!

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";
}
}
15 changes: 12 additions & 3 deletions src/Aspire.Dashboard/Resources/Columns.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/Aspire.Dashboard/Resources/Columns.resx
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@
<data name="SourceColumnSourceCopyContainerToClipboard" xml:space="preserve">
<value>Copy image name and tag to clipboard</value>
</data>
<data name="UnreadLogErrors" xml:space="preserve">
<value>{0} errors</value>
<comment>{0} is a number</comment>
</data>
<data name="StateColumnResourceExitedUnexpectedly" xml:space="preserve">
<value>{0} exited unexpectedly with exit code {1}</value>
<comment>{0} is a resource type, {1} is a number</comment>
Expand All @@ -157,4 +153,11 @@
<data name="SourceColumnDisplayCopyCommandToClipboard" xml:space="preserve">
<value>Copy full command to clipboard</value>
</data>
<data name="UnreadLogErrorsBadgeOneErrorLog" xml:space="preserve">
<value>1 error log</value>
</data>
<data name="UnreadLogErrorsBadgeErrorLogs" xml:space="preserve">
<value>{0} error logs</value>
<comment>{0} is a number</comment>
</data>
</root>
11 changes: 8 additions & 3 deletions src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading