Skip to content
Open
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: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"dotnet.solution.autoOpen": "./Aspire.slnx",
"dotnet.preview.enableSupportForSlnx": true,
"dotnet.testWindow.useTestingPlatformProtocol": true,
"aspire.enableSettingsFileCreationPromptOnStartup": false
"aspire.enableSettingsFileCreationPromptOnStartup": false,
"aspire.enableAutoRestore": false
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but useful change, we have hundreds of projects so we should not automatically restore in the aspire repo

}
23 changes: 23 additions & 0 deletions src/Aspire.Dashboard/Components/Controls/InfoPopover.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@using Aspire.Dashboard.Resources
@inject IStringLocalizer<Columns> Loc

@{
var buttonId = $"info-popover-{AnchorId}";
}

<span @onclick:stopPropagation="true" class="info-popover-container">
<FluentButton Id="@buttonId"
Appearance="Appearance.Stealth"
Class="info-popover-button"
OnClick="@(() => _popoverVisible = !_popoverVisible)"
aria-label="@Loc[nameof(Columns.StateColumnResourceInfoButton)]">
<FluentIcon Value="@(new Icons.Regular.Size16.Info())" Color="Color.Neutral" />
</FluentButton>
<FluentPopover AnchorId="@buttonId" @bind-Open="_popoverVisible" VerticalThreshold="200" AutoFocus="false">
<Body>
<div class="info-popover-content">
@ChildContent
</div>
</Body>
</FluentPopover>
</span>
17 changes: 17 additions & 0 deletions src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Components;

namespace Aspire.Dashboard.Components.Controls;

public partial class InfoPopover
{
private bool _popoverVisible;

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

[Parameter, EditorRequired]
public required RenderFragment ChildContent { get; set; }
}
43 changes: 43 additions & 0 deletions src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.info-popover-container {
display: inline-flex;
align-items: center;
margin-left: 4px;
}

::deep .info-popover-button {
min-width: unset;
padding: 0;
height: 20px;
width: 20px;
}

::deep fluent-popover {
width: auto;
max-width: 500px;
cursor: default;
}

::deep fluent-popover *,
::deep .fluent-popover-body {
cursor: default;
white-space: normal;
word-wrap: break-word;
max-width: 400px;
}

.info-popover-content {
max-width: 400px;
white-space: normal;
word-wrap: break-word;
cursor: default;
}

.info-popover-content a {
color: var(--accent-fill-rest);
text-decoration: underline;
cursor: pointer;
}

.info-popover-content a:hover {
color: var(--accent-fill-hover);
}
2 changes: 1 addition & 1 deletion src/Aspire.Dashboard/Components/Pages/Resources.razor
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<ResourceNameDisplay Resource="context.Resource" FilterText="@_filter" FormatName="GetResourceName" />
</span>
</AspireTemplateColumn>
<AspireTemplateColumn ColumnId="@StateColumn" ColumnManager="@_manager" Title="@Loc[nameof(Dashboard.Resources.Resources.ResourcesStateColumnHeader)]" Sortable="true" SortBy="@_stateSort" Tooltip="true" TooltipText="@(c => ResourceStateViewModel.GetResourceStateTooltip(c.Resource, ColumnsLoc))">
<AspireTemplateColumn ColumnId="@StateColumn" ColumnManager="@_manager" Title="@Loc[nameof(Dashboard.Resources.Resources.ResourcesStateColumnHeader)]" Sortable="true" SortBy="@_stateSort">
<StateColumnDisplay Resource="@context.Resource" UnviewedErrorCounts="@_resourceUnviewedErrorCounts" />
</AspireTemplateColumn>
<AspireTemplateColumn ColumnId="@StartTimeColumn" ColumnManager="@_manager" Title="@Loc[nameof(Dashboard.Resources.Resources.ResourcesStartTimeColumnHeader)]" Sortable="true" SortBy="@_startTimeSort" TooltipText="@(context => context.Resource.StartTimeStamp != null ? FormatHelpers.FormatDateTime(TimeProvider, context.Resource.StartTimeStamp.Value, MillisecondsDisplay.None, CultureInfo.CurrentCulture) : null)" Tooltip="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@{
// Create view model every render. The resource state may have changed.
var vm = ResourceStateViewModel.GetStateViewModel(Resource, Loc);
var tooltipMarkup = ResourceStateViewModel.GetResourceStateTooltip(Resource, Loc);
}

<div class="state-column-cell">
Expand All @@ -19,4 +20,10 @@
UnviewedErrorCounts="UnviewedErrorCounts"
Resource="@Resource" />

@if (tooltipMarkup is not null)
{
<InfoPopover AnchorId="@($"state-{Resource.Name}")">
@((MarkupString)tooltipMarkup)
</InfoPopover>
}
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.state-column-cell {
display: inline-flex;
align-items: center;
overflow: hidden;
text-overflow: ellipsis;
}
12 changes: 7 additions & 5 deletions src/Aspire.Dashboard/Model/ResourceStateViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Net;
using Aspire.Dashboard.Extensions;
using Aspire.Dashboard.Resources;
using Humanizer;
Expand Down Expand Up @@ -101,19 +102,21 @@ private static (Icon icon, Color color) GetStateIcon(ResourceViewModel resource)
/// <remarks>
/// This is a static method so it can be called at the level of the parent column.
/// </remarks>
internal static string GetResourceStateTooltip(ResourceViewModel resource, IStringLocalizer<Columns> loc)
internal static string? GetResourceStateTooltip(ResourceViewModel resource, IStringLocalizer<Columns> loc)
{
if (resource.IsStopped())
{
var encodedResourceType = WebUtility.HtmlEncode(resource.ResourceType);

if (resource.TryGetExitCode(out var exitCode) && exitCode is not 0)
{
// Process completed unexpectedly, hence the non-zero code. This is almost certainly an error, so warn users.
return loc.GetString(nameof(Columns.StateColumnResourceExitedUnexpectedly), resource.ResourceType, exitCode);
return loc.GetString(nameof(Columns.StateColumnResourceExitedUnexpectedly), encodedResourceType, exitCode);
}
else
{
// Process completed, which may not have been unexpected.
return loc.GetString(nameof(Columns.StateColumnResourceExited), resource.ResourceType);
return loc.GetString(nameof(Columns.StateColumnResourceExited), encodedResourceType);
}
}
else if (resource is { KnownState: KnownResourceState.Running, HealthStatus: not HealthStatus.Healthy })
Expand All @@ -135,8 +138,7 @@ internal static string GetResourceStateTooltip(ResourceViewModel resource, IStri
return loc[nameof(Columns.StateColumnResourceNotStarted)];
}

// Fallback to text displayed in column.
return GetStateText(resource, loc);
return null;
}

private static string GetStateText(ResourceViewModel resource, IStringLocalizer<Columns> loc)
Expand Down
11 changes: 10 additions & 1 deletion src/Aspire.Dashboard/Resources/Columns.Designer.cs

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

63 changes: 33 additions & 30 deletions src/Aspire.Dashboard/Resources/Columns.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema

Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple

There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -151,13 +151,16 @@
</data>
<data name="StateColumnResourceContainerRuntimeUnhealthy" xml:space="preserve">
<value>Container runtime was found but appears to be unhealthy. Ensure that it is running.
For more information, see https://aka.ms/dotnet/aspire/container-runtime-unhealthy</value>
<comment>Contains a new line</comment>
For more information, see &lt;a href="https://aka.ms/dotnet/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer"&gt;https://aka.ms/dotnet/aspire/container-runtime-unhealthy&lt;/a&gt;.</value>
<comment>Contains a new line. The link provided is html markup and should not be translated or otherwise modified.</comment>
</data>
<data name="StateColumnResourceNotStarted" xml:space="preserve">
<value>Resource has not started because it's configured to not automatically start.</value>
</data>
<data name="StateColumnResourceWaiting" xml:space="preserve">
<value>Resource is waiting for other resources to be in a running and healthy state.</value>
</data>
</root>
<data name="StateColumnResourceInfoButton" xml:space="preserve">
<value>More information about resource state</value>
</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.

Loading
Loading