Refactoring (#314)
* Refactoring * Refactoring * Check for a valid email. * Fixed missing character. * Moved logic to the Utilities class. * Rename template .sql file * Modified null and empty string check. * Check for a valid email. * Fixed missing character. * Moved logic to the Utilities class. * Added Favicon support, Progressive Web App support, page title and url support, and private/public user registration options * Refactoring * Refactoring * Check for a valid email. * Moved logic to the Utilities class. Co-authored-by: Aubrey <aubrey.b@treskcow.tech> Co-authored-by: MIchael Atwood <matwood@dragonmastery.com> Co-authored-by: Shaun Walker <shaun.walker@siliqon.com>
This commit is contained in:
@ -74,28 +74,29 @@
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||
private string _name = string.Empty;
|
||||
private string _jobType = string.Empty;
|
||||
private string _isEnabled = "True";
|
||||
private string _interval = string.Empty;
|
||||
private string _frequency = string.Empty;
|
||||
private string _startDate = string.Empty;
|
||||
private string _endDate = string.Empty;
|
||||
private string _retentionHistory = "10";
|
||||
|
||||
string _name = "";
|
||||
string _jobType = "";
|
||||
string _isEnabled = "True";
|
||||
string _interval = "";
|
||||
string _frequency = "";
|
||||
string _startDate = "";
|
||||
string _endDate = "";
|
||||
string _retentionHistory = "10";
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
private async Task SaveJob()
|
||||
{
|
||||
if (_name != "" && !string.IsNullOrEmpty(_jobType) && _frequency != "" && _interval != "" && _retentionHistory != "")
|
||||
if (_name != string.Empty && !string.IsNullOrEmpty(_jobType) && _frequency != string.Empty && _interval != string.Empty && _retentionHistory != string.Empty)
|
||||
{
|
||||
Job job = new Job();
|
||||
var job = new Job();
|
||||
job.Name = _name;
|
||||
job.JobType = _jobType;
|
||||
job.IsEnabled = Boolean.Parse(_isEnabled);
|
||||
job.Frequency = _frequency;
|
||||
job.Interval = int.Parse(_interval);
|
||||
if (_startDate == "")
|
||||
|
||||
if (_startDate == string.Empty)
|
||||
{
|
||||
job.StartDate = null;
|
||||
}
|
||||
@ -103,7 +104,8 @@
|
||||
{
|
||||
job.StartDate = DateTime.Parse(_startDate);
|
||||
}
|
||||
if (_endDate == "")
|
||||
|
||||
if (_endDate == string.Empty)
|
||||
{
|
||||
job.EndDate = null;
|
||||
}
|
||||
@ -111,6 +113,7 @@
|
||||
{
|
||||
job.EndDate = DateTime.Parse(_endDate);
|
||||
}
|
||||
|
||||
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||
job.IsStarted = false;
|
||||
job.IsExecuting = false;
|
||||
|
@ -74,17 +74,17 @@
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||
private int _jobId;
|
||||
private string _name = string.Empty;
|
||||
private string _jobType = string.Empty;
|
||||
private string _isEnabled = "True";
|
||||
private string _interval = string.Empty;
|
||||
private string _frequency = string.Empty;
|
||||
private string _startDate = string.Empty;
|
||||
private string _endDate = string.Empty;
|
||||
private string _retentionHistory = string.Empty;
|
||||
|
||||
int _jobId;
|
||||
string _name = "";
|
||||
string _jobType = "";
|
||||
string _isEnabled = "True";
|
||||
string _interval = "";
|
||||
string _frequency = "";
|
||||
string _startDate = "";
|
||||
string _endDate = "";
|
||||
string _retentionHistory = "";
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
@ -99,8 +99,8 @@
|
||||
_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() : "";
|
||||
_startDate = (job.StartDate != null) ? job.StartDate.ToString() : string.Empty;
|
||||
_endDate = (job.EndDate != null) ? job.EndDate.ToString() : string.Empty;
|
||||
_retentionHistory = job.RetentionHistory.ToString();
|
||||
}
|
||||
}
|
||||
@ -113,15 +113,16 @@
|
||||
|
||||
private async Task SaveJob()
|
||||
{
|
||||
if (_name != "" && !string.IsNullOrEmpty(_jobType) && _frequency != "" && _interval != "" && _retentionHistory != "")
|
||||
if (_name != string.Empty && !string.IsNullOrEmpty(_jobType) && _frequency != string.Empty && _interval != string.Empty && _retentionHistory != string.Empty)
|
||||
{
|
||||
Job job = await JobService.GetJobAsync(_jobId);
|
||||
var 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 == "")
|
||||
|
||||
if (_startDate == string.Empty)
|
||||
{
|
||||
job.StartDate = null;
|
||||
}
|
||||
@ -129,7 +130,8 @@
|
||||
{
|
||||
job.StartDate = DateTime.Parse(_startDate);
|
||||
}
|
||||
if (_endDate == "")
|
||||
|
||||
if (_endDate == string.Empty)
|
||||
{
|
||||
job.EndDate = null;
|
||||
}
|
||||
@ -137,6 +139,7 @@
|
||||
{
|
||||
job.EndDate = DateTime.Parse(_endDate);
|
||||
}
|
||||
|
||||
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||
|
||||
try
|
||||
|
@ -47,10 +47,10 @@ else
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<Job> _jobs;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||
|
||||
List<Job> _jobs;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_jobs = await JobService.GetJobsAsync();
|
||||
@ -58,7 +58,7 @@ else
|
||||
|
||||
private string DisplayStatus(bool isEnabled, bool isExecuting)
|
||||
{
|
||||
string status = "";
|
||||
var status = string.Empty;
|
||||
if (!isEnabled)
|
||||
{
|
||||
status = "Disabled";
|
||||
@ -81,7 +81,7 @@ else
|
||||
|
||||
private string DisplayFrequency(int interval, string frequency)
|
||||
{
|
||||
string result = "Every " + interval.ToString() + " ";
|
||||
var result = "Every " + interval.ToString() + " ";
|
||||
switch (frequency)
|
||||
{
|
||||
case "m":
|
||||
@ -97,10 +97,12 @@ else
|
||||
result += "Month";
|
||||
break;
|
||||
}
|
||||
|
||||
if (interval > 1)
|
||||
{
|
||||
result += "s";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -28,23 +28,25 @@ else
|
||||
}
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||
|
||||
List<JobLog> _jobLogs;
|
||||
private List<JobLog> _jobLogs;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_jobLogs = await JobLogService.GetJobLogsAsync();
|
||||
|
||||
if (PageState.QueryString.ContainsKey("id"))
|
||||
{
|
||||
_jobLogs = _jobLogs.Where(item => item.JobId == Int32.Parse(PageState.QueryString["id"])).ToList();
|
||||
}
|
||||
|
||||
_jobLogs = _jobLogs.OrderByDescending(item => item.JobLogId).ToList();
|
||||
}
|
||||
|
||||
private string DisplayStatus(bool isExecuting, bool? succeeded)
|
||||
{
|
||||
string status = "";
|
||||
var status = string.Empty;
|
||||
if (isExecuting)
|
||||
{
|
||||
status = "Executing";
|
||||
@ -60,6 +62,7 @@ else
|
||||
status = "Failed";
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user