Корректировка последовательности логов

This commit is contained in:
Maxim
2026-06-18 14:16:11 +03:00
parent 627c18c2b3
commit 9bbcd67065
2 changed files with 29 additions and 10 deletions

View File

@@ -170,12 +170,17 @@ func (a *API) HandleLogEvents(w http.ResponseWriter, r *http.Request) {
end = total
}
// Получаем строки для текущей страницы (в прямом порядке)
var resultLines []string
// Получаем строки для текущей страницы
var pageLines []string
if start < total && start >= 0 {
resultLines = lines[start:end]
pageLines = lines[start:end]
} else {
resultLines = []string{}
pageLines = []string{}
}
var reversedLines []string
for i := len(pageLines) - 1; i >= 0; i-- {
reversedLines = append(reversedLines, pageLines[i])
}
// Парсим строки для JSON
@@ -185,7 +190,7 @@ func (a *API) HandleLogEvents(w http.ResponseWriter, r *http.Request) {
}
var events []Event
for _, line := range resultLines {
for _, line := range reversedLines {
if line == "" {
continue
}
@@ -204,8 +209,8 @@ func (a *API) HandleLogEvents(w http.ResponseWriter, r *http.Request) {
"page": page,
"page_size": pageSize,
"total_pages": totalPages,
"has_previous": page > 1, // Есть более старые записи
"has_next": page < totalPages, // Есть более новые записи
"has_previous": page > 1,
"has_next": page < totalPages,
"returned": len(events),
"start_index": start + 1,
"end_index": end,

View File

@@ -5,18 +5,23 @@
display: flex;
gap: 20px;
height: calc(100vh - 120px);
overflow: visible; /* Разрешаем выход за границы */
}
.logs-sidebar {
flex: 0 0 280px;
border-right: 1px solid #00ff88;
padding-right: 16px;
padding-left: 4px;
overflow-y: auto;
overflow-x: visible;
}
.logs-content {
flex: 1;
overflow-y: auto;
overflow-x: visible;
padding: 0 4px;
}
/* ===== ФАЙЛЫ В БОКОВОЙ ПАНЕЛИ ===== */
@@ -30,6 +35,7 @@
font-family: var(--font-mono);
background: rgba(0, 255, 136, 0.03);
transform: scale(1);
box-sizing: border-box;
}
.log-file-item:hover {
@@ -37,6 +43,7 @@
border-color: #00ff88;
transform: scale(1.02);
box-shadow: 0 0 20px rgba(0, 255, 136, 0.03);
margin-left: 4px;
}
.log-file-item.active {
@@ -44,6 +51,7 @@
border-color: #00ff88;
box-shadow: 0 0 20px rgba(0, 255, 136, 0.05);
transform: scale(1);
margin-left: 0;
}
.log-file-item .file-name {
@@ -66,6 +74,7 @@
grid-template-columns: repeat(4, 1fr);
gap: 12px;
margin-bottom: 16px;
padding: 0 4px;
}
.log-stat-card {
@@ -201,7 +210,8 @@
display: flex;
gap: 8px;
margin-bottom: 16px;
padding: 4px 0;
padding: 4px 8px;
overflow: visible;
}
.tab-btn {
@@ -217,6 +227,7 @@
transition: all 0.2s ease;
letter-spacing: 0.03em;
transform: scale(1);
flex-shrink: 0;
}
.tab-btn:hover {
@@ -245,11 +256,12 @@
/* ===== ПАГИНАЦИЯ ===== */
.pagination-container {
margin: 16px 0;
padding: 14px;
padding: 14px 8px;
border-top: 1px solid rgba(0, 255, 136, 0.15);
border-bottom: 1px solid rgba(0, 255, 136, 0.15);
background: rgba(0, 255, 136, 0.02);
border-radius: 4px;
overflow: visible;
}
.pagination-controls {
@@ -258,7 +270,8 @@
justify-content: center;
gap: 8px;
flex-wrap: wrap;
padding: 4px 0;
padding: 4px 4px;
overflow: visible;
}
.pagination-btn {
@@ -274,6 +287,7 @@
transition: all 0.2s ease;
min-width: 44px;
transform: scale(1);
flex-shrink: 0;
}
.pagination-btn:hover:not(:disabled) {