event logging fix

This commit is contained in:
Shaun Walker 2019-10-28 09:02:11 -04:00
parent 72c7f4abb0
commit af423edb99
6 changed files with 83 additions and 14 deletions

View File

@ -47,11 +47,11 @@ else
<th>Function</th>
</Header>
<Row>
<td><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" /></td>
<td>@context.LogDate</td>
<td>@context.Level</td>
<td>@context.Feature</td>
<td>@context.Function</td>
<td class="@GetClass(context.Function)"><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" /></td>
<td class="@GetClass(context.Function)">@context.LogDate</td>
<td class="@GetClass(context.Function)">@context.Level</td>
<td class="@GetClass(context.Function)">@context.Feature</td>
<td class="@GetClass(context.Function)">@context.Function</td>
</Row>
</Pager>
}
@ -132,4 +132,31 @@ else
{
Logs = await LogService.GetLogsAsync(PageState.Site.SiteId, ((level == "-") ? "" : level), ((function == "-") ? "" : function), int.Parse(rows));
}
private string GetClass(string function)
{
string classname = "";
switch (function)
{
case "Create":
classname = "table-primary";
break;
case "Read":
classname = "table-secondary";
break;
case "Update":
classname = "table-success";
break;
case "Delete":
classname = "table-danger";
break;
case "Security":
classname = "table-warning";
break;
default:
classname = "";
break;
}
return classname;
}
}

View File

@ -94,9 +94,8 @@ else
}
}
private async Task Upgrade()
private void Upgrade()
{
await InstallationService.Upgrade();
NavigationManager.NavigateTo(NavigateUrl(Reload.Application));
}

View File

@ -5,7 +5,7 @@
<p>
@if(Format == "Table")
{
<table class="table table-borderless">
<table class="@Class">
<thead>
<tr>@Header</tr>
</thead>
@ -19,7 +19,7 @@
}
@if(Format == "Grid")
{
<div class="container">
<div class="@Class">
<div class="row">@Header</div>
@foreach (var item in ItemList)
{
@ -81,6 +81,9 @@
[Parameter]
public string DisplayPages { get; set; }
[Parameter]
public string Class { get; set; }
IEnumerable<TableItem> ItemList { get; set; }
protected override void OnParametersSet()
@ -89,6 +92,17 @@
{
Format = "Table";
}
if (string.IsNullOrEmpty(Class))
{
if (Format == "Table")
{
Class = "table table-borderless";
}
else
{
Class = "container";
}
}
if (string.IsNullOrEmpty(PageSize))
{
MaxItems = 10;

24
Oqtane.Framework.nuspec Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Oqtane.Framework</id>
<version>0.0.1</version>
<authors>Shaun Walker</authors>
<owners>.NET Foundation</owners>
<title>Oqtane Framework</title>
<description>A modular application framework for Blazor</description>
<copyright>.NET Foundation</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
<tags>oqtane framework</tags>
<releaseNotes>Initial Release</releaseNotes>
<summary>A modular application framework for Blazor</summary>
</metadata>
<files>
<file src="Oqtane.Client\bin\Release\netstandard2.0\Oqtane.Client.dll" target="lib" />
<file src="Oqtane.Server\bin\Release\netcoreapp3.0\Oqtane.Server.dll" target="lib" />
<file src="Oqtane.Shared\bin\Release\netstandard2.0\Oqtane.Shared.dll" target="lib" />
</files>
</package>

View File

@ -47,15 +47,17 @@ namespace Oqtane.Infrastructure
log.Url = request.Scheme.ToString() + "://" + request.Host.ToString() + request.Path.ToString() + request.QueryString.ToString();
}
if (Class.GetType() != null)
Type type = Type.GetType(Class.ToString());
if (type != null)
{
log.Category = Class.GetType().AssemblyQualifiedName;
log.Category = type.AssemblyQualifiedName;
log.Feature = Utilities.GetTypeNameLastSegment(log.Category, 0);
}
else
{
log.Category = Class.ToString();
log.Feature = log.Category;
}
log.Feature = Utilities.GetTypeNameLastSegment(log.Category, 0);
log.Function = Enum.GetName(typeof(LogFunction), Function);
log.Level = Enum.GetName(typeof(LogLevel), Level);
if (Exception != null)

3
pack.cmd Normal file
View File

@ -0,0 +1,3 @@
DEL "*.nupkg"
C:\Nuget\nuget.exe pack Oqtane.Framework.nuspec