Recipes, orders and scheduled jobs
Job Panel <smart-job-panel>
JobPanel shows what a station does on its own - the jobs it runs because of the clock rather than because of a person - with what each does, when it runs and how it went last time.
<smart-job-panel> · 6 properties, 0 methods, 2 events · source/modules/smart.jobpanel.js
Usage in Angular
The Angular wrapper is JobPanelComponent from JobPanelModule: every property is an input, every event an output named on<Event>, and the methods are called on the component reference from @ViewChild. A method that returns a value returns a Promise of it, resolved once the component has rendered; its ...Sync() twin returns the value at once, or null before the component has rendered. Unknown bindings are rejected at compile time.
import { JobPanelModule, JobPanelComponent } from 'smart-industrial/angular/jobpanel';
<smart-job-panel #jobPanel [label]="'Line 3 jobs'"
(onJobRun)="onJobRun($event)"></smart-job-panel>
@ViewChild('jobPanel', { read: JobPanelComponent }) jobPanel!: JobPanelComponent;
Properties
| Input | Type, default | Description |
|---|---|---|
[jobs] | array | Sets or retrieves the jobs as [{ id, name, enabled, when, action, lastRun, lastResult, runs, error }]. when is { daily: 'hh:mm' }, { weekly: { days, at } }, { every: milliseconds } or { cron }, and may carry text - the words the station's own schedule reader made of it, shown in place of the expression. action is { kind: 'recipe', recipe }, { kind: 'write', tag, value } or { kind: 'flow', flow }. lastResult is { ok, error }. The shape is what a Scada Studio station returns from /api/jobs. Assign a new array to update the component. |
[label] | string | Sets or retrieves the heading of the panel. It is also the accessible name of the group. |
[readOnly] | boolean | Sets or retrieves whether the panel only shows the jobs. The Run now and Enable/Disable buttons are removed rather than disabled, because a control that cannot be used should not invite a press; every job and how it last went stays readable. |
[allowToggle] | boolean | Sets or retrieves whether the Enable/Disable button is offered. Running a job and changing what the station does on its own are different rights - an operator may run the night setback early, only an engineer may switch it off - so an application can give the first without the second. When false the button is removed rather than disabled. |
[running] | string | Sets or retrieves the id of the job the application is running now. Its row says so and its button cannot be pressed twice. The application sets it on jobRun and clears it when the run comes back. From a jobRun until the application sets running, or for two seconds when it never does, the panel raises no other jobRun - so a held Enter or a double click runs a job once. |
[confirm] | boolean | Sets or retrieves whether running a job by hand asks first. The confirmation says what the job does. A job writes into a plant, and running the night setback in the middle of the afternoon is a thing to be sure about, so this is on by default. The confirmation runs exactly what it showed: the job's action is copied when it opens, so a jobs update while it is open cannot change what Run it sends. A job that has left the station by then is not run. Escape, Cancel and Run it give the focus back to the Run now button. |
Events
The data of an event is in event.detail. jobRun and jobToggle are requests: the job panel raises them only while readOnly is false, asks for confirmation before jobRun while confirm is true, and keeps jobs and running as they are. The application sets running while a job runs and updates jobs with the result or the new enabled state.
| Output | Description and detail |
|---|---|
(onJobRun) | This event is triggered when the operator runs a job by hand, after the confirmation when one is asked for. The component does not run it: the application asks the station to, sets the running property while it does, and hands back the updated jobs. It cannot know who is pressing the button or how the run should be audited, so it does not pretend to. Raised once per press: a held key or a double click does not raise it again.id string The id of the job.name string The name of the job, as the operator saw it.action any What the job does, as it was given in jobs. |
(onJobToggle) | This event is triggered when the operator switches a job on or off. The list is not changed; the application stores the change on the station and hands back the updated jobs. A second click on the same switch within a second is the same press and raises nothing.id string The id of the job.name string Its name.enabled boolean Whether the job is asked to be on: true to switch it on, false to switch it off. |
CSS variables
The component declares 3 CSS variables; the CSS page shows how to set them.
--smart-job-panel-failed-color --smart-job-panel-ok-color --smart-job-panel-mono