Merge pull request #922 from hishamco/localize-jobs-pages

Localize Jobs Pages
This commit is contained in:
Shaun Walker 2020-11-20 10:23:21 -05:00 committed by GitHub
commit 0a7e2dba84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 53 deletions

View File

@ -1,12 +1,13 @@
@namespace Oqtane.Modules.Admin.Jobs
@namespace Oqtane.Modules.Admin.Jobs
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IJobService JobService
@inject IStringLocalizer<Add> Localizer
<table class="table table-borderless">
<tr>
<td>
<Label For="name" HelpText="Enter the job name">Name: </Label>
<Label For="name" HelpText="Enter the job name" ResourceKey="Name">Name: </Label>
</td>
<td>
<input id="name" class="form-control" @bind="@_name" />
@ -14,7 +15,7 @@
</tr>
<tr>
<td>
<Label For="type" HelpText="Enter the job type">Type: </Label>
<Label For="type" HelpText="Enter the job type" ResourceKey="Type">Type: </Label>
</td>
<td>
<input id="type" class="form-control" @bind="@_jobType" />
@ -22,32 +23,32 @@
</tr>
<tr>
<td>
<Label For="enabled" HelpText="Select whether you want the job enabled or not">Enabled? </Label>
<Label For="enabled" HelpText="Select whether you want the job enabled or not" ResourceKey="Enabled">Enabled? </Label>
</td>
<td>
<select id="enabled" class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
<option value="True">@Localizer["Yes"]</option>
<option value="False">@Localizer["No"]</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="runs-every" HelpText="Select how often you want the job to run">Runs Every: </Label>
<Label For="runs-every" HelpText="Select how often you want the job to run" ResourceKey="RunsEvery">Runs Every: </Label>
</td>
<td>
<input id="runs-every" class="form-control" @bind="@_interval" />
<select id="runs-every" class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
<option value="M">Month(s)</option>
<option value="m">@Localizer["Minute(s)"]</option>
<option value="H">@Localizer["Hour(s)"]</option>
<option value="d">@Localizer["Day(s)"]</option>
<option value="M">@Localizer["Month(s)"]</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="starting" HelpText="What time do you want the job to start">Starting: </Label>
<Label For="starting" HelpText="What time do you want the job to start" ResourceKey="Starting">Starting: </Label>
</td>
<td>
<input id="starting" class="form-control" @bind="@_startDate" />
@ -55,7 +56,7 @@
</tr>
<tr>
<td>
<Label For="ending" HelpText="When do you want the job to end">Ending: </Label>
<Label For="ending" HelpText="When do you want the job to end" ResourceKey="Ending">Ending: </Label>
</td>
<td>
<input id="ending" class="form-control" @bind="@_endDate" />
@ -63,15 +64,15 @@
</tr>
<tr>
<td>
<Label For="retention-log" HelpText="What items do you want in the retention log">Retention Log (Items): </Label>
<Label For="retention-log" HelpText="What items do you want in the retention log" ResourceKey="RetentionLog">Retention Log (Items): </Label>
</td>
<td>
<input id="retention-log" class="form-control" @bind="@_retentionHistory" />
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="SaveJob">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<button type="button" class="btn btn-success" @onclick="SaveJob">@Localizer["Save"]</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
@code {
private string _name = string.Empty;

View File

@ -1,12 +1,13 @@
@namespace Oqtane.Modules.Admin.Jobs
@namespace Oqtane.Modules.Admin.Jobs
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IJobService JobService
@inject IStringLocalizer<Edit> Localizer
<table class="table table-borderless">
<tr>
<td>
<Label For="name" HelpText="Enter the job name">Name: </Label>
<Label For="name" HelpText="Enter the job name" ResourceKey="Name">Name: </Label>
</td>
<td>
<input id="name" class="form-control" @bind="@_name" />
@ -14,7 +15,7 @@
</tr>
<tr>
<td>
<Label For="type" HelpText="Enter the job type">Type: </Label>
<Label For="type" HelpText="Enter the job type" ResourceKey="Type">Type: </Label>
</td>
<td>
<input id="type" class="form-control" @bind="@_jobType" />
@ -22,32 +23,32 @@
</tr>
<tr>
<td>
<Label For="enabled" HelpText="Select whether you want the job enabled or not">Enabled? </Label>
<Label For="enabled" HelpText="Select whether you want the job enabled or not" ResourceKey="Enabled">Enabled? </Label>
</td>
<td>
<select id="enabled" class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
<option value="True">@Localizer["Yes"]</option>
<option value="False">@Localizer["No"]</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="runs-every" HelpText="Select how often you want the job to run">Runs Every: </Label>
<Label For="runs-every" HelpText="Select how often you want the job to run" ResourceKey="RunsEvery">Runs Every: </Label>
</td>
<td>
<input id="runs-every" class="form-control" @bind="@_interval" />
<select id="runs-every" class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
<option value="M">Month(s)</option>
<option value="m">@Localizer["Minute(s)"]</option>
<option value="H">@Localizer["Hour(s)"]</option>
<option value="d">@Localizer["Day(s)"]</option>
<option value="M">@Localizer["Month(s)"]</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="starting" HelpText="What time do you want the job to start">Starting: </Label>
<Label For="starting" HelpText="What time do you want the job to start" ResourceKey="Starting">Starting: </Label>
</td>
<td>
<input id="starting" class="form-control" @bind="@_startDate" />
@ -55,7 +56,7 @@
</tr>
<tr>
<td>
<Label For="ending" HelpText="When do you want the job to end">Ending: </Label>
<Label For="ending" HelpText="When do you want the job to end" ResourceKey="Ending">Ending: </Label>
</td>
<td>
<input id="ending" class="form-control" @bind="@_endDate" />
@ -63,7 +64,7 @@
</tr>
<tr>
<td>
<Label For="retention" HelpText="Number of log entries to retain for this job">Retention Log (Items): </Label>
<Label For="retention" HelpText="Number of log entries to retain for this job" ResourceKey="RetentionLog">Retention Log (Items): </Label>
</td>
<td>
<input id="retention" class="form-control" @bind="@_retentionHistory" />
@ -71,15 +72,15 @@
</tr>
<tr>
<td>
<Label For="next" HelpText="Next execution for this job.">Next Execution: </Label>
<Label For="next" HelpText="Next execution for this job." ResourceKey="NextExecution">Next Execution: </Label>
</td>
<td>
<input id="next" class="form-control" @bind="@_nextExecution" />
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="SaveJob">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<button type="button" class="btn btn-success" @onclick="SaveJob">@Localizer["Save"]</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
@code {
private int _jobId;
@ -158,7 +159,7 @@
{
job.NextExecution = DateTime.Parse(_nextExecution);
}
job.RetentionHistory = int.Parse(_retentionHistory);
try

View File

@ -1,15 +1,15 @@
@namespace Oqtane.Modules.Admin.Jobs
@namespace Oqtane.Modules.Admin.Jobs
@inherits ModuleBase
@inject IJobService JobService
@if (_jobs == null)
{
<p><em>Loading...</em></p>
<p><em>@Localizer["Loading..."]</em></p>
}
else
{
<ActionLink Action="Add" Text="Add Job" />
<ActionLink Action="Log" Class="btn btn-secondary" Text="View Logs" />
<ActionLink Action="Add" Text="Add Job" ResourceKey="AddJob" />
<ActionLink Action="Log" Class="btn btn-secondary" Text="View Logs" ResourceKey="ViewJobs" />
<button type="button" class="btn btn-secondary" @onclick="(async () => await Refresh())">Refresh</button>
<br /><br />
@ -18,16 +18,16 @@ else
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th>Name</th>
<th>Status</th>
<th>Frequency</th>
<th>Next Execution</th>
<th>@Localizer["Name"]</th>
<th>@Localizer["Status"]</th>
<th>@Localizer["Frequency"]</th>
<th>@Localizer["Next Execution"]</th>
<th style="width: 1px;">&nbsp;</th>
</Header>
<Row>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.JobId.ToString())" /></td>
<td><ActionDialog Header="Delete Job" Message="@("Are You Sure You Wish To Delete This Job?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteJob(context))" /></td>
<td><ActionLink Action="Log" Class="btn btn-secondary" Parameters="@($"id=" + context.JobId.ToString())" /></td>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.JobId.ToString())" ResourceKey="EditJob" /></td>
<td><ActionDialog Header="Delete Job" Message="@("Are You Sure You Wish To Delete This Job?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteJob(context))" ResourceKey="DeleteJob" /></td>
<td><ActionLink Action="Log" Class="btn btn-secondary" Parameters="@($"id=" + context.JobId.ToString())" ResourceKey="JobLog" /></td>
<td>@context.Name</td>
<td>@DisplayStatus(context.IsEnabled, context.IsExecuting)</td>
<td>@DisplayFrequency(context.Interval, context.Frequency)</td>
@ -35,11 +35,11 @@ else
<td>
@if (context.IsStarted)
{
<button type="button" class="btn btn-danger" @onclick="(async () => await StopJob(context.JobId))">Stop</button>
<button type="button" class="btn btn-danger" @onclick="(async () => await StopJob(context.JobId))">@Localizer["Stop"]</button>
}
else
{
<button type="button" class="btn btn-success" @onclick="(async () => await StartJob(context.JobId))">Start</button>
<button type="button" class="btn btn-success" @onclick="(async () => await StartJob(context.JobId))">@Localizer["Start"]</button>
}
</td>
</Row>

View File

@ -1,19 +1,20 @@
@namespace Oqtane.Modules.Admin.Jobs
@namespace Oqtane.Modules.Admin.Jobs
@inherits ModuleBase
@inject IJobLogService JobLogService
@inject IStringLocalizer<Log> Localizer
@if (_jobLogs == null)
{
<p><em>Loading...</em></p>
<p><em>@Localizer["Loading..."]</em></p>
}
else
{
<Pager Items="@_jobLogs">
<Header>
<th>Name</th>
<th>Status</th>
<th>Started</th>
<th>Finished</th>
<th>@Localizer["Name"]</th>
<th>@Localizer["Status"]</th>
<th>@Localizer["Started"]</th>
<th>@Localizer["Finished"]</th>
</Header>
<Row>
<td>@context.Job.Name</td>