Machine state, sequences and sessions
Sequence Editor <smart-sequence-editor>
SequenceEditor is a step sequence editor and runner for test sequences, batch procedures and recipes.
<smart-sequence-editor> · 7 properties, 8 methods, 5 events · source/modules/smart.sequenceeditor.js
Usage in Blazor
The Razor component is <SequenceEditor> in Smart.Blazor.Industrial: every property is a parameter in PascalCase, every event an EventCallback<Event> named On<Event> whose ev["Detail"] is the typed detail class, and the methods are called on the @ref. String choices are enums. In a Blazor Web App (.NET 8 and later) the page needs an interactive render mode, for example @rendermode InteractiveServer; a statically rendered component stays empty.
@using Smart.Blazor.Industrial
@* .NET 8 and later: an interactive render mode, on the page or for the whole app *@
@rendermode InteractiveServer
<SequenceEditor @ref="sequenceEditor" StopOnFailure="true"
OnSequenceComplete="OnSequenceComplete" />
@code {
SequenceEditor sequenceEditor;
void OnSequenceComplete(Event ev)
{
SequenceEditorSequenceCompleteEventDetail detail = ev["Detail"];
}
// void Abort()
void Call() => sequenceEditor.Abort();
}
Properties
| Parameter | Type, default | Description |
|---|---|---|
CurrentStep | object | Sets or retrieves the id of the step being run. Null when nothing is running. |
LimitEvaluator | object | Sets or gets a function (step, value) that returns true, false, or undefined to fall back to the built-in limit forms. Only needed for a limit that cannot be expressed as a range or as a nominal value with a tolerance. |
Mode | SequenceEditorMode | Sets or retrieves whether the sequence is being edited or run. |
PrecisionDigits | int | Sets or gets the number of decimal places used when a measurement is shown. |
ShowResults | bool | Sets or retrieves whether the result column is shown. The property is read when the default columns are built, so set it before the component is initialized. Boolean attributes are presence-based, so the column cannot be turned off from markup. |
Steps | IEnumerable<object> | Sets or retrieves the sequence as [{ id, name, action, unit, min, max, nominal, tolerance, value, skipped, aborted }]. Only id is required. A step with neither a range nor a nominal value is an action rather than a measurement: it can run but cannot fail on a value. The state of a step is derived from its measurement and its limit, so updating the measurement updates the verdict. Assign a new array to update the component. |
StopOnFailure | bool | Sets or retrieves whether a failed step aborts the rest of the run. |
Methods
| Method | Description |
|---|---|
void Abort() | Stops the run and marks every step that has not run as aborted, so that the report shows that the run did not finish. |
Task<string> LimitText(object step) | Returns the limit of a step as it appears on a specification sheet: a range, a single bound, or a nominal value with a tolerance. An invalid limit is written with "(invalid limit)" after it, and warned about once in the console.step object The step. |
void Pause() | Pauses the run at the current step. |
Task<object> Report() | Returns the record of the run: the verdict, the number of steps in each state, and every step with its limit and measurement. A run passes only when no step failed and no step was left unrun. |
void Run() | Starts the run at the first pending step and raises the stepStart event. Does nothing when the sequence is already running. |
Task<bool> SetResult(object id, object value) | Records a measurement for a step and moves to the next step. While a step is current, only that step takes a result: a result for another step is refused, raises resultRefused, changes nothing and returns false. A non-numeric result is kept and shown, and the step is marked as not evaluated rather than as passed or failed.id string | number The step's id. Always identify a step by id and never by row index, the table sorts, so an index stops meaning anything the moment a column header is clicked.value any The measurement. |
void Skip(object id) | Marks a step as not run and moves to the next step when the sequence is running.id string | number The step's id. |
Task<string> StateOf(object step) | Returns the state of a step: pending, running, passed, failed, skipped, aborted or notEvaluated. The state is derived from the measurement and the limit. A step with a limit whose result cannot be judged against it - NaN, Infinity, a text such as n/a, or a limit that is itself invalid (a minimum above the maximum, a negative tolerance) - is notEvaluated, never passed; a report with such a step has not passed.step object The step. |
Events
Every event is an EventCallback<Event>; Event is a dictionary and ev["Detail"] converts to the detail class named under the event.
| Event | Description and detail |
|---|---|
OnSequenceComplete | This event is triggered when the run finishes or is aborted.Aborted bool Whether it was aborted rather than completed.Report object The full record. |
OnSequencePause | This event is triggered when the run is paused.Step dynamic The step it paused at. |
OnStepComplete | This event is triggered when a measurement is recorded against a step.Id string The step's id.State string The state it settled into.Passed bool Whether it passed.Step object The step that completed. |
OnResultRefused | This event is triggered when setResult is called for a step that is not the one running. The result is not recorded and the run does not move.Id string The step the result was for.Value dynamic The result that was refused.Current string The step that is running. |
OnStepStart | This event is triggered when the run reaches a step. The application performs the measurement and calls setResult; the component waits and does not execute anything itself.Id string The step's id.Step object The step.Index int Its position in the sequence. |
Types
enum SequenceEditorMode
SequenceEditorMode.Edit SequenceEditorMode.Run
CSS variables
The component declares 1 CSS variables; the CSS page shows how to set them.
--smart-sequence-height