Automation Part 1

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-03 08:07:43 +00:00
parent 5d96e1a2bd
commit b9774aafa2
23 changed files with 3444 additions and 1 deletions

View File

@@ -0,0 +1,58 @@
/**
* Activity Log Component
* Real-time log viewer for automation runs
*/
import React, { useState, useEffect } from 'react';
import { automationService } from '../../services/automationService';
interface ActivityLogProps {
runId: string;
}
const ActivityLog: React.FC<ActivityLogProps> = ({ runId }) => {
const [logs, setLogs] = useState<string>('');
const [lines, setLines] = useState<number>(100);
useEffect(() => {
loadLogs();
// Poll every 3 seconds
const interval = setInterval(loadLogs, 3000);
return () => clearInterval(interval);
}, [runId, lines]);
const loadLogs = async () => {
try {
const logText = await automationService.getLogs(runId, lines);
setLogs(logText);
} catch (error) {
console.error('Failed to load logs', error);
}
};
return (
<div className="bg-white p-4 rounded-lg shadow">
<div className="flex items-center justify-between mb-3">
<h2 className="text-xl font-bold">Activity Log</h2>
<div className="flex items-center gap-2">
<label className="text-sm">Lines:</label>
<select
value={lines}
onChange={(e) => setLines(parseInt(e.target.value))}
className="border rounded px-2 py-1 text-sm"
>
<option value={50}>50</option>
<option value={100}>100</option>
<option value={200}>200</option>
<option value={500}>500</option>
</select>
</div>
</div>
<div className="bg-gray-900 text-green-400 p-4 rounded font-mono text-xs overflow-auto max-h-96">
<pre className="whitespace-pre-wrap">{logs || 'No logs available'}</pre>
</div>
</div>
);
};
export default ActivityLog;