feat(#I12CD2): 后台状态栏与任务管理关联
#Comment comment #I12CD2 #Issue close #I12CD2
This commit is contained in:
parent
a169ff89c1
commit
43a866220b
|
@ -15,7 +15,7 @@
|
|||
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.1-beta6" />
|
||||
<PackageReference Include="Longbow.Configuration" Version="2.2.7" />
|
||||
<PackageReference Include="Longbow.Logging" Version="3.0.0" />
|
||||
<PackageReference Include="Longbow.Tasks" Version="2.2.24" />
|
||||
<PackageReference Include="Longbow.Tasks" Version="2.2.25-beta1" />
|
||||
<PackageReference Include="Longbow.Web" Version="3.0.0-beta1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.0.0-preview8.19405.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
|
||||
|
|
|
@ -2,18 +2,19 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Longbow.Tasks;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers.Api
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// 系统通知控制器
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class NotificationsController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// 后台 Header 状态条调用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
|
@ -36,7 +37,7 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
});
|
||||
|
||||
// Tasks
|
||||
var task = TaskHelper.Retrieves();
|
||||
var task = TaskServicesManager.ToList().Where(s => s.NextRuntime != null).Select(s => new { s.Name, s.LastRuntime, s.LastRunResult });
|
||||
var tasksCount = task.Count();
|
||||
|
||||
//Message
|
||||
|
|
|
@ -455,3 +455,14 @@ pre {
|
|||
.refreshIcon:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.header .badge.badge-task {
|
||||
right: 8px;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
.header .content-task {
|
||||
position: relative;
|
||||
top: 6px;
|
||||
right: 26px;
|
||||
}
|
|
@ -72,9 +72,13 @@
|
|||
|
||||
// tasks
|
||||
$('#msgHeaderTask').text(result.TasksCount);
|
||||
var htmlUserTemplate = '<a class="dropdown-item" href="{4}?id={3}"><span class="desc">{0}-{2}</span><span class="percent">{1}%</span></span><div class="progress progress-striped"><div class="progress-bar" role="progressbar" aria-valuenow="{1}" aria-valuemin="0" aria-valuemax="100" style="width: {1}%"><span class="sr-only">{1}% 完成</span></div></div></a>';
|
||||
var resultFormat = {
|
||||
"Success": '<span class="badge badge-pill badge-success badge-task"><i class="fa fa-check-circle"></i><span>成功</span></span>',
|
||||
"Timeout": '<span class="badge badge-pill badge-warning badge-task"><i class="fa fa-exclamation-circle"></i><span>亚健康</span></span>'
|
||||
}
|
||||
var htmlUserTemplate = '<a class="dropdown-item position-relative" href="{0}"><span class="label label-primary"><i class="fa fa-thumb-tack"></i></span><div class="content">{1}</div><div class="small italic content-task">{2}</div>{3}</a>';
|
||||
var html = result.Tasks.map(function (u) {
|
||||
return $.format(htmlUserTemplate, u.TaskName, u.TaskProgress, u.AssignDisplayName, u.Id, $.formatUrl('Admin/Tasks'));
|
||||
return $.format(htmlUserTemplate, $.formatUrl('Admin/Tasks'), u.Name, u.LastRuntime, resultFormat[u.LastRunResult]);
|
||||
}).join('');
|
||||
$(html).insertAfter($('#msgHeaderTaskContent'));
|
||||
|
||||
|
|
Loading…
Reference in New Issue