Added database migration checking and fixed/mocked server layout

This commit is contained in:
Marcel Baumgartner 2024-02-01 22:43:43 +01:00
parent 8d75b30ae4
commit 95507fd41f
3 changed files with 19 additions and 13 deletions

View file

@ -1,17 +1,15 @@
@using Moonlight.Features.ServiceManagement.Entities
@using Moonlight.Features.ServiceManagement.Models.Abstractions
@using Moonlight.Features.Servers.Entities
@using Moonlight.Features.Servers.Services
@using Moonlight.Features.Servers.Models.Abstractions
@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.Helpers
@using MoonCoreUI.Services
@using Moonlight.Features.Servers.UI.Components
@using Microsoft.EntityFrameworkCore
@using Moonlight.Features.ServiceManagement.UI.Components
@inject Repository<Server> ServerRepository
@inject ServerService ServerService
@ -190,6 +188,9 @@
[Parameter]
public string? Route { get; set; }
[Parameter]
public ServiceDefinition Implementation { get; set; }
private Server Server;
private ServerMeta Meta;
@ -211,8 +212,8 @@
.Include(x => x.MainAllocation)
.First(x => x.Service.Id == Service.Id);
/*
Meta = new ServerMeta();
/*
// Load meta and setup event handlers
Meta = await ServerService.Meta.Get(Server);
Meta.OnStateChanged += async Task () =>
@ -259,7 +260,7 @@
await ServerService.Console.Subscribe(Server);
}
});
// In order to update the timer correctly, we are calling a re
Task.Run(async () =>
{
@ -269,7 +270,7 @@
await InvokeAsync(StateHasChanged);
}
});
*/
}

View file

@ -1,9 +1,9 @@
@page "/admin/services/view/{Id:int}/{Route?}"
@using Microsoft.EntityFrameworkCore
@using MoonCore.Abstractions
@using Moonlight.Core.Extensions.Attributes
@using Moonlight.Core.Models.Enums
@using Moonlight.Core.Services
@using Moonlight.Features.ServiceManagement.Entities
@using Moonlight.Features.ServiceManagement.Models.Abstractions
@ -78,4 +78,4 @@
await Definition.BuildAdminView(ViewContext);
await PluginService.BuildAdminServiceView(ViewContext);
}
}
}

View file

@ -23,7 +23,6 @@ Directory.CreateDirectory(PathBuilder.Dir("storage"));
Directory.CreateDirectory(PathBuilder.Dir("storage", "logs"));
// Setup logger
var now = DateTime.UtcNow;
var logPath = PathBuilder.File("storage", "logs",
$"moonlight-{now.Day}-{now.Month}-{now.Year}---{now.Hour}-{now.Minute}.log");
@ -34,6 +33,12 @@ Logger.Setup(
logInConsole: true
);
// Check database migrations
await DatabaseCheckHelper.Check(
new DataContext(configService),
false
);
// Init plugin system
var pluginService = new PluginService();
builder.Services.AddSingleton(pluginService);