@namespace Oqtane.Modules.Admin.Logs @inherits ModuleBase @inject ILogService LogService @if (Logs == null) {

Loading...

} else {
@if (Logs.Any()) {
  Date Level Feature Function
@context.LogDate @context.Level @context.Feature @context.Function
} else {

No Logs Match The Criteria Specified

} } @code { public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } } string level = "-"; string function = "-"; string rows = "10"; List Logs; protected override async Task OnInitializedAsync() { try { await GetLogs(); } catch (Exception ex) { await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message); AddModuleMessage("Error Loading Logs", MessageType.Error); } } private async void LevelChanged(ChangeEventArgs e) { try { level = (string)e.Value; await GetLogs(); StateHasChanged(); } catch (Exception ex) { await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message); AddModuleMessage("Error Loading Logs", MessageType.Error); } } private async void FunctionChanged(ChangeEventArgs e) { try { function = (string)e.Value; await GetLogs(); StateHasChanged(); } catch (Exception ex) { await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message); AddModuleMessage("Error Loading Logs", MessageType.Error); } } private async void RowsChanged(ChangeEventArgs e) { try { rows = (string)e.Value; await GetLogs(); StateHasChanged(); } catch (Exception ex) { await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message); AddModuleMessage("Error Loading Logs", MessageType.Error); } } private async Task GetLogs() { 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-success"; break; case "Read": classname = "table-primary"; break; case "Update": classname = "table-warning"; break; case "Delete": classname = "table-danger"; break; case "Security": classname = "table-secondary"; break; default: classname = ""; break; } return classname; } }