Skip to content

Sessions Header ​

The Sessions Header widget is the title bar of a sessions section: the title on the left and an Options button with a cog icon on the right. The button opens the Image saving dialog, where the user chooses which inspected images are kept. The mode applies to the whole system, not to one session.

Palette: category Monitor, label sessions header. 1 input, 1 output.

The widget does not store the mode. It asks the flow for the current mode, sends the user's choice to the flow, and shows the mode the flow sends back. The Sessions widget has the same dialog built in and stores the mode itself; Sessions Header is meant for pages built from separate widgets, such as Session Details.

Configuration ​

PropertyDescriptionDefault
NameNode name shown in the editor.''
GroupDashboard group where the widget is shown.(required)
SizeWidth and height of the widget (0 = automatic).0 / 0
TitleText shown on the left, in bold. Empty shows SESSIONS.SESSIONS
ClassExtra CSS classes added to the widget.''
TopicText set as msg.topic on every message the node sends.save-images

Image saving dialog ​

OptionValue sent
Do not save imagesnone
All imagesall
Only correct imagesok
Only incorrect imagesnok

When the dialog opens, the option of the current mode is selected; if the widget has not received one of the four values yet, All images is selected. Save sends the choice and closes the dialog. Cancel and the close button send nothing.

After Save, the browser where the user saved takes the new mode at once. The other browsers take it when the flow sends it to the node's input.

Input ​

PropertyTypeDescription
payload.saveImagesModestringCurrent mode: none, all, ok or nok.

Messages without payload.saveImagesMode are ignored. The node does not keep input messages and does not pass them to its output, so wiring the reply back to the input does not create a loop.

Output ​

The widget sends two messages, both with msg.topic set to Topic.

When the widget loads in a browser (opening or reloading the page), it asks for the current mode:

js
msg = {
    topic: "save-images",
    payload: { action: "get-save-images" }
}

When the user clicks Save in the dialog:

js
msg = {
    topic: "save-images",
    payload: { action: "set-save-images", saveImages: "nok" }
}

saveImages is one of none, all, ok or nok. The flow must store it and answer both messages with { payload: { saveImagesMode } } on the node's input.

Status and errors ​

  • No group configured: logged when the node has no group. The widget is not shown.

Usage example ​

A function node wired from the output of Sessions Header back to its input. It stores the mode in global.saveImagesMode, the variable where Sessions also keeps the mode of its own dialog, and answers with the current mode:

js
const MODES = ["none", "all", "ok", "nok"];

if (msg.payload.action === "set-save-images" && MODES.includes(msg.payload.saveImages)) {
    global.set("saveImagesMode", msg.payload.saveImages);
}

const mode = global.get("saveImagesMode");
return { payload: { saveImagesMode: MODES.includes(mode) ? mode : "all" } };

The reply is a new message, so it reaches every browser that shows the widget. The flow that saves the inspected images can read the mode from the same variable.