TUI: добавить endpoint в dashboard и выход по Q
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
@inject InMemoryLogSink LogSink
|
||||
@inject GlobalKeyboardService KeyboardService
|
||||
@inject LocalizationService Localization
|
||||
@inject IHostApplicationLifetime AppLifetime
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
@@ -38,6 +39,7 @@
|
||||
SelectedIndex="@_overviewSelection"
|
||||
SelectedIndexChanged="@OnOverviewSelectionChanged"
|
||||
ViewportRows="@GetOverviewViewportRows()"
|
||||
Endpoint="@_mcpEndpoint"
|
||||
Loc="@Localization.Current" />
|
||||
}
|
||||
else if (_activeTab == Tab.Logs)
|
||||
@@ -81,6 +83,9 @@
|
||||
private int _settingsSelection;
|
||||
private bool _logsStickToBottom = true;
|
||||
|
||||
private static readonly string _mcpEndpoint =
|
||||
Environment.GetEnvironmentVariable("ASPNETCORE_URLS") ?? "http://localhost:5000";
|
||||
|
||||
private static int GetPanelHeight() => Math.Max(Console.WindowHeight - 2, 10);
|
||||
private static int GetOverviewViewportRows() => Math.Max(Console.WindowHeight - 11, 3);
|
||||
private static int GetLogsViewportRows() => Math.Max(Console.WindowHeight - 16, 5);
|
||||
@@ -152,6 +157,12 @@
|
||||
return; // StateHasChanged вызовет OnLocaleChanged
|
||||
}
|
||||
|
||||
if (args.Key is "q" or "Q")
|
||||
{
|
||||
AppLifetime.StopApplication();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_activeTab)
|
||||
{
|
||||
case Tab.Overview:
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<Markup Content="@Loc.OverviewTitle" Foreground="@UiPalette.Text" Decoration="@Spectre.Console.Decoration.Bold" />
|
||||
<Markup Content="@Loc.OverviewHint" Foreground="@UiPalette.TextMuted" />
|
||||
<Markup Content=" " />
|
||||
<Markup Content="@($"{Loc.DashboardEndpointLabel}: {Endpoint}")" Foreground="@UiPalette.Accent" />
|
||||
<Markup Content=" " />
|
||||
|
||||
@if (Rows.Count == 0)
|
||||
{
|
||||
@@ -30,6 +32,7 @@
|
||||
[Parameter] public int SelectedIndex { get; set; }
|
||||
[Parameter] public EventCallback<int> SelectedIndexChanged { get; set; }
|
||||
[Parameter] public int ViewportRows { get; set; } = 3;
|
||||
[Parameter] public string Endpoint { get; set; } = "";
|
||||
[Parameter] public TuiResources Loc { get; set; } = TuiResources.En;
|
||||
|
||||
private int[] GetOptions() => Enumerable.Range(0, Rows.Count).ToArray();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.Extensions.Hosting
|
||||
@using RazorConsole.Components
|
||||
@using RazorConsole.Core
|
||||
@using RazorConsole.Core.Rendering
|
||||
|
||||
Reference in New Issue
Block a user