diff --git a/application_events.json b/application_events.json index fc922a7..7efc965 100644 --- a/application_events.json +++ b/application_events.json @@ -1,59 +1,5 @@ { "events": [ - { - "timestamp": "2025-07-17T17:57:48.115971", - "level": "info", - "event_type": "dataset_activated", - "message": "Dataset activated: DAR", - "details": { - "dataset_id": "dar", - "variables_count": 4, - "streaming_count": 4, - "prefix": "dar" - } - }, - { - "timestamp": "2025-07-17T17:59:20.355788", - "level": "info", - "event_type": "dataset_activated", - "message": "Dataset activated: DAR", - "details": { - "dataset_id": "dar", - "variables_count": 4, - "streaming_count": 4, - "prefix": "dar" - } - }, - { - "timestamp": "2025-07-17T17:59:20.358047", - "level": "info", - "event_type": "streaming_started", - "message": "Multi-dataset streaming started: 1 datasets activated", - "details": { - "activated_datasets": 1, - "total_datasets": 2, - "udp_host": "127.0.0.1", - "udp_port": 9870 - } - }, - { - "timestamp": "2025-07-17T18:00:01.148713", - "level": "info", - "event_type": "Application started", - "message": "Application initialization completed successfully", - "details": {} - }, - { - "timestamp": "2025-07-17T18:00:01.174850", - "level": "info", - "event_type": "plc_connection", - "message": "Successfully connected to PLC 10.1.33.11", - "details": { - "ip": "10.1.33.11", - "rack": 0, - "slot": 2 - } - }, { "timestamp": "2025-07-17T18:00:01.179115", "level": "info", @@ -10416,8 +10362,60 @@ "event_type": "csv_cleanup_failed", "message": "CSV cleanup failed: 'max_hours'", "details": {} + }, + { + "timestamp": "2025-08-14T11:34:34.684516", + "level": "info", + "event_type": "application_started", + "message": "Application initialization completed successfully", + "details": {} + }, + { + "timestamp": "2025-08-14T11:34:34.733822", + "level": "info", + "event_type": "dataset_activated", + "message": "Dataset activated: DAR", + "details": { + "dataset_id": "DAR", + "variables_count": 3, + "streaming_count": 3, + "prefix": "gateway_phoenix" + } + }, + { + "timestamp": "2025-08-14T11:34:34.751250", + "level": "info", + "event_type": "csv_recording_started", + "message": "CSV recording started: 1 datasets activated", + "details": { + "activated_datasets": 1, + "total_datasets": 3 + } + }, + { + "timestamp": "2025-08-14T11:34:34.780016", + "level": "error", + "event_type": "csv_cleanup_failed", + "message": "CSV cleanup failed: 'max_hours'", + "details": {} + }, + { + "timestamp": "2025-08-14T11:34:45.734619", + "level": "info", + "event_type": "plot_session_created", + "message": "Plot session 'UR29' created and started", + "details": { + "session_id": "plot_1", + "variables": [ + "UR29_Brix", + "UR29_ma" + ], + "time_window": 25, + "trigger_variable": null, + "auto_started": true + } } ], - "last_updated": "2025-08-14T11:26:02.293765", + "last_updated": "2025-08-14T11:34:45.734619", "total_entries": 1000 } \ No newline at end of file diff --git a/config/data/plot_definitions.json b/config/data/plot_definitions.json index 98f3bfd..5f6c775 100644 --- a/config/data/plot_definitions.json +++ b/config/data/plot_definitions.json @@ -3,7 +3,6 @@ { "id": "plot_1", "name": "UR29", - "session_id": "plot_1", "time_window": 25, "trigger_enabled": false, "trigger_on_true": true, @@ -14,7 +13,6 @@ { "id": "Brix", "name": "Brix", - "session_id": "Brix", "time_window": 60, "trigger_enabled": false, "trigger_on_true": true diff --git a/config/schema/plot-definitions.schema.json b/config/schema/plot-definitions.schema.json index b2e04cb..4b71f4f 100644 --- a/config/schema/plot-definitions.schema.json +++ b/config/schema/plot-definitions.schema.json @@ -16,18 +16,13 @@ "id": { "type": "string", "title": "Plot ID", - "description": "Unique identifier for the plot" + "description": "Unique identifier for the plot session" }, "name": { "type": "string", "title": "Plot Name", "description": "Human-readable name of the plot session" }, - "session_id": { - "type": "string", - "title": "Session ID", - "description": "Session identifier for this plot" - }, "time_window": { "type": "integer", "title": "Time window (s)", diff --git a/config/schema/ui/plot-definitions.uischema.json b/config/schema/ui/plot-definitions.uischema.json index 9d6011b..07cf070 100644 --- a/config/schema/ui/plot-definitions.uischema.json +++ b/config/schema/ui/plot-definitions.uischema.json @@ -10,7 +10,6 @@ "ui:order": [ "id", "name", - "session_id", "time_window", "y_min", "y_max", @@ -22,15 +21,11 @@ [ { "name": "id", - "width": 3 - }, - { - "name": "name", "width": 4 }, { - "name": "session_id", - "width": 3 + "name": "name", + "width": 6 }, { "name": "time_window", diff --git a/core/plot_manager.py b/core/plot_manager.py index 2233a55..143424f 100644 --- a/core/plot_manager.py +++ b/core/plot_manager.py @@ -284,8 +284,10 @@ class PlotManager: def create_session(self, config: Dict[str, Any]) -> str: """Crear una nueva sesión de plotting""" with self.lock: - session_id = f"plot_{self.session_counter}" - self.session_counter += 1 + # Use the ID from config if available, otherwise generate one + session_id = config.get("id") or f"plot_{self.session_counter}" + if not config.get("id"): + self.session_counter += 1 session = PlotSession(session_id, config) # 🔑 CAMBIO: Crear sesiones en modo activo por defecto para mejor UX diff --git a/frontend/src/components/PlotRealtimeSession.jsx b/frontend/src/components/PlotRealtimeSession.jsx index 1897d44..c9a670f 100644 --- a/frontend/src/components/PlotRealtimeSession.jsx +++ b/frontend/src/components/PlotRealtimeSession.jsx @@ -122,7 +122,7 @@ export default function PlotRealtimeSession({ const variableNames = plotVariables.map(v => v.variable_name) const plotConfig = { - session_id: plotDefinition.id, + id: plotDefinition.id, // Use id instead of session_id name: plotDefinition.name, variables: variableNames, time_window: plotDefinition.time_window || 60, @@ -151,7 +151,7 @@ export default function PlotRealtimeSession({ try { // Try to create the plot session with current configuration await api.createPlot({ - session_id: plotDefinition.id, + id: plotDefinition.id, // Use id instead of session_id name: plotDefinition.name, variables: plotVariables.map(v => v.variable_name), // Simplified format time_window: localConfig.time_window, diff --git a/main.py b/main.py index 513857b..48e0f5b 100644 --- a/main.py +++ b/main.py @@ -1542,6 +1542,7 @@ def create_plot(): # Crear configuración de la sesión config = { + "id": data.get("id"), # Use the plot ID from the definition "name": data.get( "name", f"Plot {len(streamer.data_streamer.plot_manager.sessions) + 1}" ), diff --git a/system_state.json b/system_state.json index 3e52620..07b1a7c 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-14T11:26:02.237589" + "last_update": "2025-08-14T11:34:34.761474" } \ No newline at end of file