diff --git a/.vscode/settings.json b/.vscode/settings.json index 0fcd24e7881..ae7dab56e4a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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 } diff --git a/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor b/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor new file mode 100644 index 00000000000..8119d3854be --- /dev/null +++ b/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor @@ -0,0 +1,23 @@ +@using Aspire.Dashboard.Resources +@inject IStringLocalizer Loc + +@{ + var buttonId = $"info-popover-{AnchorId}"; +} + + + + + + + +
+ @ChildContent +
+ +
+
diff --git a/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.cs b/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.cs new file mode 100644 index 00000000000..bebe55424f1 --- /dev/null +++ b/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.cs @@ -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; } +} diff --git a/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.css b/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.css new file mode 100644 index 00000000000..daf4f1e1295 --- /dev/null +++ b/src/Aspire.Dashboard/Components/Controls/InfoPopover.razor.css @@ -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); +} diff --git a/src/Aspire.Dashboard/Components/Pages/Resources.razor b/src/Aspire.Dashboard/Components/Pages/Resources.razor index aa0fdd9c54c..7a465093672 100644 --- a/src/Aspire.Dashboard/Components/Pages/Resources.razor +++ b/src/Aspire.Dashboard/Components/Pages/Resources.razor @@ -157,7 +157,7 @@ - + diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor index b16a6abad04..84f03ba3fe4 100644 --- a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor +++ b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor @@ -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); }
@@ -19,4 +20,10 @@ UnviewedErrorCounts="UnviewedErrorCounts" Resource="@Resource" /> + @if (tooltipMarkup is not null) + { + + @((MarkupString)tooltipMarkup) + + }
diff --git a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor.css b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor.css index 10d3716a99b..23f0e5fc352 100644 --- a/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor.css +++ b/src/Aspire.Dashboard/Components/ResourcesGridColumns/StateColumnDisplay.razor.css @@ -1,4 +1,6 @@ .state-column-cell { + display: inline-flex; + align-items: center; overflow: hidden; text-overflow: ellipsis; } diff --git a/src/Aspire.Dashboard/Model/ResourceStateViewModel.cs b/src/Aspire.Dashboard/Model/ResourceStateViewModel.cs index 6c5ef03f5a2..ea564f7ecdb 100644 --- a/src/Aspire.Dashboard/Model/ResourceStateViewModel.cs +++ b/src/Aspire.Dashboard/Model/ResourceStateViewModel.cs @@ -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; @@ -101,19 +102,21 @@ private static (Icon icon, Color color) GetStateIcon(ResourceViewModel resource) /// /// This is a static method so it can be called at the level of the parent column. /// - internal static string GetResourceStateTooltip(ResourceViewModel resource, IStringLocalizer loc) + internal static string? GetResourceStateTooltip(ResourceViewModel resource, IStringLocalizer 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 }) @@ -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 loc) diff --git a/src/Aspire.Dashboard/Resources/Columns.Designer.cs b/src/Aspire.Dashboard/Resources/Columns.Designer.cs index 2f513b6f3f1..59c2bba066d 100644 --- a/src/Aspire.Dashboard/Resources/Columns.Designer.cs +++ b/src/Aspire.Dashboard/Resources/Columns.Designer.cs @@ -100,7 +100,7 @@ public static string SourceColumnDisplayCopyCommandToClipboard { /// /// Looks up a localized string similar to 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. + ///For more informationTEST, see <a href="https://aka.ms/dotnet/aspire/container-runtime-unhealthy" target="_blank">https://aka.ms/dotnet/aspire/container-runtime-unhealthy</a>. /// public static string StateColumnResourceContainerRuntimeUnhealthy { get { @@ -144,6 +144,15 @@ public static string StateColumnResourceWaiting { } } + /// + /// Looks up a localized string similar to More information about resource state. + /// + public static string StateColumnResourceInfoButton { + get { + return ResourceManager.GetString("StateColumnResourceInfoButton", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unknown. /// diff --git a/src/Aspire.Dashboard/Resources/Columns.resx b/src/Aspire.Dashboard/Resources/Columns.resx index 47636a17538..6e3860cdf3d 100644 --- a/src/Aspire.Dashboard/Resources/Columns.resx +++ b/src/Aspire.Dashboard/Resources/Columns.resx @@ -1,17 +1,17 @@ - @@ -151,8 +151,8 @@ 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 - Contains a new line +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. Resource has not started because it's configured to not automatically start. @@ -160,4 +160,7 @@ For more information, see https://aka.ms/dotnet/aspire/container-runtime-unhealt Resource is waiting for other resources to be in a running and healthy state. - \ No newline at end of file + + More information about resource state + + diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf index 1bd4780768d..aef59ed1ca6 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf @@ -19,10 +19,10 @@ 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 - Modul runtime kontejneru byl nalezen, ale zdá se, že není v pořádku. Ujistěte se, že je spuštěný. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Modul runtime kontejneru byl nalezen, ale zdá se, že není v pořádku. Ujistěte se, že je spuštěný. Další informace najdete na https://aka.ms/dotnet/aspire/container-runtime-unhealthy. - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Další informace najdete na https://aka.ms/dotnet/aspire/container-runtime-unhe Prostředek {0} byl neočekávaně ukončen s ukončovacím kódem {1}. {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. Prostředek se nespustil, protože je nakonfigurovaný tak, aby se nespouštěl automaticky. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf index 28bc567d28f..1de0a164c59 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf @@ -19,10 +19,10 @@ 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 - Die Containerruntime wurde gefunden, scheint aber fehlerhaft zu sein. Stellen Sie sicher, dass sie ausgeführt wird. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Die Containerruntime wurde gefunden, scheint aber fehlerhaft zu sein. Stellen Sie sicher, dass sie ausgeführt wird. Weitere Informationen finden Sie unter https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Weitere Informationen finden Sie unter https://aka.ms/dotnet/aspire/container-ru {0} wurde unerwartet mit dem Exitcode {1} beendet. {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. Die Ressource wurde nicht gestartet, weil sie so eingestellt ist, dass sie nicht automatisch startet. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf index 0ffcfa7748a..4eb35633d28 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf @@ -19,10 +19,10 @@ 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 - Se encontró el runtime de contenedor, pero parece que está en un estado incorrecto. Asegúrese de que se está ejecutando. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Se encontró el runtime de contenedor, pero parece que está en un estado incorrecto. Asegúrese de que se está ejecutando. Para obtener más información, consulte https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Para obtener más información, consulte https://aka.ms/dotnet/aspire/container- {0} se cerró inesperadamente con el código de salida {1} {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. El recurso no se ha iniciado porque está configurado para no iniciarse automáticamente. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf index bcd3d9c7556..14e74e5f7f8 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf @@ -19,10 +19,10 @@ 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 - Le runtime de conteneur a été trouvé, mais il semble qu’il ne soit pas sain. Assurez-vous qu’il est en cours d’exécution. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Le runtime de conteneur a été trouvé, mais il semble qu’il ne soit pas sain. Assurez-vous qu’il est en cours d’exécution. Pour plus d’informations, consultez https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Pour plus d’informations, consultez https://aka.ms/dotnet/aspire/container-run {0} s’est arrêté de manière inattendue avec le code {1} {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. La ressource n’a pas démarré, car elle est configurée pour ne pas démarrer automatiquement. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf index 369646e584a..849888dff7c 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf @@ -19,10 +19,10 @@ 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 - È stato trovato il runtime del contenitore, ma non è integro. Verificare che sia in esecuzione. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + È stato trovato il runtime del contenitore, ma non è integro. Verificare che sia in esecuzione. Per altre informazioni, vedere https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Per altre informazioni, vedere https://aka.ms/dotnet/aspire/container-runtime-un La risorsa {0} è stata chiusa in modo imprevisto con codice di uscita {1} {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. La risorsa non è stata avviata perché è configurata per non avviarsi automaticamente. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf index 7cc6c173498..262b747d407 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf @@ -19,10 +19,10 @@ 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 - コンテナー ランタイムが見つかりましたが、異常である可能性があります。実行中であることを確認してください。 +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + コンテナー ランタイムが見つかりましたが、異常である可能性があります。実行中であることを確認してください。 詳細については、https://aka.ms/dotnet/aspire/container-runtime-unhealthy を参照してください。 - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ For more information, see https://aka.ms/dotnet/aspire/container-runtime-unhealt {0} は終了コード{1} で予期せず終了しました {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. リソースは自動的に開始しないように構成されているため、開始されていません。 diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf index 3dd314d416c..dae733fe9ad 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf @@ -19,10 +19,10 @@ 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 - 컨테이너 런타임을 찾았지만 비정상 상태인 것 같습니다. 실행 중인지 확인하세요. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + 컨테이너 런타임을 찾았지만 비정상 상태인 것 같습니다. 실행 중인지 확인하세요. 자세한 내용은 https://aka.ms/dotnet/aspire/container-runtime-unhealthy 페이지를 참조하세요. - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ For more information, see https://aka.ms/dotnet/aspire/container-runtime-unhealt {0}(이)가 종료 코드 {1}(으)로 예기치 않게 종료되었습니다. {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. 리소스가 자동으로 시작되지 않도록 구성되어 있어 시작되지 않았습니다. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf index a7c74fffa86..385eda74d15 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf @@ -19,10 +19,10 @@ 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 - Znaleziono środowisko uruchomieniowe kontenera, ale wygląda na to, że jest w złej kondycji. Upewnij się, że jest uruchomione. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Znaleziono środowisko uruchomieniowe kontenera, ale wygląda na to, że jest w złej kondycji. Upewnij się, że jest uruchomione. Aby uzyskać więcej informacji, zobacz https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Aby uzyskać więcej informacji, zobacz https://aka.ms/dotnet/aspire/container-r Nieoczekiwanie zakończony {0} z kodem zakończenia {1} {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. Zasób nie został uruchomiony, ponieważ jest skonfigurowany tak, aby nie uruchamiał się automatycznie. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf index 8c1d89739b3..2389a460674 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf @@ -19,10 +19,10 @@ 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 - O runtime do contêiner foi encontrado, mas parece não íntegro. Certifique-se de que ele esteja em execução. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + O runtime do contêiner foi encontrado, mas parece não íntegro. Certifique-se de que ele esteja em execução. Para obter mais informações, consulte https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Para obter mais informações, consulte https://aka.ms/dotnet/aspire/container- {0} saiu inesperadamente com o código de saída {1} {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. O recurso não foi iniciado porque está configurado para não iniciar automaticamente. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf index eb3d812e1d8..fd6ab7cae1c 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf @@ -19,10 +19,10 @@ 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 - Среда выполнения контейнера обнаружена, но, по-видимому, неработоспособна. Убедитесь, что она запущена. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Среда выполнения контейнера обнаружена, но, по-видимому, неработоспособна. Убедитесь, что она запущена. Дополнительные сведения см. по адресу https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ For more information, see https://aka.ms/dotnet/aspire/container-runtime-unhealt {0} неожиданно завершила работу, вернув код {1}. {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. Ресурс не запущен, поскольку он настроен на отключение автоматического запуска. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf index d247d908d7f..d413eaee129 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf @@ -19,10 +19,10 @@ 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 - Kapsayıcı çalışma zamanı bulundu, ancak iyi durumda değil. Çalışır durumda olduğundan emin olun. +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + Kapsayıcı çalışma zamanı bulundu, ancak iyi durumda değil. Çalışır durumda olduğundan emin olun. Daha fazla bilgi için bkz. https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ Daha fazla bilgi için bkz. https://aka.ms/dotnet/aspire/container-runtime-unhea {0} {1} çıkış kodu ile beklenmedik bir şekilde çıktı {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. Kaynak, otomatik olarak başlatılmak için yapılandırılmadığından başlatılmadı. diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf index fc6948b20af..c81623df8f5 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf @@ -19,10 +19,10 @@ 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 - 已找到容器运行时,但它似乎运行不正常。请确保它正在运行。 +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + 已找到容器运行时,但它似乎运行不正常。请确保它正在运行。 有关详细信息,请参阅 https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ For more information, see https://aka.ms/dotnet/aspire/container-runtime-unhealt {0} 已意外退出,退出代码为 {1} {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. 资源尚未启动,因为它配置为不自动启动。 diff --git a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf index 83b307ef69a..bf1890eb4a3 100644 --- a/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf +++ b/src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf @@ -19,10 +19,10 @@ 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 - 找到容器執行階段,但似乎狀況不良。確保它執行中。 +For more information, see <a href="https://aka.ms/aspire/container-runtime-unhealthy" target="_blank" rel="noopener noreferrer">https://aka.ms/aspire/container-runtime-unhealthy</a>. + 找到容器執行階段,但似乎狀況不良。確保它執行中。 如需詳細資訊,請參閱 https://aka.ms/dotnet/aspire/container-runtime-unhealthy - Contains a new line + Contains a new line. The link provided is html markup and should not be translated or otherwise modified. {0} is no longer running @@ -34,6 +34,11 @@ For more information, see https://aka.ms/dotnet/aspire/container-runtime-unhealt {0} 意外結束,結束代碼: {1} {0} is a resource type, {1} is a number + + More information about resource state + More information about resource state + + Resource has not started because it's configured to not automatically start. 資源尚未啟動,因為它已設定為不會自動啟動。 diff --git a/tests/Aspire.Dashboard.Tests/Model/ResourceStateViewModelTests.cs b/tests/Aspire.Dashboard.Tests/Model/ResourceStateViewModelTests.cs index ce6ed7bbeae..5e499d73e99 100644 --- a/tests/Aspire.Dashboard.Tests/Model/ResourceStateViewModelTests.cs +++ b/tests/Aspire.Dashboard.Tests/Model/ResourceStateViewModelTests.cs @@ -1,11 +1,13 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Globalization; using Aspire.Dashboard.Model; using Aspire.Dashboard.Resources; using Aspire.Tests.Shared.DashboardModel; using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.Localization; using Microsoft.FluentUI.AspNetCore.Components; using Xunit; using Enum = System.Enum; @@ -33,11 +35,11 @@ public class ResourceStateViewModelTests /* expected output */ $"Localized:{nameof(Columns.StateColumnResourceExited)}:CustomResource", "RecordStop", Color.Info, "Finished")] [InlineData( /* state */ "Container", KnownResourceState.Unknown, null, null, null, - /* expected output */ "Unknown", "CircleHint", Color.Info, "Unknown")] + /* expected output */ null, "CircleHint", Color.Info, "Unknown")] // Health checks [InlineData( /* state */ "Container", KnownResourceState.Running, null, "Healthy", null, - /* expected output */ "Running", "CheckmarkCircle", Color.Success, "Running")] + /* expected output */ null, "CheckmarkCircle", Color.Success, "Running")] [InlineData( /* state */ "Container", KnownResourceState.Running, null, "", null, /* expected output */ $"Localized:{nameof(Columns.RunningAndUnhealthyResourceStateToolTip)}", "CheckmarkCircleWarning", Color.Warning, "Running (Unhealthy)")] @@ -46,13 +48,13 @@ public class ResourceStateViewModelTests /* expected output */ $"Localized:{nameof(Columns.RunningAndUnhealthyResourceStateToolTip)}", "CheckmarkCircleWarning", Color.Warning, "Running (Unhealthy)")] [InlineData( /* state */ "Container", KnownResourceState.Running, null, "Healthy", "warning", - /* expected output */ "Running", "Warning", Color.Warning, "Running")] + /* expected output */ null, "Warning", Color.Warning, "Running")] [InlineData( /* state */ "Container", KnownResourceState.Running, null, "Healthy", "NOT_A_VALID_STATE_STYLE", - /* expected output */ "Running", "Circle", Color.Neutral, "Running")] + /* expected output */ null, "Circle", Color.Neutral, "Running")] [InlineData( /* state */ "Container", KnownResourceState.Running, null, null, "info", - /* expected output */ "Running", "Info", Color.Info, "Running")] + /* expected output */ null, "Info", Color.Info, "Running")] [InlineData( /* state */ "Container", KnownResourceState.RuntimeUnhealthy, null, null, null, /* expected output */ $"Localized:{nameof(Columns.StateColumnResourceContainerRuntimeUnhealthy)}", "Warning", Color.Warning, "Runtime unhealthy")] @@ -101,4 +103,61 @@ public void ResourceViewModel_ReturnsCorrectIconAndTooltip( Assert.Equal(expectedColor, vm.Color); Assert.Equal(expectedText, vm.Text); } + + [Fact] + public void GetResourceStateTooltip_ExitedCustomResource_EncodesResourceType() + { + var resource = ModelTestHelpers.CreateResource( + state: KnownResourceState.Exited, + resourceType: "An HTML resource type!"); + + var tooltip = ResourceStateViewModel.GetResourceStateTooltip(resource, new HtmlTestStringLocalizer()); + + Assert.Equal("<marquee>An HTML resource type!</marquee> is no longer running", tooltip); + } + + [Fact] + public void GetResourceStateTooltip_RuntimeUnhealthyContainer_PreservesLocalizedMarkup() + { + var resource = ModelTestHelpers.CreateResource(state: KnownResourceState.RuntimeUnhealthy); + + var tooltip = ResourceStateViewModel.GetResourceStateTooltip(resource, new HtmlTestStringLocalizer()); + + Assert.Contains(" + { + public LocalizedString this[string name] + { + get + { + return name switch + { + nameof(Columns.StateColumnResourceContainerRuntimeUnhealthy) => new(name, "Container runtime issue. More information."), + nameof(Columns.RunningAndUnhealthyResourceStateToolTip) => new(name, "Resource is running but not in a healthy state."), + nameof(Columns.StateColumnResourceWaiting) => new(name, "Resource is waiting for other resources to be in a running and healthy state."), + nameof(Columns.StateColumnResourceNotStarted) => new(name, "Resource has not started because it's configured to not automatically start."), + _ => new(name, name) + }; + } + } + + public LocalizedString this[string name, params object[] arguments] + { + get + { + var format = name switch + { + nameof(Columns.StateColumnResourceExited) => "{0} is no longer running", + nameof(Columns.StateColumnResourceExitedUnexpectedly) => "{0} exited unexpectedly with exit code {1}", + _ => name + }; + + return new(name, string.Format(CultureInfo.CurrentCulture, format, arguments)); + } + } + + public IEnumerable GetAllStrings(bool includeParentCultures) => []; + } }