From 95507fd41ff23c65b371ed8d11b13a178cf04136 Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Thu, 1 Feb 2024 22:43:43 +0100 Subject: [PATCH] Added database migration checking and fixed/mocked server layout --- .../Servers/UI/Layouts/UserLayout.razor | 21 ++++++++++--------- .../UI/Views/Admin/View.razor | 4 ++-- Moonlight/Program.cs | 7 ++++++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Moonlight/Features/Servers/UI/Layouts/UserLayout.razor b/Moonlight/Features/Servers/UI/Layouts/UserLayout.razor index 3a5eef9a..725de514 100644 --- a/Moonlight/Features/Servers/UI/Layouts/UserLayout.razor +++ b/Moonlight/Features/Servers/UI/Layouts/UserLayout.razor @@ -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 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); } }); - + */ } diff --git a/Moonlight/Features/ServiceManagement/UI/Views/Admin/View.razor b/Moonlight/Features/ServiceManagement/UI/Views/Admin/View.razor index 16c5ca83..5a85b505 100644 --- a/Moonlight/Features/ServiceManagement/UI/Views/Admin/View.razor +++ b/Moonlight/Features/ServiceManagement/UI/Views/Admin/View.razor @@ -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); } -} +} \ No newline at end of file diff --git a/Moonlight/Program.cs b/Moonlight/Program.cs index 88a08857..988a7659 100644 --- a/Moonlight/Program.cs +++ b/Moonlight/Program.cs @@ -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);