83 lines
2.5 KiB
Plaintext
83 lines
2.5 KiB
Plaintext
@page "/history"
|
|
@using ECM.JobRunner.Common.JobRunnerReference;
|
|
@using ECM.JobRunner.Web.Data;
|
|
@inject DashboardService 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 if (historyEntries.Count == 0)
|
|
{
|
|
<ul class="list-group">
|
|
<li class="list-group-item">No Job History yet.</li>
|
|
</ul>
|
|
}
|
|
else
|
|
{
|
|
@foreach (var entry in historyEntries)
|
|
{
|
|
<ul class="list-group mb-3">
|
|
<li class="list-group-item bg-light bg-gradient 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>
|
|
</div>
|
|
</li>
|
|
@foreach (var step in entry.Steps)
|
|
{
|
|
<li class="list-group-item">
|
|
<strong>@step.Created.ToString("HH:mm")</strong> @step.Message
|
|
</li>
|
|
}
|
|
<li class="list-group-item">
|
|
<strong>@entry.CreatedAt.ToString("HH:mm")</strong> @entry.Message
|
|
</li>
|
|
@if (entry.Successful == false)
|
|
{
|
|
<li class="list-group-item text-danger">Job Failed</li>
|
|
}
|
|
else
|
|
{
|
|
<li class="list-group-item text-success">Job Succeeded</li>
|
|
}
|
|
</ul>
|
|
}
|
|
}
|
|
|
|
@code {
|
|
private DateTime today;
|
|
private List<HistoryItem>? historyEntries;
|
|
|
|
protected async override void OnInitialized()
|
|
{
|
|
DashboardResponse data = await Api.GetData();
|
|
UpdateData(data);
|
|
|
|
Api.DataUpdated += Api_DataUpdated;
|
|
}
|
|
|
|
protected void Api_DataUpdated(object sender, DashboardResponse e)
|
|
{
|
|
UpdateData(e);
|
|
}
|
|
|
|
protected void UpdateData(DashboardResponse response)
|
|
{
|
|
today = response.heartbeat;
|
|
historyEntries = response.jobHistory;
|
|
|
|
InvokeAsync(StateHasChanged);
|
|
}
|
|
} |