From e8456de2cbc6516708c325786d25c55295b0c2c7 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Thu, 13 Apr 2023 17:57:51 -0500 Subject: [PATCH] Lightly integrate xtermjs --- LANCommander/LANCommander.csproj | 1 + LANCommander/Pages/Servers/Logs.razor | 18 +++++++++--------- LANCommander/Pages/_Layout.cshtml | 2 ++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/LANCommander/LANCommander.csproj b/LANCommander/LANCommander.csproj index 7942b71..78f62d7 100644 --- a/LANCommander/LANCommander.csproj +++ b/LANCommander/LANCommander.csproj @@ -41,6 +41,7 @@ + diff --git a/LANCommander/Pages/Servers/Logs.razor b/LANCommander/Pages/Servers/Logs.razor index 223e207..c4feac7 100644 --- a/LANCommander/Pages/Servers/Logs.razor +++ b/LANCommander/Pages/Servers/Logs.razor @@ -1,23 +1,24 @@ @page "/Servers/{id:guid}/Logs" @using Microsoft.AspNetCore.SignalR.Client +@using XtermBlazor @attribute [Authorize] @inject ServerService ServerService @inject ServerProcessService ServerProcessService @inject NavigationManager NavigationManager @implements IAsyncDisposable -
-    @foreach (var message in Messages)
-    {
-        @message 
- } -
+ @code { [Parameter] public Guid Id { get; set; } + Xterm? Terminal; HubConnection? HubConnection; - List Messages = new List(); + TerminalOptions TerminalOptions = new TerminalOptions + { + CursorBlink = true, + CursorStyle = CursorStyle.Underline + }; protected override async Task OnInitializedAsync() { @@ -27,8 +28,7 @@ HubConnection.On("Log", (message) => { - Messages.Add(message); - InvokeAsync(StateHasChanged); + Terminal.WriteLine(message); }); await HubConnection.StartAsync(); diff --git a/LANCommander/Pages/_Layout.cshtml b/LANCommander/Pages/_Layout.cshtml index 36504df..2dc7185 100644 --- a/LANCommander/Pages/_Layout.cshtml +++ b/LANCommander/Pages/_Layout.cshtml @@ -10,6 +10,7 @@ + @@ -26,6 +27,7 @@ +