Projektdateien hinzufügen.
This commit is contained in:
62
ECM.JobRunner.Web/Pages/History.razor
Normal file
62
ECM.JobRunner.Web/Pages/History.razor
Normal file
@@ -0,0 +1,62 @@
|
||||
@page "/history"
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@inject ApiService Api
|
||||
|
||||
<PageTitle>History</PageTitle>
|
||||
|
||||
<h3>Job History</h3>
|
||||
|
||||
@if (historyEntries == null)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Loading Job History..</li>
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ul class="list-group">
|
||||
@foreach (var entry in historyEntries)
|
||||
{
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-circle text-success" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z" />
|
||||
</svg>
|
||||
<span>@entry.JobName</span>
|
||||
</div>
|
||||
@entry.Message
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">@entry.CreatedAt.ToShortTimeString()</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
@code {
|
||||
private DateTime today;
|
||||
private List<HistoryItem>? historyEntries;
|
||||
|
||||
protected async override void OnInitialized()
|
||||
{
|
||||
ApiStatusResponse data = await Api.GetData();
|
||||
UpdateData(data);
|
||||
|
||||
Api.DataUpdated += Api_DataUpdated;
|
||||
}
|
||||
|
||||
protected void Api_DataUpdated(object sender, ApiStatusResponse e)
|
||||
{
|
||||
UpdateData(e);
|
||||
}
|
||||
|
||||
protected void UpdateData(ApiStatusResponse response)
|
||||
{
|
||||
today = response.heartbeat;
|
||||
historyEntries = response.jobHistory;
|
||||
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user