Commit Graph

56 Commits

Author SHA1 Message Date
Martino Ferrari 519c1f2df4 controllogic: make expr evaluator value-polymorphic (arrays, indexing, array funcs)
Rewrites internal/controllogic/expr.go to evaluate to Value (scalar float64
or []Value array): adds array literals [a,b], postfix indexing arr[i], and
array functions (len, sum, mean, push, pop, slice, concat, sort, …). Resolver
type changes from func(...) float64 to func(...) Value; EvalValue added;
EvalExpr/EvalBool retain scalar float64/bool returns. Three temporary shims
added in engine.go, lua.go, and expr_test.go pending Tasks 4 and 6.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 14:53:40 +02:00
Martino Ferrari 3ddffc14d7 controllogic: add Graph.StateVars declarations (persisted via store JSON)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 14:46:01 +02:00
Martino Ferrari e76865d132 controllogic: add Value union + sizing helpers (port of arraypolicy.ts) 2026-06-24 14:42:40 +02:00
Martino Ferrari 5012511306 docs: plan for control-logic array+scalar local variables (Phase 2)
Implementation plan to port the panel-logic declared-local-variable feature
(scalar + array, sizing policies) to the server-side control-logic engine and
its editor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 14:40:35 +02:00
Martino Ferrari 44c8f98e01 Remove legacy array logic nodes; migrate + dropdown-ify
Delete the action.accumulate / action.clear node kinds (superseded by the
typed action.array.* nodes). Old panels are migrated transparently on load
(xml.ts migrateLegacyArrayNode): accumulate→array.push, clear→array.clear,
and legacy single-`array` export folded into the JSON `columns` form.

Export CSV column pickers now use array-local dropdowns instead of free-text
+ datalist, matching the action.array.* node inspectors. Removes the now-dead
flow-array-names datalist and legacy single-`array` fallbacks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 14:21:11 +02:00
Martino Ferrari 05b06d64a4 feat(editor): suggest declared array locals in array-name autocomplete
The flow-array-names datalist (used by the export-CSV node columns and the
legacy accumulate/clear nodes) was sourced only from array names already
referenced by other nodes, so a freshly declared array local would not appear
as an autocomplete suggestion until it was typed somewhere. Seed the datalist
with declared array statevars first, then node-referenced names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 14:08:11 +02:00
Martino Ferrari cb4e81beb2 fix(editor): array local-variable support in signal-tree pane
The signal-tree pane (edit mode) has its own inline "add local variable"
form, separate from the Logic-tab LocalVars form that gained array support
in the array-locals feature. This second entry point was missed, so the
type dropdown there only offered number/bool/string. Mirror the LogicEditor
form: add the array type option plus elem/sizing/capacity selects and a
JSON-validated initial value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 13:59:18 +02:00
Martino Ferrari 9d9e538a90 fix(logic): subscribe signals referenced by array action node params
subscribeRefs() walked node kinds to build the signal subscription set but
omitted the new action.array.push/set/remove nodes. Signal or local-var
references in their expr/index params were never subscribed, so the live
cache held no value and they resolved to NaN at run time (action.accumulate
was handled, its modern equivalent action.array.push was not). Add the
missing cases, including the comma-split index list for array.set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 13:50:26 +02:00
Martino Ferrari 9d48292976 docs(logic): document panel-logic array locals
Document array-valued local variables (statevar type=array with
elem/sizing/capacity), the value-polymorphic expression engine and array
functions, the array.* mutation nodes, accumulate/export unification, and
index-aligned CSV export in TECHNICAL_SPEC §3.8. Note in TODO that panel-logic
(Phase 1) array support is complete while the server-side control-logic port
(Phase 2) remains pending.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 13:31:15 +02:00
Martino Ferrari 91661485ae feat(widgets): array source modes for plot, table, multi-LED
- PlotWidget: 1-D array values (local vars + EPICS waveforms) are
  routed through the waveform rendering path regardless of configured
  plotType; nested 2-D arrays are skipped gracefully.  effectivePlotType
  switches to 'waveform' whenever any waveforms[] slot is populated.
- TableWidget: new sourceMode:'array' option renders one <tr> per array
  element (index in 'name' col, formatted value in 'value' col).  For
  2-D (elem:'array') rows, colIndices option maps column positions to
  inner-array positions.  Scalar/multi-signal mode unchanged.
- MultiLed: new sourceMode:'array' option (or auto-detect when value is
  already an array) renders one LED per element with live-length tracking;
  elem truthiness controls lit state; per-element label/color overrides
  supported; meta.elem==='bool' awareness noted in code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 13:22:20 +02:00
Martino Ferrari 603574f86f feat(logic): array local declaration form + array nodes + array debug badges
- LocalVars: add array type option with elem/sizing/capacity sub-fields
  and JSON literal initial value with inline parse validation
- Palette + KIND_LABEL: register action.array.push/set/remove/pop/clear
- Inspector: array-node cases with array-local select, index and expr fields
- nodeLabel: compact summaries for all five array node kinds
- flowDebug: export fmtBadge() for compact array display [a,b,c,…](n=N);
  formatBadge now delegates to fmtBadge for numbers and arrays
- EditMode: wrap both initLocalState calls with ensureArrayDecls so
  array locals referenced only by logic nodes are auto-declared in preview

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 11:18:00 +02:00
Martino Ferrari b82e8852b3 feat(logic): round-trip array statevar attributes in panel XML
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 11:12:05 +02:00
Martino Ferrari 8f50bc2498 feat(logic): array action nodes + accumulate/export unification + migration
Add five action.array.push|set|remove|pop|clear node kinds; replace the
legacy {t,v} in-memory arrays store with array locals as single source of
truth; alias action.accumulate→push and action.clear→array.clear for
backward compat; rewrite action.export as index-aligned CSV with custom
header labels; add ensureArrayDecls() auto-declare migration wired via
Canvas.tsx so undeclared arrays referenced by logic nodes are initialised.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 11:07:24 +02:00
Martino Ferrari 062bb44dba feat(logic): array local init + sizing enforcement in localstate
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 11:01:32 +02:00
Martino Ferrari f776de378f fix(logic): single-eval array index + typed reduce accumulators
- Fix redundant double-evaluation of n.a in the 'index' case by extracting
  to a local const before use in both idx() call and array indexing.
- Add explicit <number> type argument to reduce() calls in sum and mean
  functions to fix TypeScript TS2345 accumulator type error: the inferred
  ArrVal union type was not compatible with numeric addition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 10:57:45 +02:00
Martino Ferrari 5578bceea2 feat(logic): array-aware expression engine (literals, indexing, array funcs)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 10:54:43 +02:00
Martino Ferrari 2f40a9d1a0 feat(logic): add array sizing-policy helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 10:51:28 +02:00
Martino Ferrari 3b8c6540e1 feat(logic): add array fields to StateVar type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 10:50:06 +02:00
Martino Ferrari 774e28453b Add Phase 1 (panel-logic TS) implementation plan for local arrays
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 10:40:36 +02:00
Martino Ferrari e4e67ee0c2 Add design spec for local array values in flow engines
Approved design for first-class array-valued local variables across the
panel-logic (TS) and control-logic (Go) engines: array StateVar declarations
(dynamic/capped/fixed sizing), an array-aware expression language shared by
both engines, sizing-policy-aware mutation nodes (unifying the existing
accumulate/export/clear arrays), persistence, and widget binding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 10:32:11 +02:00
Martino Ferrari cf9da3df0a Implemented new datasources (modbus,scpi) 2026-06-24 06:12:52 +02:00
Martino Ferrari 999a1510d4 Ignore build/test output and workspace runtime state
Add .gitignore rules for SQLite WAL/SHM sidecars, coverage output, and
the dev workspace/data storage dir (keeping the demo.xml/epics_test.xml
fixtures), completing the runtime-artifact cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 01:48:07 +02:00
Martino Ferrari 6f7c90cc98 Stop tracking dev workspace runtime artifacts
Untrack generated runtime state under workspace/data (SQLite audit db +
WAL/SHM, config/control-logic/synthetic versions, trash, acl) plus dev
logs and iocsh history; these are regenerated on each run. Curated
fixtures (demo.xml, epics_test.xml, the EPICS test IOC db, run.sh,
st.cmd) stay tracked. Extend .gitignore so they don't return.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 01:47:43 +02:00
Martino Ferrari c0f7e662be Testing 2026-06-24 01:39:15 +02:00
Martino Ferrari 11120bedca Added ldap and pam authentication 2026-06-23 17:59:40 +02:00
Martino Ferrari ac24011487 Implemented admin pane + user permission 2026-06-22 17:49:14 +02:00
Martino Ferrari 73fcbe7b28 Improved plot view 2026-06-22 00:30:15 +02:00
Martino Ferrari 113e5a0fe8 Implemented confi snapshots 2026-06-21 23:50:03 +02:00
Martino Ferrari 04d31a15c4 Done config 2026-06-21 17:40:04 +02:00
Martino Ferrari b0ac044035 Working on better ux and comnfig editro 2026-06-21 12:50:04 +02:00
Martino Ferrari 3fc7c1b546 initial config manager 2026-06-20 17:40:03 +02:00
Martino Ferrari 206d5b541d Expand TODO widgets item with concrete HMI widget examples
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-20 17:10:52 +02:00
Martino Ferrari f7f297c3df Add synthetic array (waveform) DSP support + UX improvements
Adds full array/waveform support through the synthetic DSP engine: a
dsp.Sample value model (scalar or []float64), array ops (index, slice,
sum, mean, min, max, length, fft) with an in-tree radix-2 FFT, and static
type propagation (OpOutputType) that the editor mirrors to colour wires by
data type and flag invalid wirings. Stateful filters and lua stay
scalar-only. Adds a waveform plot mode (x-vs-index trace).

Also: errored-node hover reasons, S/N add-signal/add-node HUD shortcuts in
the synthetic editor, and view-mode widgets that blend with the canvas
background (chrome kept in edit mode).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-20 17:06:55 +02:00
Martino Ferrari 446de7f1ee Improving all side of app 2026-06-20 14:28:28 +02:00
Martino Ferrari 901b87d407 Implementing more advanced feature: audit and more 2026-06-19 14:17:46 +02:00
Martino Ferrari 8f6dbcba49 Working on audit 2026-06-19 09:44:57 +02:00
Martino Ferrari 914108e575 Plot fix 2026-06-19 07:57:42 +02:00
Martino Ferrari ba836f00e6 Add widget-control logic action and multi-column CSV / multi-field dialogs
Extend the panel logic editor with two capabilities:

- action.widget: drive a panel widget by id from a flow — enable/disable,
  show/hide, and (for plot widgets) clear, pause, or resume the live plot.
  Wired via a per-widget command store consumed by a Canvas WidgetView wrapper
  (disable overlay / hide) and PlotWidget (pause/clear), reset on panel unmount.
- action.export now emits multiple named arrays as CSV columns with per-column
  labels and an alignment mode (common/any/interpolate); dialogs support asking
  for and displaying multiple values per dialog.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-19 07:51:18 +02:00
Martino Ferrari afefba3184 Add control logic engine, panel logic dialogs, logic-edit restriction
Introduce server-side control-logic flow graphs (cron/alarm triggers,
Lua blocks) with CRUD endpoints, panel-logic lifecycle triggers and
user-interaction dialog nodes, and a synthetic node-graph editor.

Add an optional logic-editor allowlist (server.logic_editors) gating who
may add/edit panel logic and control logic, surfaced via /api/v1/me and
enforced in the API; hide logic affordances in the UI accordingly.

Update README, example config, and functional/technical specs to cover
all current features (plot panels, panel/control logic, local variables,
access control) and refresh the in-app manual and contextual help.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-19 07:27:35 +02:00
Martino Ferrari aba394b84d Major changes: logic add to panel, local variables, panel histor, users management... 2026-06-18 17:37:04 +02:00
Martino Ferrari 71430bc3b0 Wworking on improving the tool 2026-05-21 07:41:56 +02:00
Martino Ferrari 6ff8fb5c25 Improved perfs 2026-05-12 10:16:48 +02:00
Martino Ferrari 912ecdd9ed Improved UI 2026-05-06 15:55:45 +02:00
Martino Ferrari 0a5a85e4c4 working epics ioc and tested 2026-05-04 21:13:36 +02:00
Martino Ferrari 90669c5fd6 Initial working fully go release 2026-04-30 23:01:01 +02:00
Martino Ferrari 6e51ffc5e1 Initial go port of epics 2026-04-28 00:09:22 +02:00
Martino Ferrari 47e481a461 final use of c libepics 2026-04-27 12:56:00 +02:00
Martino Ferrari 1bda25454b Implemented epics read/write 2026-04-27 12:42:10 +02:00
Martino Ferrari b76b7f0ba8 complete first iteration 2026-04-26 14:28:48 +02:00
Martino Ferrari e5e67afafd complete first iteration 2026-04-26 14:28:42 +02:00