Some checks failed
Build and Push Docker Image to Gitea / build-and-push (push) Failing after 54s
Phase 1 Complete: Log Viewer with Real-time Monitoring ====================================================== Features Added: - Real-time log viewer with syntax highlighting (ERROR, WARNING, INFO) - Play/Pause controls for auto-refresh - Auto-scroll with user scroll detection - Search and filter functionality with highlighting - Process selector (all processes + supervisord main log) - Stdout/Stderr log type switching - Download logs to file - Clear logs (process-specific or main log) - Responsive layout with proper height handling API Routes Added: - GET /api/supervisor/logs - Read main supervisord log - DELETE /api/supervisor/logs - Clear main log - DELETE /api/supervisor/processes/[name]/logs - Clear process logs - POST /api/supervisor/processes/logs/clear-all - Clear all logs Hooks Added: - useMainLog() - Query main supervisord log with auto-refresh - useClearMainLog() - Mutation to clear main log - useClearProcessLogs() - Mutation to clear process logs - useClearAllLogs() - Mutation to clear all process logs Components: - LogViewer - Displays logs with syntax highlighting and search - LogControls - Control panel with play/pause, auto-scroll, actions - LogSearch - Search input with clear button - Full logs page implementation with process/log type selection UX Improvements: - Color-coded log levels (red for errors, yellow for warnings, cyan for info) - Search term highlighting in logs - Auto-scroll with "Scroll to bottom" button when paused - Confirmation dialogs for destructive actions - Loading states and error handling - Download logs with timestamped filenames This completes the most requested feature (log viewing) with production-ready functionality including real-time tailing, search, and management capabilities. 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { createSupervisorClient } from '@/lib/supervisor/client';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
// GET main supervisord log
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const searchParams = request.nextUrl.searchParams;
|
|
const offset = parseInt(searchParams.get('offset') || '-4096', 10);
|
|
const length = parseInt(searchParams.get('length') || '4096', 10);
|
|
|
|
const client = createSupervisorClient();
|
|
const logs = await client.readLog(offset, length);
|
|
|
|
return NextResponse.json({ logs, offset, length });
|
|
} catch (error: any) {
|
|
console.error('Supervisor main log error:', error);
|
|
return NextResponse.json(
|
|
{ error: error.message || 'Failed to fetch main log' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|
|
|
|
// DELETE - Clear main supervisord log
|
|
export async function DELETE() {
|
|
try {
|
|
const client = createSupervisorClient();
|
|
const result = await client.clearLog();
|
|
return NextResponse.json({ success: result, message: 'Main log cleared' });
|
|
} catch (error: any) {
|
|
console.error('Supervisor clear main log error:', error);
|
|
return NextResponse.json(
|
|
{ error: error.message || 'Failed to clear main log' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|