Commit Graph

42 Commits

Author SHA1 Message Date
bd31838139 Debug: Agregar plugin de error handler y más logging
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m5s
- Crear plugin error-handler.ts para capturar todos los errores
- Captura errores de app:error, vue:error y errorHandler
- Agregar logs en script setup de componentes
- Logs antes y después de llamar a useLotes()
- Esto nos mostrará exactamente dónde crashea la app
2025-11-21 23:42:08 -06:00
b0b179d945 Debug: Agregar logging extensivo en servidor y cliente
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m6s
- Logs en useLotes() para ver cuándo se llama
- Logs en fetchLotes() para rastrear el flujo
- Logs en API /api/lotes para ver requests del servidor
- Todos los logs con emojis para fácil identificación:
  🔵 = Cliente/Composable
  🟦 = Servidor/API
   = Errores
2025-11-21 23:39:11 -06:00
2ca062b9e0 Fix: Deshabilitar useToast en SSR para evitar crash
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m6s
El problema era que useToast() no funciona en Server-Side Rendering.
Cuando los componentes se renderizaban en el servidor, crasheaba con error 500.

Cambios:
- Hacer que toast sea opcional: process.client ? useToast() : null
- Cambiar todos toast.add() a toast?.add()
- Ahora el composable funciona tanto en servidor como en cliente
2025-11-21 23:36:01 -06:00
da5032ad54 Debug: Agregar manejo robusto de errores en componentes
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m6s
- Agregar try-catch en loadLotes/loadOperaciones
- Agregar try-catch en onMounted y watch
- Agregar estado de error y mostrar mensaje en UI
- Agregar console.log detallados para debug
- Mostrar errores en tarjeta roja sin crashear la app
2025-11-21 23:30:12 -06:00
01e99609c9 Fix: Restaurar componentes completos de Lotes y Operaciones
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m5s
- Restaurar LotesTable completo con onMounted y watch
- Habilitar carga automática de datos
- Base de datos recreada con credenciales correctas
- Conexión PostgreSQL funcionando correctamente
2025-11-21 23:25:16 -06:00
120e1871e5 Test: Simplificar LotesTable para debug de hidratación
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 2m30s
Componente ultra simple sin composables complejos ni Nuxt UI
para aislar el problema de hidratación SSR.
2025-11-21 23:07:08 -06:00
039bf47d21 masiso
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 23:03:31 -06:00
acafcd1390 Fix: Usar nombres correctos de componentes LotesLotesTable y OperacionesOperacionesTable
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
2025-11-21 23:00:19 -06:00
a385f58500 otra vez cambiesito facil de codex 2025-11-21 22:58:45 -06:00
85bcd5737c Debug: Deshabilitar onMounted y watch en componentes de tablas
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s
2025-11-21 22:55:17 -06:00
c5d11433e3 Debug: Importar componentes explícitamente en app.vue
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 22:49:51 -06:00
0857573334 Debug: Agregar console.logs a componentes de tablas
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 22:46:40 -06:00
c37dbc03f6 UI: Mejorar estilo del header principal
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 22:41:32 -06:00
00b508ffaf Debug: Agregar headers a tabs para verificar renderizado
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 15s
2025-11-21 20:48:09 -06:00
6f713a5ed1 Fix: Actualizar implementación de UTabs a Nuxt UI v4
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Cambiar selectedTab de ref(0) a ref('lotes') para usar string
- Agregar propiedad value explícita a cada tab item
- Crear documento nuxt-ui-tips.md con documentación de cambios
- Los valores deben ser strings según API de v4
2025-11-21 20:44:04 -06:00
d9ea2fb18d Fix: Actualizar implementación de UModal a Nuxt UI v4
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Cambiar v-model a v-model:open según API de v4
- Agregar slot #content requerido en todos los modales
- Corregir prop :ui para anchos personalizados (content en lugar de width)
- Aplicar clases correctas del tema para max-w-3xl y max-w-4xl
2025-11-21 20:35:58 -06:00
3a1c3fb7a2 Agregar botones de debug temporales para gestión de BD
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
⚠️ CÓDIGO TEMPORAL - NO ELIMINAR SIN CONSULTAR ⚠️

Backend:
- POST /api/debug/reset-database - Borra todos los datos
- POST /api/debug/seed-database - Carga datos de ejemplo

Frontend:
- Card rojo con advertencias notorias
- Botones: 🗑️ BORRAR TODA LA BD y 🌱 CARGAR DATOS DE EJEMPLO
- Confirmación antes de resetear
- Estados de loading
- Alertas de éxito/error

Todos los archivos marcados con comentarios muy visibles:
⚠️⚠️⚠️ NO ELIMINAR SIN CONSULTAR A DARIO/DRAGANEL/NUCLEO000 ⚠️⚠️⚠️

Útil para desarrollo y debugging del sistema de trazabilidad.
2025-11-21 19:43:04 -06:00
f24f2373f9 Agregar botones de prueba de API en frontend
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Botones simples para probar GET /api/lotes, /api/operaciones y trazabilidad
- Resultados se muestran en console.log del navegador
- Facilita debugging de la API desde el frontend
2025-11-21 19:28:59 -06:00
ee3dffa38e Implementar sistema completo de trazabilidad de lotes
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 1m47s
- Agregar PostgreSQL 16 con esquema completo
- Crear API endpoints para lotes y operaciones
- Implementar UI con Nuxt UI (tablas, formularios, trazabilidad)
- Agregar datos de ejemplo del flujo completo
- Documentar sistema en PLAN_TRAZABILIDAD.md
2025-11-21 18:39:04 -06:00
43bcf4a647 Add modular group verification system with frontend and backend checks
This commit implements a comprehensive, reusable group verification system:

Components:
- GroupCheckButton: Base component for group verification
- 7 specialized buttons: 3 real groups (authentik Admins, grupo-prueba, lvl0), 1 public access test, 2 system verification buttons
- All buttons support both frontend and backend verification modes

Backend:
- New API endpoint /api/auth/check-group for server-side group validation
- Reads Authentik headers and validates group membership

Frontend:
- Enhanced useAuthentik composable with hasGroup() and checkGroupBackend() methods
- Toast notifications for all verification results
- Smooth animations and color-coded visual feedback

UI Improvements:
- Organized layout with cards for different verification types
- Grid layout for group buttons
- Professional styling with hover effects and shadows
- Clear visual distinction between frontend/backend checks
2025-10-13 04:09:42 -06:00
f52f9f393f Add temporary debug endpoint to inspect all headers 2025-10-13 03:40:36 -06:00
1c901fa877 Remove debug endpoint 2025-10-13 03:21:59 -06:00
96fac68c6d Enhance user metadata display with app and outpost information
- Update AuthentikUser interface to include appSlug and outpostName
- Capture x-authentik-meta-app and x-authentik-meta-outpost headers
- Improve UserMetadata component to display connection information
- Filter empty groups from groups array
- Add documentation about available Authentik headers
2025-10-13 03:20:05 -06:00
1cba2f427e Add debug endpoint to inspect Authentik headers 2025-10-13 03:16:36 -06:00
3f5c4bc820 Fix TypeScript errors in useAuthentik composable
- Add AuthentikUser and AuthStatusResponse interfaces
- Fix toast color from 'gray' to 'neutral' (valid color)
- Remove invalid 'timeout' property from toast.add()
- Fix toast action from 'click' to 'onClick'
- Add proper type annotations for error handling
- Replace process.server with import.meta.server
- Make email, name, uid optional in AuthentikUser interface
2025-10-13 03:05:04 -06:00
d8f70f2aa5 Refactor auth components into individual button components
- Remove StatusBadges component (badges for authenticated, connected, groups)
- Remove ActionButtons component
- Create individual button components:
  - SessionStatusButton: handles session status check
  - ProfileButton: navigates to user profile
  - LogoutButton: handles user logout
  - LoginButton: reloads page to trigger login
- Update app.vue to use new individual button components
- Improve code quality with better component separation and reusability
2025-10-13 03:00:02 -06:00
87ae5b95e6 Improve PWA offline functionality and fix session caching
- Enable navigateFallback for offline navigation support
- Add JSON files to glob patterns for heroicons support
- Change Authentik API caching from NetworkFirst to NetworkOnly to prevent stale session data
- Add offline detection in checkSessionStatus with proper user feedback
- Add no-cache headers to /api/auth/status endpoint to prevent browser caching
- Show "Modo Offline" toast when user tries to check session while offline
2025-10-13 02:21:50 -06:00
226fcc7c64 Make 'Iniciar Sesión' button always visible alongside other buttons
Change button layout to show all 4 buttons at the same time:
- Estado de Sesión (info/blue)
- Ver Perfil (primary/blue)
- Cerrar Sesión (error/red)
- Iniciar Sesión (success/green) - NEW: always visible

This allows users to force a re-authentication by clicking 'Iniciar
Sesión' even when already authenticated, triggering Authentik login flow.
2025-10-13 02:02:45 -06:00
a132fdfbf8 Add permanent 'Iniciar Sesión' button when not authenticated
Replace 'Ver Perfil' and 'Cerrar Sesión' buttons with a prominent
'Iniciar Sesión' button when user is not authenticated. The button
reloads the page to trigger Authentik login redirect.

This provides a more accessible way to log in compared to the toast
button, which can be difficult to click.

Button layout:
- Authenticated: [Estado de Sesión] [Ver Perfil] [Cerrar Sesión]
- Not authenticated: [Estado de Sesión] [Iniciar Sesión]
2025-10-13 01:56:42 -06:00
5676647f0f Add login button to 'No Session' toast notifications
Add 'Iniciar Sesión' button to toasts when session is not active.
Clicking the button reloads the page, triggering Authentik redirect
to login flow.

Also increased toast timeout from 5s to 10s to give users more time
to see and click the login button.
2025-10-13 01:52:33 -06:00
00c5657b0a Handle session expiration correctly and fix icon CORS errors
- Detect CORS/redirect errors from Authentik and interpret them as
  "no session" instead of generic error
- When session expires, Authentik returns 302 redirect to login which
  causes CORS error in fetch requests
- Add /api/_nuxt_icon/ to public routes to prevent icon load failures
  after logout

This fixes the issue where logout in Authentik showed "Error" instead
of "Sin Sesión" when checking session status.
2025-10-13 01:49:20 -06:00
f6ba3dff5e Fix session status check to preserve authentication state
Remove /api/auth/status from public routes so it receives Authentik headers.
Remove logic that was clearing local auth state, which caused the page to
show "No autenticado" even when user was authenticated.

Now the button only displays session status without modifying the UI state.
2025-10-13 01:40:49 -06:00
ddea20376d Fix API endpoint location for Nuxt server structure
Move /api/auth/status endpoint from app/server/ to server/ directory.
Nuxt expects server API routes to be in /server/api/, not /app/server/api/.

This fixes the issue where the endpoint was returning HTML instead of JSON.
2025-10-13 01:33:10 -06:00
2fc478dd07 Make session status check query Authentik actively
Create real-time session verification against Authentik:
- Add /api/auth/status endpoint that reads Authentik headers live
- Modify checkSessionStatus() to fetch from API instead of local state
- Show "Verifying..." toast while checking
- Sync local state with actual Authentik session status
- Handle connection errors gracefully

This ensures the status check reflects the current Authentik session,
not just the cached local state.
2025-10-13 01:27:51 -06:00
b7285316cf Add session status check button
Add new button to check and display current session status:
- New checkSessionStatus() function in useAuthentik composable
- Displays toast notification with session info
- Shows user name if authenticated or warning if not
- Add UNotifications component to app.vue to render toasts

This allows users to quickly verify their authentication status.
2025-10-13 01:20:45 -06:00
d84f78ca2a Add PWA screenshots and window controls overlay
- Add screenshots to manifest (desktop, tablet, mobile)
- Enable window-controls-overlay for Windows compact mode
- Fix deprecated apple-mobile-web-app-capable warning
- Add mobile-web-app-capable meta tag
2025-10-13 00:39:30 -06:00
85cc2306d5 Fix PWA manifest link injection and navigateFallback error
- Add useHead() in app.vue to inject manifest and PWA meta tags
- Set navigateFallback to undefined to prevent non-precached-url error
- Add includeAssets configuration for PWA module
- Fixes service worker error on initial page load

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-10-13 00:20:19 -06:00
98c674924b Fix logout to invalidate complete Authentik session
- Change logout endpoint from proxy-only to full invalidation
- Use /flows/-/default/invalidation/ endpoint
- Add NUXT_PUBLIC_AUTHENTIK_URL to runtime config
- Logout now closes session in all applications
- Prevents automatic re-authentication after logout
2025-10-12 23:19:46 -06:00
201f257129 Add Tailwind CSS and Nuxt UI imports
- Create app/assets/css/main.css with required imports
- Configure nuxt.config.ts to load main.css
- Fix missing CSS styling issue
- Following Nuxt UI v4 setup documentation
2025-10-12 23:13:40 -06:00
a0a31e8dce Fix: Move composables and components into app/ directory
- Resolve SSR error "useAuthentik is not defined"
- Follow Nuxt 4 directory structure conventions
- When app/ exists, all app directories must be inside it
- This enables proper auto-import of composables
2025-10-12 23:08:55 -06:00
7de670d824 Add Authentik integration UI components
- Create useAuthentik composable to read headers
- Add UserAvatar component with avatar and user info
- Add StatusBadges for auth/connection status
- Add ActionButtons for logout and profile
- Add UserMetadata component with full user details
- Integrate all components in main page
- Use Nuxt UI components throughout
2025-10-12 22:53:44 -06:00
c794a883fa Initial commit: Nuxt 4 template with Authentik OAuth
- Add Nuxt 4 application structure
- Add Docker and docker-compose configuration
- Add Gitea Actions CI/CD workflow
- Add Claude Code hooks for action monitoring
2025-10-12 17:09:21 -06:00