additional changes for #2228
This commit is contained in:
parent
7d9188b659
commit
6d3a556d34
|
@ -1,15 +1,12 @@
|
|||
@namespace Oqtane.Modules.Admin.Logs
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ILogService LogService
|
||||
@inject ISettingService SettingService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
|
||||
|
||||
@if (_id > 0)
|
||||
{
|
||||
<Detail/>
|
||||
}
|
||||
else if (_logs == null)
|
||||
@if (_logs == null)
|
||||
{
|
||||
<p><em>@SharedLocalizer["Loading"]</em></p>
|
||||
}
|
||||
|
@ -95,7 +92,6 @@ else
|
|||
}
|
||||
|
||||
@code {
|
||||
private int _id = 0;
|
||||
private string _level = "-";
|
||||
private string _function = "-";
|
||||
private string _rows = "10";
|
||||
|
@ -111,7 +107,7 @@ else
|
|||
{
|
||||
if (PageState.QueryString.ContainsKey("id") && int.TryParse(PageState.QueryString["id"], out int id))
|
||||
{
|
||||
_id = id;
|
||||
NavigationManager.NavigateTo(EditUrl(PageState.Page.Path, ModuleState.ModuleId, "Detail", $"id={id}"));
|
||||
}
|
||||
if (PageState.QueryString.ContainsKey("level"))
|
||||
{
|
||||
|
|
|
@ -203,12 +203,15 @@ namespace Oqtane.Infrastructure
|
|||
}
|
||||
if (Enum.Parse<LogLevel>(log.Level) >= notifylevel)
|
||||
{
|
||||
var alias = _tenantManager.GetAlias();
|
||||
foreach (var userrole in _userRoles.GetUserRoles(log.SiteId.Value))
|
||||
{
|
||||
if (userrole.Role.Name == RoleNames.Host)
|
||||
{
|
||||
var url = $"{_accessor.HttpContext.Request.Scheme}://{_tenantManager.GetAlias().Name}/admin/log?id={log.LogId}";
|
||||
var notification = new Notification(log.SiteId.Value, userrole.User, "Site " + log.Level + " Notification", "Please visit " + url + " for more information");
|
||||
var subject = $"{alias.Name} Site {log.Level} Notification";
|
||||
var url = $"{_accessor.HttpContext.Request.Scheme}://{alias.Name}/admin/log?id={log.LogId}";
|
||||
string body = $"Log Message: {log.Message}\n\nPlease visit {url} for more information";
|
||||
var notification = new Notification(log.SiteId.Value, userrole.User, subject, body);
|
||||
_notifications.AddNotification(notification);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user