# Formatting ui-notification

**URL:** https://discourse.nodered.org/t/formatting-ui-notification/90348
**Category:** Dashboard
**Tags:** dashboard-2
**Created:** [22 August 2024 20:44 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348 "2024-08-22T20:44:44Z")
**Posts on this page:** 12
**Page:** 2

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [24 August 2024 14:17 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/21 "2024-08-24T14:17:08Z")

</div>

> [@Colin](#):
>
> What is the advantage of just providing the two?

I've explained that above.

What extra functionality would be added by a third output, that isn't provided by the other two? Your rationale wasn't clear (to me, Colin).

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [24 August 2024 14:41 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/22 "2024-08-24T14:41:13Z")

</div>

> [@Paul-Reed](#):
>
> What extra functionality would be added by a third output, that isn't provided by the other two?

It is the same rationale as that for having more than 1 output.  
With just one output a Switch node is needed to take specific action on confirm or cancel or timeout.  
With two outputs a Switch node is still needed to take specific action on cancel or timeout.  
With three outputs a Switch node will never be required.

The simplest use case is where I want to take one action on Confirm and a Different action on Cancel. With two outputs I would still need a Switch node on the second output.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [24 August 2024 14:54 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/23 "2024-08-24T14:54:22Z")

</div>

I just wanted to keep things simple. All the confirmed input msg's leave by output 1, and all ui-notification msg's leave by output 2.

We both have valid ideas, but I'm sure Joe will have his own perspective on this.

---

<div class="post-metadata">

### Author: ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)
#### Post date: [25 August 2024 06:42 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/24 "2024-08-25T06:42:41Z")

</div>

For me, if it's of type "Confirm", it's sensible to hold the contents of the triggering message, _until_ confirmed. At which point, we include the provided contents in any transmitted message?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [25 August 2024 07:56 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/25 "2024-08-25T07:56:26Z")

</div>

I don't think that it matters what type it is, ideally any message passed on should be the original message with only the properties that are supposed to change modified.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [25 August 2024 08:13 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/26 "2024-08-25T08:13:50Z")

</div>

> [@joepavitt](#):
>
> At which point, we include the provided contents in any transmitted message?

Yes, but that is all that ideally should be outputted on that output pin, that's why we are suggesting `confirm_clicked` , `dismiss_clicked` & `timeout` msg's are output on a separate output pin(s).

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [25 August 2024 08:20 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/27 "2024-08-25T08:20:25Z")

</div>

(sorry - late to the party - so maybe missing the point) - why couldn't they be added as an additional (say) msg.status property rather than a separate output... If in a separate output you then have to join them back together if you need to know which payload was timed out etc... Isn't it better to keep everything together ?

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [25 August 2024 08:31 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/28 "2024-08-25T08:31:59Z")

</div>

> [@dceejay](#):
>
> why couldn't they be added as an additional (say) msg.status property

Because if for example, it was not confirmed, a `timeout` message would be generated, which would trigger the flow, meaning we would then have to filter out those messages with a switch node.  
I doubt many users will make use of the `confirm_clicked` , `dismiss_clicked` & `timeout` messages, they will really only want the confirmed original message or nothing.

Isn't that how the original DB1 notification node worked @dceejay ?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [25 August 2024 08:38 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/29 "2024-08-25T08:38:06Z")

</div>

> [@dceejay](#):
>
> so maybe missing the point)

Possibly. Currently the node sends out a message where the payload indicates Confirm, Cancel or Timeout. Almost always it will be necessary to add a Switch node to determine which it is. The suggestion is to effectively include the Switch node in the notification node so that it sends the message to just the relevant output. No need for Switches or Joins.

> [@Paul-Reed](#):
>
> Isn't that how the original DB1 notification node worked

The D1 node sends the payload containing the label of whichever button is clicked, so it is up to the user what payload it sends rather being hard coded into the node. The node is agnostic about whether the buttons are OK and Cancel or Cancel and OK or Action A and Action B.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [25 August 2024 08:45 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/30 "2024-08-25T08:45:15Z")

</div>

> [@Colin](#):
>
> The suggestion is to effectively include the Switch node in the notification node so that it sends the message to just the relevant output. No need for Switches or Joins.

Yes, in a nutshell!

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [25 August 2024 15:53 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/31 "2024-08-25T15:53:00Z")

</div>

The original DB1 would send whatever the OK button text was set to as the payload, and whatever the cancel button was set to as the cancel payload. Hitting Esc to dismiss the dialog would also send the cancel text - so you always got some feedback you would have to switch on. Adding timeout to the mix would not seem unreasonable.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [25 August 2024 16:24 UTC](https://discourse.nodered.org/t/formatting-ui-notification/90348/32 "2024-08-25T16:24:02Z")

</div>

> [@dceejay](#):
>
> The original DB1 would send whatever the OK button text was set to as the payload,

@Steve-Mcl suggested adding typed input, so adding text instead of the msg, would be similar to DB1.

> [@dceejay](#):
>
> Adding timeout to the mix would not seem unreasonable.

Yes, it's a nice touch, especially with the countdown bar.

[Previous page](https://discourse.nodered.org/t/formatting-ui-notification/90348.md?page=1)
