improve performance of alias handling and allow aliases to be an unlimited number of subfolders in depth
This commit is contained in:
@ -2,29 +2,15 @@
|
||||
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 SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public JobService(HttpClient http) : base(http) { }
|
||||
|
||||
public JobService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Job"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("Job");
|
||||
|
||||
public async Task<List<Job>> GetJobsAsync()
|
||||
{
|
||||
@ -34,7 +20,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Job> GetJobAsync(int jobId)
|
||||
{
|
||||
return await GetJsonAsync<Job>($"{Apiurl}/{jobId.ToString()}");
|
||||
return await GetJsonAsync<Job>($"{Apiurl}/{jobId}");
|
||||
}
|
||||
|
||||
public async Task<Job> AddJobAsync(Job job)
|
||||
@ -44,21 +30,21 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Job> UpdateJobAsync(Job job)
|
||||
{
|
||||
return await PutJsonAsync<Job>($"{Apiurl}/{job.JobId.ToString()}", job);
|
||||
return await PutJsonAsync<Job>($"{Apiurl}/{job.JobId}", job);
|
||||
}
|
||||
public async Task DeleteJobAsync(int jobId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{jobId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{jobId}");
|
||||
}
|
||||
|
||||
public async Task StartJobAsync(int jobId)
|
||||
{
|
||||
await GetAsync($"{Apiurl}/start/{jobId.ToString()}");
|
||||
await GetAsync($"{Apiurl}/start/{jobId}");
|
||||
}
|
||||
|
||||
public async Task StopJobAsync(int jobId)
|
||||
{
|
||||
await GetAsync($"{Apiurl}/stop/{jobId.ToString()}");
|
||||
await GetAsync($"{Apiurl}/stop/{jobId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user