From 3c421cf7b8f8227f690cbd6f985f4097cc3adcb8 Mon Sep 17 00:00:00 2001 From: Debian Date: Thu, 8 Jan 2026 02:10:55 +0000 Subject: [PATCH] Add job logging and increase timeout to 20 minutes - Add JobLogger class to handler.py for structured timestamped logging - Increase MAX_TIMEOUT from 600s to 1200s (20 minutes) - Add logs column to generated_content table via migration - Store and display job execution logs in gallery UI - Add Logs button to gallery items with modal display Co-Authored-By: Claude Opus 4.5 --- frontend/public/css/style.css | 62 +++++++++ frontend/public/js/app.js | 43 ++++++ frontend/src/db/index.ts | 2 + frontend/src/db/migrations/002_add_logs.sql | 2 + frontend/src/routes/content.ts | 29 ++++ frontend/src/routes/generate.ts | 13 +- frontend/src/services/contentService.ts | 6 + frontend/src/services/jobProcessor.ts | 10 +- frontend/src/types/index.ts | 2 + handler.py | 146 ++++++++++++++------ 10 files changed, 269 insertions(+), 46 deletions(-) create mode 100644 frontend/src/db/migrations/002_add_logs.sql diff --git a/frontend/public/css/style.css b/frontend/public/css/style.css index 8895b5c..15ebac9 100644 --- a/frontend/public/css/style.css +++ b/frontend/public/css/style.css @@ -766,3 +766,65 @@ body { text-shadow: 0 1px 3px rgba(0,0,0,0.5); pointer-events: none; } + +/* Logs Modal */ +.logs-container { + background: var(--gray-100); + border-radius: var(--radius); + padding: 15px; +} + +.logs-status { + margin-bottom: 12px; + font-size: 14px; +} + +.logs-status .badge { + margin-left: 8px; +} + +.badge-completed { background: var(--success); color: white; } +.badge-processing { background: var(--warning); color: var(--gray-900); } +.badge-pending { background: var(--gray-500); color: white; } +.badge-failed { background: var(--danger); color: white; } + +.logs-error { + background: #f8d7da; + color: #721c24; + padding: 12px; + border-radius: var(--radius); + margin-bottom: 12px; + font-size: 13px; +} + +.logs-content { + font-family: 'SF Mono', Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.6; + background: var(--gray-900); + color: #e0e0e0; + padding: 15px; + border-radius: var(--radius); + max-height: 400px; + overflow-y: auto; + white-space: pre-wrap; + word-break: break-word; +} + +.logs-content::-webkit-scrollbar { + width: 8px; +} + +.logs-content::-webkit-scrollbar-track { + background: var(--gray-800); + border-radius: 4px; +} + +.logs-content::-webkit-scrollbar-thumb { + background: var(--gray-600); + border-radius: 4px; +} + +.logs-content::-webkit-scrollbar-thumb:hover { + background: var(--gray-500); +} diff --git a/frontend/public/js/app.js b/frontend/public/js/app.js index 17a508b..b162397 100644 --- a/frontend/public/js/app.js +++ b/frontend/public/js/app.js @@ -437,6 +437,7 @@ function renderGallery(container, items) {