oqtane.framework/Oqtane.Client/Modules/Admin/Jobs/Log.razor
Hisham Bin Ateya 66ad089088
Refactoring (#314)
* Refactoring

* Refactoring

* Check for a valid email.

* Fixed missing character.

* Moved logic to  the Utilities class.

* Rename template .sql file

* Modified null and empty string check.

* Check for a valid email.

* Fixed missing character.

* Moved logic to  the Utilities class.

* Added Favicon support, Progressive Web App support, page title and url support, and private/public user registration options

* Refactoring

* Refactoring

* Check for a valid email.

* Moved logic to  the Utilities class.

Co-authored-by: Aubrey <aubrey.b@treskcow.tech>
Co-authored-by: MIchael Atwood <matwood@dragonmastery.com>
Co-authored-by: Shaun Walker <shaun.walker@siliqon.com>
2020-03-31 10:21:05 -04:00

69 lines
1.6 KiB
Plaintext

@namespace Oqtane.Modules.Admin.Jobs
@inherits ModuleBase
@inject IJobLogService JobLogService
@if (_jobLogs == null)
{
<p><em>Loading...</em></p>
}
else
{
<Pager Items="@_jobLogs">
<Header>
<th>Name</th>
<th>Status</th>
<th>Started</th>
<th>Finished</th>
</Header>
<Row>
<td>@context.Job.Name</td>
<td>@DisplayStatus(context.Job.IsExecuting, context.Succeeded)</td>
<td>@context.StartDate</td>
<td>@context.FinishDate</td>
</Row>
<Detail>
<td colspan="4">@context.Notes</td>
</Detail>
</Pager>
}
@code {
private List<JobLog> _jobLogs;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
protected override async Task OnParametersSetAsync()
{
_jobLogs = await JobLogService.GetJobLogsAsync();
if (PageState.QueryString.ContainsKey("id"))
{
_jobLogs = _jobLogs.Where(item => item.JobId == Int32.Parse(PageState.QueryString["id"])).ToList();
}
_jobLogs = _jobLogs.OrderByDescending(item => item.JobLogId).ToList();
}
private string DisplayStatus(bool isExecuting, bool? succeeded)
{
var status = string.Empty;
if (isExecuting)
{
status = "Executing";
}
else
{
if (succeeded != null && succeeded.Value)
{
status = "Succeeded";
}
else
{
status = "Failed";
}
}
return status;
}
}