- @if (IsInstalling)
- {
-
-
-
- }
- else if (IsConsoleDisconnected)
+ @if (IsConsoleDisconnected)
{
We lost the connection to the server. Please refresh the page in order to retry. If this error persists please contact the support
@@ -137,6 +131,12 @@
The node this server is on is still booting. Please refresh the page in order to retry. If this error persists please contact the support
}
+ else if (IsInstalling)
+ {
+
+
+
+ }
else
{
@@ -217,37 +217,7 @@
Console = new ServerConsole(Server);
// Configure
- Console.OnStateChange += async state =>
- {
- // General rerender to update the state text in the ui
- // NOTE: Obsolete because of the update timer
- //await InvokeAsync(StateHasChanged);
-
- // Change from offline to installing
- // This will trigger the initialisation of the install view
- if (state == ServerState.Installing && !IsInstalling)
- {
- IsInstalling = true;
-
- // After this call, we should have access to the install terminal reference
- await InvokeAsync(StateHasChanged);
-
- Console.OnNewMessage += OnInstallConsoleMessage;
- }
- // Change from installing to offline
- // This will trigger the destruction of the install view
- else if (state == ServerState.Offline && IsInstalling)
- {
- IsInstalling = false;
-
- Console.OnNewMessage -= OnInstallConsoleMessage;
-
- // After this call, the install terminal will disappear
- await InvokeAsync(StateHasChanged);
-
- await ToastService.Info("Server installation complete");
- }
- };
+ Console.OnStateChange += async state => await HandleStateChange(state);
Console.OnDisconnected += async () =>
{
@@ -267,7 +237,7 @@
await InvokeAsync(StateHasChanged);
return;
}
-
+
// We want to check if its an connection error, if yes we want to show the user that its an error with the connection
// If not we proceed with the throwing for the soft error handler.
@@ -288,6 +258,41 @@
}
UpdateTimer = new Timer(async _ => { await InvokeAsync(StateHasChanged); }, null, TimeSpan.Zero, TimeSpan.FromSeconds(1));
+
+ var state = await ServerService.GetState(Server);
+ await HandleStateChange(state);
+ }
+
+ private async Task HandleStateChange(ServerState state)
+ {
+ // General rerender to update the state text in the ui
+ // NOTE: Obsolete because of the update timer
+ //await InvokeAsync(StateHasChanged);
+
+ // Change from offline to installing
+ // This will trigger the initialisation of the install view
+ if (state == ServerState.Installing && !IsInstalling)
+ {
+ IsInstalling = true;
+
+ // After this call, we should have access to the install terminal reference
+ await InvokeAsync(StateHasChanged);
+
+ Console.OnNewMessage += OnInstallConsoleMessage;
+ }
+ // Change from installing to offline
+ // This will trigger the destruction of the install view
+ else if (state == ServerState.Offline && IsInstalling)
+ {
+ IsInstalling = false;
+
+ Console.OnNewMessage -= OnInstallConsoleMessage;
+
+ // After this call, the install terminal will disappear
+ await InvokeAsync(StateHasChanged);
+
+ await ToastService.Info("Server installation complete");
+ }
}
private async Task OnInstallConsoleMessage(string message)
@@ -308,7 +313,10 @@
await UpdateTimer.DisposeAsync();
if (Console != null)
+ {
await Console.Close();
+ Console.Dispose();
+ }
}
private int GetIndex()
@@ -331,7 +339,7 @@
case "/network":
return 2;
-
+
case "/schedules":
return 7;
diff --git a/Moonlight/Features/Servers/UI/UserViews/Console.razor b/Moonlight/Features/Servers/UI/UserViews/Console.razor
index 79544e3..fe50781 100644
--- a/Moonlight/Features/Servers/UI/UserViews/Console.razor
+++ b/Moonlight/Features/Servers/UI/UserViews/Console.razor
@@ -1,4 +1,3 @@
-@using Moonlight.Features.Servers.Models.Abstractions
@using Moonlight.Features.Servers.Services
@using Moonlight.Features.Servers.UI.Components
@using Moonlight.Features.Servers.Entities
@@ -6,7 +5,6 @@
@using Moonlight.Features.Servers.Api.Packets
@using Moonlight.Features.Servers.Models.Enums
@using MoonCore.Helpers
-@using ApexCharts
@inject ServerService ServerService
@@ -79,13 +77,14 @@
var text = "";
foreach (var line in ServerConsole.Messages.TakeLast(50))
- text += line + "\n\r";
+ {
+ var lineModified = line.Replace("\n", "\n\r");
+ text += lineModified + "\n\r";
+ }
await Terminal.Write(text);
-
ServerConsole.OnNewMessage += OnMessage;
-
ServerConsole.OnStatsChange += HandleStats;
ServerConsole.OnStateChange += HandleState;
}
@@ -108,7 +107,7 @@
private async Task OnMessage(string message)
{
- await Terminal.WriteLine(message);
+ await Terminal.Write(message + "\n\r");
}
private async Task SendCommand()
diff --git a/Moonlight/Moonlight.csproj b/Moonlight/Moonlight.csproj
index f140329..df200a7 100644
--- a/Moonlight/Moonlight.csproj
+++ b/Moonlight/Moonlight.csproj
@@ -74,8 +74,7 @@
-
-
+
@@ -90,7 +89,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
@@ -114,6 +113,7 @@
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileManager.razor" />
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileUploader.razor" />
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileView.razor" />
+ <_ContentIncludedByDefault Remove="storage\configs\core.json" />