From dcbea5799ac9b538d010b13fc27af198b7f4fd7c Mon Sep 17 00:00:00 2001 From: Orionis312050 Date: Thu, 16 Apr 2026 20:09:41 +0200 Subject: [PATCH] Ai selection --- src/components/LogTerminal.tsx | 55 +++++++++++++++++++++++++--------- src/index.css | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 14 deletions(-) diff --git a/src/components/LogTerminal.tsx b/src/components/LogTerminal.tsx index f71ace9..5faa049 100644 --- a/src/components/LogTerminal.tsx +++ b/src/components/LogTerminal.tsx @@ -95,6 +95,21 @@ export default function LogTerminal({ service, initialLogs = [] }: { })); }; + const handleAnalyzeChunk = (chunk: { id: string, line: string, isError: boolean }[]) => { + if (chunk.length === 0) return; + const batchText = chunk.map(l => l.line).join('\n'); + window.dispatchEvent(new CustomEvent('analyze-log', { + detail: { line: `Voici un ensemble de ${chunk.length} logs :\n${batchText}`, serviceName: service.name } + })); + }; + + const chunkedLogs = []; + // Chunk starting from the end so latest logs are strictly grouped by 5 + for (let i = logs.length; i > 0; i -= 5) { + const start = Math.max(0, i - 5); + chunkedLogs.unshift(logs.slice(start, i)); + } + return (
@@ -116,25 +131,37 @@ export default function LogTerminal({ service, initialLogs = [] }: {
- {logs.length === 0 ? ( + {chunkedLogs.length === 0 ? (
En attente de nouveaux logs pour '{service.name}'...
) : ( - logs.map(log => ( -
-
- - {log.line} - + chunkedLogs.map((chunk, chunkIndex) => ( +
+
+ {chunk.map(log => ( +
+
+ + {log.line} + +
+ +
+ ))} +
+ +
handleAnalyzeChunk(chunk)} title="Analyser cette zone de logs"> +
+ +
-
)) )} diff --git a/src/index.css b/src/index.css index 9e895ea..1b6fd6d 100644 --- a/src/index.css +++ b/src/index.css @@ -1000,3 +1000,58 @@ header h1 { color: var(--text-muted); font-style: italic; } + +/* Chunked Logs Container */ +.log-chunk { + display: flex; + position: relative; + transition: background 0.2s; +} + +.chunk-lines { + flex: 1; + min-width: 0; + transition: background 0.2s; + border-radius: 4px 0 0 4px; +} + +/* La fameuse fine barre continue */ +.chunk-sidebar { + width: 24px; + flex-shrink: 0; + border-left: 1px solid rgba(255, 255, 255, 0.05); /* Ligne subtile pour marquer la droite */ + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + background: transparent; + transition: all 0.2s; + margin-right: -1rem; /* S'étend jusqu'au bord du padding */ +} + +.chunk-sidebar-icon { + opacity: 0; + color: var(--accent-color); + transition: opacity 0.2s, transform 0.2s; +} + +/* Comportement au survol de la zone de la barre latérale ! */ +.chunk-sidebar:hover { + background: rgba(45, 120, 255, 0.05); + border-left: 1px solid var(--accent-color); +} + +.chunk-sidebar:hover .chunk-sidebar-icon { + opacity: 1; + transform: scale(1.1); +} + +/* Surbrillance visuelle automatique des logs dans cette zone (utilise le sélecteur :has pour Chrome/Safari modernes) */ +.log-chunk:has(.chunk-sidebar:hover) .chunk-lines { + background: rgba(45, 120, 255, 0.08); /* Highlight de la zone de texte */ +} + +/* Garder l'apparition du bouton sparkle au survol sur une ligne individuelle */ +.log-line-wrapper { + position: relative; +}