Ai selection
This commit is contained in:
1 parent
b8a847c210
commit
dcbea5799a
2 files changed
+96
-14
No files matched your search
@@ -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 (
|
||||
<div className={`terminal-container ${isPaused ? 'paused' : 'live'}`}>
|
||||
<div className="terminal-controls">
|
||||
@@ -116,25 +131,37 @@ export default function LogTerminal({ service, initialLogs = [] }: {
|
||||
</div>
|
||||
|
||||
<div className="terminal-content" ref={terminalContentRef}>
|
||||
{logs.length === 0 ? (
|
||||
{chunkedLogs.length === 0 ? (
|
||||
<div style={{ color: 'var(--text-muted)', display: 'flex', height: '100%', alignItems: 'center', justifyContent: 'center' }}>
|
||||
En attente de nouveaux logs pour '{service.name}'...
|
||||
</div>
|
||||
) : (
|
||||
logs.map(log => (
|
||||
<div key={log.id} className="log-line-wrapper">
|
||||
<div className="log-line">
|
||||
<span className={`log-text ${log.isError ? 'log-error' : ''}`}>
|
||||
{log.line}
|
||||
</span>
|
||||
chunkedLogs.map((chunk, chunkIndex) => (
|
||||
<div key={`chunk-${chunkIndex}`} className="log-chunk">
|
||||
<div className="chunk-lines">
|
||||
{chunk.map(log => (
|
||||
<div key={log.id} className="log-line-wrapper">
|
||||
<div className="log-line">
|
||||
<span className={`log-text ${log.isError ? 'log-error' : ''}`}>
|
||||
{log.line}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
className="btn-analyze-log"
|
||||
onClick={() => handleAnalyzeLog(log.line)}
|
||||
title="Analyser ce log uniquement"
|
||||
>
|
||||
<Sparkles size={12} />
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="chunk-sidebar" onClick={() => handleAnalyzeChunk(chunk)} title="Analyser cette zone de logs">
|
||||
<div className="chunk-sidebar-icon">
|
||||
<Sparkles size={14} />
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
className="btn-analyze-log"
|
||||
onClick={() => handleAnalyzeLog(log.line)}
|
||||
title="Analyser avec l'IA"
|
||||
>
|
||||
<Sparkles size={12} />
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user