Added database migration checking and fixed/mocked server layout
This commit is contained in:
@@ -1,17 +1,15 @@
|
|||||||
@using Moonlight.Features.ServiceManagement.Entities
|
@using Moonlight.Features.ServiceManagement.Entities
|
||||||
@using Moonlight.Features.ServiceManagement.Models.Abstractions
|
@using Moonlight.Features.ServiceManagement.Models.Abstractions
|
||||||
@using Moonlight.Features.Servers.Entities
|
@using Moonlight.Features.Servers.Entities
|
||||||
@using Moonlight.Features.Servers.Services
|
|
||||||
|
|
||||||
|
|
||||||
@using Moonlight.Features.Servers.Models.Abstractions
|
@using Moonlight.Features.Servers.Models.Abstractions
|
||||||
@using Moonlight.Features.Servers.Models.Enums
|
@using Moonlight.Features.Servers.Models.Enums
|
||||||
@using Microsoft.EntityFrameworkCore
|
@using Moonlight.Features.Servers.Services
|
||||||
|
@using Moonlight.Features.Servers.UI.Components
|
||||||
@using MoonCore.Abstractions
|
@using MoonCore.Abstractions
|
||||||
@using MoonCore.Helpers
|
@using MoonCore.Helpers
|
||||||
@using MoonCoreUI.Services
|
@using MoonCoreUI.Services
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
@using Moonlight.Features.Servers.UI.Components
|
@using Moonlight.Features.ServiceManagement.UI.Components
|
||||||
|
|
||||||
@inject Repository<Server> ServerRepository
|
@inject Repository<Server> ServerRepository
|
||||||
@inject ServerService ServerService
|
@inject ServerService ServerService
|
||||||
@@ -191,6 +189,9 @@
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public string? Route { get; set; }
|
public string? Route { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public ServiceDefinition Implementation { get; set; }
|
||||||
|
|
||||||
private Server Server;
|
private Server Server;
|
||||||
private ServerMeta Meta;
|
private ServerMeta Meta;
|
||||||
private CancellationTokenSource BackgroundCancel = new();
|
private CancellationTokenSource BackgroundCancel = new();
|
||||||
@@ -211,8 +212,8 @@
|
|||||||
.Include(x => x.MainAllocation)
|
.Include(x => x.MainAllocation)
|
||||||
.First(x => x.Service.Id == Service.Id);
|
.First(x => x.Service.Id == Service.Id);
|
||||||
|
|
||||||
/*
|
Meta = new ServerMeta();
|
||||||
|
/*
|
||||||
// Load meta and setup event handlers
|
// Load meta and setup event handlers
|
||||||
Meta = await ServerService.Meta.Get(Server);
|
Meta = await ServerService.Meta.Get(Server);
|
||||||
Meta.OnStateChanged += async Task () =>
|
Meta.OnStateChanged += async Task () =>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
@page "/admin/services/view/{Id:int}/{Route?}"
|
@page "/admin/services/view/{Id:int}/{Route?}"
|
||||||
|
|
||||||
@using Microsoft.EntityFrameworkCore
|
@using Microsoft.EntityFrameworkCore
|
||||||
@using MoonCore.Abstractions
|
@using MoonCore.Abstractions
|
||||||
@using Moonlight.Core.Extensions.Attributes
|
@using Moonlight.Core.Extensions.Attributes
|
||||||
@using Moonlight.Core.Models.Enums
|
@using Moonlight.Core.Models.Enums
|
||||||
|
|
||||||
@using Moonlight.Core.Services
|
@using Moonlight.Core.Services
|
||||||
@using Moonlight.Features.ServiceManagement.Entities
|
@using Moonlight.Features.ServiceManagement.Entities
|
||||||
@using Moonlight.Features.ServiceManagement.Models.Abstractions
|
@using Moonlight.Features.ServiceManagement.Models.Abstractions
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ Directory.CreateDirectory(PathBuilder.Dir("storage"));
|
|||||||
Directory.CreateDirectory(PathBuilder.Dir("storage", "logs"));
|
Directory.CreateDirectory(PathBuilder.Dir("storage", "logs"));
|
||||||
|
|
||||||
// Setup logger
|
// Setup logger
|
||||||
|
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
var logPath = PathBuilder.File("storage", "logs",
|
var logPath = PathBuilder.File("storage", "logs",
|
||||||
$"moonlight-{now.Day}-{now.Month}-{now.Year}---{now.Hour}-{now.Minute}.log");
|
$"moonlight-{now.Day}-{now.Month}-{now.Year}---{now.Hour}-{now.Minute}.log");
|
||||||
@@ -34,6 +33,12 @@ Logger.Setup(
|
|||||||
logInConsole: true
|
logInConsole: true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Check database migrations
|
||||||
|
await DatabaseCheckHelper.Check(
|
||||||
|
new DataContext(configService),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
// Init plugin system
|
// Init plugin system
|
||||||
var pluginService = new PluginService();
|
var pluginService = new PluginService();
|
||||||
builder.Services.AddSingleton(pluginService);
|
builder.Services.AddSingleton(pluginService);
|
||||||
|
|||||||
Reference in New Issue
Block a user