feat(central-ui): add Min time between runs field to the script form
The template script editor had no input for MinTimeBetweenRuns, so a WhileTrue trigger configured through the UI always saved a null interval and degraded to a single edge fire. The Add/Edit Script modal now has a "Min time between runs" number+unit (ms/sec/min) field. - Visible only for ValueChange / Conditional / Expression triggers — the auto-firing triggers MinTimeBetweenRuns throttles. Hidden for Interval (its own period is the cadence), Call (invoked explicitly, never throttled), and None. - For a WhileTrue Conditional/Expression trigger the field is labelled as the re-fire interval and shows a warning while it is blank. - Wired through the new-script and edit-script save paths (edit previously only preserved the existing value, never let the user change it). New DurationInput helper does the TimeSpan <-> number+unit conversion; ScriptTriggerConfigCodec.SupportsMinTimeBetweenRuns classifies trigger types. Both TDD'd — 21 new tests. CentralUI suite 316 green; verified end-to-end in the browser (visibility per trigger type, WhileTrue warning, save/reload round-trip).
This commit is contained in:
@@ -117,6 +117,27 @@ public class ScriptTriggerConfigCodecTests
|
||||
Assert.Equal(mode, reparsed.Mode);
|
||||
}
|
||||
|
||||
// ── SupportsMinTimeBetweenRuns ─────────────────────────────────────────
|
||||
|
||||
[Theory]
|
||||
[InlineData("ValueChange")]
|
||||
[InlineData("Conditional")]
|
||||
[InlineData("Expression")]
|
||||
public void SupportsMinTimeBetweenRuns_TrueForAutoTriggersThatThrottle(string triggerType)
|
||||
{
|
||||
Assert.True(ScriptTriggerConfigCodec.SupportsMinTimeBetweenRuns(triggerType));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Interval")] // has its own period control
|
||||
[InlineData("Call")] // invoked explicitly — no throttle applies
|
||||
[InlineData(null)] // None — never runs automatically
|
||||
[InlineData("Bogus")] // Unknown trigger type
|
||||
public void SupportsMinTimeBetweenRuns_FalseForIntervalCallNoneAndUnknown(string? triggerType)
|
||||
{
|
||||
Assert.False(ScriptTriggerConfigCodec.SupportsMinTimeBetweenRuns(triggerType));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
|
||||
Reference in New Issue
Block a user