Updated to latest moonlight and mooncore version. Done refactoring to async scheme and other changes. Recreated database migrations and cleaned models
This commit is contained in:
@@ -16,7 +16,7 @@ public class PowerController : Controller
|
||||
}
|
||||
|
||||
[HttpPost("start")]
|
||||
public async Task<ActionResult> Start([FromRoute] int id)
|
||||
public async Task<ActionResult> StartAsync([FromRoute] int id)
|
||||
{
|
||||
var server = ServerService.GetById(id);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PowerController : Controller
|
||||
}
|
||||
|
||||
[HttpPost("stop")]
|
||||
public async Task<ActionResult> Stop([FromRoute] int id)
|
||||
public async Task<ActionResult> StopAsync([FromRoute] int id)
|
||||
{
|
||||
var server = ServerService.GetById(id);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PowerController : Controller
|
||||
}
|
||||
|
||||
[HttpPost("kill")]
|
||||
public async Task<ActionResult> Kill([FromRoute] int id)
|
||||
public async Task<ActionResult> KillAsync([FromRoute] int id)
|
||||
{
|
||||
var server = ServerService.GetById(id);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class PowerController : Controller
|
||||
}
|
||||
|
||||
[HttpPost("install")]
|
||||
public async Task<ActionResult> Install([FromRoute] int id)
|
||||
public async Task<ActionResult> InstallAsync([FromRoute] int id)
|
||||
{
|
||||
var server = ServerService.GetById(id);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using MoonlightServers.Daemon.Mappers;
|
||||
using MoonlightServers.Daemon.Services;
|
||||
using MoonlightServers.DaemonShared.DaemonSide.Http.Responses.Servers;
|
||||
using MoonlightServers.DaemonShared.Enums;
|
||||
using MoonlightServers.DaemonShared.PanelSide.Http.Responses;
|
||||
|
||||
namespace MoonlightServers.Daemon.Http.Controllers.Servers;
|
||||
|
||||
@@ -21,14 +20,14 @@ public class ServersController : Controller
|
||||
}
|
||||
|
||||
[HttpPost("sync")]
|
||||
public async Task<ActionResult> Sync([FromRoute] int id)
|
||||
public async Task<ActionResult> SyncAsync([FromRoute] int id)
|
||||
{
|
||||
await ServerService.InitializeById(id);
|
||||
await ServerService.InitializeByIdAsync(id);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
[HttpGet("status")]
|
||||
public async Task<ActionResult<ServerStatusResponse>> Status([FromRoute] int id)
|
||||
public async Task<ActionResult<ServerStatusResponse>> StatusAsync([FromRoute] int id)
|
||||
{
|
||||
var server = ServerService.GetById(id);
|
||||
|
||||
@@ -42,7 +41,7 @@ public class ServersController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("logs")]
|
||||
public async Task<ActionResult<ServerLogsResponse>> Logs([FromRoute] int id)
|
||||
public async Task<ActionResult<ServerLogsResponse>> LogsAsync([FromRoute] int id)
|
||||
{
|
||||
var server = ServerService.GetById(id);
|
||||
|
||||
@@ -58,7 +57,7 @@ public class ServersController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("stats")]
|
||||
public async Task<ServerStatsResponse> GetStats([FromRoute] int id)
|
||||
public async Task<ServerStatsResponse> GetStatsAsync([FromRoute] int id)
|
||||
{
|
||||
return new ServerStatsResponse()
|
||||
{
|
||||
|
||||
@@ -18,17 +18,17 @@ public class StatisticsController : Controller
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<StatisticsResponse> Get()
|
||||
public async Task<StatisticsResponse> GetAsync()
|
||||
{
|
||||
var response = new StatisticsResponse();
|
||||
|
||||
var cpuUsage = await HostSystemHelper.GetCpuUsage();
|
||||
var cpuUsage = await HostSystemHelper.GetCpuUsageAsync();
|
||||
|
||||
response.Cpu.Model = cpuUsage.Model;
|
||||
response.Cpu.Usage = cpuUsage.OverallUsage;
|
||||
response.Cpu.UsagePerCore = cpuUsage.PerCoreUsage;
|
||||
|
||||
var memoryUsage = await HostSystemHelper.GetMemoryUsage();
|
||||
var memoryUsage = await HostSystemHelper.GetMemoryUsageAsync();
|
||||
|
||||
response.Memory.Available = memoryUsage.Available;
|
||||
response.Memory.Cached = memoryUsage.Cached;
|
||||
@@ -37,7 +37,7 @@ public class StatisticsController : Controller
|
||||
response.Memory.SwapTotal = memoryUsage.SwapTotal;
|
||||
response.Memory.SwapFree = memoryUsage.SwapFree;
|
||||
|
||||
var diskDetails = await HostSystemHelper.GetDiskUsages();
|
||||
var diskDetails = await HostSystemHelper.GetDiskUsagesAsync();
|
||||
|
||||
response.Disks = diskDetails.Select(x => new StatisticsResponse.DiskData()
|
||||
{
|
||||
|
||||
@@ -20,13 +20,13 @@ public class StatisticsDockerController : Controller
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<StatisticsDockerResponse> Get()
|
||||
public async Task<StatisticsDockerResponse> GetAsync()
|
||||
{
|
||||
var usage = await DockerInfoService.GetDataUsage();
|
||||
var usage = await DockerInfoService.GetDataUsageAsync();
|
||||
|
||||
return new StatisticsDockerResponse
|
||||
{
|
||||
Version = await DockerInfoService.GetDockerVersion(),
|
||||
Version = await DockerInfoService.GetDockerVersionAsync(),
|
||||
ContainersReclaimable = usage.Containers.Reclaimable,
|
||||
ContainersUsed = usage.Containers.Used,
|
||||
BuildCacheReclaimable = usage.BuildCache.Reclaimable,
|
||||
|
||||
@@ -18,7 +18,7 @@ public class SystemStatusController : Controller
|
||||
RemoteService = remoteService;
|
||||
}
|
||||
|
||||
public async Task<SystemStatusResponse> Get()
|
||||
public async Task<SystemStatusResponse> GetAsync()
|
||||
{
|
||||
SystemStatusResponse response;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class SystemStatusController : Controller
|
||||
|
||||
try
|
||||
{
|
||||
await RemoteService.GetStatus();
|
||||
await RemoteService.GetStatusAsync();
|
||||
|
||||
sw.Stop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user