Log notification improvement

This commit is contained in:
Pavel Vesely 2022-05-31 11:06:00 +02:00
parent 91b9a0280f
commit f06cb0dfbb
2 changed files with 11 additions and 2 deletions

View File

@ -5,7 +5,11 @@
@inject IStringLocalizer<Index> Localizer @inject IStringLocalizer<Index> Localizer
@inject IStringLocalizer<SharedResources> SharedLocalizer @inject IStringLocalizer<SharedResources> SharedLocalizer
@if (_logs == null) @if (_id > 0)
{
<Detail/>
}
else if (_logs == null)
{ {
<p><em>@SharedLocalizer["Loading"]</em></p> <p><em>@SharedLocalizer["Loading"]</em></p>
} }
@ -91,6 +95,7 @@ else
} }
@code { @code {
private int _id = 0;
private string _level = "-"; private string _level = "-";
private string _function = "-"; private string _function = "-";
private string _rows = "10"; private string _rows = "10";
@ -104,6 +109,10 @@ else
{ {
try try
{ {
if (PageState.QueryString.ContainsKey("id") && int.TryParse(PageState.QueryString["id"], out int id))
{
_id = id;
}
if (PageState.QueryString.ContainsKey("level")) if (PageState.QueryString.ContainsKey("level"))
{ {
_level = PageState.QueryString["level"]; _level = PageState.QueryString["level"];

View File

@ -207,7 +207,7 @@ namespace Oqtane.Infrastructure
{ {
if (userrole.Role.Name == RoleNames.Host) if (userrole.Role.Name == RoleNames.Host)
{ {
var url = _accessor.HttpContext.Request.Scheme + "://" + _tenantManager.GetAlias().Name + "/admin/log"; 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 notification = new Notification(log.SiteId.Value, userrole.User, "Site " + log.Level + " Notification", "Please visit " + url + " for more information");
_notifications.AddNotification(notification); _notifications.AddNotification(notification);
} }