feat: Enhance logging for plot sessions, update UI widgets to use switches, and reorder active datasets in system state

This commit is contained in:
Miguel 2025-08-15 19:55:57 +02:00
parent 609ae865de
commit 4481eb33a7
11 changed files with 172 additions and 17 deletions

View File

@ -7425,8 +7425,144 @@
"trigger_variable": null,
"auto_started": true
}
},
{
"timestamp": "2025-08-15T19:41:15.511230",
"level": "info",
"event_type": "plot_session_created",
"message": "Plot session 'UR29' created and started",
"details": {
"session_id": "plot_1_1755279675511_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:41:35.767669",
"level": "info",
"event_type": "plot_session_created",
"message": "Plot session 'UR29' created and started",
"details": {
"session_id": "plot_1_1755279695767_4",
"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:41:38.863722",
"level": "info",
"event_type": "plot_session_created",
"message": "Plot session 'UR29' created and started",
"details": {
"session_id": "plot_1_1755279698863_5",
"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:49:54.180453",
"level": "info",
"event_type": "application_started",
"message": "Application initialization completed successfully",
"details": {}
},
{
"timestamp": "2025-08-15T19:49:54.228721",
"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:49:54.237641",
"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:49:54.247238",
"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:53:52.531913",
"level": "info",
"event_type": "application_started",
"message": "Application initialization completed successfully",
"details": {}
},
{
"timestamp": "2025-08-15T19:53:52.582271",
"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:53:52.590457",
"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:53:52.599789",
"level": "info",
"event_type": "csv_recording_started",
"message": "CSV recording started: 2 datasets activated",
"details": {
"activated_datasets": 2,
"total_datasets": 3
}
}
],
"last_updated": "2025-08-15T19:40:55.642005",
"total_entries": 605
"last_updated": "2025-08-15T19:53:52.599789",
"total_entries": 616
}

View File

@ -6,7 +6,7 @@
"name": "UR29",
"point_hover_radius": 4,
"point_radius": 2.5,
"stacked": false,
"stacked": true,
"stepped": true,
"time_window": 36,
"trigger_enabled": false,

View File

@ -31,7 +31,7 @@
},
"enabled": {
"ui:help": "When enabled, this dataset will be actively sampled and recorded",
"ui:widget": "checkbox"
"ui:widget": "switch"
},
"sampling_interval": {
"ui:help": "Custom sampling interval in seconds (0.0110). Leave empty to use the global PLC sampling interval.",

View File

@ -187,7 +187,7 @@
}
},
"streaming": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "📡 Enable real-time streaming to PlotJuggler for visualization"
}
},
@ -229,7 +229,7 @@
"ui:help": "🔍 Search and select a symbol from the loaded ASC file"
},
"streaming": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "📡 Enable real-time streaming to PlotJuggler for visualization"
}
}

View File

@ -18,7 +18,7 @@
},
"rotation_enabled": {
"ui:column": 3,
"ui:widget": "checkbox"
"ui:widget": "switch"
},
"ui:order": [
"max_days",

View File

@ -118,11 +118,11 @@
"ui:help": "🎯 Variable name to use as trigger (optional)"
},
"trigger_enabled": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "✅ Enable trigger-based recording"
},
"trigger_on_true": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "🔄 Trigger when variable becomes true (vs false)"
},
"line_tension": {
@ -130,11 +130,11 @@
"ui:help": "📈 Line smoothness: 0=straight lines, 0.4=smooth curves"
},
"stepped": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "📊 Enable stepped line style instead of curves"
},
"stacked": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "📚 Enable stacked Y-axes for multi-axis visualization"
},
"point_radius": {

View File

@ -101,7 +101,7 @@
"ui:help": "📊 Which Y-axis to use for this variable (left or right)"
},
"enabled": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "📊 Enable this variable to be displayed in the real-time plot"
}
}

View File

@ -1,6 +1,6 @@
import React from 'react'
import {
FormControl, FormLabel, FormHelperText, Input, Textarea, Select, Checkbox,
FormControl, FormLabel, FormHelperText, Input, Textarea, Select, Checkbox, Switch,
NumberInput, NumberInputField, NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper,
useColorModeValue
} from '@chakra-ui/react'
@ -147,12 +147,30 @@ export const CheckboxWidget = ({ id, label, value, required, disabled, readonly,
</FormControl>
)
export const SwitchWidget = ({ id, label, value, required, disabled, readonly, onChange, rawErrors = [] }) => (
<FormControl display="flex" alignItems="center" isRequired={required} isDisabled={disabled} isReadOnly={readonly} isInvalid={rawErrors.length > 0}>
<FormLabel htmlFor={id} mb="0" mr={3}>
{label}
</FormLabel>
<Switch
id={id}
isChecked={!!value}
onChange={(e) => onChange(e.target.checked)}
colorScheme="blue"
/>
{rawErrors.length > 0 && (
<FormHelperText color="red.500">{rawErrors[0]}</FormHelperText>
)}
</FormControl>
)
// Map keys must match RJSF default widget names to override them automatically by type
export const widgets = {
TextWidget,
UpDownWidget,
SelectWidget,
CheckboxWidget,
SwitchWidget,
TextareaWidget,
// Custom PLC widgets
PlcAreaWidget,

View File

@ -20,6 +20,7 @@ export const allWidgets = {
textarea: widgets.TextareaWidget,
select: widgets.SelectWidget,
checkbox: widgets.CheckboxWidget,
switch: widgets.SwitchWidget,
// Variable selector aliases - use the advanced version with search and metadata
variableSelector: VariableSelectorWidget,

View File

@ -901,7 +901,7 @@ function DatasetManager() {
"ui:help": "PLC data type"
},
"streaming": {
"ui:widget": "checkbox",
"ui:widget": "switch",
"ui:help": "Enable UDP streaming to PlotJuggler"
}
}

View File

@ -3,11 +3,11 @@
"should_connect": true,
"should_stream": false,
"active_datasets": [
"Fast",
"DAR",
"Test"
"Test",
"Fast"
]
},
"auto_recovery_enabled": true,
"last_update": "2025-08-15T19:35:23.650095"
"last_update": "2025-08-15T19:53:52.606916"
}