Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ui_notification.html 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <style>
  2. #ui-chart-colors input[type="color"] {
  3. font-weight: bold;
  4. }
  5. #ui-chart-colors input[type="color"]::-webkit-color-swatch,
  6. #ui-chart-colors input[type="color"]::-moz-color-swatch {
  7. border: none;
  8. }
  9. </style>
  10. <script type="text/javascript">
  11. (function () {
  12. RED.nodes.registerType('ui-notification', {
  13. category: RED._('@flowfuse/node-red-dashboard/ui-base:ui-base.label.category'),
  14. color: RED._('@flowfuse/node-red-dashboard/ui-base:ui-base.colors.medium'),
  15. defaults: {
  16. ui: { type: 'ui-base', value: '', required: true },
  17. position: { value: 'top right' },
  18. colorDefault: { value: true },
  19. color: { value: null },
  20. displayTime: { value: '3' },
  21. showCountdown: { value: true },
  22. outputs: { value: 1 },
  23. allowDismiss: { value: true },
  24. dismissText: { value: 'Close' },
  25. allowConfirm: { value: false },
  26. confirmText: { value: 'Confirm' },
  27. raw: { value: false },
  28. className: { value: '' },
  29. name: { value: '' }
  30. },
  31. inputs: 1,
  32. outputs: 1,
  33. align: 'right',
  34. icon: 'font-awesome/fa-envelope-o',
  35. paletteLabel: 'notification',
  36. label: function () { return this.name || (this.position === 'prompt' ? 'show dialog' : (this.position === 'dialog' ? 'show dialog' : 'show notification')) },
  37. labelStyle: function () { return this.name ? 'node_label_italic' : '' },
  38. oneditprepare: function () {
  39. $('#node-input-topic').typedInput({
  40. default: 'str',
  41. typeField: $('#node-input-topicType'),
  42. types: ['str', 'msg', 'flow', 'global']
  43. })
  44. $('#node-input-allowDismiss').on('change', function () {
  45. const allowDismiss = $('#node-input-allowDismiss').is(':checked')
  46. if (allowDismiss) {
  47. $('#node-notification-dismissText').show()
  48. } else {
  49. $('#node-notification-dismissText').hide()
  50. }
  51. })
  52. $('#node-input-allowConfirm').on('change', function () {
  53. const allowConfirm = $('#node-input-allowConfirm').is(':checked')
  54. if (allowConfirm) {
  55. $('#node-notification-confirmText').show()
  56. } else {
  57. $('#node-notification-confirmText').hide()
  58. }
  59. })
  60. $('#node-input-colorDefault').on('change', function () {
  61. const defaultColor = $('#node-input-colorDefault').is(':checked')
  62. if (defaultColor) {
  63. $('#node-input-color').hide()
  64. } else {
  65. $('#node-input-color').show()
  66. }
  67. })
  68. // use jQuery UI tooltip to convert the plain old title attribute to a nice tooltip
  69. $('.ui-node-popover-title').tooltip({
  70. show: {
  71. effect: 'slideDown',
  72. delay: 150
  73. }
  74. })
  75. }
  76. })
  77. })()
  78. </script>
  79. <script type="text/html" data-template-name="ui-notification">
  80. <div class="form-row">
  81. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  82. <input type="text" id="node-input-name" placeholder="Name">
  83. </div>
  84. <div class="form-row">
  85. <label for="node-input-ui"><i class="fa fa-bookmark"></i> UI</label>
  86. <input type="text" id="node-input-ui">
  87. </div>
  88. <div class="form-row">
  89. <label for="node-input-position"><i class="fa fa-th-large"></i> Position</label>
  90. <select type="text" id="node-input-position" style="display:inline-block; width:70%; vertical-align:baseline;">
  91. <option value="top right">Top Right</option>
  92. <option value="top center">Top Center</option>
  93. <option value="top left">Top Left</option>
  94. <option value="bottom right">Bottom Right</option>
  95. <option value="bottom center">Bottom Center</option>
  96. <option value="bottom left">Bottom Left</option>
  97. <option value="center center">Center</option>
  98. </select>
  99. </div>
  100. <div class="form-row">
  101. <label for="node-input-color"><i class="fa fa-paint-brush"></i> Color</label>
  102. <div style="display: inline-flex; gap: 8px; align-items: center;">
  103. <input type="checkbox" id="node-input-colorDefault" style="width: auto; margin: 0;">
  104. <label for="node-input-colorDefault" style="margin: 0; line-height: 34px;">Default</label>
  105. <input type="color" id="node-input-color" placeholder="#FFFFFF">
  106. </div>
  107. </div>
  108. <div class="form-row" id="node-toast-displaytime">
  109. <label for="node-input-displayTime"><i class="fa fa-clock-o"></i> Timeout (S)</label>
  110. <input type="text" id="node-input-displayTime" placeholder="[msg.timeout]">
  111. </div>
  112. <div class="form-row form-row-flex" id="node-notification-showCountdown">
  113. <input type="checkbox" id="node-input-showCountdown">
  114. <label for="node-input-showCountdown">Show timeout countdown bar on notification</label>
  115. </div>
  116. <div class="form-row form-row-flex" id="node-notification-allowDismiss">
  117. <input type="checkbox" id="node-input-allowDismiss">
  118. <label for="node-input-allowDismiss"> Allow Manual Dismissal</label>
  119. </div>
  120. <div class="form-row form-row-flex" style="margin-left: 32px;" id="node-notification-dismissText">
  121. <label for="node-input-dismissText"><i class="fa fa-check"></i> Button Label</label>
  122. <input type="text" id="node-input-dismissText" placeholder="Close">
  123. </div>
  124. <div class="form-row form-row-flex" id="node-notification-allowConfirm">
  125. <input type="checkbox" id="node-input-allowConfirm">
  126. <label for="node-input-allowConfirm"> Allow Manual Confirmation</label>
  127. </div>
  128. <div class="form-row form-row-flex" style="margin-left: 32px;" id="node-notification-confirmText">
  129. <label for="node-input-confirmText"><i class="fa fa-check"></i> Button Label</label>
  130. <input type="text" id="node-input-confirmText" placeholder="Confirm">
  131. </div>
  132. <div class="form-row form-row-flex" id="node-toast-raw">
  133. <input type="checkbox" id="node-input-raw" style="display:inline-block; width:auto; vertical-align:baseline;">
  134. <label style="width:auto" for="node-input-raw"> Accept raw HTML/JavaScript input in msg.payload to format popup.</label>
  135. </div>
  136. <div class="form-row">
  137. <label for="node-input-className"><i class="fa fa-code"></i> Class</label>
  138. <div style="display: inline;">
  139. <input style="width: 70%;" type="text" id="node-input-className" placeholder="Optional CSS class name(s)" style="flex-grow: 1;">
  140. <a
  141. data-html="true"
  142. title="Dynamic Property: Send msg.class to append new classes to this widget. NOTE: classes set at runtime will be applied in addition to any class(es) set in the nodes class field."
  143. class="red-ui-button ui-node-popover-title"
  144. style="margin-left: 4px; cursor: help; font-size: 0.625rem; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; justify-content: center; align-items: center;">
  145. <i style="font-family: ui-serif;">fx</i>
  146. </a>
  147. </div>
  148. </div>
  149. <div class="form-tips"><b>Note</b>: checking <i>Accept raw HTML/JavaScript</i> can allow injection of code.
  150. Ensure the input comes from trusted sources.</span></div>
  151. </script>