07-12-2022
This commit is contained in:
@@ -49,7 +49,8 @@ else
|
||||
</div>
|
||||
|
||||
<div class="btn-group mt-3" role="group" aria-label="Basic example">
|
||||
<a class="btn btn-secondary" href="jobs/@job.Id">
|
||||
|
||||
<a class="btn btn-secondary" href="@GetBackUrl()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z" />
|
||||
</svg> Back
|
||||
@@ -73,6 +74,11 @@ else
|
||||
private JobDefinition? job = new();
|
||||
private List<JobType>? types;
|
||||
|
||||
protected string GetBackUrl()
|
||||
{
|
||||
return JobId == Constants.ENTITY_ID_NEW ? "jobs" : $"jobs/{JobId}";
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
types = await Jobs.GetJobTypes();
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
|
||||
<div class="progress">
|
||||
<div class="progress" style="height: 30px;">
|
||||
<div class="progress-bar"
|
||||
role="progressbar"
|
||||
style="width: @getCompletedPercent(jobStatus)%"
|
||||
aria-label="Job Status in %"
|
||||
role="progressbar"
|
||||
style="width: @getCompletedPercent(jobStatus)%"
|
||||
aria-label="Job Status in %"
|
||||
aria-valuenow="@getCompletedPercent(jobStatus)"
|
||||
aria-valuemin="0"
|
||||
aria-valuemax="100"
|
||||
></div>
|
||||
>@jobStatus.ProgressCurrent/@jobStatus.ProgressTotal</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public StatusItem? jobStatus { get; set; }
|
||||
|
||||
protected float getCompletedPercent(StatusItem? entry)
|
||||
protected int getCompletedPercent(StatusItem? entry)
|
||||
{
|
||||
if (entry != null && entry.ProgressCurrent > 0 && entry.ProgressTotal > 0)
|
||||
{
|
||||
return ((float)entry.ProgressCurrent / (float)entry.ProgressTotal) * 100;
|
||||
float fraction = (float)entry.ProgressCurrent / entry.ProgressTotal;
|
||||
float percent = fraction * 100;
|
||||
return (int)percent;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -35,9 +35,7 @@ namespace ECM.JobRunner.Web.Data
|
||||
private async void PollingTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
OnDataUpdated(await GetData());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async Task<DashboardResponse> GetData()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ else
|
||||
</svg>
|
||||
<span>@entry.JobName</span>
|
||||
</div>
|
||||
@entry.Message
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">@entry.CreatedAt.ToShortTimeString()</span>
|
||||
</li>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<h3>Jobs</h3>
|
||||
|
||||
@if (jobs == null)
|
||||
@if (filteredJobs == null)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Loading Jobs..</li>
|
||||
@@ -15,8 +15,22 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<section class="mb-3">
|
||||
<input class="form-control" placeholder="Enter a filter query and press ENTER" type="text" @bind="FilterQuery" />
|
||||
</section>
|
||||
|
||||
<div class="list-group">
|
||||
@foreach (var job in jobs)
|
||||
@if (filteredJobs.Count() == 0)
|
||||
{
|
||||
<a class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
No Jobs found.
|
||||
</div>
|
||||
|
||||
</a>
|
||||
}
|
||||
|
||||
@foreach (var job in filteredJobs)
|
||||
{
|
||||
<a class="list-group-item list-group-item-action d-flex justify-content-between align-items-start" href="/jobs/@job.Id">
|
||||
<div class="ms-2 me-auto">
|
||||
@@ -44,7 +58,7 @@ else
|
||||
|
||||
@if (job.Active)
|
||||
{
|
||||
<span class="badge bg-primary rounded-pill">Running</span>
|
||||
<span class="badge bg-success rounded-pill">Running</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -66,11 +80,36 @@ else
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<JobDefinition>? jobs;
|
||||
private IEnumerable<JobDefinition>? jobs;
|
||||
private IEnumerable<JobDefinition>? filteredJobs;
|
||||
|
||||
private string filterQuery = "";
|
||||
private string FilterQuery {
|
||||
get { return filterQuery; }
|
||||
set {
|
||||
filterQuery = value;
|
||||
OnFilterChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected async override void OnInitialized()
|
||||
{
|
||||
jobs = await Jobs.GetJobs();
|
||||
filteredJobs = jobs;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected void OnFilterChanged()
|
||||
{
|
||||
if (jobs != null)
|
||||
{
|
||||
filteredJobs = jobs.Where(j => j.Name.Contains(FilterQuery, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
} else
|
||||
{
|
||||
filteredJobs = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,20 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<h3>@job.Name</h3>
|
||||
<h3>@job.Name</h3>
|
||||
|
||||
<ul class="list-group">
|
||||
<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-info-square" viewBox="0 0 16 16">
|
||||
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" />
|
||||
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
|
||||
</svg> Active
|
||||
</div>
|
||||
@job.Active
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">
|
||||
@@ -102,8 +113,10 @@ else
|
||||
bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?");
|
||||
if (confirmed)
|
||||
{
|
||||
await Jobs.DeleteJob(job);
|
||||
Navigation.NavigateTo($"/jobs");
|
||||
if (await Jobs.DeleteJob(job) == true)
|
||||
{
|
||||
Navigation.NavigateTo($"/jobs");
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
Navigation.NavigateTo($"/jobs");
|
||||
Navigation.NavigateTo("/jobs");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Components.Status;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@inject DashboardService Api
|
||||
@inject DashboardService Dashboard;
|
||||
|
||||
<PageTitle>Status</PageTitle>
|
||||
|
||||
@@ -31,17 +31,16 @@
|
||||
<ul class="list-group">
|
||||
@foreach (var entry in executingEntries)
|
||||
{
|
||||
<li class="list-group-item">
|
||||
<li class="list-group-item" @key="entry.Id">
|
||||
<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 xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear text-primary" viewBox="0 0 16 16">
|
||||
<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z" />
|
||||
<path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z" />
|
||||
</svg>
|
||||
<span>@entry.Name</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">Started @entry.StartTime.ToLongTimeString()</span>
|
||||
</div>
|
||||
@@ -91,7 +90,7 @@ else
|
||||
<li>Completed: @entry.CompleteTime.ToLongTimeString()</li>
|
||||
</ul>
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">Completed @entry.CompleteTime.ToLongTimeString()</span>
|
||||
<span class="badge bg-success rounded-pill">Completed @entry.CompleteTime.ToLongTimeString()</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@@ -105,13 +104,13 @@ else
|
||||
|
||||
protected async override void OnInitialized()
|
||||
{
|
||||
DashboardResponse data = await Api.GetData();
|
||||
DashboardResponse data = await Dashboard.GetData();
|
||||
UpdateData(data);
|
||||
|
||||
Api.DataUpdated += Api_DataUpdated;
|
||||
Dashboard.DataUpdated += Dashboard_DataUpdated;
|
||||
}
|
||||
|
||||
protected void Api_DataUpdated(object sender, DashboardResponse e)
|
||||
protected void Dashboard_DataUpdated(object sender, DashboardResponse e)
|
||||
{
|
||||
UpdateData(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user