@* ── Monitored attribute ───────────────────────────────────────────── *@
+ @* Expression triggers reference attributes inside the C# expression itself,
+ so they do not use the single-attribute picker. *@
+ @if (TriggerType != AlarmTriggerType.Expression)
+ {
+ A boolean C# expression — e.g. Attributes["Temperature"] > 80.
+
+ };
+
+ private async Task OnExpressionChanged(string value)
+ {
+ _model.Expression = value;
+ await Emit();
+ }
+
// ── Hint text ──────────────────────────────────────────────────────────
private string BuildHint()
@@ -582,6 +614,9 @@
AlarmTriggerType.HiLo => BuildHiLoHint(attr),
+ AlarmTriggerType.Expression =>
+ "Alarm is active while this expression is true.",
+
_ => string.Empty
};
}
diff --git a/src/ScadaLink.CentralUI/Components/Shared/ScriptTriggerEditor.razor b/src/ScadaLink.CentralUI/Components/Shared/ScriptTriggerEditor.razor
index 0f5a3ae..07f0dad 100644
--- a/src/ScadaLink.CentralUI/Components/Shared/ScriptTriggerEditor.razor
+++ b/src/ScadaLink.CentralUI/Components/Shared/ScriptTriggerEditor.razor
@@ -23,6 +23,7 @@
+
@if (_kind == ScriptTriggerKind.Unknown)
{
@@ -45,6 +46,9 @@
case ScriptTriggerKind.Conditional:
@RenderConditional();
break;
+ case ScriptTriggerKind.Expression:
+ @RenderExpression();
+ break;
case ScriptTriggerKind.Call:
No automatic trigger — this script runs only when another script
@@ -62,7 +66,8 @@
}
@* ── Hint ──────────────────────────────────────────────────────────── *@
- @if (_kind is ScriptTriggerKind.Interval or ScriptTriggerKind.ValueChange or ScriptTriggerKind.Conditional)
+ @if (_kind is ScriptTriggerKind.Interval or ScriptTriggerKind.ValueChange
+ or ScriptTriggerKind.Conditional or ScriptTriggerKind.Expression)
{