feat(admin): layout log files page side-by-side when viewing
This commit is contained in:
@@ -9,16 +9,28 @@
|
|||||||
<Breadcrumb IsFirstFromRoot="true" Caption="@Resources.LogFiles"/>
|
<Breadcrumb IsFirstFromRoot="true" Caption="@Resources.LogFiles"/>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<!-- Left Column: File List -->
|
||||||
|
<div class="@(this._selectedFile != null ? "col-lg-3 col-md-4" : "col-12") transition-all">
|
||||||
<div class="card shadow-sm border-0 mb-4">
|
<div class="card shadow-sm border-0 mb-4">
|
||||||
<div class="card-body p-0">
|
<div class="card-header bg-light py-2 px-3">
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<strong class="m-0">Log Files</strong>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-secondary py-0 px-2" @onclick="RefreshFileList" title="Reload File List">
|
||||||
|
<span class="oi oi-reload" style="font-size: 11px;"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0" style="max-height: 620px; overflow-y: auto;">
|
||||||
<table class="table table-striped table-hover mb-0">
|
<table class="table table-striped table-hover mb-0">
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>@Resources.FileName</th>
|
<th>@Resources.FileName</th>
|
||||||
<th>@Resources.LastUpdate</th>
|
@if (this._selectedFile == null)
|
||||||
<th>@Resources.Size</th>
|
{
|
||||||
<th class="text-end px-4">Actions</th>
|
<th>@Resources.LastUpdate</th>
|
||||||
|
<th>@Resources.Size</th>
|
||||||
|
}
|
||||||
|
<th class="text-end px-3">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -27,13 +39,20 @@
|
|||||||
var isSelected = this._selectedFile?.FullName == entry.FullName;
|
var isSelected = this._selectedFile?.FullName == entry.FullName;
|
||||||
<tr class="@(isSelected ? "table-info" : "")">
|
<tr class="@(isSelected ? "table-info" : "")">
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-link p-0 text-start font-monospace text-decoration-none fw-bold" @onclick="() => SelectFile(entry)">
|
<button type="button" class="btn btn-link p-0 text-start font-monospace text-decoration-none fw-bold text-truncate" style="max-width: @(this._selectedFile != null ? "140px" : "100%");" @onclick="() => SelectFile(entry)" title="@entry.Name">
|
||||||
<span class="oi oi-terminal me-2 @(isSelected ? "text-primary" : "text-muted")"></span>@entry.Name
|
<span class="oi oi-terminal me-1 @(isSelected ? "text-primary" : "text-muted")"></span>@entry.Name
|
||||||
</button>
|
</button>
|
||||||
|
@if (this._selectedFile != null)
|
||||||
|
{
|
||||||
|
<div class="text-muted" style="font-size: 11px;">@FormatFileSize(entry.Length)</div>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@entry.LastWriteTime</td>
|
@if (this._selectedFile == null)
|
||||||
<td>@FormatFileSize(entry.Length)</td>
|
{
|
||||||
<td class="text-end px-4">
|
<td>@entry.LastWriteTime</td>
|
||||||
|
<td>@FormatFileSize(entry.Length)</td>
|
||||||
|
}
|
||||||
|
<td class="text-end px-3">
|
||||||
<a href="logs/@entry.Name" download class="btn btn-sm btn-outline-secondary py-0 px-2" title="Download File">
|
<a href="logs/@entry.Name" download class="btn btn-sm btn-outline-secondary py-0 px-2" title="Download File">
|
||||||
<span class="oi oi-data-transfer-download" aria-hidden="true"></span>
|
<span class="oi oi-data-transfer-download" aria-hidden="true"></span>
|
||||||
</a>
|
</a>
|
||||||
@@ -45,78 +64,80 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (this._selectedFile != null)
|
<!-- Right Column: Log Viewer Terminal -->
|
||||||
{
|
@if (this._selectedFile != null)
|
||||||
<div class="card border-secondary shadow-lg mb-4">
|
{
|
||||||
<div class="card-header bg-dark text-white d-flex justify-content-between align-items-center py-2 px-3">
|
<div class="col-lg-9 col-md-8">
|
||||||
<div class="d-flex align-items-center">
|
<div class="card border-secondary shadow-lg mb-4">
|
||||||
<span class="oi oi-terminal text-info me-2" aria-hidden="true"></span>
|
<div class="card-header bg-dark text-white d-flex justify-content-between align-items-center py-2 px-3">
|
||||||
<span class="me-2">Log Viewer:</span>
|
<div class="d-flex align-items-center text-truncate me-2">
|
||||||
<span class="badge bg-secondary font-monospace">@this._selectedFile.Name</span>
|
<span class="oi oi-terminal text-info me-2" aria-hidden="true"></span>
|
||||||
<span class="badge bg-dark border border-secondary ms-2 text-muted" style="font-size: 11px;">@FormatFileSize(this._selectedFile.Length)</span>
|
<span class="me-2 d-none d-sm-inline">Log Viewer:</span>
|
||||||
</div>
|
<span class="badge bg-secondary font-monospace text-truncate" style="max-width: 250px;">@this._selectedFile.Name</span>
|
||||||
<div class="d-flex align-items-center gap-3">
|
</div>
|
||||||
<div class="form-check form-switch m-0 d-flex align-items-center gap-2">
|
<div class="d-flex align-items-center gap-2 gap-sm-3 flex-shrink-0">
|
||||||
<input class="form-check-input cursor-pointer" type="checkbox" id="liveUpdateSwitch" @onchange="ToggleLiveUpdate" checked="@this._liveUpdate">
|
<div class="form-check form-switch m-0 d-flex align-items-center gap-2">
|
||||||
<label class="form-check-label text-light select-none cursor-pointer" for="liveUpdateSwitch" style="font-size: 13px;">Live Update</label>
|
<input class="form-check-input cursor-pointer" type="checkbox" id="liveUpdateSwitch" @onchange="ToggleLiveUpdate" checked="@this._liveUpdate">
|
||||||
|
<label class="form-check-label text-light select-none cursor-pointer" for="liveUpdateSwitch" style="font-size: 13px;">Live</label>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-sm btn-outline-info d-flex align-items-center gap-1 py-1" @onclick="RefreshLogLines">
|
||||||
|
<span class="oi oi-reload" style="font-size: 11px;"></span> Refresh
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-sm btn-outline-danger d-flex align-items-center gap-1 py-1" @onclick="CloseViewer">
|
||||||
|
<span class="oi oi-x" style="font-size: 11px;"></span> Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-sm btn-outline-info d-flex align-items-center gap-1 py-1" @onclick="RefreshLogLines">
|
<div class="card-body bg-dark p-3" style="background-color: #121214 !important;">
|
||||||
<span class="oi oi-reload" style="font-size: 11px;"></span> Refresh
|
<div class="row g-2 mb-3">
|
||||||
</button>
|
<div class="col">
|
||||||
<button class="btn btn-sm btn-outline-danger d-flex align-items-center gap-1 py-1" @onclick="CloseViewer">
|
<div class="input-group">
|
||||||
<span class="oi oi-x" style="font-size: 11px;"></span> Close
|
<span class="input-group-text bg-secondary text-white border-0"><span class="oi oi-magnifying-glass" aria-hidden="true"></span></span>
|
||||||
</button>
|
<input type="text" class="form-control bg-secondary text-white border-0" placeholder="Filter log entries..." @bind="this._searchText" @bind:event="oninput" style="background-color: #2b2b30 !important; color: #fff !important;" />
|
||||||
</div>
|
@if (!string.IsNullOrEmpty(this._searchText))
|
||||||
</div>
|
{
|
||||||
<div class="card-body bg-dark p-3" style="background-color: #121214 !important;">
|
<button class="btn btn-secondary border-0" @onclick="ClearSearch"><span class="oi oi-x" aria-hidden="true"></span></button>
|
||||||
<div class="row g-2 mb-3">
|
}
|
||||||
<div class="col">
|
</div>
|
||||||
<div class="input-group">
|
</div>
|
||||||
<span class="input-group-text bg-secondary text-white border-0"><span class="oi oi-magnifying-glass" aria-hidden="true"></span></span>
|
</div>
|
||||||
<input type="text" class="form-control bg-secondary text-white border-0" placeholder="Filter log entries..." @bind="this._searchText" @bind:event="oninput" style="background-color: #2b2b30 !important; color: #fff !important;" />
|
|
||||||
@if (!string.IsNullOrEmpty(this._searchText))
|
<div id="log-terminal" class="p-3 rounded" style="height: 480px; overflow-y: auto; font-family: 'Consolas', 'Liberation Mono', Menlo, Courier, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; background-color: #0c0c0d !important; border: 1px solid #2d2d30;">
|
||||||
|
@if (this._logLines.Count == 0)
|
||||||
{
|
{
|
||||||
<button class="btn btn-secondary border-0" @onclick="ClearSearch"><span class="oi oi-x" aria-hidden="true"></span></button>
|
<div class="text-muted text-center py-5">No log entries found.</div>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var filteredLines = GetFilteredLines();
|
||||||
|
@if (filteredLines.Count == 0)
|
||||||
|
{
|
||||||
|
<div class="text-muted text-center py-5">No log entries match your filter.</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@foreach (var line in filteredLines)
|
||||||
|
{
|
||||||
|
<div style="@GetLineColorStyle(line)">@line</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between align-items-center mt-2 text-muted" style="font-size: 12px;">
|
||||||
|
<div>
|
||||||
|
Showing @GetFilteredLines().Count of @this._logLines.Count lines (Last 300 lines loaded).
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-sm btn-outline-secondary py-1 px-2" style="font-size: 12px; color: #a0a0a8;" @onclick="ScrollToBottom">
|
||||||
|
<span class="oi oi-arrow-bottom" aria-hidden="true"></span> Scroll to Bottom
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="log-terminal" class="p-3 rounded" style="height: 450px; overflow-y: auto; font-family: 'Consolas', 'Liberation Mono', Menlo, Courier, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; background-color: #0c0c0d !important; border: 1px solid #2d2d30;">
|
|
||||||
@if (this._logLines.Count == 0)
|
|
||||||
{
|
|
||||||
<div class="text-muted text-center py-5">No log entries found.</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var filteredLines = GetFilteredLines();
|
|
||||||
@if (filteredLines.Count == 0)
|
|
||||||
{
|
|
||||||
<div class="text-muted text-center py-5">No log entries match your filter.</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@foreach (var line in filteredLines)
|
|
||||||
{
|
|
||||||
<div style="@GetLineColorStyle(line)">@line</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-2 text-muted" style="font-size: 12px;">
|
|
||||||
<div>
|
|
||||||
Showing @GetFilteredLines().Count of @this._logLines.Count lines (Last 300 lines loaded).
|
|
||||||
</div>
|
|
||||||
<button class="btn btn-sm btn-outline-secondary py-1 px-2" style="font-size: 12px; color: #a0a0a8;" @onclick="ScrollToBottom">
|
|
||||||
<span class="oi oi-arrow-bottom" aria-hidden="true"></span> Scroll to Bottom
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private readonly List<FileInfo> _files = new ();
|
private readonly List<FileInfo> _files = new ();
|
||||||
|
|||||||
Reference in New Issue
Block a user