|
|
@@ -204,9 +204,9 @@ export default function NodeLogTerminal({
|
|
|
};
|
|
|
|
|
|
return (
|
|
|
- <div className="flex flex-col h-full bg-neutral-900 border-2 border-black text-xs font-mono select-text">
|
|
|
+ <div className="flex flex-col h-full min-h-0 bg-neutral-900 border-2 border-black text-xs font-mono select-text overflow-hidden">
|
|
|
{/* 1. 顶部控制工具栏 */}
|
|
|
- <div className="bg-neutral-800 border-b-2 border-black p-2.5 flex flex-wrap items-center justify-between gap-2 text-white">
|
|
|
+ <div className="bg-neutral-800 border-b-2 border-black p-2.5 flex flex-wrap items-center justify-between gap-2 text-white shrink-0 select-none">
|
|
|
{/* 左侧:角色切换 & 状态指示 */}
|
|
|
<div className="flex items-center gap-2 flex-wrap">
|
|
|
<div className="flex items-center gap-1.5 px-2 py-1 bg-black border border-neutral-700">
|
|
|
@@ -376,7 +376,7 @@ export default function NodeLogTerminal({
|
|
|
<div
|
|
|
ref={terminalBodyRef}
|
|
|
onScroll={handleScroll}
|
|
|
- className="flex-1 overflow-y-auto p-3.5 space-y-1 bg-[#0d1117] text-neutral-200 font-mono text-[11px] leading-relaxed relative min-h-[360px] max-h-[560px]"
|
|
|
+ className="flex-1 min-h-0 overflow-y-auto p-3.5 pb-6 space-y-1 bg-[#0d1117] text-neutral-200 font-mono text-[11px] leading-relaxed relative"
|
|
|
>
|
|
|
{filteredLogs.length === 0 ? (
|
|
|
<div className="h-full flex flex-col items-center justify-center text-neutral-500 py-16">
|
|
|
@@ -395,54 +395,59 @@ export default function NodeLogTerminal({
|
|
|
)}
|
|
|
</div>
|
|
|
) : (
|
|
|
- filteredLogs.map((log, idx) => {
|
|
|
- const lvl = (log.level || 'INFO').toUpperCase();
|
|
|
- const isError = lvl === 'ERROR';
|
|
|
- const isWarn = lvl === 'WARN' || lvl === 'WARNING';
|
|
|
-
|
|
|
- return (
|
|
|
- <div
|
|
|
- key={log.id ? `${log.id}-${idx}` : idx}
|
|
|
- className={`flex items-start gap-2 py-0.5 hover:bg-neutral-800/60 rounded-xs px-1.5 transition ${
|
|
|
- isError
|
|
|
- ? 'text-rose-300 bg-rose-950/20'
|
|
|
- : isWarn
|
|
|
- ? 'text-amber-200 bg-amber-950/20'
|
|
|
- : 'text-neutral-300'
|
|
|
- }`}
|
|
|
- >
|
|
|
- {/* 时间戳 */}
|
|
|
- <span className="text-neutral-500 shrink-0 select-none">
|
|
|
- {log.timestamp ? log.timestamp.split(' ')[1] || log.timestamp : '--:--:--'}
|
|
|
- </span>
|
|
|
-
|
|
|
- {/* 级别 Badge */}
|
|
|
- <span
|
|
|
- className={`px-1 py-0.2 rounded-2xs text-[9px] font-black uppercase shrink-0 ${
|
|
|
+ <>
|
|
|
+ {filteredLogs.map((log, idx) => {
|
|
|
+ const lvl = (log.level || 'INFO').toUpperCase();
|
|
|
+ const isError = lvl === 'ERROR';
|
|
|
+ const isWarn = lvl === 'WARN' || lvl === 'WARNING';
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ key={log.id ? `${log.id}-${idx}` : idx}
|
|
|
+ className={`flex items-start gap-2 py-0.5 hover:bg-neutral-800/60 rounded-xs px-1.5 transition ${
|
|
|
isError
|
|
|
- ? 'bg-rose-700 text-white'
|
|
|
+ ? 'text-rose-300 bg-rose-950/20'
|
|
|
: isWarn
|
|
|
- ? 'bg-amber-500 text-black'
|
|
|
- : 'bg-neutral-800 text-emerald-400 border border-emerald-900/60'
|
|
|
+ ? 'text-amber-200 bg-amber-950/20'
|
|
|
+ : 'text-neutral-300'
|
|
|
}`}
|
|
|
>
|
|
|
- {lvl}
|
|
|
- </span>
|
|
|
+ {/* 时间戳 */}
|
|
|
+ <span className="text-neutral-500 shrink-0 select-none">
|
|
|
+ {log.timestamp ? log.timestamp.split(' ')[1] || log.timestamp : '--:--:--'}
|
|
|
+ </span>
|
|
|
|
|
|
- {/* Group 标识 (若有) */}
|
|
|
- {log.group_id && (
|
|
|
- <span className="px-1 py-0.2 rounded-2xs text-[9px] font-mono font-bold bg-cyan-950 text-cyan-300 border border-cyan-800 shrink-0">
|
|
|
- {log.group_id}
|
|
|
+ {/* 级别 Badge */}
|
|
|
+ <span
|
|
|
+ className={`px-1 py-0.2 rounded-2xs text-[9px] font-black uppercase shrink-0 ${
|
|
|
+ isError
|
|
|
+ ? 'bg-rose-700 text-white'
|
|
|
+ : isWarn
|
|
|
+ ? 'bg-amber-500 text-black'
|
|
|
+ : 'bg-neutral-800 text-emerald-400 border border-emerald-900/60'
|
|
|
+ }`}
|
|
|
+ >
|
|
|
+ {lvl}
|
|
|
</span>
|
|
|
- )}
|
|
|
-
|
|
|
- {/* 日志内容 */}
|
|
|
- <span className="break-all whitespace-pre-wrap flex-1">
|
|
|
- {renderMessageWithHighlight(log.message)}
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- );
|
|
|
- })
|
|
|
+
|
|
|
+ {/* Group 标识 (若有) */}
|
|
|
+ {log.group_id && (
|
|
|
+ <span className="px-1 py-0.2 rounded-2xs text-[9px] font-mono font-bold bg-cyan-950 text-cyan-300 border border-cyan-800 shrink-0">
|
|
|
+ {log.group_id}
|
|
|
+ </span>
|
|
|
+ )}
|
|
|
+
|
|
|
+ {/* 日志内容 */}
|
|
|
+ <span className="break-all whitespace-pre-wrap flex-1">
|
|
|
+ {renderMessageWithHighlight(log.message)}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ })}
|
|
|
+
|
|
|
+ {/* 底部缓冲垫,确保最后一条日志即使自动置底时也不会被贴底截断或遮挡 */}
|
|
|
+ <div className="h-6 shrink-0" aria-hidden="true" />
|
|
|
+ </>
|
|
|
)}
|
|
|
|
|
|
{/* 浮动置底按钮 */}
|
|
|
@@ -459,7 +464,7 @@ export default function NodeLogTerminal({
|
|
|
</div>
|
|
|
|
|
|
{/* 3. 底部状态指示栏 */}
|
|
|
- <div className="bg-neutral-950 border-t border-neutral-800 px-3 py-1 flex items-center justify-between text-[10px] text-neutral-400">
|
|
|
+ <div className="bg-neutral-950 border-t border-neutral-800 px-3 py-1.5 flex items-center justify-between text-[10px] text-neutral-400 shrink-0 select-none">
|
|
|
<div className="flex items-center gap-3">
|
|
|
<span>
|
|
|
通道: <code>vs:stream:logs:{nodeId}:{selectedRole}</code>
|