Skip to content

Conversation

@GogoVega
Copy link
Contributor

@GogoVega GogoVega commented Oct 27, 2025

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Introduces the ephemeral status and duration option.

Ephemeral Concept

An ephemeral status is a purely visual status; it has no role in the runtime (it does not trigger a Status node).

This status is defined by adding the ephemeral=true property. Optionally, the duration property allows to override the default duration of 5s.

At the end of the duration, the old retained status will be restored or cleared if no status is available.

Editor

  • The minimum duration is set to 100 ms
  • If an ephemeral status is in progress and another status arrives (ephemeral or not) it will replace the status with its associated behavior.
  • The displayed text is in italics to recognize an ephemeral status

Runtime

  • When an ephemeral status arrives at handleStatus, this status will only trigger the node-status event.
  • Status nodes will not be triggered.
  • Duration is not handled in the runtime when it is an ephemeral status.

Duration Concept

Duration on default status allows it to be cleared at the end of the duration.

Editor

  • The minimum duration is set to 100 ms
  • If a status is in progress and another status arrives (ephemeral or not) it will replace the status with its associated behavior.

Runtime

  • The duration must be greater than 0.
  • When duration is set, it will call handleStatus back at the end of duration to clear the status.
  • Clearing status is handled in the editor.

Typing

interface NodeStatus {
  fill?: NodeStatusFill;
  shape?: NodeStatusShape;
  text?: string;
  duration?: number;
  ephemeral: boolean;
}

Related Issue(s)

Todo list

  • Italic text
  • Update docs
  • Update Monaco/ACE editors
  • Add unit tests

Test Flow

[{"id":"9739d6958aed6192","type":"inject","z":"15cdbf1d258ebb57","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":600,"wires":[["fa5a603cdb6a42ea"]]},{"id":"fa5a603cdb6a42ea","type":"function","z":"15cdbf1d258ebb57","name":"ephemeral status (default duration)","func":"node.status({ text: \"Ephemeral status\", ephemeral: true });\n","outputs":1,"timeout":0,"noerr":1,"initialize":"","finalize":"","libs":[],"x":380,"y":600,"wires":[[]]},{"id":"e76c2f23c57af9d6","type":"status","z":"15cdbf1d258ebb57","name":"","scope":["fa5a603cdb6a42ea","a08e3b5aa8485fa2","74a4c130fa6a4b6d","c40307b55d5b98bf","2bec1993b26781ee","5980e238a83f0a1f","7275cb35d58c5686"],"x":140,"y":540,"wires":[["c955bb08f295d98b"]]},{"id":"c955bb08f295d98b","type":"debug","z":"15cdbf1d258ebb57","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":300,"y":540,"wires":[]},{"id":"935f83eb956fa672","type":"inject","z":"15cdbf1d258ebb57","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":660,"wires":[["a08e3b5aa8485fa2"]]},{"id":"a08e3b5aa8485fa2","type":"function","z":"15cdbf1d258ebb57","name":"ephemeral status (500ms)","func":"node.status({ text: \"Ephemeral status\", ephemeral: true, duration: 500 });\n","outputs":1,"timeout":0,"noerr":1,"initialize":"","finalize":"","libs":[],"x":350,"y":660,"wires":[[]]},{"id":"1f7bc533642eaf32","type":"inject","z":"15cdbf1d258ebb57","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":720,"wires":[["74a4c130fa6a4b6d"]]},{"id":"74a4c130fa6a4b6d","type":"function","z":"15cdbf1d258ebb57","name":"ephemeral status (10ms => 100ms)","func":"node.status({ text: \"Ephemeral status\", ephemeral: true, duration: 10 });\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":720,"wires":[[]]},{"id":"9ae0dd3ac04bc582","type":"inject","z":"15cdbf1d258ebb57","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":780,"wires":[["c40307b55d5b98bf"]]},{"id":"c40307b55d5b98bf","type":"function","z":"15cdbf1d258ebb57","name":"normal status","func":"node.status({ text: \"Normal status\", ephemeral: false });\n","outputs":1,"timeout":0,"noerr":1,"initialize":"","finalize":"","libs":[],"x":320,"y":780,"wires":[[]]},{"id":"e42f1cf1d264e4f1","type":"inject","z":"15cdbf1d258ebb57","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":840,"wires":[["2bec1993b26781ee"]]},{"id":"2bec1993b26781ee","type":"function","z":"15cdbf1d258ebb57","name":"normal status (500ms)","func":"node.status({ text: \"Normal status\", duration: 500 });\n","outputs":1,"timeout":0,"noerr":1,"initialize":"","finalize":"","libs":[],"x":340,"y":840,"wires":[[]]},{"id":"aee7c6b4a48eef98","type":"inject","z":"15cdbf1d258ebb57","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":960,"wires":[["5980e238a83f0a1f"]]},{"id":"5980e238a83f0a1f","type":"function","z":"15cdbf1d258ebb57","name":"should restore ephemeral status (1s then 500ms)","func":"node.status({ text: \"Normal status\" });\n\nsetTimeout(() => node.status({ text: \"Ephemeral status\", duration: 500, ephemeral: true }), 1000);\n","outputs":1,"timeout":0,"noerr":1,"initialize":"","finalize":"","libs":[],"x":430,"y":960,"wires":[[]]},{"id":"ddf2920ec8cecc35","type":"inject","z":"15cdbf1d258ebb57","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":900,"wires":[["7275cb35d58c5686"]]},{"id":"7275cb35d58c5686","type":"function","z":"15cdbf1d258ebb57","name":"normal status (2000ms)","func":"node.status({ text: \"Normal status\", duration: 2000 });\n","outputs":1,"timeout":0,"noerr":1,"initialize":"","finalize":"","libs":[],"x":350,"y":900,"wires":[[]]}]

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@AllanOricil
Copy link
Contributor

AllanOricil commented Oct 27, 2025

At the end of the duration, the old retained status will be restored or cleared if no status is available.

Is the status node triggered again when the status is restored? I believe it shouldn't happen, but I asked because I couldn't see this spec in the pr description

old -> ephemeral : status node does not trigger
ephemeral -> old: what happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants