Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/components/ContainerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ const ContainerCard: React.FC<ContainerCardProps> = ({
const handleStart = async () => {
await onStart(key);
};
const getLogColor = (line: string) => {
if (/\bERROR\b/.test(line)) return '#ff4d4d';
if (/\bWARN\b/.test(line) || /\bWARNING\b/.test(line)) return '#ffd966';
if (/\bINFO\b/.test(line)) return '#87CEEB';
return '#ffffff';
};

// Connect WebSocket logs when running and logsWsUrl changes
useEffect(() => {
Expand Down Expand Up @@ -142,18 +148,26 @@ const ContainerCard: React.FC<ContainerCardProps> = ({
ref={logBoxRef}
style={{
backgroundColor: '#111',
color: '#0f0',
padding: 10,
borderRadius: 4,
height: 150,
overflowY: 'auto',
marginTop: 4,
fontSize: 12,
whiteSpace: 'pre-wrap',
wordWrap: 'break-word',
}}
>
{logs.join('\n')}
{logs.map((line, idx) => (
<div
key={idx}
style={{
color: getLogColor(line),
whiteSpace: 'pre-wrap',
wordBreak: 'break-word',
}}
>
{line}
</div>
))}
</pre>
</div>
)}
Expand Down
Loading