Skip to content

Session Info ​

The ui-session-info widget shows a card with up to three figures taken from msg.payload: the last result, the total count (titled Total) and the error count. A button under them opens a dialog titled Session with a table of the error breakdown. Each message replaces everything shown: the widget does not add up values between messages.

Session Info

Palette: category Monitor, label session info. 1 input, 1 output.

Configuration ​

PropertyDescriptionDefault
NameNode name shown in the editor.""
GroupDashboard group where the card is displayed.(required)
SizeWidget width and height; 0 means automatic.0 x 0
No Class LabelTitle of the error count figure.Errors
Param LabelText of the button that opens the error dialog, and header of the first column (error name) of its table.Errors
Counter LabelHeader of the count column of the error table, used when every entry is a plain number.Count
Last Result LabelTitle of the last result figure.Last result

Input ​

msg.payload is an object with these properties, all optional:

PropertyTypeShown as
isAnomalousbooleanLast result: NOK when true, OK when false.
tagstringLast result, when isAnomalous is not a boolean.
totalCounternumberThe Total figure; 0 when missing.
anomalyCounternumberThe error count figure; 0 when missing.
noClassCounternumberThe error count figure, when anomalyCounter is missing.
errorCounterobjectThe error table: one row per key.

The last result figure is shown only when isAnomalous is true or tag is not empty, so a payload with isAnomalous: false and no tag hides it.

msg.payload = "reset" clears the card: both counts back to 0, the last result hidden and the table empty.

The node keeps the last message: a browser that opens the page shows it.

Error table ​

Each key of errorCounter is a row, and its value is a number or an object of numbers:

  • When every value is a number, the table has two columns: Param Label and Counter Label.
  • When at least one value is an object, the columns after the first are the keys found in those objects, in order of appearance. A plain number in such a table goes under the count column (or the first column when there is no count), with - in the others.

Entries that have not happened are left out: a number 0, an object whose count is 0, or an object without count whose values are all 0. Numbers are shown with up to two decimals in the browser's number format; missing or non-numeric cells show -.

Output ​

This node does not send messages. Input messages are not passed on.

Usage example ​

A function node that sends the figures of the current session after each inspection:

js
const s = flow.get("session") || { total: 0, nok: 0, scratches: 0, scratchArea: 0, dents: 0 };
msg.payload = {
    isAnomalous: msg.payload.isAnomalous,
    totalCounter: s.total,
    anomalyCounter: s.nok,
    errorCounter: {
        "Scratch": { count: s.scratches, area: s.scratchArea },
        "Dent": s.dents
    }
};
return msg;

The dialog then has the columns Param Label, count and area; the Dent row shows its number under count and - under area. A row whose count is 0 is not shown. When the session ends, msg.payload = "reset" clears the card.