feat: Add detailed logging for plot sessions, update plot configuration, and enhance chart handling
This commit is contained in:
parent
6cd5f36c7c
commit
5caa74fa27
|
@ -4979,8 +4979,175 @@
|
|||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:06:24.612602",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:06:48.036346",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:06:54.887448",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:14:31.424812",
|
||||
"level": "info",
|
||||
"event_type": "application_started",
|
||||
"message": "Application initialization completed successfully",
|
||||
"details": {}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:14:31.473155",
|
||||
"level": "info",
|
||||
"event_type": "dataset_activated",
|
||||
"message": "Dataset activated: DAR",
|
||||
"details": {
|
||||
"dataset_id": "DAR",
|
||||
"variables_count": 2,
|
||||
"streaming_count": 2,
|
||||
"prefix": "gateway_phoenix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:14:31.480168",
|
||||
"level": "info",
|
||||
"event_type": "dataset_activated",
|
||||
"message": "Dataset activated: Fast",
|
||||
"details": {
|
||||
"dataset_id": "Fast",
|
||||
"variables_count": 2,
|
||||
"streaming_count": 1,
|
||||
"prefix": "fast"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:14:31.487149",
|
||||
"level": "info",
|
||||
"event_type": "csv_recording_started",
|
||||
"message": "CSV recording started: 2 datasets activated",
|
||||
"details": {
|
||||
"activated_datasets": 2,
|
||||
"total_datasets": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:14:39.254547",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:14:59.673582",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:15:06.665880",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T13:15:29.776996",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"last_updated": "2025-08-15T13:04:44.329049",
|
||||
"total_entries": 434
|
||||
"last_updated": "2025-08-15T13:15:29.776996",
|
||||
"total_entries": 445
|
||||
}
|
|
@ -6,9 +6,9 @@
|
|||
"name": "UR29",
|
||||
"point_hover_radius": 4,
|
||||
"point_radius": 0,
|
||||
"stacked": true,
|
||||
"stacked": false,
|
||||
"stepped": true,
|
||||
"time_window": 36,
|
||||
"time_window": 10,
|
||||
"trigger_enabled": false,
|
||||
"trigger_on_true": true,
|
||||
"trigger_variable": null,
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
"variable_name": "AUX Blink_1.0S",
|
||||
"color": "#3498db",
|
||||
"line_width": 2,
|
||||
"y_axis": "left",
|
||||
"y_axis": "right",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"variable_name": "AUX Blink_1.6S",
|
||||
"color": "#630de3",
|
||||
"line_width": 2,
|
||||
"y_axis": "left",
|
||||
"y_axis": "right",
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -347,9 +347,20 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
|
|||
}, []);
|
||||
|
||||
const createStreamingChart = useCallback(async () => {
|
||||
const cfg = resolvedConfigRef.current || session?.config;
|
||||
// Ensure we have the most up-to-date config
|
||||
const sessionConfig = session?.config;
|
||||
const resolvedConfig = resolvedConfigRef.current;
|
||||
|
||||
// Prefer session config if it's newer or if resolved config is missing
|
||||
const cfg = sessionConfig || resolvedConfig;
|
||||
|
||||
if (!canvasRef.current || !cfg) return;
|
||||
|
||||
// Update resolvedConfigRef to ensure consistency
|
||||
if (sessionConfig && (!resolvedConfig || JSON.stringify(sessionConfig) !== JSON.stringify(resolvedConfig))) {
|
||||
resolvedConfigRef.current = sessionConfig;
|
||||
}
|
||||
|
||||
console.log(`🔧 Creating chart for session ${session?.session_id}...`);
|
||||
|
||||
try {
|
||||
|
@ -1382,6 +1393,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
|
|||
const needsRecreation = !oldConfig ||
|
||||
oldConfig.line_tension !== newConfig.line_tension ||
|
||||
oldConfig.stepped !== newConfig.stepped ||
|
||||
oldConfig.stacked !== newConfig.stacked ||
|
||||
oldConfig.point_radius !== newConfig.point_radius ||
|
||||
oldConfig.point_hover_radius !== newConfig.point_hover_radius ||
|
||||
oldConfig.time_window !== newConfig.time_window ||
|
||||
|
@ -1486,13 +1498,19 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
|
|||
}
|
||||
}, [session?.is_active, session?.is_paused, pauseStreaming, resumeStreaming]);
|
||||
|
||||
// Recreate chart when fullscreen mode changes to enable/disable zoom
|
||||
// Handle fullscreen mode changes more gracefully
|
||||
useEffect(() => {
|
||||
if (chartRef.current && typeof session?.isFullscreen === 'boolean') {
|
||||
console.log(`🔄 Fullscreen mode changed to ${session.isFullscreen}, recreating chart...`);
|
||||
createStreamingChart();
|
||||
console.log(`🔄 Fullscreen mode changed to ${session.isFullscreen}`);
|
||||
// Instead of recreating the chart, just trigger a resize and update zoom state
|
||||
setTimeout(() => {
|
||||
if (chartRef.current) {
|
||||
chartRef.current.resize();
|
||||
console.log(`📐 Chart resized for fullscreen: ${session.isFullscreen}`);
|
||||
}
|
||||
}, 100); // Small delay to allow modal animation to complete
|
||||
}
|
||||
}, [session?.isFullscreen, createStreamingChart]);
|
||||
}, [session?.isFullscreen]);
|
||||
|
||||
// Update zoom configuration when zoom enabled state changes
|
||||
useEffect(() => {
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
"should_connect": true,
|
||||
"should_stream": false,
|
||||
"active_datasets": [
|
||||
"Fast",
|
||||
"Test",
|
||||
"Fast",
|
||||
"DAR"
|
||||
]
|
||||
},
|
||||
"auto_recovery_enabled": true,
|
||||
"last_update": "2025-08-15T13:03:20.882463"
|
||||
"last_update": "2025-08-15T13:14:31.493157"
|
||||
}
|
Loading…
Reference in New Issue