#153 long running jobs in UI
This commit is contained in:
parent
b8f65f965a
commit
a949113d3f
31
GanjooRazor/Areas/Admin/Pages/LongRunningJobs.cshtml
Normal file
31
GanjooRazor/Areas/Admin/Pages/LongRunningJobs.cshtml
Normal file
@ -0,0 +1,31 @@
|
||||
@page
|
||||
@model GanjooRazor.Areas.Admin.Pages.LongRunningJobsModel
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = "_AdminLayout";
|
||||
ViewData["Title"] = "کارهای جاری";
|
||||
}
|
||||
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>کار</th>
|
||||
<th>شروع</th>
|
||||
<th>گام</th>
|
||||
<th>پیشرفت</th>
|
||||
<th>موفق</th>
|
||||
<th>خطا</th>
|
||||
</tr>
|
||||
@foreach (var job in Model.Jobs)
|
||||
{
|
||||
<tr>
|
||||
<td>@job.Name</td>
|
||||
<td>@job.StartTime</td>
|
||||
<td>@job.Step</td>
|
||||
<td>@job.Progress</td>
|
||||
<td>@job.Succeeded</td>
|
||||
<td>@job.Exception</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
32
GanjooRazor/Areas/Admin/Pages/LongRunningJobs.cshtml.cs
Normal file
32
GanjooRazor/Areas/Admin/Pages/LongRunningJobs.cshtml.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using GanjooRazor.Utils;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Newtonsoft.Json;
|
||||
using RSecurityBackend.Models.Generic.Db;
|
||||
|
||||
namespace GanjooRazor.Areas.Admin.Pages
|
||||
{
|
||||
public class LongRunningJobsModel : PageModel
|
||||
{
|
||||
public RLongRunningJobStatus[] Jobs { get; set; }
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
using (HttpClient secureClient = new HttpClient())
|
||||
{
|
||||
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
|
||||
{
|
||||
var response = await secureClient.GetAsync($"{APIRoot.Url}/api/rjobs");
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
Jobs = JsonConvert.DeserializeObject<RLongRunningJobStatus[]>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return Page();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,6 +166,14 @@
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Admin" asp-page="LongRunningJobs">کارها</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user