Merge pull request #920 from hishamco/localize-logs-pages

Localize Logs Pages
This commit is contained in:
Shaun Walker 2020-11-20 10:22:51 -05:00 committed by GitHub
commit c205b9f930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 128 additions and 126 deletions

View File

@ -1,4 +1,4 @@
@namespace Oqtane.Modules.Admin.Logs @namespace Oqtane.Modules.Admin.Logs
@using System.Globalization @using System.Globalization
@inherits ModuleBase @inherits ModuleBase
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@ -6,11 +6,12 @@
@inject IPageService PageService @inject IPageService PageService
@inject IPageModuleService PageModuleService @inject IPageModuleService PageModuleService
@inject IUserService UserService @inject IUserService UserService
@inject IStringLocalizer<Index> Localizer
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<Label For="dateTime" HelpText="The date and time of this log">Date/Time: </Label> <Label For="dateTime" HelpText="The date and time of this log" ResourceKey="DateTime">Date/Time: </Label>
</td> </td>
<td> <td>
<input id="dateTime" class="form-control" @bind="@_logDate" readonly /> <input id="dateTime" class="form-control" @bind="@_logDate" readonly />
@ -18,7 +19,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="level" HelpText="The level of this log">Level: </Label> <Label For="level" HelpText="The level of this log" ResourceKey="Level">Level: </Label>
</td> </td>
<td> <td>
<input id="level" class="form-control" @bind="@_level" readonly /> <input id="level" class="form-control" @bind="@_level" readonly />
@ -26,7 +27,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="feature" HelpText="The feature that was affected">Feature: </Label> <Label For="feature" HelpText="The feature that was affected" ResourceKey="Feature">Feature: </Label>
</td> </td>
<td> <td>
<input id="feature" class="form-control" @bind="@_feature" readonly /> <input id="feature" class="form-control" @bind="@_feature" readonly />
@ -34,7 +35,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="function" HelpText="The function that was performed">Function: </Label> <Label For="function" HelpText="The function that was performed" ResourceKey="Function">Function: </Label>
</td> </td>
<td> <td>
<input id="function" class="form-control" @bind="@_function" readonly /> <input id="function" class="form-control" @bind="@_function" readonly />
@ -42,7 +43,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="category" HelpText="The categories that were affected">Category: </Label> <Label For="category" HelpText="The categories that were affected" ResourceKey="Category">Category: </Label>
</td> </td>
<td> <td>
<input id="category" class="form-control" @bind="@_category" readonly /> <input id="category" class="form-control" @bind="@_category" readonly />
@ -52,7 +53,7 @@
{ {
<tr> <tr>
<td> <td>
<Label For="page" HelpText="The page that was affected">Page: </Label> <Label For="page" HelpText="The page that was affected" ResourceKey="Page">Page: </Label>
</td> </td>
<td> <td>
<input id="page" class="form-control" @bind="@_pageName" readonly /> <input id="page" class="form-control" @bind="@_pageName" readonly />
@ -63,7 +64,7 @@
{ {
<tr> <tr>
<td> <td>
<Label For="module" HelpText="The module that was affected">Module: </Label> <Label For="module" HelpText="The module that was affected" ResourceKey="Module">Module: </Label>
</td> </td>
<td> <td>
<input id="module" class="form-control" @bind="@_moduleTitle" readonly /> <input id="module" class="form-control" @bind="@_moduleTitle" readonly />
@ -74,7 +75,7 @@
{ {
<tr> <tr>
<td> <td>
<Label For="user" HelpText="The user that caused this log">User: </Label> <Label For="user" HelpText="The user that caused this log" ResourceKey="User">User: </Label>
</td> </td>
<td> <td>
<input id="user" class="form-control" @bind="@_username" readonly /> <input id="user" class="form-control" @bind="@_username" readonly />
@ -83,7 +84,7 @@
} }
<tr> <tr>
<td> <td>
<Label For="url" HelpText="The url the log comes from">Url: </Label> <Label For="url" HelpText="The url the log comes from" ResourceKey="Url">Url: </Label>
</td> </td>
<td> <td>
<input id="url" class="form-control" @bind="@_url" readonly /> <input id="url" class="form-control" @bind="@_url" readonly />
@ -91,7 +92,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="template" HelpText="What the log is about">Template: </Label> <Label For="template" HelpText="What the log is about" ResourceKey="Template">Template: </Label>
</td> </td>
<td> <td>
<input id="template" class="form-control" @bind="@_template" readonly /> <input id="template" class="form-control" @bind="@_template" readonly />
@ -99,7 +100,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="message" HelpText="The message that the system generated"class="control-label">Message: </Label> <Label For="message" HelpText="The message that the system generated" class="control-label" ResourceKey="Message">Message: </Label>
</td> </td>
<td> <td>
<textarea id="message" class="form-control" @bind="@_message" rows="5" readonly></textarea> <textarea id="message" class="form-control" @bind="@_message" rows="5" readonly></textarea>
@ -109,7 +110,7 @@
{ {
<tr> <tr>
<td> <td>
<Label For="exception" HelpText="The exceptions generated by the system">Exception: </Label> <Label For="exception" HelpText="The exceptions generated by the system" ResourceKey="Exception">Exception: </Label>
</td> </td>
<td> <td>
<textarea id="exception" class="form-control" @bind="@_exception" rows="5" readonly></textarea> <textarea id="exception" class="form-control" @bind="@_exception" rows="5" readonly></textarea>
@ -118,7 +119,7 @@
} }
<tr> <tr>
<td> <td>
<Label For="properties" HelpText="The properties that were affected">Properties: </Label> <Label For="properties" HelpText="The properties that were affected" ResourceKey="Properties">Properties: </Label>
</td> </td>
<td> <td>
<textarea id="properties" class="form-control" @bind="@_properties" rows="5" readonly></textarea> <textarea id="properties" class="form-control" @bind="@_properties" rows="5" readonly></textarea>
@ -126,14 +127,14 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="server" HelpText="The server that was affected">Server: </Label> <Label For="server" HelpText="The server that was affected" ResourceKey="Server">Server: </Label>
</td> </td>
<td> <td>
<input id="server" class="form-control" @bind="@_server" readonly /> <input id="server" class="form-control" @bind="@_server" readonly />
</td> </td>
</tr> </tr>
</table> </table>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
@code { @code {
private int _logId; private int _logId;

View File

@ -1,17 +1,18 @@
@namespace Oqtane.Modules.Admin.Logs @namespace Oqtane.Modules.Admin.Logs
@inherits ModuleBase @inherits ModuleBase
@inject ILogService LogService @inject ILogService LogService
@inject IStringLocalizer<Index> Localizer
@if (_logs == null) @if (_logs == null)
{ {
<p><em>Loading...</em></p> <p><em>@Localizer["Loading..."]</em></p>
} }
else else
{ {
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<label>Level: </label> <label>@Localizer["Level:"] </label>
<select class="form-control" @onchange="(e => LevelChanged(e))"> <select class="form-control" @onchange="(e => LevelChanged(e))">
<option value="-">&lt;All Levels&gt;</option> <option value="-">&lt;All Levels&gt;</option>
<option value="Trace">Trace</option> <option value="Trace">Trace</option>
@ -23,19 +24,19 @@ else
</select> </select>
</td> </td>
<td> <td>
<label>Function: </label> <label>@Localizer["Function:"] </label>
<select class="form-control" @onchange="(e => FunctionChanged(e))"> <select class="form-control" @onchange="(e => FunctionChanged(e))">
<option value="-">&lt;All Functions&gt;</option> <option value="-">&lt;@Localizer["All Functions"]&gt;</option>
<option value="Create">Create</option> <option value="Create">@Localizer["Create"]</option>
<option value="Read">Read</option> <option value="Read">@Localizer["Read"]</option>
<option value="Update">Update</option> <option value="Update">@Localizer["Update"]</option>
<option value="Delete">Delete</option> <option value="Delete">@Localizer["Delete"]</option>
<option value="Security">Security</option> <option value="Security">@Localizer["Security"]</option>
<option value="Other">Other</option> <option value="Other">@Localizer["Other"]</option>
</select> </select>
</td> </td>
<td> <td>
<label>Rows: </label> <label>@Localizer["Rows:"] </label>
<select class="form-control" @onchange="(e => RowsChanged(e))"> <select class="form-control" @onchange="(e => RowsChanged(e))">
<option value="10">10</option> <option value="10">10</option>
<option value="50">50</option> <option value="50">50</option>
@ -50,13 +51,13 @@ else
<Pager Items="@_logs"> <Pager Items="@_logs">
<Header> <Header>
<th style="width: 1px;">&nbsp;</th> <th style="width: 1px;">&nbsp;</th>
<th>Date</th> <th>@Localizer["Date"]</th>
<th>Level</th> <th>@Localizer["Level"]</th>
<th>Feature</th> <th>@Localizer["Feature"]</th>
<th>Function</th> <th>@Localizer["Function"]</th>
</Header> </Header>
<Row> <Row>
<td class="@GetClass(context.Function)"><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" /></td> <td class="@GetClass(context.Function)"><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" ResourceKey="LogDetails" /></td>
<td class="@GetClass(context.Function)">@context.LogDate</td> <td class="@GetClass(context.Function)">@context.LogDate</td>
<td class="@GetClass(context.Function)">@context.Level</td> <td class="@GetClass(context.Function)">@context.Level</td>
<td class="@GetClass(context.Function)">@context.Feature</td> <td class="@GetClass(context.Function)">@context.Feature</td>
@ -66,7 +67,7 @@ else
} }
else else
{ {
<p><em>No Logs Match The Criteria Specified</em></p> <p><em>@Localizer["No Logs Match The Criteria Specified"]</em></p>
} }
} }