feat: 健康检查增加更新按钮

This commit is contained in:
Argo-Tianyi 2022-01-04 08:21:09 +08:00
parent 3ebfe8cd56
commit 0e81c0e257
3 changed files with 19 additions and 3 deletions

View File

@ -5,12 +5,14 @@
<CardHeader> <CardHeader>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<span class="flex-fill">健康检查结果</span> <span class="flex-fill">健康检查结果</span>
<span class="mx-3">@Duration</span> <span class="me-3">@Duration</span>
<Tag Color="GetTagColor()" Icon="@GetTagIcon()">@GetTagText()</Tag> <Tag class="me-3" Color="GetTagColor()" Icon="@GetTagIcon()">@GetTagText()</Tag>
<Button class="btn-hc" IsAsync="true" OnClickWithoutRender="OnCheck" Icon="fa fa-fw fa-refresh" Text="重新检查"></Button>
</div> </div>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
<Table TItem="HealthCheckReportItem" OnQueryAsync="OnQueryAsync" ShowSkeleton="true" IsBordered="true" IsStriped="true" ShowExtendButtons="true"> <Table TItem="HealthCheckReportItem" IsBordered="true" IsStriped="true" @ref="HealthTable"
OnQueryAsync="OnQueryAsync" ShowSkeleton="true" ShowLoading="true" ShowExtendButtons="true">
<TableColumns> <TableColumns>
<TableColumn @bind-Field="@context.Name" Lookup="@GetNameLookup()" Text="检查项"></TableColumn> <TableColumn @bind-Field="@context.Name" Lookup="@GetNameLookup()" Text="检查项"></TableColumn>
<TableColumn @bind-Field="@context.Description" Text="描述"></TableColumn> <TableColumn @bind-Field="@context.Description" Text="描述"></TableColumn>

View File

@ -23,6 +23,9 @@ public partial class Healths
private HealthStatus Status { get; set; } private HealthStatus Status { get; set; }
[NotNull]
private Table<HealthCheckReportItem>? HealthTable { get; set; }
[Inject] [Inject]
[NotNull] [NotNull]
private DialogService? DialogService { get; set; } private DialogService? DialogService { get; set; }
@ -58,6 +61,13 @@ public partial class Healths
return ret; return ret;
} }
private async Task OnCheck()
{
await HealthTable.ToggleLoading(true);
await HealthTable.QueryAsync();
await HealthTable.ToggleLoading(false);
}
private static List<SelectedItem> GetNameLookup() => LookupHelper.GetCheckItems(); private static List<SelectedItem> GetNameLookup() => LookupHelper.GetCheckItems();
private string? GetTagText(HealthStatus? status = null) => (status ?? Status) switch private string? GetTagText(HealthStatus? status = null) => (status ?? Status) switch

View File

@ -114,3 +114,7 @@
text-overflow: ellipsis; text-overflow: ellipsis;
color: var(--bs-info); color: var(--bs-info);
} }
.btn-hc {
padding: 3px 12px;
}