Introduces the ephemeral status and duration option
#5331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Types of changes
Proposed changes
Introduces the
ephemeralstatus anddurationoption.Ephemeral Concept
An ephemeral status is a purely visual status; it has no role in the runtime (it does not trigger a
Statusnode).This status is defined by adding the
ephemeral=trueproperty. Optionally, thedurationproperty allows to override the default duration of5s.At the end of the duration, the old retained status will be restored or cleared if no status is available.
Editor
100 msRuntime
handleStatus, this status will only trigger thenode-statusevent.Statusnodes will not be triggered.Duration Concept
Duration on default status allows it to be cleared at the end of the duration.
Editor
100 msRuntime
0.handleStatusback at the end of duration to clear the status.Typing
Related Issue(s)
Todo list
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
npm run testto verify the unit tests pass