Added connection exception handling to node status and added error detail view in node overview
This commit is contained in:
@@ -59,7 +59,20 @@ public class NodesController : BaseCrudController<Node, DetailNodeResponse, Crea
|
||||
|
||||
using var httpClient = node.CreateClient();
|
||||
|
||||
var response = await httpClient.GetJson<SystemInfoResponse>("system/info");
|
||||
SystemInfoResponse response;
|
||||
|
||||
try
|
||||
{
|
||||
response = await httpClient.GetJson<SystemInfoResponse>("system/info");
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
throw new ApiException(
|
||||
"The requested node's api server was not reachable",
|
||||
e.Message,
|
||||
statusCode: 502
|
||||
);
|
||||
}
|
||||
|
||||
var result = Mapper.Map<StatusNodeResponse>(response);
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
@page "/admin/servers/nodes"
|
||||
|
||||
@using System.Diagnostics
|
||||
@using MoonCore.Exceptions
|
||||
@using Moonlight.Client.App.Models.Crud
|
||||
@using Moonlight.Client.App.Services
|
||||
@using Moonlight.Shared.Http.Resources
|
||||
@using MoonlightServers.Client.UI.Components.Forms
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.Nodes
|
||||
@@ -8,6 +11,7 @@
|
||||
@using MoonlightServers.Client.UI.Components.Partials
|
||||
|
||||
@inject HttpApiClient HttpApiClient
|
||||
@inject AlertService AlertService
|
||||
|
||||
@attribute [RequirePermission("admin.servers.nodes.get")]
|
||||
|
||||
@@ -77,7 +81,9 @@
|
||||
<i class="mr-1 align-middle text-lg bi bi-exclamation-triangle-fill text-red-500"></i>
|
||||
<span class="mr-1">Offline:</span>
|
||||
|
||||
@fetchState.Exception.Message
|
||||
<a href="#" @onclick:preventDefault @onclick="() => ShowDetails(fetchState.Exception)" class="mr-1 text-red-400">
|
||||
Show details
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -85,7 +91,7 @@
|
||||
</SmartColumn>
|
||||
</View>
|
||||
<DetailView>
|
||||
<SmartTabs>
|
||||
<SmartTabs BarStyle="true" BarText="Details">
|
||||
<SmartTab Name="Overview">
|
||||
<NodeOverview NodeId="@context.Id"/>
|
||||
</SmartTab>
|
||||
@@ -156,6 +162,8 @@
|
||||
options.ShowUpdateAsModal = false;
|
||||
options.ShowDetailsAsModal = false;
|
||||
|
||||
options.ShowDetailsBar = false;
|
||||
|
||||
options.OnConfigureCreate = option =>
|
||||
{
|
||||
option
|
||||
@@ -203,6 +211,11 @@
|
||||
};
|
||||
}
|
||||
|
||||
private async Task ShowDetails(Exception e)
|
||||
{
|
||||
await AlertService.ErrorLog("Node connection error", e.ToStringDemystified());
|
||||
}
|
||||
|
||||
class NodeFetchState
|
||||
{
|
||||
public StatusNodeResponse? Response { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user