Naming fixes

This commit is contained in:
Pavel Vesely
2020-03-14 09:54:48 +01:00
parent 52e31c42f6
commit a06ad38432
34 changed files with 467 additions and 466 deletions

View File

@ -6,26 +6,26 @@
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
<label class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@name" />
<input class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Type: </label>
<label class="control-label">Type: </label>
</td>
<td>
<input class="form-control" @bind="@jobtype" />
<input class="form-control" @bind="@_jobType" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Enabled? </label>
<label class="control-label">Enabled? </label>
</td>
<td>
<select class="form-control" @bind="@isenabled">
<select class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
@ -33,11 +33,11 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Runs Every: </label>
<label class="control-label">Runs Every: </label>
</td>
<td>
<input class="form-control" @bind="@interval" />
<select class="form-control" @bind="@frequency">
<input class="form-control" @bind="@_interval" />
<select class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
@ -47,26 +47,26 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Starting: </label>
<label class="control-label">Starting: </label>
</td>
<td>
<input class="form-control" @bind="@startdate" />
<input class="form-control" @bind="@_startDate" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Ending: </label>
<label class="control-label">Ending: </label>
</td>
<td>
<input class="form-control" @bind="@enddate" />
<input class="form-control" @bind="@_endDate" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Retention Log (Items): </label>
<label class="control-label">Retention Log (Items): </label>
</td>
<td>
<input class="form-control" @bind="@retentionhistory" />
<input class="form-control" @bind="@_retentionHistory" />
</td>
</tr>
</table>
@ -76,42 +76,42 @@
@code {
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
string name = "";
string jobtype = "";
string isenabled = "True";
string interval = "";
string frequency = "";
string startdate = "";
string enddate = "";
string retentionhistory = "10";
string _name = "";
string _jobType = "";
string _isEnabled = "True";
string _interval = "";
string _frequency = "";
string _startDate = "";
string _endDate = "";
string _retentionHistory = "10";
private async Task SaveJob()
{
if (name != "" && !string.IsNullOrEmpty(jobtype) && frequency != "" && interval != "" && retentionhistory != "")
if (_name != "" && !string.IsNullOrEmpty(_jobType) && _frequency != "" && _interval != "" && _retentionHistory != "")
{
Job job = new Job();
job.Name = name;
job.JobType = jobtype;
job.IsEnabled = Boolean.Parse(isenabled);
job.Frequency = frequency;
job.Interval = int.Parse(interval);
if (startdate == "")
job.Name = _name;
job.JobType = _jobType;
job.IsEnabled = Boolean.Parse(_isEnabled);
job.Frequency = _frequency;
job.Interval = int.Parse(_interval);
if (_startDate == "")
{
job.StartDate = null;
}
else
{
job.StartDate = DateTime.Parse(startdate);
job.StartDate = DateTime.Parse(_startDate);
}
if (enddate == "")
if (_endDate == "")
{
job.EndDate = null;
}
else
{
job.EndDate = DateTime.Parse(enddate);
job.EndDate = DateTime.Parse(_endDate);
}
job.RetentionHistory = int.Parse(retentionhistory);
job.RetentionHistory = int.Parse(_retentionHistory);
job.IsStarted = false;
job.IsExecuting = false;
job.NextExecution = null;

View File

@ -6,26 +6,26 @@
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
<label class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@name" />
<input class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Type: </label>
<label class="control-label">Type: </label>
</td>
<td>
<input class="form-control" @bind="@jobtype" />
<input class="form-control" @bind="@_jobType" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Enabled? </label>
<label class="control-label">Enabled? </label>
</td>
<td>
<select class="form-control" @bind="@isenabled">
<select class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
@ -33,11 +33,11 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Runs Every: </label>
<label class="control-label">Runs Every: </label>
</td>
<td>
<input class="form-control" @bind="@interval" />
<select class="form-control" @bind="@frequency">
<input class="form-control" @bind="@_interval" />
<select class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
@ -47,26 +47,26 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Starting: </label>
<label class="control-label">Starting: </label>
</td>
<td>
<input class="form-control" @bind="@startdate" />
<input class="form-control" @bind="@_startDate" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Ending: </label>
<label class="control-label">Ending: </label>
</td>
<td>
<input class="form-control" @bind="@enddate" />
<input class="form-control" @bind="@_endDate" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Retention Log (Items): </label>
<label class="control-label">Retention Log (Items): </label>
</td>
<td>
<input class="form-control" @bind="@retentionhistory" />
<input class="form-control" @bind="@_retentionHistory" />
</td>
</tr>
</table>
@ -76,68 +76,68 @@
@code {
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
int jobid;
string name = "";
string jobtype = "";
string isenabled = "True";
string interval = "";
string frequency = "";
string startdate = "";
string enddate = "";
string retentionhistory = "";
int _jobId;
string _name = "";
string _jobType = "";
string _isEnabled = "True";
string _interval = "";
string _frequency = "";
string _startDate = "";
string _endDate = "";
string _retentionHistory = "";
protected override async Task OnInitializedAsync()
{
try
{
jobid = Int32.Parse(PageState.QueryString["id"]);
Job job = await JobService.GetJobAsync(jobid);
_jobId = Int32.Parse(PageState.QueryString["id"]);
Job job = await JobService.GetJobAsync(_jobId);
if (job != null)
{
name = job.Name;
jobtype = job.JobType;
isenabled = job.IsEnabled.ToString();
interval = job.Interval.ToString();
frequency = job.Frequency;
startdate = (job.StartDate != null) ? job.StartDate.ToString() : "";
enddate = (job.EndDate != null) ? job.EndDate.ToString() : "";
retentionhistory = job.RetentionHistory.ToString();
_name = job.Name;
_jobType = job.JobType;
_isEnabled = job.IsEnabled.ToString();
_interval = job.Interval.ToString();
_frequency = job.Frequency;
_startDate = (job.StartDate != null) ? job.StartDate.ToString() : "";
_endDate = (job.EndDate != null) ? job.EndDate.ToString() : "";
_retentionHistory = job.RetentionHistory.ToString();
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Job {JobId} {Error}", jobid, ex.Message);
await logger.LogError(ex, "Error Loading Job {JobId} {Error}", _jobId, ex.Message);
AddModuleMessage("Error Loading Job", MessageType.Error);
}
}
private async Task SaveJob()
{
if (name != "" && !string.IsNullOrEmpty(jobtype) && frequency != "" && interval != "" && retentionhistory != "")
if (_name != "" && !string.IsNullOrEmpty(_jobType) && _frequency != "" && _interval != "" && _retentionHistory != "")
{
Job job = await JobService.GetJobAsync(jobid);
job.Name = name;
job.JobType = jobtype;
job.IsEnabled = Boolean.Parse(isenabled);
job.Frequency = frequency;
job.Interval = int.Parse(interval);
if (startdate == "")
Job job = await JobService.GetJobAsync(_jobId);
job.Name = _name;
job.JobType = _jobType;
job.IsEnabled = Boolean.Parse(_isEnabled);
job.Frequency = _frequency;
job.Interval = int.Parse(_interval);
if (_startDate == "")
{
job.StartDate = null;
}
else
{
job.StartDate = DateTime.Parse(startdate);
job.StartDate = DateTime.Parse(_startDate);
}
if (enddate == "")
if (_endDate == "")
{
job.EndDate = null;
}
else
{
job.EndDate = DateTime.Parse(enddate);
job.EndDate = DateTime.Parse(_endDate);
}
job.RetentionHistory = int.Parse(retentionhistory);
job.RetentionHistory = int.Parse(_retentionHistory);
try
{

View File

@ -2,7 +2,7 @@
@inherits ModuleBase
@inject IJobService JobService
@if (Jobs == null)
@if (_jobs == null)
{
<p><em>Loading...</em></p>
}
@ -13,7 +13,7 @@ else
<button type="button" class="btn btn-secondary" @onclick="(async () => await Refresh())">Refresh</button>
<br /><br />
<Pager Items="@Jobs">
<Pager Items="@_jobs">
<Header>
<th>&nbsp;</th>
<th>&nbsp;</th>
@ -49,23 +49,23 @@ else
@code {
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
List<Job> Jobs;
List<Job> _jobs;
protected override async Task OnParametersSetAsync()
{
Jobs = await JobService.GetJobsAsync();
_jobs = await JobService.GetJobsAsync();
}
private string DisplayStatus(bool IsEnabled, bool IsExecuting)
private string DisplayStatus(bool isEnabled, bool isExecuting)
{
string status = "";
if (!IsEnabled)
if (!isEnabled)
{
status = "Disabled";
}
else
{
if (IsExecuting)
if (isExecuting)
{
status = "Executing";
}
@ -79,59 +79,59 @@ else
}
private string DisplayFrequency(int Interval, string Frequency)
private string DisplayFrequency(int interval, string frequency)
{
string frequency = "Every " + Interval.ToString() + " ";
switch (Frequency)
string result = "Every " + interval.ToString() + " ";
switch (frequency)
{
case "m":
frequency += "Minute";
result += "Minute";
break;
case "H":
frequency += "Hour";
result += "Hour";
break;
case "d":
frequency += "Day";
result += "Day";
break;
case "M":
frequency += "Month";
result += "Month";
break;
}
if (Interval > 1)
if (interval > 1)
{
frequency += "s";
result += "s";
}
return frequency;
return result;
}
private async Task DeleteJob(Job Job)
private async Task DeleteJob(Job job)
{
try
{
await JobService.DeleteJobAsync(Job.JobId);
await logger.LogInformation("Job Deleted {Job}", Job);
await JobService.DeleteJobAsync(job.JobId);
await logger.LogInformation("Job Deleted {Job}", job);
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Job {Job} {Error}", Job, ex.Message);
await logger.LogError(ex, "Error Deleting Job {Job} {Error}", job, ex.Message);
AddModuleMessage("Error Deleting Job", MessageType.Error);
}
}
private async Task StartJob(int JobId)
private async Task StartJob(int jobId)
{
await JobService.StartJobAsync(JobId);
await JobService.StartJobAsync(jobId);
}
private async Task StopJob(int JobId)
private async Task StopJob(int jobId)
{
await JobService.StopJobAsync(JobId);
await JobService.StopJobAsync(jobId);
}
private async Task Refresh()
{
Jobs = await JobService.GetJobsAsync();
_jobs = await JobService.GetJobsAsync();
StateHasChanged();
}
}
}

View File

@ -2,13 +2,13 @@
@inherits ModuleBase
@inject IJobLogService JobLogService
@if (JobLogs == null)
@if (_jobLogs == null)
{
<p><em>Loading...</em></p>
}
else
{
<Pager Items="@JobLogs">
<Pager Items="@_jobLogs">
<Header>
<th>Name</th>
<th>Status</th>
@ -30,28 +30,28 @@ else
@code {
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
List<JobLog> JobLogs;
List<JobLog> _jobLogs;
protected override async Task OnParametersSetAsync()
{
JobLogs = await JobLogService.GetJobLogsAsync();
_jobLogs = await JobLogService.GetJobLogsAsync();
if (PageState.QueryString.ContainsKey("id"))
{
JobLogs = JobLogs.Where(item => item.JobId == Int32.Parse(PageState.QueryString["id"])).ToList();
_jobLogs = _jobLogs.Where(item => item.JobId == Int32.Parse(PageState.QueryString["id"])).ToList();
}
JobLogs = JobLogs.OrderByDescending(item => item.JobLogId).ToList();
_jobLogs = _jobLogs.OrderByDescending(item => item.JobLogId).ToList();
}
private string DisplayStatus(bool IsExecuting, bool? Succeeded)
private string DisplayStatus(bool isExecuting, bool? succeeded)
{
string status = "";
if (IsExecuting)
if (isExecuting)
{
status = "Executing";
}
else
{
if (Succeeded.Value)
if (succeeded != null && succeeded.Value)
{
status = "Succeeded";
}
@ -62,4 +62,4 @@ else
}
return status;
}
}
}