Fixed a bug. Improved error handling. Small cleanup of code
This commit is contained in:
@@ -99,9 +99,11 @@ public class ServerConsole : IDisposable
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e is not WebSocketException)
|
if (e is WebSocketException)
|
||||||
|
Logger.Warn($"Lost connection to daemon server websocket: {e.Message}");
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Logger.Warn("Lost connection to daemon server websocket");
|
Logger.Warn("Server console ws disconnected because of application error:");
|
||||||
Logger.Warn(e);
|
Logger.Warn(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,13 +113,7 @@
|
|||||||
<ServerNavigation Index="@GetIndex()" ServerId="@Id"/>
|
<ServerNavigation Index="@GetIndex()" ServerId="@Id"/>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
@if (IsInstalling)
|
@if (IsConsoleDisconnected)
|
||||||
{
|
|
||||||
<div class="card card-body bg-black p-3">
|
|
||||||
<Terminal @ref="InstallTerminal" EnableClipboard="false"/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else if (IsConsoleDisconnected)
|
|
||||||
{
|
{
|
||||||
<IconAlert Title="Connection to server lost" Color="danger" Icon="bx-error">
|
<IconAlert Title="Connection to server lost" Color="danger" Icon="bx-error">
|
||||||
We lost the connection to the server. Please refresh the page in order to retry. If this error persists please contact the support
|
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
|
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
|
||||||
</IconAlert>
|
</IconAlert>
|
||||||
}
|
}
|
||||||
|
else if (IsInstalling)
|
||||||
|
{
|
||||||
|
<div class="card card-body bg-black p-3">
|
||||||
|
<Terminal @ref="InstallTerminal" EnableClipboard="false"/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<CascadingValue Value="Server">
|
<CascadingValue Value="Server">
|
||||||
@@ -217,37 +217,7 @@
|
|||||||
Console = new ServerConsole(Server);
|
Console = new ServerConsole(Server);
|
||||||
|
|
||||||
// Configure
|
// Configure
|
||||||
Console.OnStateChange += async state =>
|
Console.OnStateChange += async state => await HandleStateChange(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.OnDisconnected += async () =>
|
Console.OnDisconnected += async () =>
|
||||||
{
|
{
|
||||||
@@ -288,6 +258,41 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateTimer = new Timer(async _ => { await InvokeAsync(StateHasChanged); }, null, TimeSpan.Zero, TimeSpan.FromSeconds(1));
|
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)
|
private async Task OnInstallConsoleMessage(string message)
|
||||||
|
|||||||
@@ -74,8 +74,7 @@
|
|||||||
<Folder Include="Features\FileManager\Http\Requests\" />
|
<Folder Include="Features\FileManager\Http\Requests\" />
|
||||||
<Folder Include="Features\FileManager\Http\Resources\" />
|
<Folder Include="Features\FileManager\Http\Resources\" />
|
||||||
<Folder Include="Features\Servers\Http\Resources\" />
|
<Folder Include="Features\Servers\Http\Resources\" />
|
||||||
<Folder Include="storage\assetOverrides\x\y\" />
|
<Folder Include="storage\" />
|
||||||
<Folder Include="storage\logs\" />
|
|
||||||
<Folder Include="Styles\" />
|
<Folder Include="Styles\" />
|
||||||
<Folder Include="wwwroot\css\" />
|
<Folder Include="wwwroot\css\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -114,6 +113,7 @@
|
|||||||
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileManager.razor" />
|
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileManager.razor" />
|
||||||
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileUploader.razor" />
|
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileUploader.razor" />
|
||||||
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileView.razor" />
|
<_ContentIncludedByDefault Remove="Features\FileManager\UI\Components\FileView.razor" />
|
||||||
|
<_ContentIncludedByDefault Remove="storage\configs\core.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user