Started implementing dynamic server tabs
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
@using Microsoft.AspNetCore.SignalR.Client
|
||||
@using MoonlightServers.Frontend.UI.Views.User
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Shared.Http.Responses.Users.Servers
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public ServerDetailResponse Server { get; set; }
|
||||
[Parameter] public ServerState State { get; set; }
|
||||
[Parameter] public string InitialConsoleMessage { get; set; }
|
||||
[Parameter] public HubConnection HubConnection { get; set; }
|
||||
[Parameter] public Manage Parent { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
@using Microsoft.AspNetCore.SignalR.Client
|
||||
|
||||
@inherits BaseServerTab
|
||||
|
||||
<div class="h-44">
|
||||
<XtermConsole @ref="XtermConsole" OnAfterInitialized="OnAfterConsoleInitialized"/>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
private XtermConsole? XtermConsole;
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
// We are already connected to the hub at this point
|
||||
|
||||
HubConnection.On<string>("ConsoleOutput", async content =>
|
||||
{
|
||||
if(XtermConsole != null)
|
||||
await XtermConsole.Write(content);
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task OnAfterConsoleInitialized()
|
||||
{
|
||||
await XtermConsole!.Write(InitialConsoleMessage);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user