AI-Studio/app/MindWork AI Studio/Assistants/LogViewer/AssistantLogViewer.razor
Paul Koudelka b1459523d9
Some checks are pending
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Added an assistant to view the AI Studio logs (#859)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
2026-07-15 19:44:43 +02:00

112 lines
6.8 KiB
Plaintext

@attribute [Route(Routes.ASSISTANT_LOG_VIEWER)]
@inherits MSGComponentBase
<div class="inner-scrolling-context">
<MudText Typo="Typo.h3" Class="mb-2 mr-3">
@T("Log Viewer")
</MudText>
<InnerScrolling FillEntireHorizontalSpace="@true" Class="log-viewer-shell">
<HeaderContent>
<MudStack Row="@true" Wrap="@Wrap.Wrap" AlignItems="@AlignItems.Center" Spacing="2" Class="mb-2">
<MudSelect T="LogFileKind" Value="@this.selectedLogFile" ValueChanged="@this.SelectedLogFileChanged" Label="@T("Select a log file")" Variant="Variant.Outlined" Margin="Margin.Dense" Class="log-viewer-select">
<MudSelectItem T="LogFileKind" Value="@LogFileKind.APP">@T("Usage log")</MudSelectItem>
<MudSelectItem T="LogFileKind" Value="@LogFileKind.STARTUP">@T("Startup log")</MudSelectItem>
</MudSelect>
<MudCheckBox T="bool" Value="@this.autoRefresh" ValueChanged="@this.AutoRefreshChanged" Label="@T("Auto-refresh")" Color="Color.Primary" />
@if (!this.autoRefresh)
{
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Refresh" OnClick="@this.RefreshLogAsync" Disabled="@this.isLoading">
@T("Refresh")
</MudButton>
}
<MudNumericField T="int" Value="@this.maxLines" ValueChanged="@this.MaxLinesChanged" Label="@T("Max lines")" Variant="Variant.Outlined" Margin="Margin.Dense" Min="@MIN_MAX_LINES" Max="@MAX_MAX_LINES" Step="500" Class="log-viewer-number" />
<MudButton Variant="Variant.Outlined" Color="Color.Default" StartIcon="@Icons.Material.Filled.FolderOpen" OnClick="@this.OpenCurrentLogInFileManager" Disabled="@(!this.CanOpenCurrentLogPath)">
@T("Open in folder")
</MudButton>
</MudStack>
<MudStack Row="@true" Wrap="@Wrap.Wrap" AlignItems="@AlignItems.Center" Spacing="2" Class="mb-1">
<MudSelect T="string" Label="@T("Log level")" MultiSelection="@true" SelectedValues="@this.selectedLogLevels" SelectedValuesChanged="@this.SelectedLogLevelsChanged" MultiSelectionTextFunc="@this.GetMultiSelectionText" Variant="Variant.Outlined" Margin="Margin.Dense" Class="log-viewer-multiselect" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Label">
@foreach (var option in this.logLevelOptions)
{
<MudSelectItem T="string" Value="@option">
@this.GetFilterOptionDisplay(option)
</MudSelectItem>
}
</MudSelect>
<MudSelect T="string" Label="@T("Logger")" MultiSelection="@true" SelectedValues="@this.selectedLoggers" SelectedValuesChanged="@this.SelectedLoggersChanged" MultiSelectionTextFunc="@this.GetMultiSelectionText" Variant="Variant.Outlined" Margin="Margin.Dense" Class="log-viewer-multiselect" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Source">
@foreach (var option in this.loggerOptions)
{
<MudSelectItem T="string" Value="@option">
@this.GetFilterOptionDisplay(option)
</MudSelectItem>
}
</MudSelect>
<MudSelect T="string" Label="@T("Source details")" MultiSelection="@true" SelectedValues="@this.selectedSourceDetails" SelectedValuesChanged="@this.SelectedSourceDetailsChanged" MultiSelectionTextFunc="@this.GetMultiSelectionText" Variant="Variant.Outlined" Margin="Margin.Dense" Class="log-viewer-multiselect" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Settings">
@foreach (var option in this.sourceDetailOptions)
{
<MudSelectItem T="string" Value="@option">
@this.GetFilterOptionDisplay(option)
</MudSelectItem>
}
</MudSelect>
<MudCheckBox T="bool" @bind-Value="@this.ShowTimestamps" Label="@T("Show timestamps")" Color="Color.Primary" />
</MudStack>
<MudStack Row="@true" Wrap="@Wrap.Wrap" AlignItems="@AlignItems.Center" Spacing="2" Class="mb-1">
<MudTextField T="string" @bind-Text="@this.FilterText" Immediate="@true" Label="@T("Find")" Variant="Variant.Outlined" Margin="Margin.Dense" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" Class="log-viewer-filter" />
<MudButton Variant="Variant.Text" Color="Color.Default" StartIcon="@Icons.Material.Filled.Clear" Disabled="@(!this.HasActiveFilter)" OnClick="@this.ClearFilters">
@T("Clear")
</MudButton>
<MudCheckBox T="bool" @bind-Value="@this.FilterOnly" Label="@T("Filter only")" Color="Color.Primary" />
</MudStack>
<MudText Typo="Typo.body2" Class="log-viewer-path mb-1">
@this.CurrentLogPath
</MudText>
<MudText Typo="Typo.caption" Class="mb-2">
@this.StatusText
</MudText>
</HeaderContent>
<ChildContent>
@if (!string.IsNullOrWhiteSpace(this.loadError))
{
<MudAlert Severity="Severity.Error" Dense="@true" Variant="Variant.Outlined" Class="mb-2">
@this.loadError
</MudAlert>
}
<div class="log-viewer-pane">
@if (this.isLoading && this.loadedLines.Count == 0)
{
<div class="log-viewer-empty">
<MudProgressCircular Size="Size.Small" Indeterminate="@true" />
<MudText Typo="Typo.body2">@T("Loading log file...")</MudText>
</div>
}
else if (this.displayLines.Count == 0)
{
<div class="log-viewer-empty">
<MudIcon Icon="@Icons.Material.Filled.SearchOff" />
<MudText Typo="Typo.body2">@T("No matching log lines.")</MudText>
</div>
}
else
{
<div class="log-viewer-lines" role="textbox" aria-readonly="true">
@foreach (var line in this.displayLines)
{
<div class="@GetLineClass(line)">
<span class="log-viewer-line-number">@line.Number</span>
<span class="log-viewer-line-text">@((MarkupString)this.RenderLine(line))</span>
</div>
}
</div>
}
</div>
</ChildContent>
</InnerScrolling>
</div>