209 lines
6.4 KiB
Plaintext
209 lines
6.4 KiB
Plaintext
@namespace Oqtane.Modules.Admin.Logs
|
|
@using System.Globalization
|
|
@inherits ModuleBase
|
|
@inject NavigationManager NavigationManager
|
|
@inject ILogService LogService
|
|
@inject IPageService PageService
|
|
@inject IPageModuleService PageModuleService
|
|
@inject IUserService UserService
|
|
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Date/Time: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_logDate" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Level: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_level" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Feature: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_feature" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Function: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_function" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Category: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_category" disabled />
|
|
</td>
|
|
</tr>
|
|
@if (_pageName != "")
|
|
{
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Page: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_pageName" disabled />
|
|
</td>
|
|
</tr>
|
|
}
|
|
@if (_moduleTitle != "")
|
|
{
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Module: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_moduleTitle" disabled />
|
|
</td>
|
|
</tr>
|
|
}
|
|
@if (_username != "")
|
|
{
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">User: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_username" disabled />
|
|
</td>
|
|
</tr>
|
|
}
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Url: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_url" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Template: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_template" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Message: </label>
|
|
</td>
|
|
<td>
|
|
<textarea class="form-control" @bind="@_message" rows="5" disabled></textarea>
|
|
</td>
|
|
</tr>
|
|
@if (!string.IsNullOrEmpty(_exception))
|
|
{
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Exception: </label>
|
|
</td>
|
|
<td>
|
|
<textarea class="form-control" @bind="@_exception" rows="5" disabled></textarea>
|
|
</td>
|
|
</tr>
|
|
}
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Properties: </label>
|
|
</td>
|
|
<td>
|
|
<textarea class="form-control" @bind="@_properties" rows="5" disabled></textarea>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label class="control-label">Server: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@_server" disabled />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
|
|
|
@code {
|
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
|
|
|
int _logId;
|
|
string _logDate = "";
|
|
string _level = "";
|
|
string _feature = "";
|
|
string _function = "";
|
|
string _category = "";
|
|
string _pageName = "";
|
|
string _moduleTitle = "";
|
|
string _username = "";
|
|
string _url = "";
|
|
string _template = "";
|
|
string _message = "";
|
|
string _exception = "";
|
|
string _properties = "";
|
|
string _server = "";
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
_logId = Int32.Parse(PageState.QueryString["id"]);
|
|
Log log = await LogService.GetLogAsync(_logId);
|
|
if (log != null)
|
|
{
|
|
_logDate = log.LogDate.ToString(CultureInfo.CurrentCulture);
|
|
_level = log.Level;
|
|
_feature = log.Feature;
|
|
_function = log.Function;
|
|
_category = log.Category;
|
|
if (log.PageId != null)
|
|
{
|
|
Page page = await PageService.GetPageAsync(log.PageId.Value);
|
|
if (page != null)
|
|
{
|
|
_pageName = page.Name;
|
|
}
|
|
}
|
|
if (log.PageId != null && log.ModuleId != null)
|
|
{
|
|
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(log.PageId.Value, log.ModuleId.Value);
|
|
if (pagemodule != null)
|
|
{
|
|
_moduleTitle = pagemodule.Title;
|
|
}
|
|
}
|
|
if (log.UserId != null)
|
|
{
|
|
User user = await UserService.GetUserAsync(log.UserId.Value, PageState.Site.SiteId);
|
|
if (user != null)
|
|
{
|
|
_username = user.Username;
|
|
}
|
|
}
|
|
_url = log.Url;
|
|
_template = log.MessageTemplate;
|
|
_message = log.Message;
|
|
_exception = log.Exception;
|
|
_properties = log.Properties;
|
|
_server = log.Server;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
await logger.LogError(ex, "Error Loading Log {LogId} {Error}", _logId, ex.Message);
|
|
AddModuleMessage("Error Loading Log", MessageType.Error);
|
|
}
|
|
}
|
|
}
|