From 98a4f0eb4ca1a5091392b4419720b041987cab2b Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Tue, 2 May 2023 17:35:58 +0200 Subject: [PATCH] Update Index.razor --- Moonlight/Shared/Views/Server/Index.razor | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Moonlight/Shared/Views/Server/Index.razor b/Moonlight/Shared/Views/Server/Index.razor index 8c86c2cf..c266dae7 100644 --- a/Moonlight/Shared/Views/Server/Index.razor +++ b/Moonlight/Shared/Views/Server/Index.razor @@ -252,8 +252,27 @@ var image = ImageRepository .Get() + .Include(x => x.Variables) .First(x => x.Id == CurrentServer.Image.Id); + // Live variable migration + + foreach (var variable in image.Variables) + { + if (!CurrentServer.Variables.Any(x => x.Key == variable.Key)) + { + CurrentServer.Variables.Add(new ServerVariable() + { + Key = variable.Key, + Value = variable.DefaultValue + }); + + ServerRepository.Update(CurrentServer); + } + } + + // Tags + Tags = JsonConvert.DeserializeObject(image.TagsJson) ?? Array.Empty(); Image = image; @@ -263,7 +282,7 @@ await Event.On($"server.{CurrentServer.Uuid}.installComplete", this, server => { - NavigationManager.NavigateTo(NavigationManager.Uri); + NavigationManager.NavigateTo(NavigationManager.Uri, true); return Task.CompletedTask; });