diff --git a/application_events.json b/application_events.json
index 0c42a82..f38bb17 100644
--- a/application_events.json
+++ b/application_events.json
@@ -7160,8 +7160,273 @@
"trigger_variable": null,
"auto_started": true
}
+ },
+ {
+ "timestamp": "2025-08-15T19:21:26.768254",
+ "level": "info",
+ "event_type": "plot_session_created",
+ "message": "Plot session 'UR29' created and started",
+ "details": {
+ "session_id": "plot_1_1755278486768_11",
+ "variables": [
+ "UR29_Brix",
+ "UR29_ma",
+ "AUX Blink_1.0S",
+ "AUX Blink_1.6S"
+ ],
+ "time_window": 36,
+ "trigger_variable": null,
+ "auto_started": true
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:21:50.617034",
+ "level": "info",
+ "event_type": "application_started",
+ "message": "Application initialization completed successfully",
+ "details": {}
+ },
+ {
+ "timestamp": "2025-08-15T19:21:50.682511",
+ "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-15T19:21:50.690509",
+ "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-15T19:21:50.700936",
+ "level": "info",
+ "event_type": "csv_recording_started",
+ "message": "CSV recording started: 2 datasets activated",
+ "details": {
+ "activated_datasets": 2,
+ "total_datasets": 3
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:22:31.628745",
+ "level": "info",
+ "event_type": "plot_session_created",
+ "message": "Plot session 'UR29' created and started",
+ "details": {
+ "session_id": "plot_1_1755278551628_2",
+ "variables": [
+ "UR29_Brix",
+ "UR29_ma",
+ "AUX Blink_1.0S",
+ "AUX Blink_1.6S"
+ ],
+ "time_window": 36,
+ "trigger_variable": null,
+ "auto_started": true
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:22:55.516514",
+ "level": "info",
+ "event_type": "plot_session_created",
+ "message": "Plot session 'UR29' created and started",
+ "details": {
+ "session_id": "plot_1_1755278575515_3",
+ "variables": [
+ "UR29_Brix",
+ "UR29_ma",
+ "AUX Blink_1.0S",
+ "AUX Blink_1.6S"
+ ],
+ "time_window": 36,
+ "trigger_variable": null,
+ "auto_started": true
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:25:04.730033",
+ "level": "info",
+ "event_type": "application_started",
+ "message": "Application initialization completed successfully",
+ "details": {}
+ },
+ {
+ "timestamp": "2025-08-15T19:25:04.779181",
+ "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-15T19:25:04.786391",
+ "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-15T19:25:04.795793",
+ "level": "info",
+ "event_type": "csv_recording_started",
+ "message": "CSV recording started: 2 datasets activated",
+ "details": {
+ "activated_datasets": 2,
+ "total_datasets": 3
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:28:14.264386",
+ "level": "info",
+ "event_type": "application_started",
+ "message": "Application initialization completed successfully",
+ "details": {}
+ },
+ {
+ "timestamp": "2025-08-15T19:28:14.328949",
+ "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-15T19:28:14.336952",
+ "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-15T19:28:14.346444",
+ "level": "info",
+ "event_type": "csv_recording_started",
+ "message": "CSV recording started: 2 datasets activated",
+ "details": {
+ "activated_datasets": 2,
+ "total_datasets": 3
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:33:01.899945",
+ "level": "info",
+ "event_type": "plot_session_created",
+ "message": "Plot session 'UR29' created and started",
+ "details": {
+ "session_id": "plot_1_1755279181898_2",
+ "variables": [
+ "UR29_Brix",
+ "UR29_ma",
+ "AUX Blink_1.0S",
+ "AUX Blink_1.6S"
+ ],
+ "time_window": 36,
+ "trigger_variable": null,
+ "auto_started": true
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:35:23.574418",
+ "level": "info",
+ "event_type": "application_started",
+ "message": "Application initialization completed successfully",
+ "details": {}
+ },
+ {
+ "timestamp": "2025-08-15T19:35:23.621963",
+ "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-15T19:35:23.631481",
+ "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-15T19:35:23.642043",
+ "level": "info",
+ "event_type": "csv_recording_started",
+ "message": "CSV recording started: 2 datasets activated",
+ "details": {
+ "activated_datasets": 2,
+ "total_datasets": 3
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:40:28.186263",
+ "level": "info",
+ "event_type": "config_reload",
+ "message": "Dataset configuration reloaded from files with CSV header validation",
+ "details": {
+ "datasets_count": 3,
+ "active_datasets_count": 3,
+ "csv_recording_active": true
+ }
+ },
+ {
+ "timestamp": "2025-08-15T19:40:55.642005",
+ "level": "info",
+ "event_type": "plot_session_created",
+ "message": "Plot session 'UR29' created and started",
+ "details": {
+ "session_id": "plot_1_1755279655640_2",
+ "variables": [
+ "UR29_Brix",
+ "UR29_ma",
+ "AUX Blink_1.0S",
+ "AUX Blink_1.6S"
+ ],
+ "time_window": 36,
+ "trigger_variable": null,
+ "auto_started": true
+ }
}
],
- "last_updated": "2025-08-15T19:06:20.284691",
- "total_entries": 583
+ "last_updated": "2025-08-15T19:40:55.642005",
+ "total_entries": 605
}
\ No newline at end of file
diff --git a/frontend/src/components/TabCoordinationDemo.jsx b/frontend/src/components/TabCoordinationDemo.jsx
new file mode 100644
index 0000000..0e5b3b3
--- /dev/null
+++ b/frontend/src/components/TabCoordinationDemo.jsx
@@ -0,0 +1,62 @@
+import React from 'react'
+import { Box, Text, Badge, VStack, HStack, useColorModeValue } from '@chakra-ui/react'
+import { getTabCoordinator } from '../utils/TabCoordinator'
+
+/**
+ * TabCoordinationDemo - Componente de demostración para mostrar el estado de coordinación
+ */
+export default function TabCoordinationDemo() {
+ const [coordinator, setCoordinator] = React.useState(null)
+ const [isLeader, setIsLeader] = React.useState(false)
+ const [tabInfo, setTabInfo] = React.useState({})
+ const bgColor = useColorModeValue('gray.50', 'gray.800')
+
+ React.useEffect(() => {
+ const coord = getTabCoordinator()
+ setCoordinator(coord)
+ setIsLeader(coord.getIsLeader())
+ setTabInfo({
+ tabId: coord.tabId,
+ isLeader: coord.getIsLeader()
+ })
+
+ // Subscribirse a cambios de liderazgo
+ const unsubscribe = coord.subscribe('demo', ({ type, data }) => {
+ if (type === 'leadership_change') {
+ setIsLeader(data.isLeader)
+ setTabInfo(prev => ({
+ ...prev,
+ isLeader: data.isLeader
+ }))
+ }
+ })
+
+ return unsubscribe
+ }, [])
+
+ if (!coordinator) {
+ return Loading coordinator...
+ }
+
+ return (
+
+
+
+ 🔗 Tab Coordination Status
+
+ {isLeader ? '👑 Leader' : '👥 Follower'}
+
+
+
+ Tab ID: {tabInfo.tabId}
+
+
+ Role: {isLeader ? 'Making real connections to backend' : 'Receiving data from leader tab'}
+
+
+ Only the leader tab creates actual HTTP connections. Other tabs receive data via BroadcastChannel.
+
+
+
+ )
+}
diff --git a/frontend/src/hooks/useCoordinatedConnection.js b/frontend/src/hooks/useCoordinatedConnection.js
index 2af6584..2365f31 100644
--- a/frontend/src/hooks/useCoordinatedConnection.js
+++ b/frontend/src/hooks/useCoordinatedConnection.js
@@ -148,6 +148,14 @@ export function useCoordinatedSSE(source, url, dependencies = []) {
return useCoordinatedConnection(
source,
useCallback((onData) => {
+ // Don't create EventSource if URL is null or undefined
+ if (!url) {
+ console.log(`Skipping SSE connection - URL is ${url}`)
+ return {
+ close: () => {} // Return mock connection with close method
+ }
+ }
+
console.log(`Creating SSE connection to ${url}`)
const eventSource = new EventSource(url)
diff --git a/system_state.json b/system_state.json
index 030bc8b..da9fe66 100644
--- a/system_state.json
+++ b/system_state.json
@@ -3,11 +3,11 @@
"should_connect": true,
"should_stream": false,
"active_datasets": [
+ "Fast",
"DAR",
- "Test",
- "Fast"
+ "Test"
]
},
"auto_recovery_enabled": true,
- "last_update": "2025-08-15T18:51:36.158179"
+ "last_update": "2025-08-15T19:35:23.650095"
}
\ No newline at end of file