Added server node status screen check thingy
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
@inject ServerRepository ServerRepository
|
@inject ServerRepository ServerRepository
|
||||||
@inject WingsConsoleHelper WingsConsoleHelper
|
@inject WingsConsoleHelper WingsConsoleHelper
|
||||||
@inject MessageService MessageService
|
@inject MessageService MessageService
|
||||||
|
@inject NodeService NodeService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
@@ -26,10 +27,12 @@
|
|||||||
{
|
{
|
||||||
<div class="d-flex justify-content-center flex-center">
|
<div class="d-flex justify-content-center flex-center">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<img src="/assets/media/svg/nodata.svg" class="card-img-top w-25 mx-auto pt-5" alt="Not found image" />
|
<img src="/assets/media/svg/nodata.svg" class="card-img-top w-50 mx-auto pt-5" alt="Not found image"/>
|
||||||
<div class="card-body text-center">
|
<div class="card-body text-center">
|
||||||
<h4 class="card-title"><TL>Server not found</TL></h4>
|
<h1 class="card-title">
|
||||||
<p class="card-text">
|
<TL>Server not found</TL>
|
||||||
|
</h1>
|
||||||
|
<p class="card-text fs-4">
|
||||||
<TL>A server with that id cannot be found or you have no access for this server</TL>
|
<TL>A server with that id cannot be found or you have no access for this server</TL>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,107 +41,126 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Console.ConnectionState == ConnectionState.Connected)
|
if (NodeOnline)
|
||||||
{
|
{
|
||||||
if (Console.ServerState == ServerState.Installing)
|
if (Console.ConnectionState == ConnectionState.Connected)
|
||||||
{
|
{
|
||||||
<div class="card">
|
if (Console.ServerState == ServerState.Installing)
|
||||||
<div class="card-body">
|
{
|
||||||
<div class="mb-10">
|
<div class="card">
|
||||||
<div class="fs-2hx fw-bold text-gray-800 text-center mb-13">
|
<div class="card-body">
|
||||||
<span class="me-2">
|
<div class="mb-10">
|
||||||
<TL>Server installation is currently running</TL>
|
<div class="fs-2hx fw-bold text-gray-800 text-center mb-13">
|
||||||
</span>
|
<span class="me-2">
|
||||||
|
<TL>Server installation is currently running</TL>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<Terminal @ref="InstallConsole"></Terminal>
|
||||||
</div>
|
</div>
|
||||||
<Terminal @ref="InstallConsole"></Terminal>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
else if (CurrentServer.Installing)
|
||||||
else if (CurrentServer.Installing)
|
{
|
||||||
{
|
<div class="card">
|
||||||
<div class="card">
|
<div class="card-body">
|
||||||
<div class="card-body">
|
<div class="mb-10">
|
||||||
<div class="mb-10">
|
<div class="fs-2hx fw-bold text-gray-800 text-center mb-13">
|
||||||
<div class="fs-2hx fw-bold text-gray-800 text-center mb-13">
|
<span class="me-2">
|
||||||
<span class="me-2">
|
<TL>Server installation is currently running</TL>
|
||||||
<TL>Server installation is currently running</TL>
|
</span>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<Terminal @ref="InstallConsole"></Terminal>
|
||||||
</div>
|
</div>
|
||||||
<Terminal @ref="InstallConsole"></Terminal>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
<CascadingValue Value="Console">
|
||||||
<CascadingValue Value="Console">
|
<CascadingValue Value="CurrentServer">
|
||||||
<CascadingValue Value="CurrentServer">
|
<CascadingValue Value="Tags">
|
||||||
<CascadingValue Value="Tags">
|
<CascadingValue Value="Node">
|
||||||
<CascadingValue Value="Node">
|
<CascadingValue Value="Image">
|
||||||
<CascadingValue Value="Image">
|
<CascadingValue Value="NodeAllocation">
|
||||||
<CascadingValue Value="NodeAllocation">
|
@{
|
||||||
@{
|
var index = 0;
|
||||||
var index = 0;
|
|
||||||
|
|
||||||
switch (Route)
|
switch (Route)
|
||||||
{
|
{
|
||||||
case "files":
|
case "files":
|
||||||
index = 1;
|
index = 1;
|
||||||
break;
|
break;
|
||||||
case "backups":
|
case "backups":
|
||||||
index = 2;
|
index = 2;
|
||||||
break;
|
break;
|
||||||
case "network":
|
case "network":
|
||||||
index = 3;
|
index = 3;
|
||||||
break;
|
break;
|
||||||
case "addons":
|
case "addons":
|
||||||
index = 4;
|
index = 4;
|
||||||
break;
|
break;
|
||||||
case "settings":
|
case "settings":
|
||||||
index = 5;
|
index = 5;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
index = 0;
|
index = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
<ServerNavigation Index="index">
|
<ServerNavigation Index="index">
|
||||||
@switch (Route)
|
@switch (Route)
|
||||||
{
|
{
|
||||||
case "files":
|
case "files":
|
||||||
<ServerFiles></ServerFiles>
|
<ServerFiles></ServerFiles>
|
||||||
break;
|
break;
|
||||||
case "backups":
|
case "backups":
|
||||||
<ServerBackups></ServerBackups>
|
<ServerBackups></ServerBackups>
|
||||||
break;
|
break;
|
||||||
case "network":
|
case "network":
|
||||||
<ServerNetwork></ServerNetwork>
|
<ServerNetwork></ServerNetwork>
|
||||||
break;
|
break;
|
||||||
case "addons":
|
case "addons":
|
||||||
<ServerAddons></ServerAddons>
|
<ServerAddons></ServerAddons>
|
||||||
break;
|
break;
|
||||||
case "settings":
|
case "settings":
|
||||||
<ServerSettings></ServerSettings>
|
<ServerSettings></ServerSettings>
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
<ServerConsole></ServerConsole>
|
<ServerConsole></ServerConsole>
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
</ServerNavigation>
|
</ServerNavigation>
|
||||||
|
</CascadingValue>
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
</CascadingValue>
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<TL>Connecting</TL>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="alert alert-info">
|
<div class="d-flex justify-content-center flex-center">
|
||||||
<TL>Connecting</TL>
|
<div class="card">
|
||||||
|
<img src="/assets/media/svg/serverdown.svg" class="card-img-top w-50 mx-auto pt-5" alt="Not found image"/>
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<h1 class="card-title">
|
||||||
|
<TL>Node offline</TL>
|
||||||
|
</h1>
|
||||||
|
<p class="card-text fs-4">
|
||||||
|
<TL>The node the server is running on is currently offline</TL>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +171,7 @@
|
|||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string ServerUuid { get; set; }
|
public string ServerUuid { get; set; }
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
@@ -159,6 +181,7 @@
|
|||||||
private PteroConsole? Console;
|
private PteroConsole? Console;
|
||||||
private Server? CurrentServer;
|
private Server? CurrentServer;
|
||||||
private Node Node;
|
private Node Node;
|
||||||
|
private bool NodeOnline = false;
|
||||||
private Image Image;
|
private Image Image;
|
||||||
private NodeAllocation NodeAllocation;
|
private NodeAllocation NodeAllocation;
|
||||||
private string[] Tags;
|
private string[] Tags;
|
||||||
@@ -205,7 +228,7 @@
|
|||||||
.Include(x => x.Owner)
|
.Include(x => x.Owner)
|
||||||
.First(x => x.Uuid == uuid);
|
.First(x => x.Uuid == uuid);
|
||||||
|
|
||||||
if (CurrentServer.Owner.Id != User!.Id && User.Admin)
|
if (CurrentServer.Owner.Id != User!.Id && !User.Admin)
|
||||||
CurrentServer = null;
|
CurrentServer = null;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@@ -215,28 +238,43 @@
|
|||||||
|
|
||||||
if (CurrentServer != null)
|
if (CurrentServer != null)
|
||||||
{
|
{
|
||||||
await lazyLoader.SetText("Requesting tags");
|
await lazyLoader.SetText("Checking node online status");
|
||||||
|
|
||||||
var image = ImageRepository
|
try
|
||||||
.Get()
|
|
||||||
.First(x => x.Id == CurrentServer.Image.Id);
|
|
||||||
|
|
||||||
Tags = JsonConvert.DeserializeObject<string[]>(image.TagsJson) ?? Array.Empty<string>();
|
|
||||||
Image = image;
|
|
||||||
|
|
||||||
await lazyLoader.SetText("Connecting to console");
|
|
||||||
|
|
||||||
await WingsConsoleHelper.ConnectWings(Console!, CurrentServer);
|
|
||||||
|
|
||||||
MessageService.Subscribe<Index, Server>($"server.{CurrentServer.Uuid}.installcomplete", this, server =>
|
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
//TODO: Implement status caching
|
||||||
|
var data = await NodeService.GetStatus(CurrentServer.Node);
|
||||||
|
|
||||||
|
if (data != null)
|
||||||
|
NodeOnline = true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NodeOnline)
|
||||||
|
{
|
||||||
|
await lazyLoader.SetText("Requesting tags");
|
||||||
|
|
||||||
|
var image = ImageRepository
|
||||||
|
.Get()
|
||||||
|
.First(x => x.Id == CurrentServer.Image.Id);
|
||||||
|
|
||||||
|
Tags = JsonConvert.DeserializeObject<string[]>(image.TagsJson) ?? Array.Empty<string>();
|
||||||
|
Image = image;
|
||||||
|
|
||||||
|
await lazyLoader.SetText("Connecting to console");
|
||||||
|
|
||||||
|
await WingsConsoleHelper.ConnectWings(Console!, CurrentServer);
|
||||||
|
|
||||||
|
MessageService.Subscribe<Index, Server>($"server.{CurrentServer.Uuid}.installcomplete", this, server =>
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo(NavigationManager.Uri);
|
Task.Run(() => { NavigationManager.NavigateTo(NavigationManager.Uri); });
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return Task.CompletedTask;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -478,3 +478,7 @@ Enter your information;Enter your information
|
|||||||
You need to enter your full name in order to use moonlight;You need to enter your full name in order to use moonlight
|
You need to enter your full name in order to use moonlight;You need to enter your full name in order to use moonlight
|
||||||
No node found;No node found
|
No node found;No node found
|
||||||
No node found to deploy to found;No node found to deploy to found
|
No node found to deploy to found;No node found to deploy to found
|
||||||
|
Node offline;Node offline
|
||||||
|
The node the server is running on is currently offline;The node the server is running on is currently offline
|
||||||
|
Server not found;Server not found
|
||||||
|
A server with that id cannot be found or you have no access for this server;A server with that id cannot be found or you have no access for this server
|
||||||
|
|||||||
1
Moonlight/wwwroot/assets/media/svg/serverdown.svg
Normal file
1
Moonlight/wwwroot/assets/media/svg/serverdown.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.4 KiB |
Reference in New Issue
Block a user