completed background job scheduler
This commit is contained in:
19
Oqtane.Client/Services/Interfaces/IJobLogService.cs
Normal file
19
Oqtane.Client/Services/Interfaces/IJobLogService.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface IJobLogService
|
||||
{
|
||||
Task<List<JobLog>> GetJobLogsAsync();
|
||||
|
||||
Task<JobLog> GetJobLogAsync(int JobLogId);
|
||||
|
||||
Task<JobLog> AddJobLogAsync(JobLog JobLog);
|
||||
|
||||
Task<JobLog> UpdateJobLogAsync(JobLog JobLog);
|
||||
|
||||
Task DeleteJobLogAsync(int JobLogId);
|
||||
}
|
||||
}
|
23
Oqtane.Client/Services/Interfaces/IJobService.cs
Normal file
23
Oqtane.Client/Services/Interfaces/IJobService.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface IJobService
|
||||
{
|
||||
Task<List<Job>> GetJobsAsync();
|
||||
|
||||
Task<Job> GetJobAsync(int JobId);
|
||||
|
||||
Task<Job> AddJobAsync(Job Job);
|
||||
|
||||
Task<Job> UpdateJobAsync(Job Job);
|
||||
|
||||
Task DeleteJobAsync(int JobId);
|
||||
|
||||
Task StartJobAsync(int JobId);
|
||||
|
||||
Task StopJobAsync(int JobId);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface IScheduleLogService
|
||||
{
|
||||
Task<List<ScheduleLog>> GetScheduleLogsAsync();
|
||||
|
||||
Task<ScheduleLog> GetScheduleLogAsync(int ScheduleLogId);
|
||||
|
||||
Task<ScheduleLog> AddScheduleLogAsync(ScheduleLog ScheduleLog);
|
||||
|
||||
Task<ScheduleLog> UpdateScheduleLogAsync(ScheduleLog ScheduleLog);
|
||||
|
||||
Task DeleteScheduleLogAsync(int ScheduleLogId);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface IScheduleService
|
||||
{
|
||||
Task<List<Schedule>> GetSchedulesAsync();
|
||||
|
||||
Task<Schedule> GetScheduleAsync(int ScheduleId);
|
||||
|
||||
Task<Schedule> AddScheduleAsync(Schedule Schedule);
|
||||
|
||||
Task<Schedule> UpdateScheduleAsync(Schedule Schedule);
|
||||
|
||||
Task DeleteScheduleAsync(int ScheduleId);
|
||||
}
|
||||
}
|
54
Oqtane.Client/Services/JobLogService.cs
Normal file
54
Oqtane.Client/Services/JobLogService.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class JobLogService : ServiceBase, IJobLogService
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly NavigationManager NavigationManager;
|
||||
|
||||
public JobLogService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.NavigationManager = NavigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "JobLog"); }
|
||||
}
|
||||
|
||||
public async Task<List<JobLog>> GetJobLogsAsync()
|
||||
{
|
||||
List<JobLog> Joblogs = await http.GetJsonAsync<List<JobLog>>(apiurl);
|
||||
return Joblogs.OrderBy(item => item.StartDate).ToList();
|
||||
}
|
||||
|
||||
public async Task<JobLog> GetJobLogAsync(int JobLogId)
|
||||
{
|
||||
return await http.GetJsonAsync<JobLog>(apiurl + "/" + JobLogId.ToString());
|
||||
}
|
||||
|
||||
public async Task<JobLog> AddJobLogAsync(JobLog Joblog)
|
||||
{
|
||||
return await http.PostJsonAsync<JobLog>(apiurl, Joblog);
|
||||
}
|
||||
|
||||
public async Task<JobLog> UpdateJobLogAsync(JobLog Joblog)
|
||||
{
|
||||
return await http.PutJsonAsync<JobLog>(apiurl + "/" + Joblog.JobLogId.ToString(), Joblog);
|
||||
}
|
||||
public async Task DeleteJobLogAsync(int JobLogId)
|
||||
{
|
||||
await http.DeleteAsync(apiurl + "/" + JobLogId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
64
Oqtane.Client/Services/JobService.cs
Normal file
64
Oqtane.Client/Services/JobService.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class JobService : ServiceBase, IJobService
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly NavigationManager NavigationManager;
|
||||
|
||||
public JobService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.NavigationManager = NavigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Job"); }
|
||||
}
|
||||
|
||||
public async Task<List<Job>> GetJobsAsync()
|
||||
{
|
||||
List<Job> Jobs = await http.GetJsonAsync<List<Job>>(apiurl);
|
||||
return Jobs.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<Job> GetJobAsync(int JobId)
|
||||
{
|
||||
return await http.GetJsonAsync<Job>(apiurl + "/" + JobId.ToString());
|
||||
}
|
||||
|
||||
public async Task<Job> AddJobAsync(Job Job)
|
||||
{
|
||||
return await http.PostJsonAsync<Job>(apiurl, Job);
|
||||
}
|
||||
|
||||
public async Task<Job> UpdateJobAsync(Job Job)
|
||||
{
|
||||
return await http.PutJsonAsync<Job>(apiurl + "/" + Job.JobId.ToString(), Job);
|
||||
}
|
||||
public async Task DeleteJobAsync(int JobId)
|
||||
{
|
||||
await http.DeleteAsync(apiurl + "/" + JobId.ToString());
|
||||
}
|
||||
|
||||
public async Task StartJobAsync(int JobId)
|
||||
{
|
||||
await http.GetAsync(apiurl + "/start/" + JobId.ToString());
|
||||
}
|
||||
|
||||
public async Task StopJobAsync(int JobId)
|
||||
{
|
||||
await http.GetAsync(apiurl + "/stop/" + JobId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class ScheduleLogService : ServiceBase, IScheduleLogService
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly NavigationManager NavigationManager;
|
||||
|
||||
public ScheduleLogService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.NavigationManager = NavigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "ScheduleLog"); }
|
||||
}
|
||||
|
||||
public async Task<List<ScheduleLog>> GetScheduleLogsAsync()
|
||||
{
|
||||
List<ScheduleLog> schedulelogs = await http.GetJsonAsync<List<ScheduleLog>>(apiurl);
|
||||
return schedulelogs.OrderBy(item => item.StartDate).ToList();
|
||||
}
|
||||
|
||||
public async Task<ScheduleLog> GetScheduleLogAsync(int ScheduleLogId)
|
||||
{
|
||||
return await http.GetJsonAsync<ScheduleLog>(apiurl + "/" + ScheduleLogId.ToString());
|
||||
}
|
||||
|
||||
public async Task<ScheduleLog> AddScheduleLogAsync(ScheduleLog schedulelog)
|
||||
{
|
||||
return await http.PostJsonAsync<ScheduleLog>(apiurl, schedulelog);
|
||||
}
|
||||
|
||||
public async Task<ScheduleLog> UpdateScheduleLogAsync(ScheduleLog schedulelog)
|
||||
{
|
||||
return await http.PutJsonAsync<ScheduleLog>(apiurl + "/" + schedulelog.ScheduleLogId.ToString(), schedulelog);
|
||||
}
|
||||
public async Task DeleteScheduleLogAsync(int ScheduleLogId)
|
||||
{
|
||||
await http.DeleteAsync(apiurl + "/" + ScheduleLogId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class ScheduleService : ServiceBase, IScheduleService
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly NavigationManager NavigationManager;
|
||||
|
||||
public ScheduleService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.NavigationManager = NavigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Schedule"); }
|
||||
}
|
||||
|
||||
public async Task<List<Schedule>> GetSchedulesAsync()
|
||||
{
|
||||
List<Schedule> schedules = await http.GetJsonAsync<List<Schedule>>(apiurl);
|
||||
return schedules.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<Schedule> GetScheduleAsync(int ScheduleId)
|
||||
{
|
||||
return await http.GetJsonAsync<Schedule>(apiurl + "/" + ScheduleId.ToString());
|
||||
}
|
||||
|
||||
public async Task<Schedule> AddScheduleAsync(Schedule schedule)
|
||||
{
|
||||
return await http.PostJsonAsync<Schedule>(apiurl, schedule);
|
||||
}
|
||||
|
||||
public async Task<Schedule> UpdateScheduleAsync(Schedule schedule)
|
||||
{
|
||||
return await http.PutJsonAsync<Schedule>(apiurl + "/" + schedule.ScheduleId.ToString(), schedule);
|
||||
}
|
||||
public async Task DeleteScheduleAsync(int ScheduleId)
|
||||
{
|
||||
await http.DeleteAsync(apiurl + "/" + ScheduleId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user