Lightly integrate xtermjs
parent
74c1930ede
commit
e8456de2cb
|
@ -41,6 +41,7 @@
|
|||
<PackageReference Include="swashbuckle" Version="5.6.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="7.0.0" />
|
||||
<PackageReference Include="XtermBlazor" Version="1.8.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="12.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
<pre>
|
||||
@foreach (var message in Messages)
|
||||
{
|
||||
@message <br />
|
||||
}
|
||||
</pre>
|
||||
<Xterm @ref="Terminal" Options="TerminalOptions" />
|
||||
|
||||
@code {
|
||||
[Parameter] public Guid Id { get; set; }
|
||||
|
||||
Xterm? Terminal;
|
||||
HubConnection? HubConnection;
|
||||
List<string> Messages = new List<string>();
|
||||
TerminalOptions TerminalOptions = new TerminalOptions
|
||||
{
|
||||
CursorBlink = true,
|
||||
CursorStyle = CursorStyle.Underline
|
||||
};
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
@ -27,8 +28,7 @@
|
|||
|
||||
HubConnection.On<string>("Log", (message) =>
|
||||
{
|
||||
Messages.Add(message);
|
||||
InvokeAsync(StateHasChanged);
|
||||
Terminal.WriteLine(message);
|
||||
});
|
||||
|
||||
await HubConnection.StartAsync();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<base href="~/" />
|
||||
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />
|
||||
<link href="_content/XtermBlazor/XtermBlazor.css" rel="stylesheet" />
|
||||
<link href="~/css/site.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -26,6 +27,7 @@
|
|||
<script src="~/_content/BlazorMonaco/jsInterop.js"></script>
|
||||
<script src="~/_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js"></script>
|
||||
<script src="~/_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js"></script>
|
||||
<script src="~/_content/XtermBlazor/XtermBlazor.min.js"></script>
|
||||
<script src="~/js/site.js"></script>
|
||||
<script src="~/js/Upload.js"></script>
|
||||
<script>window.Uploader = new Uploader();</script>
|
||||
|
|
Loading…
Reference in New Issue