fix(sheets-import): increase express payload limit to 50MB and add comprehensive incident diagnosis and system error audit
This commit is contained in:
@@ -11,6 +11,19 @@ El formato está basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1
|
||||
- **Sincronización Continua Moodle (Fase 6):** Automatización de workers persistentes en background para el procesamiento continuo de la cola de Web Services Moodle 4.1.
|
||||
- **Pruebas de Carga y Hardening (Fase 6):** Pruebas de estrés de concurrencia y validación final de producción.
|
||||
|
||||
## [3.4.9] - 2026-10-09
|
||||
### Corregido & Mejorado (Importador de Google Sheets & Sistema de Diagnóstico de Incidentes)
|
||||
- **Corrección de Límite de Payload en Importación Masiva de Google Sheets (`PayloadTooLargeError`):**
|
||||
- Ajuste de los analizadores de cuerpo en el Frontend BFF Express (`express.json({ limit: '50mb' })` y `express.urlencoded({ extended: true, limit: '50mb' })`), resolviendo el error 500 al enviar matrices de filas preseleccionadas (~154 KB que excedían el límite por defecto de 100 KB).
|
||||
- **Sistema Institucional de Manejo de Incidentes y Diagnóstico Transparente:**
|
||||
- Reemplazo de la pantalla genérica de error por una interfaz estructurada con código de ticket único (`INC-YYYYMMDD-XXXX`), código HTTP, síntesis contextual y recomendación de acción correctiva.
|
||||
- Sección técnica colapsable de diagnóstico con Ruta, Marca de Tiempo, Usuario activo, IP del cliente y Stack Trace.
|
||||
- Botón "Copiar Reporte para Soporte" con formateo estándar para agilizar la asistencia técnica por Bedelía o Soporte IT.
|
||||
- Registro automático del incidente técnico en `AuditLog` (`action='SYSTEM_ERROR'`, `module='system'`) vía nuevo endpoint `/api/v1/admin/log-error`.
|
||||
- **Auditoría Integral de Sincronización de Hojas de Cálculo (`/api/v1/dashboard/sync-sheets`):**
|
||||
- Registro de eventos exitosos (`SHEETS_IMPORT`) con estadísticas de entidades procesadas (carreras, materias, comisiones, aulas, reservas) y filtros aplicados.
|
||||
- Registro de errores de sincronización (`SHEETS_IMPORT_ERROR`) con detalle de la excepción para trazabilidad en la bitácora institucional.
|
||||
|
||||
## [3.4.8] - 2026-10-09
|
||||
### Agregado & Mejorado (Registro de Auditoría Institucional y Trazabilidad Operativa)
|
||||
- **Auditoría Completa de Autenticación y Sesiones (`AuditService` & `/api/v1/auth/`):**
|
||||
|
||||
@@ -169,6 +169,15 @@ Memoria del proyecto entre sesiones para la rama `dev`.
|
||||
- **Bump Semántico y Despliegue Obligatorio (Principio 9)**:
|
||||
- Versión incrementada a `v3.4.8` en Frontend y Backend.
|
||||
|
||||
- **Sprint v3.4.9: Solución de Límite de Payload en Importador de Sheets & Diagnóstico Transparente de Incidentes**:
|
||||
- **Incidencias y Mejoras**:
|
||||
1. `frontend/src/app.js`: Elevado límite de `express.json` y `express.urlencoded` de 100 KB por defecto a 50 MB (`{ limit: '50mb' }`), resolviendo el error `PayloadTooLargeError: request entity too large: expected 154166, length 154166, limit 102400` que provocaba HTTP 500 al enviar la matriz de filas preseleccionadas en `/admin/google_sheets_import`.
|
||||
2. Manejo de Incidentes y Diagnóstico Transparente: Reemplazo total de la pantalla genérica de error por una interfaz estructurada con código de ticket único (`INC-YYYYMMDD-XXXX`), diagnóstico descriptivo clasificado, sección técnica de diagnóstico colapsable (Ruta, Timestamp, Usuario actuante, IP, Stack trace), botón para copiar reporte a soporte IT y enlace directo a la Auditoría Institucional.
|
||||
3. `backend/app/routes/api/admin.py`: Nuevo endpoint `/api/v1/admin/log-error` para registrar incidentes técnicos no controlados del frontend directamente en `AuditLog` (`action='SYSTEM_ERROR'`, `module='system'`).
|
||||
4. `backend/app/routes/api/dashboard.py`: Instrumentada auditoría completa en `sync_google_sheets` para registrar tanto importaciones exitosas (`SHEETS_IMPORT`) como fallos (`SHEETS_IMPORT_ERROR`) con desglose de estadísticas y excepciones.
|
||||
- **Bump Semántico y Despliegue Obligatorio (Principio 9)**:
|
||||
- Versión incrementada a `v3.4.9` en Frontend y Backend.
|
||||
|
||||
## Próximos pasos
|
||||
1. Continuar con los objetivos de la Fase 6 del Roadmap institucional (Docker-compose productivo, Nginx con SSL y automatización de workers continuos Moodle).
|
||||
2. Monitoreo continuo de la experiencia de usuario en Bedelía, Cartelera del Día y Sincronización Académica.
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
## Gestión de Espacios Áulicos, Asignación de Comisiones y Operatoria de Bedelía
|
||||
|
||||
**Institución:** Universidad de la Ciudad de Buenos Aires (UniCABA)
|
||||
**Versión:** 3.4.8 (Registro de Auditoría Institucional y Trazabilidad Operativa)
|
||||
**Versión:** 3.4.9 (Importador de Google Sheets Robusto & Diagnóstico Transparente de Incidentes)
|
||||
**Fecha de Actualización:** 09 de Octubre de 2026
|
||||
**Rama Base:** `dev`
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from flask_babel import Babel, gettext as _
|
||||
from config.config import Config
|
||||
|
||||
# Initialize extensions
|
||||
__version__ = "3.4.8"
|
||||
__version__ = "3.4.9"
|
||||
db = SQLAlchemy()
|
||||
migrate = Migrate()
|
||||
cors = CORS()
|
||||
|
||||
@@ -2872,7 +2872,7 @@ def get_audit_logs():
|
||||
modules = sorted(list(set([r[0].lower() for r in modules_tuples if r[0]])))
|
||||
actions = sorted(list(set([r[0].upper() for r in actions_tuples if r[0]])))
|
||||
|
||||
default_modules = ['auth', 'reservations', 'classrooms', 'buildings', 'academic', 'optimizer', 'users', 'admin']
|
||||
default_modules = ['auth', 'reservations', 'classrooms', 'buildings', 'academic', 'optimizer', 'users', 'admin', 'system', 'import']
|
||||
for m in default_modules:
|
||||
if m not in modules:
|
||||
modules.append(m)
|
||||
@@ -2881,7 +2881,8 @@ def get_audit_logs():
|
||||
'LOGIN', 'LOGIN_FAILED', 'LOGIN_BLOCKED', 'LOGIN_GOOGLE', 'LOGIN_MOODLE', 'LOGOUT',
|
||||
'PASSWORD_CHANGE', 'IMPERSONATE_START', 'IMPERSONATE_END',
|
||||
'CREATE', 'UPDATE', 'DELETE', 'CONFIRM', 'CANCEL', 'TOGGLE',
|
||||
'OPTIMIZE_RUN', 'OPTIMIZE_APPLY', 'SYSTEM_RESET'
|
||||
'OPTIMIZE_RUN', 'OPTIMIZE_APPLY', 'SYSTEM_RESET', 'SYSTEM_ERROR',
|
||||
'SHEETS_IMPORT', 'SHEETS_IMPORT_ERROR'
|
||||
]
|
||||
for a in default_actions:
|
||||
if a not in actions:
|
||||
@@ -2906,3 +2907,51 @@ def get_audit_logs():
|
||||
}), 200
|
||||
|
||||
|
||||
@api_admin_bp.route('/log-error', methods=['POST'])
|
||||
def log_system_error():
|
||||
"""
|
||||
Endpoint para registrar incidentes técnicos o errores no controlados
|
||||
provenientes del frontend BFF o subsistemas en AuditLog.
|
||||
"""
|
||||
try:
|
||||
data = request.get_json(silent=True) or {}
|
||||
incident_id = data.get('incident_id')
|
||||
error_title = data.get('error_title', 'Error de Sistema')
|
||||
error_message = data.get('error_message', 'Error desconocido')
|
||||
status_code = data.get('status_code', 500)
|
||||
path = data.get('path', '')
|
||||
user_email = data.get('user_email') or 'anonymous'
|
||||
ip_address = data.get('ip_address') or request.remote_addr
|
||||
stack = data.get('stack', '')
|
||||
|
||||
details = {
|
||||
'incident_id': incident_id,
|
||||
'title': error_title,
|
||||
'message': error_message,
|
||||
'status_code': status_code,
|
||||
'path': path,
|
||||
'stack_preview': stack[:500] if stack else ''
|
||||
}
|
||||
|
||||
AuditService.log(
|
||||
action='SYSTEM_ERROR',
|
||||
module='system',
|
||||
user_email=user_email,
|
||||
ip_address=ip_address,
|
||||
details=details,
|
||||
status='failed'
|
||||
)
|
||||
|
||||
return jsonify({
|
||||
'status': 'success',
|
||||
'logged': True,
|
||||
'incident_id': incident_id
|
||||
}), 200
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
'status': 'error',
|
||||
'message': str(e)
|
||||
}), 500
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from flask import Blueprint, jsonify, request
|
||||
from flask import Blueprint, jsonify, request, g
|
||||
from app.utils.jwt_decorators import jwt_required
|
||||
from app.models.classroom import Classroom
|
||||
from app.models.subject import Subject
|
||||
from app.models.user import User
|
||||
from app.models.reservation import Reservation
|
||||
from app.models.audit_log import AuditLog
|
||||
from app.services.audit_service import AuditService
|
||||
from datetime import datetime, timedelta
|
||||
from sqlalchemy import func
|
||||
from app import db
|
||||
@@ -630,12 +631,47 @@ def sync_google_sheets():
|
||||
import_reservations=import_reservations,
|
||||
selected_rows=selected_rows
|
||||
)
|
||||
|
||||
user_info = getattr(g, 'current_user', {}) or {}
|
||||
user_email = user_info.get('email') if isinstance(user_info, dict) else getattr(user_info, 'email', None)
|
||||
AuditService.log(
|
||||
action='SHEETS_IMPORT',
|
||||
module='import',
|
||||
user_email=user_email,
|
||||
ip_address=request.remote_addr,
|
||||
details={
|
||||
'stats': stats,
|
||||
'filter_career': filter_career,
|
||||
'filter_subject': filter_subject,
|
||||
'filter_day': filter_day,
|
||||
'filter_days': filter_days,
|
||||
'single_date_only': single_date_only,
|
||||
'manual_date': manual_date
|
||||
},
|
||||
status='success'
|
||||
)
|
||||
|
||||
return jsonify({
|
||||
'status': 'success',
|
||||
'stats': stats,
|
||||
'source_url': importer.base_url
|
||||
}), 200
|
||||
except Exception as e:
|
||||
user_info = getattr(g, 'current_user', {}) or {}
|
||||
user_email = user_info.get('email') if isinstance(user_info, dict) else getattr(user_info, 'email', None)
|
||||
AuditService.log(
|
||||
action='SHEETS_IMPORT_ERROR',
|
||||
module='import',
|
||||
user_email=user_email,
|
||||
ip_address=request.remote_addr,
|
||||
details={
|
||||
'error': str(e),
|
||||
'filter_career': filter_career,
|
||||
'filter_subject': filter_subject,
|
||||
'filter_day': filter_day
|
||||
},
|
||||
status='failed'
|
||||
)
|
||||
return jsonify({
|
||||
'status': 'error',
|
||||
'message': str(e)
|
||||
|
||||
@@ -7,7 +7,7 @@ OPENAPI_SPEC = {
|
||||
"info": {
|
||||
"title": "Edu-Space REST API",
|
||||
"description": "Enterprise Academic & Physical Space Management REST API with JWT Authentication and Role-Based Access Control.",
|
||||
"version": "3.4.8"
|
||||
"version": "3.4.9"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="edu-space-admin",
|
||||
version="3.4.8",
|
||||
version="3.4.9",
|
||||
description="Administrative interface for Edu-Space Classroom Management System",
|
||||
author="Edu-Space Development Team",
|
||||
author_email="admin@edu-space.com",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "3.4.8",
|
||||
"version": "3.4.9",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
+201
-23
@@ -68,9 +68,9 @@ app.post('/auth/login', authLimiter);
|
||||
app.post('/auth/moodle', authLimiter);
|
||||
app.use('/api', generalLimiter);
|
||||
|
||||
// Configuración de middlewares
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
// Configuración de middlewares con soporte para importaciones masivas y payloads extensos
|
||||
app.use(express.json({ limit: '50mb' }));
|
||||
app.use(express.urlencoded({ extended: true, limit: '50mb' }));
|
||||
app.use(cookieParser());
|
||||
|
||||
// Configuración de archivos estáticos
|
||||
@@ -85,9 +85,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
|
||||
});
|
||||
|
||||
// Versiones institucionales del sistema
|
||||
const APP_VERSION = '3.4.8';
|
||||
const FRONTEND_VERSION = '3.4.8';
|
||||
const BACKEND_VERSION = '3.4.8';
|
||||
const APP_VERSION = '3.4.9';
|
||||
const FRONTEND_VERSION = '3.4.9';
|
||||
const BACKEND_VERSION = '3.4.9';
|
||||
|
||||
env.addGlobal('app_version', APP_VERSION);
|
||||
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
||||
@@ -587,37 +587,215 @@ app.use((req, res) => {
|
||||
`);
|
||||
});
|
||||
|
||||
// Middleware Global de Error 500
|
||||
app.use((err, req, res, next) => {
|
||||
console.error('Error no capturado en BFF:', err);
|
||||
res.status(500).send(`
|
||||
// Middleware Global de Error 500 & Diagnóstico Institucional
|
||||
app.use(async (err, req, res, next) => {
|
||||
const incidentId = 'INC-' + new Date().toISOString().slice(0, 10).replace(/-/g, '') + '-' + Math.random().toString(36).substring(2, 7).toUpperCase();
|
||||
const timestampStr = new Date().toLocaleString('es-AR', { timeZone: 'America/Argentina/Buenos_Aires' });
|
||||
const userEmail = req.user?.email || (req.cookies?.refresh_token ? 'Usuario con sesión activa' : 'No autenticado');
|
||||
const reqPath = `${req.method} ${req.originalUrl || req.url}`;
|
||||
const clientIp = req.headers['x-forwarded-for'] || req.ip || req.socket?.remoteAddress || '-';
|
||||
|
||||
console.error(`[BFF Error ${incidentId}] en ${reqPath}:`, err);
|
||||
|
||||
// Clasificación y mensaje amigable
|
||||
let statusCode = err.status || err.statusCode || 500;
|
||||
let errorTitle = 'Eventualidad en la Aplicación';
|
||||
let errorSummary = 'Ocurrió un error inesperado al procesar la operación solicitada.';
|
||||
let errorResolution = 'Por favor intente nuevamente o comuníquese con Soporte / Bedelía indicando el código de incidente.';
|
||||
|
||||
if (err.type === 'entity.too.large' || statusCode === 413) {
|
||||
statusCode = 413;
|
||||
errorTitle = 'Tamaño de Datos Excedido (Payload Too Large)';
|
||||
const lengthKb = err.length ? (err.length / 1024).toFixed(1) + ' KB' : 'desconocido';
|
||||
const limitKb = err.limit ? (err.limit / 1024).toFixed(1) + ' KB' : 'desconocido';
|
||||
errorSummary = `El volumen de datos enviado (${lengthKb}) superó la capacidad de recepción configurada (${limitKb}).`;
|
||||
errorResolution = 'Si está importando planillas masivas de Google Sheets, aplique filtros por día o carrera, o solicite a Soporte que amplíe el límite de transferencia.';
|
||||
} else if (err.code === 'ECONNREFUSED' || err.code === 'ETIMEDOUT') {
|
||||
statusCode = 503;
|
||||
errorTitle = 'Fallo de Comunicación con Backend Core';
|
||||
errorSummary = 'No fue posible conectarse con la API central de Edu-Space en el puerto 5000.';
|
||||
errorResolution = 'El servicio backend podría estar reiniciándose o en mantenimiento. Aguarde unos segundos y vuelva a intentar.';
|
||||
} else if (err.response && err.response.data) {
|
||||
errorTitle = `Respuesta del Servidor Central (${err.response.status})`;
|
||||
errorSummary = err.response.data.message || err.response.data.error || err.message;
|
||||
errorResolution = 'Revise los parámetros ingresados o consulte el registro de auditoría si posee permisos de administrador.';
|
||||
} else if (err.message) {
|
||||
errorSummary = err.message;
|
||||
}
|
||||
|
||||
// Registro asíncrono no bloqueante en AuditLog del backend
|
||||
try {
|
||||
const backendBase = process.env.BACKEND_URL || 'http://localhost:5000/api/v1';
|
||||
axios.post(`${backendBase}/admin/log-error`, {
|
||||
incident_id: incidentId,
|
||||
error_title: errorTitle,
|
||||
error_message: err.message || errorSummary,
|
||||
status_code: statusCode,
|
||||
path: reqPath,
|
||||
user_email: userEmail,
|
||||
ip_address: clientIp,
|
||||
stack: err.stack ? err.stack.slice(0, 1000) : null
|
||||
}, { timeout: 3000 }).catch(() => {});
|
||||
} catch (_) {}
|
||||
|
||||
// Si la petición espera JSON, responder en JSON estructurado
|
||||
if (req.xhr || (req.headers.accept && req.headers.accept.includes('application/json'))) {
|
||||
return res.status(statusCode).json({
|
||||
status: 'error',
|
||||
incident_id: incidentId,
|
||||
title: errorTitle,
|
||||
message: errorSummary,
|
||||
resolution: errorResolution,
|
||||
path: reqPath,
|
||||
timestamp: timestampStr
|
||||
});
|
||||
}
|
||||
|
||||
// Renderizar pantalla institucional de diagnóstico
|
||||
res.status(statusCode).send(`
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Error del Sistema — Edu-Space</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Error del Sistema — Edu-Space UniCABA</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<style>
|
||||
body { background: #0f172a; color: #f8fafc; font-family: system-ui, -apple-system, sans-serif; min-height: 100vh; display: flex; align-items: center; justify-content: center; margin: 0; }
|
||||
.card-error { background: #1e293b; border: 1px solid #334155; border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); }
|
||||
:root { --bs-body-bg: #0f172a; --bs-body-color: #f8fafc; }
|
||||
body { background: #0f172a; color: #f8fafc; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
|
||||
.card-diagnostic { background: #1e293b; border: 1px solid #334155; border-radius: 16px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7); max-width: 760px; width: 100%; }
|
||||
.code-box { background: #0b1120; border: 1px solid #334155; color: #38bdf8; border-radius: 8px; font-family: monospace; font-size: 0.85rem; }
|
||||
.incident-badge { background: #3b82f6; color: white; letter-spacing: 0.05em; font-family: monospace; }
|
||||
.accordion-button { background: #1e293b; color: #94a3b8; }
|
||||
.accordion-button:not(.collapsed) { background: #0f172a; color: #f8fafc; }
|
||||
.accordion-item { border-color: #334155; background: transparent; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container text-center p-4" style="max-width: 520px;">
|
||||
<div class="card card-error p-4 p-md-5">
|
||||
<div class="mb-3 text-danger">
|
||||
<i class="bi bi-exclamation-triangle-fill fs-1"></i>
|
||||
<div class="card card-diagnostic p-4 p-md-5">
|
||||
<!-- Header con branding institucional -->
|
||||
<div class="d-flex align-items-center justify-content-between border-bottom border-secondary pb-3 mb-4 flex-wrap gap-2">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="fs-4 fw-bold text-primary">Edu-Space</span>
|
||||
<span class="badge bg-secondary-subtle text-secondary border border-secondary font-monospace">UniCABA</span>
|
||||
</div>
|
||||
<h1 class="h3 fw-bold mb-2">Error en la Aplicación</h1>
|
||||
<p class="text-secondary small mb-4">
|
||||
Ocurrió una eventualidad procesando la solicitud. Nuestro equipo técnico ha sido notificado.
|
||||
<div>
|
||||
<span class="badge incident-badge px-3 py-2 rounded-pill fs-6" id="badgeIncidentId">
|
||||
<i class="bi bi-ticket-perforated me-1"></i>${incidentId}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Título y síntesis del incidente -->
|
||||
<div class="text-center mb-4">
|
||||
<div class="mb-3">
|
||||
<span class="d-inline-flex align-items-center justify-content-center rounded-circle bg-danger-subtle text-danger p-3" style="width: 64px; height: 64px;">
|
||||
<i class="bi bi-exclamation-triangle-fill fs-2"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="d-flex align-items-center justify-content-center gap-2 mb-2">
|
||||
<span class="badge bg-danger">HTTP ${statusCode}</span>
|
||||
<h1 class="h4 fw-bold mb-0 text-white">${errorTitle}</h1>
|
||||
</div>
|
||||
<p class="text-light fs-6 mb-2 text-start bg-dark p-3 rounded border border-secondary-subtle">
|
||||
<i class="bi bi-info-circle text-info me-2"></i>${errorSummary}
|
||||
</p>
|
||||
<a href="/dashboard" class="btn btn-primary px-4 fw-semibold">
|
||||
<i class="bi bi-house-door me-1"></i>Volver al Panel
|
||||
</a>
|
||||
<p class="text-secondary small mb-0 text-start">
|
||||
<strong>Acción recomendada:</strong> ${errorResolution}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Sección colapsable de Diagnóstico Técnico -->
|
||||
<div class="accordion mb-4" id="diagnosticAccordion">
|
||||
<div class="accordion-item rounded overflow-hidden">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button class="accordion-button collapsed py-2 small fw-semibold" type="button" data-bs-toggle="collapse" data-bs-target="#collapseDiag" aria-expanded="false" aria-controls="collapseDiag">
|
||||
<i class="bi bi-cpu me-2"></i>Detalles Técnicos y Diagnóstico del Servidor
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapseDiag" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#diagnosticAccordion">
|
||||
<div class="accordion-body p-3 bg-dark">
|
||||
<div class="row g-2 small mb-3">
|
||||
<div class="col-sm-6">
|
||||
<span class="text-secondary">Ruta / Solicitud:</span>
|
||||
<div class="font-monospace text-light">${reqPath}</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<span class="text-secondary">Fecha y Hora:</span>
|
||||
<div class="font-monospace text-light">${timestampStr}</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<span class="text-secondary">Usuario Actuante:</span>
|
||||
<div class="font-monospace text-light">${userEmail}</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<span class="text-secondary">Dirección IP:</span>
|
||||
<div class="font-monospace text-light">${clientIp}</div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="text-secondary small fw-bold mb-1">Traza de Error (Stack Trace):</label>
|
||||
<pre class="code-box p-3 mb-0" style="max-height: 180px; overflow-y: auto;">${(err.stack || err.message || 'Sin traza disponible').replace(/</g, '<').replace(/>/g, '>')}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Acciones Rápidas y Copia de Reporte -->
|
||||
<div class="d-flex flex-wrap gap-2 justify-content-between align-items-center pt-2 border-top border-secondary">
|
||||
<div class="d-flex gap-2 flex-wrap">
|
||||
<button type="button" class="btn btn-outline-info btn-sm fw-semibold" onclick="copyDiagnosticReport()">
|
||||
<i class="bi bi-clipboard-check me-1"></i>Copiar Reporte para Soporte
|
||||
</button>
|
||||
<a href="/admin/audit_logs" class="btn btn-outline-secondary btn-sm">
|
||||
<i class="bi bi-shield-check me-1"></i>Ver Auditoría
|
||||
</a>
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-secondary btn-sm" onclick="history.back()">
|
||||
<i class="bi bi-arrow-left me-1"></i>Atrás
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-light btn-sm" onclick="location.reload()">
|
||||
<i class="bi bi-arrow-clockwise me-1"></i>Reintentar
|
||||
</button>
|
||||
<a href="/dashboard" class="btn btn-primary btn-sm fw-semibold">
|
||||
<i class="bi bi-house-door me-1"></i>Panel Principal
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
function copyDiagnosticReport() {
|
||||
const report = [
|
||||
'=== REPORTE DE INCIDENTE EDU-SPACE (UniCABA) ===',
|
||||
'Código: ' + '${incidentId}',
|
||||
'Fecha/Hora: ' + '${timestampStr}',
|
||||
'Estado HTTP: ' + '${statusCode}',
|
||||
'Título: ' + '${errorTitle}',
|
||||
'Resumen: ' + '${errorSummary.replace(/'/g, "\\'")}',
|
||||
'Ruta Solicitada: ' + '${reqPath}',
|
||||
'Usuario: ' + '${userEmail}',
|
||||
'IP Cliente: ' + '${clientIp}',
|
||||
'Error Stack:',
|
||||
'${(err.stack || err.message || '').replace(/'/g, "\\'").replace(/\n/g, '\\n')}',
|
||||
'=================================================='
|
||||
].join('\\n');
|
||||
|
||||
navigator.clipboard.writeText(report).then(() => {
|
||||
alert('Reporte copiado al portapapeles. Puede pegarlo y enviarlo al equipo de Soporte IT o Bedelía.');
|
||||
}).catch(() => {
|
||||
const ta = document.createElement('textarea');
|
||||
ta.value = report;
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(ta);
|
||||
alert('Reporte copiado al portapapeles.');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
|
||||
@@ -1127,7 +1127,7 @@
|
||||
|
||||
<div class="sidebar-footer-text mt-3 pt-2 border-top border-secondary-subtle text-center">
|
||||
<span class="badge bg-secondary-subtle text-secondary-emphasis font-monospace px-2 py-1" style="font-size:0.68rem;" title="Versión Institucional de Edu-Space">
|
||||
<i class="bi bi-tag-fill me-1"></i>v{{ app_version or '3.4.8' }} <span class="opacity-75">(FE: {{ frontend_version or '3.4.8' }} · BE: {{ backend_version or '3.4.8' }})</span>
|
||||
<i class="bi bi-tag-fill me-1"></i>v{{ app_version or '3.4.9' }} <span class="opacity-75">(FE: {{ frontend_version or '3.4.9' }} · BE: {{ backend_version or '3.4.9' }})</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user