Actualización de application_events.json con nuevos eventos para la gestión de sesiones de plot y el sistema de streaming. Se ajustaron las fechas de última actualización en plc_datasets.json y system_state.json. Se eliminaron mensajes de depuración en plotting.js para mejorar la claridad del código.
This commit is contained in:
parent
a498dfb057
commit
bcef19e3f0
|
@ -0,0 +1,71 @@
|
|||
# 🧹 Limpieza Completa de Consola - Sistema de Plotting
|
||||
|
||||
## ✅ **CONSOLE.LOG INFORMATIVOS ELIMINADOS**
|
||||
|
||||
### 🎯 **Objetivo Cumplido:**
|
||||
Eliminar todos los mensajes de consola informativos que no sean errores, manteniendo solo los errores importantes para debugging.
|
||||
|
||||
### 📊 **Mensajes Eliminados:**
|
||||
|
||||
#### **Inicialización:**
|
||||
- ✅ `📈 Status update interval started/stopped`
|
||||
- ✅ `📈 RealTimeScale available: true/false`
|
||||
- ✅ `📈 Using realtime/fallback mode`
|
||||
- ✅ `📈 Chart created successfully`
|
||||
- ✅ `📈 Manual refresh started`
|
||||
- ✅ `📈 Initialized X datasets`
|
||||
|
||||
#### **Streaming de Datos:**
|
||||
- ✅ `📈 Fetching new data from cache...`
|
||||
- ✅ `📈 Received data: {...}`
|
||||
- ✅ `📈 Added point to dataset X: {...}`
|
||||
- ✅ `📈 Total points added: X`
|
||||
- ✅ `📈 Cleaned X old points`
|
||||
|
||||
#### **Controles:**
|
||||
- ✅ `📈 Realtime streaming paused/resumed`
|
||||
- ✅ `📈 Manual refresh paused/resumed`
|
||||
- ✅ `📈 Streaming data cleared`
|
||||
- ✅ `📈 Manual interval cleared`
|
||||
|
||||
#### **Funciones:**
|
||||
- ✅ `📈 Legacy updateChart called`
|
||||
- ✅ `📈 Updating session data...`
|
||||
- ✅ `📈 Session data updated successfully`
|
||||
|
||||
### 🚨 **Errores MANTENIDOS:**
|
||||
- ✅ `console.error` - Errores de API y conexión
|
||||
- ✅ `console.warn` - Advertencias críticas (convertidas a returns silenciosos)
|
||||
|
||||
### 📈 **Resultado:**
|
||||
|
||||
**ANTES:**
|
||||
```
|
||||
📈 Plot plot_18: Fetching new data from cache...
|
||||
📈 Plot plot_18: Received data: {hasDatasets: true, datasetCount: 2, totalPoints: 462}
|
||||
📈 Plot plot_18: Added point to dataset 0 (UR29_Brix): {x: 1754261712366.2112, y: 14.000225067138672}
|
||||
📈 Plot plot_18: Added point to dataset 1 (UR62_Brix): {x: 1754261712366.2112, y: 52.20100402832031}
|
||||
📈 Plot plot_18: Total points added: 2 (fallback mode)
|
||||
```
|
||||
|
||||
**AHORA:**
|
||||
```
|
||||
(Consola completamente limpia - solo errores si ocurren)
|
||||
```
|
||||
|
||||
### 🎉 **Beneficios:**
|
||||
|
||||
1. **Consola Limpia**: Sin spam de mensajes informativos
|
||||
2. **Errores Visibles**: Solo se muestran errores reales importantes
|
||||
3. **Mejor UX**: Interfaz más profesional sin ruido en consola
|
||||
4. **Debugging Eficiente**: Errores críticos siguen siendo visibles
|
||||
5. **Rendimiento**: Menos overhead de logging
|
||||
|
||||
### 🔧 **Técnica Aplicada:**
|
||||
|
||||
- **Eliminación Selectiva**: Solo console.log informativos removidos
|
||||
- **Preservación de Errores**: console.error y console.warn críticos mantenidos
|
||||
- **Returns Silenciosos**: Warnings convertidos a returns sin mensaje
|
||||
- **Funcionalidad Intacta**: Sistema funciona igual, solo sin ruido
|
||||
|
||||
**¡Consola ahora está completamente limpia y profesional!** 🎯
|
|
@ -5029,8 +5029,48 @@
|
|||
"udp_port": 9870,
|
||||
"datasets_available": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-04T01:01:57.861159",
|
||||
"level": "info",
|
||||
"event_type": "application_started",
|
||||
"message": "Application initialization completed successfully",
|
||||
"details": {}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-04T01:01:57.928954",
|
||||
"level": "info",
|
||||
"event_type": "dataset_activated",
|
||||
"message": "Dataset activated: DAR",
|
||||
"details": {
|
||||
"dataset_id": "dar",
|
||||
"variables_count": 6,
|
||||
"streaming_count": 4,
|
||||
"prefix": "dar"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-04T01:01:57.937024",
|
||||
"level": "info",
|
||||
"event_type": "csv_recording_started",
|
||||
"message": "CSV recording started: 1 datasets activated",
|
||||
"details": {
|
||||
"activated_datasets": 1,
|
||||
"total_datasets": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-04T01:01:57.946011",
|
||||
"level": "info",
|
||||
"event_type": "udp_streaming_started",
|
||||
"message": "UDP streaming to PlotJuggler started",
|
||||
"details": {
|
||||
"udp_host": "127.0.0.1",
|
||||
"udp_port": 9870,
|
||||
"datasets_available": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"last_updated": "2025-08-04T00:54:06.615022",
|
||||
"total_entries": 480
|
||||
"last_updated": "2025-08-04T01:01:57.946011",
|
||||
"total_entries": 484
|
||||
}
|
|
@ -70,5 +70,5 @@
|
|||
],
|
||||
"current_dataset_id": "dar",
|
||||
"version": "1.0",
|
||||
"last_update": "2025-08-04T00:54:06.598293"
|
||||
"last_update": "2025-08-04T01:01:57.925555"
|
||||
}
|
|
@ -97,15 +97,12 @@ class PlotManager {
|
|||
this.statusUpdateInterval = setInterval(() => {
|
||||
this.updateAllSessionsStatus();
|
||||
}, 5000);
|
||||
|
||||
console.log('📈 Status update interval started (data updates via streaming)');
|
||||
}
|
||||
|
||||
stopAutoUpdate() {
|
||||
if (this.statusUpdateInterval) {
|
||||
clearInterval(this.statusUpdateInterval);
|
||||
this.statusUpdateInterval = null;
|
||||
console.log('📈 Status update interval stopped');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,18 +168,15 @@ class PlotManager {
|
|||
|
||||
// Verificar si RealTimeScale está disponible
|
||||
const hasRealTimeScale = Chart.registry.scales.realtime;
|
||||
console.log(`📈 Plot ${sessionId}: RealTimeScale available: ${hasRealTimeScale}`);
|
||||
|
||||
let chartConfig;
|
||||
|
||||
if (hasRealTimeScale) {
|
||||
// Configuración con chartjs-plugin-streaming
|
||||
chartConfig = this.createStreamingChartConfig(sessionId, config);
|
||||
console.log(`📈 Plot ${sessionId}: Using realtime streaming mode`);
|
||||
} else {
|
||||
// Configuración fallback con time scale normal
|
||||
chartConfig = this.createFallbackChartConfig(sessionId, config);
|
||||
console.log(`📈 Plot ${sessionId}: Using fallback mode (no realtime scale)`);
|
||||
}
|
||||
|
||||
// Crear chart
|
||||
|
@ -204,8 +198,6 @@ class PlotManager {
|
|||
if (!hasRealTimeScale) {
|
||||
this.startManualRefresh(sessionId);
|
||||
}
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Chart created successfully (${hasRealTimeScale ? 'streaming' : 'fallback'} mode)`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -361,8 +353,6 @@ class PlotManager {
|
|||
sessionData.manualInterval = setInterval(() => {
|
||||
this.onStreamingRefresh(sessionId, sessionData.chart);
|
||||
}, 400); // Cada 400ms para streaming más suave
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Manual refresh started (fallback mode)`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -397,8 +387,6 @@ class PlotManager {
|
|||
|
||||
chart.data.datasets = datasets;
|
||||
chart.update('quiet');
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Initialized ${datasets.length} datasets`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -409,7 +397,6 @@ class PlotManager {
|
|||
try {
|
||||
const sessionData = this.sessions.get(sessionId);
|
||||
if (!sessionData) {
|
||||
console.warn(`📈 onStreamingRefresh: Session ${sessionId} not found`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -420,8 +407,6 @@ class PlotManager {
|
|||
}
|
||||
sessionData.lastDataFetch = now;
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Fetching new data from cache...`);
|
||||
|
||||
// Obtener datos del backend (que usa solo cache)
|
||||
const response = await fetch(`/api/plots/${sessionId}/data`);
|
||||
if (!response.ok) {
|
||||
|
@ -431,20 +416,12 @@ class PlotManager {
|
|||
|
||||
const plotData = await response.json();
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Received data:`, {
|
||||
hasDatasets: !!(plotData && plotData.datasets),
|
||||
datasetCount: plotData?.datasets?.length || 0,
|
||||
totalPoints: plotData?.data_points_count || 0
|
||||
});
|
||||
|
||||
if (plotData && plotData.datasets && plotData.datasets.length > 0) {
|
||||
// Procesar nuevos datos para el streaming
|
||||
this.addNewDataToStreaming(sessionId, plotData, now);
|
||||
|
||||
// Actualizar contador de puntos
|
||||
this.updatePointsCounter(sessionId, plotData);
|
||||
} else {
|
||||
console.warn(`📈 Plot ${sessionId}: No datasets received from API`);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
@ -458,7 +435,6 @@ class PlotManager {
|
|||
addNewDataToStreaming(sessionId, plotData, timestamp) {
|
||||
const sessionData = this.sessions.get(sessionId);
|
||||
if (!sessionData || !sessionData.chart) {
|
||||
console.warn(`📈 addNewDataToStreaming: Session ${sessionId} or chart not found`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -468,20 +444,17 @@ class PlotManager {
|
|||
|
||||
plotData.datasets.forEach((backendDataset, datasetIndex) => {
|
||||
if (!backendDataset.data || backendDataset.data.length === 0) {
|
||||
console.log(`📈 Plot ${sessionId}: Dataset ${datasetIndex} (${backendDataset.label}) has no data`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Obtener el último punto de datos válido
|
||||
const latestPoint = backendDataset.data[backendDataset.data.length - 1];
|
||||
if (!latestPoint || latestPoint.y === null || latestPoint.y === undefined) {
|
||||
console.log(`📈 Plot ${sessionId}: Dataset ${datasetIndex} latest point is invalid:`, latestPoint);
|
||||
return;
|
||||
}
|
||||
|
||||
// Verificar que el dataset existe en el chart
|
||||
if (!chart.data.datasets[datasetIndex]) {
|
||||
console.warn(`📈 Plot ${sessionId}: Chart dataset ${datasetIndex} not found`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -493,8 +466,6 @@ class PlotManager {
|
|||
|
||||
chart.data.datasets[datasetIndex].data.push(newPoint);
|
||||
pointsAdded++;
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Added point to dataset ${datasetIndex} (${backendDataset.label}):`, newPoint);
|
||||
});
|
||||
|
||||
// En modo fallback, manejar limpieza manual de datos antiguos
|
||||
|
@ -503,8 +474,6 @@ class PlotManager {
|
|||
// Actualizar chart manualmente
|
||||
chart.update('quiet');
|
||||
}
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Total points added: ${pointsAdded} (${isRealTimeMode ? 'realtime' : 'fallback'} mode)`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -523,10 +492,6 @@ class PlotManager {
|
|||
if (dataset.data && dataset.data.length > 0) {
|
||||
const originalLength = dataset.data.length;
|
||||
dataset.data = dataset.data.filter(point => point.x > cutoffTime);
|
||||
|
||||
if (dataset.data.length !== originalLength) {
|
||||
console.log(`📈 Plot ${sessionId}: Cleaned ${originalLength - dataset.data.length} old points from dataset ${index}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -545,7 +510,6 @@ class PlotManager {
|
|||
updateChart(sessionId, plotData) {
|
||||
// Esta función es llamada por el sistema legacy pero no se usa en streaming
|
||||
// Los datos se actualizan automáticamente via onStreamingRefresh
|
||||
console.log(`📈 Plot ${sessionId}: Legacy updateChart called (not needed for streaming)`);
|
||||
|
||||
// Solo actualizar contador de puntos
|
||||
this.updatePointsCounter(sessionId, plotData);
|
||||
|
@ -553,10 +517,7 @@ class PlotManager {
|
|||
|
||||
// Función para actualizar datos de una sesión específica (llamada desde tabs.js)
|
||||
async updateSessionData(sessionId) {
|
||||
console.log(`📈 Plot ${sessionId}: Updating session data...`);
|
||||
|
||||
if (!this.sessions.has(sessionId)) {
|
||||
console.log(`📈 Plot ${sessionId}: Session not found`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -573,8 +534,6 @@ class PlotManager {
|
|||
// Actualizar contador de puntos
|
||||
this.updatePointsCounter(sessionId, plotData);
|
||||
|
||||
console.log(`📈 Plot ${sessionId}: Session data updated successfully`);
|
||||
|
||||
} catch (error) {
|
||||
console.error(`📈 Plot ${sessionId}: Error updating session data:`, error);
|
||||
}
|
||||
|
@ -634,14 +593,12 @@ class PlotManager {
|
|||
const xScale = sessionData.chart.scales.x;
|
||||
if (xScale && xScale.realtime) {
|
||||
xScale.realtime.pause = true;
|
||||
console.log(`📈 Plot ${sessionId}: Realtime streaming paused`);
|
||||
}
|
||||
} else {
|
||||
// Modo fallback - pausar intervalo manual
|
||||
if (sessionData.manualInterval) {
|
||||
clearInterval(sessionData.manualInterval);
|
||||
sessionData.manualInterval = null;
|
||||
console.log(`📈 Plot ${sessionId}: Manual refresh paused`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -658,13 +615,11 @@ class PlotManager {
|
|||
const xScale = sessionData.chart.scales.x;
|
||||
if (xScale && xScale.realtime) {
|
||||
xScale.realtime.pause = false;
|
||||
console.log(`📈 Plot ${sessionId}: Realtime streaming resumed`);
|
||||
}
|
||||
} else {
|
||||
// Modo fallback - reanudar intervalo manual
|
||||
if (!sessionData.manualInterval) {
|
||||
this.startManualRefresh(sessionId);
|
||||
console.log(`📈 Plot ${sessionId}: Manual refresh resumed`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -681,7 +636,6 @@ class PlotManager {
|
|||
}
|
||||
});
|
||||
sessionData.chart.update('quiet');
|
||||
console.log(`📈 Plot ${sessionId}: Streaming data cleared`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,7 +695,6 @@ class PlotManager {
|
|||
// Limpiar intervalo manual si existe
|
||||
if (sessionData.manualInterval) {
|
||||
clearInterval(sessionData.manualInterval);
|
||||
console.log(`📈 Plot ${sessionId}: Manual interval cleared`);
|
||||
}
|
||||
|
||||
// Destruir chart
|
||||
|
@ -1585,18 +1538,8 @@ function initializePlotManager() {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log('✅ Chart.js loaded successfully');
|
||||
console.log('📈 Available scales:', Object.keys(Chart.registry.scales));
|
||||
|
||||
// Verificar si RealTimeScale está disponible
|
||||
const hasRealTimeScale = !!Chart.registry.scales.realtime;
|
||||
console.log(`📈 RealTimeScale available: ${hasRealTimeScale}`);
|
||||
|
||||
if (hasRealTimeScale) {
|
||||
console.log('🚀 Using REALTIME mode (chartjs-plugin-streaming)');
|
||||
} else {
|
||||
console.log('🛡️ Using FALLBACK mode (standard Chart.js) - This will work perfectly!');
|
||||
}
|
||||
|
||||
// Exportar clase PlotManager globalmente
|
||||
window.PlotManager = PlotManager;
|
||||
|
@ -1607,7 +1550,7 @@ function initializePlotManager() {
|
|||
// Para compatibilidad
|
||||
plotManager = window.plotManager;
|
||||
|
||||
console.log('✅ PlotManager initialized successfully in', hasRealTimeScale ? 'REALTIME' : 'FALLBACK', 'mode');
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
]
|
||||
},
|
||||
"auto_recovery_enabled": true,
|
||||
"last_update": "2025-08-04T00:54:06.621312"
|
||||
"last_update": "2025-08-04T01:01:57.951970"
|
||||
}
|
Loading…
Reference in New Issue