06-12-2022
This commit is contained in:
135
ECM.JobRunner.Web/Pages/Status.razor
Normal file
135
ECM.JobRunner.Web/Pages/Status.razor
Normal file
@@ -0,0 +1,135 @@
|
||||
@page "/status"
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Components.Status;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@inject DashboardService Api
|
||||
|
||||
<PageTitle>Status</PageTitle>
|
||||
|
||||
<h3 class="mb-3">Job Status</h3>
|
||||
|
||||
<section class="mb-5">
|
||||
@if (executingEntries == null)
|
||||
{
|
||||
<h4>Executing</h4>
|
||||
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Loading Job Status..</li>
|
||||
</ul>
|
||||
}
|
||||
else if (executingEntries.Count == 0)
|
||||
{
|
||||
<h4>Executing</h4>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">No jobs currently executing</li>
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h4>Executing (@executingEntries.Count)</h4>
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach (var entry in executingEntries)
|
||||
{
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-start mb-3">
|
||||
<div class="ms-2 me-auto w-100">
|
||||
<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.Name</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">Started @entry.StartTime.ToLongTimeString()</span>
|
||||
</div>
|
||||
<Progress jobStatus="entry" />
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
</section>
|
||||
|
||||
@if (completedEntries == null)
|
||||
{
|
||||
<h4>Completed</h4>
|
||||
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Loading Job Status..</li>
|
||||
</ul>
|
||||
}
|
||||
else if (completedEntries.Count == 0)
|
||||
{
|
||||
<h4>Completed</h4>
|
||||
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">No jobs currently executing</li>
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h4>Completed (@completedEntries.Count)</h4>
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach (var entry in completedEntries)
|
||||
{
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto w-100">
|
||||
<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.Name</span>
|
||||
</div>
|
||||
<ul>
|
||||
<li>Execution Time: @((int)entry.ExecutionTime.TotalSeconds)s</li>
|
||||
<li>Started: @entry.StartTime.ToLongTimeString()</li>
|
||||
<li>Completed: @entry.CompleteTime.ToLongTimeString()</li>
|
||||
</ul>
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">Completed @entry.CompleteTime.ToLongTimeString()</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
private DateTime today;
|
||||
private List<StatusItem>? executingEntries;
|
||||
private List<StatusItem>? completedEntries;
|
||||
|
||||
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;
|
||||
|
||||
executingEntries = response.jobStatus.
|
||||
Where(s => s.ProgressTotal > 0).
|
||||
Where(s => s.Executing).
|
||||
ToList();
|
||||
|
||||
completedEntries = response.jobStatus.
|
||||
Where(s => !s.Executing).
|
||||
Where(s => s.StartTime.AddMinutes(1) > DateTime.Now).
|
||||
ToList();
|
||||
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user