feat: 增加 HealthCheckDetails 组件
This commit is contained in:
parent
c633dd4a81
commit
383eaaf14e
|
@ -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>
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue