feat: 增加 HealthCheckDetails 组件

This commit is contained in:
Argo-Lenovo 2022-01-03 02:30:45 +08:00
parent c633dd4a81
commit 383eaaf14e
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<Table TItem="SelectedItem" Items="Items" IsBordered="true" IsStriped="true">
<TableColumns>
<TableColumn @bind-Field="@context.Value" Text="检查项"></TableColumn>
<TableColumn @bind-Field="@context.Text" Text="值" TextWrap="true">
<Template Context="v">
@GetText(v.Value)
</Template>
</TableColumn>
</TableColumns>
</Table>

View File

@ -0,0 +1,31 @@
using Bootstrap.Security.Blazor.HealthChecks;
namespace BootstrapAdmin.Web.Components;
public partial class HealthCheckDetails
{
[Parameter]
[EditorRequired]
[NotNull]
public IDictionary<string, object?>? Data { get; set; }
[NotNull]
private List<SelectedItem>? Items { get; set; }
/// <summary>
///
/// </summary>
protected override void OnInitialized()
{
base.OnInitialized();
Items = Data.Select(d => new SelectedItem(d.Key, d.Value?.ToString() ?? "")).ToList();
}
private static MarkupString GetText(string? value)
{
var ret = value ?? "";
ret = ret.Replace("\n", "<br />");
return new MarkupString(ret);
}
}