@kumologica/sdk 3.2.0-beta9 → 4.0.0-alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (570) hide show
  1. package/bin/kl.js +1 -1
  2. package/cli/cli.js +0 -2
  3. package/cli/commands/create-commands/create-project-iteratively.js +14 -7
  4. package/cli/commands/create.js +16 -15
  5. package/cli/commands/open.js +12 -5
  6. package/cli/commands/start.js +165 -0
  7. package/cli/commands/test/TestSuiteRunner.js +76 -0
  8. package/cli/commands/test.js +92 -120
  9. package/cli/utils/fs/parse.js +1 -1
  10. package/cli/utils/logger.js +9 -3
  11. package/package.json +12 -114
  12. package/src/api/core/comms.js +141 -0
  13. package/src/api/core/context.js +296 -0
  14. package/src/api/core/flows.js +286 -0
  15. package/src/api/core/index.js +29 -0
  16. package/src/api/core/library.js +106 -0
  17. package/src/api/core/nodes.js +476 -0
  18. package/src/api/core/projects.js +426 -0
  19. package/src/{app/ui/editor-api/lib/admin → api/core/rest}/context.js +1 -1
  20. package/src/{app/ui/editor-api/lib/admin → api/core/rest}/flow.js +2 -4
  21. package/src/{app/ui/editor-api/lib/admin → api/core/rest}/flows.js +1 -1
  22. package/src/{app/ui/editor-api/lib/admin → api/core/rest}/index.js +43 -27
  23. package/src/{app/ui/editor-api/lib/admin → api/core/rest}/nodes.js +1 -1
  24. package/src/{app/ui/editor-api/lib → api/core/rest}/util.js +6 -4
  25. package/src/api/core/settings.js +287 -0
  26. package/src/api/tools/base/DesignerTool.js +108 -0
  27. package/src/api/tools/core/flow.js +58 -0
  28. package/src/api/tools/core/index.js +18 -0
  29. package/src/api/tools/core/node.js +77 -0
  30. package/src/api/tools/debugger/index.js +193 -0
  31. package/src/api/tools/filemanager/index.js +127 -0
  32. package/src/api/tools/git/index.js +103 -0
  33. package/src/api/tools/index.js +13 -0
  34. package/src/api/tools/test/index.js +56 -0
  35. package/src/api/tools/test/lib/TestCaseRunner.js +105 -0
  36. package/src/api/tools/test/lib/reporters/index.js +120 -0
  37. package/src/server/DesignerServer.js +141 -0
  38. package/cli/.DS_Store +0 -0
  39. package/cli/commands/test-utils/TestSuiteController.js +0 -363
  40. package/cli/commands/test-utils/TestSuiteController.test.js +0 -171
  41. package/cli/commands/test-utils/util/output.js +0 -14
  42. package/cli/commands/test-utils/util/updates/index.js +0 -17
  43. package/cli/commands/test-utils/util/updates/pkg.js +0 -13
  44. package/cli/commands/test-utils/util/updates/templates/default-settings.js +0 -209
  45. package/src/app/lib/aws/aws-profile.js +0 -43
  46. package/src/app/lib/aws/ca-alexa-api.js +0 -29
  47. package/src/app/lib/aws/ca-apigw-api.js +0 -216
  48. package/src/app/lib/aws/ca-cloudwatch-api.js +0 -78
  49. package/src/app/lib/aws/ca-codecommit-api.js +0 -63
  50. package/src/app/lib/aws/ca-dynamodb-api.js +0 -27
  51. package/src/app/lib/aws/ca-elb-api.js +0 -44
  52. package/src/app/lib/aws/ca-events-api.js +0 -27
  53. package/src/app/lib/aws/ca-iot-api.js +0 -105
  54. package/src/app/lib/aws/ca-s3-api.js +0 -115
  55. package/src/app/lib/aws/ca-sns-api.js +0 -38
  56. package/src/app/lib/aws/ca-sqs-api.js +0 -51
  57. package/src/app/lib/aws/cf.js +0 -449
  58. package/src/app/lib/aws/index.js +0 -988
  59. package/src/app/lib/aws/kl-iam-api.js +0 -27
  60. package/src/app/lib/aws/kl-rekognition-api.js +0 -66
  61. package/src/app/lib/aws/kl-ssm-api.js +0 -24
  62. package/src/app/lib/azure/index.js +0 -80
  63. package/src/app/lib/dependencies.js +0 -50
  64. package/src/app/lib/kumohub/index.js +0 -201
  65. package/src/app/lib/runtime-loader/index.js +0 -42
  66. package/src/app/lib/serverless/index.js +0 -318
  67. package/src/app/lib/stores/aws-cloud-config-store.js +0 -35
  68. package/src/app/lib/stores/azure-config-store.js +0 -24
  69. package/src/app/lib/stores/kumohub-config-store.js +0 -24
  70. package/src/app/lib/stores/project-info-config-store.js +0 -26
  71. package/src/app/lib/stores/settings-cloud-store.js +0 -120
  72. package/src/app/lib/stores/settings-cloud-store.spec.js +0 -26
  73. package/src/app/lib/stores/settings-network-store.js +0 -118
  74. package/src/app/lib/stores/settings-network-store.spec.js +0 -27
  75. package/src/app/lib/stores/store.js +0 -97
  76. package/src/app/lib/stores/test-config-store.js +0 -159
  77. package/src/app/lib/stores/user-preference-store.js +0 -44
  78. package/src/app/lib/stores/util/iniParser.js +0 -46
  79. package/src/app/lib/stores/util/iniParser.spec.js +0 -72
  80. package/src/app/lib/utils/editor.js +0 -98
  81. package/src/app/lib/utils/fix-path.js +0 -15
  82. package/src/app/main-process/editor-manager.js +0 -177
  83. package/src/app/main-process/favicon.ico +0 -0
  84. package/src/app/main-process/main-window.js +0 -214
  85. package/src/app/main-process/menu.js +0 -420
  86. package/src/app/main-process/modal-home.js +0 -122
  87. package/src/app/main-process/modal-newproject.js +0 -123
  88. package/src/app/main-process/modal-newtab.js +0 -96
  89. package/src/app/main-process/modal-nodelibrary.js +0 -94
  90. package/src/app/main-process/modal-welcome.js +0 -119
  91. package/src/app/main.js +0 -620
  92. package/src/app/preload.js +0 -649
  93. package/src/app/ui/editor-api/lib/auth/clients.js +0 -17
  94. package/src/app/ui/editor-api/lib/auth/index.js +0 -269
  95. package/src/app/ui/editor-api/lib/auth/permissions.js +0 -51
  96. package/src/app/ui/editor-api/lib/auth/strategies.js +0 -144
  97. package/src/app/ui/editor-api/lib/auth/tokens.js +0 -138
  98. package/src/app/ui/editor-api/lib/auth/users.js +0 -122
  99. package/src/app/ui/editor-api/lib/editor/comms.js +0 -247
  100. package/src/app/ui/editor-api/lib/editor/credentials.js +0 -22
  101. package/src/app/ui/editor-api/lib/editor/index.js +0 -242
  102. package/src/app/ui/editor-api/lib/editor/library.js +0 -69
  103. package/src/app/ui/editor-api/lib/editor/locales.js +0 -37
  104. package/src/app/ui/editor-api/lib/editor/projects.js +0 -497
  105. package/src/app/ui/editor-api/lib/editor/settings.js +0 -118
  106. package/src/app/ui/editor-api/lib/editor/sshkeys.js +0 -87
  107. package/src/app/ui/editor-api/lib/editor/theme.js +0 -184
  108. package/src/app/ui/editor-api/lib/editor/ui.js +0 -170
  109. package/src/app/ui/editor-api/lib/index.js +0 -149
  110. package/src/app/ui/editor-api/lib/runner/index.js +0 -81
  111. package/src/app/ui/editor-client/README.md +0 -10
  112. package/src/app/ui/editor-client/constants.js +0 -5
  113. package/src/app/ui/editor-client/index.js +0 -3
  114. package/src/app/ui/editor-client/public/favicon.ico +0 -0
  115. package/src/app/ui/editor-client/public/red/images/bolt.png +0 -0
  116. package/src/app/ui/editor-client/public/red/images/debugger/continue-full.png +0 -0
  117. package/src/app/ui/editor-client/public/red/images/debugger/continue-outline.png +0 -0
  118. package/src/app/ui/editor-client/public/red/images/debugger/pause.png +0 -0
  119. package/src/app/ui/editor-client/public/red/images/debugger/restart.png +0 -0
  120. package/src/app/ui/editor-client/public/red/images/debugger/stepover.png +0 -0
  121. package/src/app/ui/editor-client/public/red/images/debugger/stop.png +0 -0
  122. package/src/app/ui/editor-client/public/red/images/deploy-flows-o.png +0 -0
  123. package/src/app/ui/editor-client/public/red/images/deploy-flows.png +0 -0
  124. package/src/app/ui/editor-client/public/red/images/deploy-full-o.png +0 -0
  125. package/src/app/ui/editor-client/public/red/images/deploy-full.png +0 -0
  126. package/src/app/ui/editor-client/public/red/images/deploy-nodes-o.png +0 -0
  127. package/src/app/ui/editor-client/public/red/images/deploy-nodes.png +0 -0
  128. package/src/app/ui/editor-client/public/red/images/deploy-reload.png +0 -0
  129. package/src/app/ui/editor-client/public/red/images/grip.png +0 -0
  130. package/src/app/ui/editor-client/public/red/images/icons/arrow-in.png +0 -0
  131. package/src/app/ui/editor-client/public/red/images/icons/bolt.png +0 -0
  132. package/src/app/ui/editor-client/public/red/images/icons/node-changed.png +0 -0
  133. package/src/app/ui/editor-client/public/red/images/icons/node-error.png +0 -0
  134. package/src/app/ui/editor-client/public/red/images/icons/node-play.png +0 -0
  135. package/src/app/ui/editor-client/public/red/images/kumologica-app.png +0 -0
  136. package/src/app/ui/editor-client/public/red/images/node-red-256.png +0 -0
  137. package/src/app/ui/editor-client/public/red/images/node-red-icon-black.svg +0 -9
  138. package/src/app/ui/editor-client/public/red/images/node-red-icon.svg +0 -33
  139. package/src/app/ui/editor-client/public/red/images/node-red.png +0 -0
  140. package/src/app/ui/editor-client/public/red/images/pw_maze_white.png +0 -0
  141. package/src/app/ui/editor-client/public/red/images/spin.svg +0 -41
  142. package/src/app/ui/editor-client/public/red/images/spinner.gif +0 -0
  143. package/src/app/ui/editor-client/public/red/images/subflow_tab.png +0 -0
  144. package/src/app/ui/editor-client/public/red/images/test-icon.png +0 -0
  145. package/src/app/ui/editor-client/public/red/images/typedInput/09.png +0 -0
  146. package/src/app/ui/editor-client/public/red/images/typedInput/az.png +0 -0
  147. package/src/app/ui/editor-client/public/red/images/typedInput/bin.png +0 -0
  148. package/src/app/ui/editor-client/public/red/images/typedInput/bool.png +0 -0
  149. package/src/app/ui/editor-client/public/red/images/typedInput/env.png +0 -0
  150. package/src/app/ui/editor-client/public/red/images/typedInput/expr.png +0 -0
  151. package/src/app/ui/editor-client/public/red/images/typedInput/json.png +0 -0
  152. package/src/app/ui/editor-client/public/red/images/typedInput/re.png +0 -0
  153. package/src/app/ui/editor-client/public/red/keymap.json +0 -54
  154. package/src/app/ui/editor-client/public/red/main-modals.js +0 -14
  155. package/src/app/ui/editor-client/public/red/main-modals.min.js +0 -1
  156. package/src/app/ui/editor-client/public/red/main.js +0 -10
  157. package/src/app/ui/editor-client/public/red/main.min.js +0 -1
  158. package/src/app/ui/editor-client/public/red/red.js +0 -45913
  159. package/src/app/ui/editor-client/public/red/red.min.js +0 -19
  160. package/src/app/ui/editor-client/public/red/style.min.css +0 -9
  161. package/src/app/ui/editor-client/public/vendor/ace/LICENSE +0 -24
  162. package/src/app/ui/editor-client/public/vendor/ace/ace.js +0 -17
  163. package/src/app/ui/editor-client/public/vendor/ace/ext-language_tools.js +0 -8
  164. package/src/app/ui/editor-client/public/vendor/ace/ext-searchbox.js +0 -8
  165. package/src/app/ui/editor-client/public/vendor/ace/mode-css.js +0 -8
  166. package/src/app/ui/editor-client/public/vendor/ace/mode-handlebars.js +0 -8
  167. package/src/app/ui/editor-client/public/vendor/ace/mode-html.js +0 -8
  168. package/src/app/ui/editor-client/public/vendor/ace/mode-javascript.js +0 -8
  169. package/src/app/ui/editor-client/public/vendor/ace/mode-json.js +0 -8
  170. package/src/app/ui/editor-client/public/vendor/ace/mode-jsonata.js +0 -1
  171. package/src/app/ui/editor-client/public/vendor/ace/mode-markdown.js +0 -8
  172. package/src/app/ui/editor-client/public/vendor/ace/mode-properties.js +0 -8
  173. package/src/app/ui/editor-client/public/vendor/ace/mode-python.js +0 -8
  174. package/src/app/ui/editor-client/public/vendor/ace/mode-sql.js +0 -8
  175. package/src/app/ui/editor-client/public/vendor/ace/mode-swift.js +0 -8
  176. package/src/app/ui/editor-client/public/vendor/ace/mode-text.js +0 -8
  177. package/src/app/ui/editor-client/public/vendor/ace/mode-xml.js +0 -8
  178. package/src/app/ui/editor-client/public/vendor/ace/mode-yaml.js +0 -8
  179. package/src/app/ui/editor-client/public/vendor/ace/snippets/css.js +0 -8
  180. package/src/app/ui/editor-client/public/vendor/ace/snippets/handlebars.js +0 -8
  181. package/src/app/ui/editor-client/public/vendor/ace/snippets/html.js +0 -8
  182. package/src/app/ui/editor-client/public/vendor/ace/snippets/javascript.js +0 -8
  183. package/src/app/ui/editor-client/public/vendor/ace/snippets/json.js +0 -8
  184. package/src/app/ui/editor-client/public/vendor/ace/snippets/jsonata.js +0 -1
  185. package/src/app/ui/editor-client/public/vendor/ace/snippets/markdown.js +0 -8
  186. package/src/app/ui/editor-client/public/vendor/ace/snippets/properties.js +0 -8
  187. package/src/app/ui/editor-client/public/vendor/ace/snippets/python.js +0 -8
  188. package/src/app/ui/editor-client/public/vendor/ace/snippets/sql.js +0 -8
  189. package/src/app/ui/editor-client/public/vendor/ace/snippets/swift.js +0 -8
  190. package/src/app/ui/editor-client/public/vendor/ace/snippets/text.js +0 -8
  191. package/src/app/ui/editor-client/public/vendor/ace/snippets/xml.js +0 -8
  192. package/src/app/ui/editor-client/public/vendor/ace/snippets/yaml.js +0 -8
  193. package/src/app/ui/editor-client/public/vendor/ace/theme-chrome.js +0 -8
  194. package/src/app/ui/editor-client/public/vendor/ace/theme-tomorrow.js +0 -8
  195. package/src/app/ui/editor-client/public/vendor/ace/worker-css.js +0 -1
  196. package/src/app/ui/editor-client/public/vendor/ace/worker-html.js +0 -1
  197. package/src/app/ui/editor-client/public/vendor/ace/worker-javascript.js +0 -1
  198. package/src/app/ui/editor-client/public/vendor/ace/worker-json.js +0 -1
  199. package/src/app/ui/editor-client/public/vendor/ace/worker-jsonata.js +0 -2140
  200. package/src/app/ui/editor-client/public/vendor/ace/worker-xml.js +0 -1
  201. package/src/app/ui/editor-client/public/vendor/beautifyjs/beautify.min.js +0 -1
  202. package/src/app/ui/editor-client/public/vendor/bootstrap/css/bootstrap.min.css +0 -9
  203. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  204. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  205. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/active-line.js +0 -72
  206. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/coffeescript-lint.js +0 -47
  207. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-hint.js +0 -157
  208. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-lint.js +0 -63
  209. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/jshint.js +0 -29591
  210. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.css +0 -73
  211. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.js +0 -252
  212. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.css +0 -36
  213. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.js +0 -460
  214. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/sql-hint.js +0 -304
  215. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.css +0 -350
  216. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.js +0 -9800
  217. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/javascript.js +0 -927
  218. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/sql.js +0 -494
  219. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/base16-dark.css +0 -38
  220. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/monokai.css +0 -42
  221. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/solarized.css +0 -168
  222. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.css +0 -43
  223. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.js +0 -86
  224. package/src/app/ui/editor-client/public/vendor/easy-json-schema/index.js +0 -88
  225. package/src/app/ui/editor-client/public/vendor/electron-tabs/electron-tabs.js +0 -2907
  226. package/src/app/ui/editor-client/public/vendor/font-awesome/css/font-awesome.min.css +0 -4
  227. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  228. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  229. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
  230. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  231. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  232. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  233. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.eot +0 -0
  234. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.svg +0 -2105
  235. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.ttf +0 -0
  236. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff +0 -0
  237. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff2 +0 -0
  238. package/src/app/ui/editor-client/public/vendor/icofont/icofont.min.css +0 -7
  239. package/src/app/ui/editor-client/public/vendor/jqtree/tree.jquery.js +0 -119
  240. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  241. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  242. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  243. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  244. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  245. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  246. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  247. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  248. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  249. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  250. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  251. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  252. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  253. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  254. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +0 -5
  255. package/src/app/ui/editor-client/public/vendor/jsonata/jsonata.min.js +0 -190
  256. package/src/app/ui/editor-client/public/vendor/kumologica/http-test-case.js +0 -131
  257. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.css +0 -181
  258. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.js +0 -48
  259. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +0 -7
  260. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +0 -15
  261. package/src/app/ui/editor-client/public/vendor/vendor.css +0 -517
  262. package/src/app/ui/editor-client/public/vendor/vendor.js +0 -2769
  263. package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +0 -2
  264. package/src/app/ui/editor-client/src/ace/README.md +0 -50
  265. package/src/app/ui/editor-client/src/ace/mode/nrjavascript.js +0 -35
  266. package/src/app/ui/editor-client/src/ace/mode/nrjavascript_worker.js +0 -189
  267. package/src/app/ui/editor-client/src/favicon.ico +0 -0
  268. package/src/app/ui/editor-client/src/images/bolt.png +0 -0
  269. package/src/app/ui/editor-client/src/images/debugger/continue-full.png +0 -0
  270. package/src/app/ui/editor-client/src/images/debugger/continue-outline.png +0 -0
  271. package/src/app/ui/editor-client/src/images/debugger/pause.png +0 -0
  272. package/src/app/ui/editor-client/src/images/debugger/restart.png +0 -0
  273. package/src/app/ui/editor-client/src/images/debugger/stepover.png +0 -0
  274. package/src/app/ui/editor-client/src/images/debugger/stop.png +0 -0
  275. package/src/app/ui/editor-client/src/images/deploy-flows-o.png +0 -0
  276. package/src/app/ui/editor-client/src/images/deploy-flows.png +0 -0
  277. package/src/app/ui/editor-client/src/images/deploy-full-o.png +0 -0
  278. package/src/app/ui/editor-client/src/images/deploy-full.png +0 -0
  279. package/src/app/ui/editor-client/src/images/deploy-nodes-o.png +0 -0
  280. package/src/app/ui/editor-client/src/images/deploy-nodes.png +0 -0
  281. package/src/app/ui/editor-client/src/images/deploy-reload.png +0 -0
  282. package/src/app/ui/editor-client/src/images/grip.png +0 -0
  283. package/src/app/ui/editor-client/src/images/icons/arrow-in.png +0 -0
  284. package/src/app/ui/editor-client/src/images/icons/bolt.png +0 -0
  285. package/src/app/ui/editor-client/src/images/icons/node-changed.png +0 -0
  286. package/src/app/ui/editor-client/src/images/icons/node-error.png +0 -0
  287. package/src/app/ui/editor-client/src/images/icons/node-play.png +0 -0
  288. package/src/app/ui/editor-client/src/images/kumologica-app.png +0 -0
  289. package/src/app/ui/editor-client/src/images/node-red-256.png +0 -0
  290. package/src/app/ui/editor-client/src/images/node-red-icon-black.svg +0 -9
  291. package/src/app/ui/editor-client/src/images/node-red-icon.svg +0 -33
  292. package/src/app/ui/editor-client/src/images/node-red.png +0 -0
  293. package/src/app/ui/editor-client/src/images/pw_maze_white.png +0 -0
  294. package/src/app/ui/editor-client/src/images/spin.svg +0 -41
  295. package/src/app/ui/editor-client/src/images/spinner.gif +0 -0
  296. package/src/app/ui/editor-client/src/images/subflow_tab.png +0 -0
  297. package/src/app/ui/editor-client/src/images/test-icon.png +0 -0
  298. package/src/app/ui/editor-client/src/images/typedInput/09.png +0 -0
  299. package/src/app/ui/editor-client/src/images/typedInput/az.png +0 -0
  300. package/src/app/ui/editor-client/src/images/typedInput/bin.png +0 -0
  301. package/src/app/ui/editor-client/src/images/typedInput/bool.png +0 -0
  302. package/src/app/ui/editor-client/src/images/typedInput/env.png +0 -0
  303. package/src/app/ui/editor-client/src/images/typedInput/expr.png +0 -0
  304. package/src/app/ui/editor-client/src/images/typedInput/json.png +0 -0
  305. package/src/app/ui/editor-client/src/images/typedInput/re.png +0 -0
  306. package/src/app/ui/editor-client/src/js/comms.js +0 -174
  307. package/src/app/ui/editor-client/src/js/events.js +0 -39
  308. package/src/app/ui/editor-client/src/js/font-awesome.js +0 -818
  309. package/src/app/ui/editor-client/src/js/history.js +0 -337
  310. package/src/app/ui/editor-client/src/js/i18n.js +0 -81
  311. package/src/app/ui/editor-client/src/js/jquery-addons.js +0 -21
  312. package/src/app/ui/editor-client/src/js/keymap.json +0 -54
  313. package/src/app/ui/editor-client/src/js/main-modals.js +0 -14
  314. package/src/app/ui/editor-client/src/js/main.js +0 -10
  315. package/src/app/ui/editor-client/src/js/modals/modal-home.js +0 -162
  316. package/src/app/ui/editor-client/src/js/modals/modal-new-project.js +0 -86
  317. package/src/app/ui/editor-client/src/js/modals/modal-new-tab.js +0 -58
  318. package/src/app/ui/editor-client/src/js/modals/modal-node-library.js +0 -255
  319. package/src/app/ui/editor-client/src/js/modals/modal-welcome.js +0 -102
  320. package/src/app/ui/editor-client/src/js/nodes.js +0 -1762
  321. package/src/app/ui/editor-client/src/js/red.js +0 -707
  322. package/src/app/ui/editor-client/src/js/settings.js +0 -275
  323. package/src/app/ui/editor-client/src/js/text/bidi.js +0 -116
  324. package/src/app/ui/editor-client/src/js/text/format.js +0 -1316
  325. package/src/app/ui/editor-client/src/js/ui/actions.js +0 -39
  326. package/src/app/ui/editor-client/src/js/ui/clipboard.js +0 -510
  327. package/src/app/ui/editor-client/src/js/ui/common/checkboxSet.js +0 -117
  328. package/src/app/ui/editor-client/src/js/ui/common/editableList.js +0 -322
  329. package/src/app/ui/editor-client/src/js/ui/common/menu.js +0 -277
  330. package/src/app/ui/editor-client/src/js/ui/common/panels.js +0 -104
  331. package/src/app/ui/editor-client/src/js/ui/common/popover.js +0 -268
  332. package/src/app/ui/editor-client/src/js/ui/common/searchBox.js +0 -98
  333. package/src/app/ui/editor-client/src/js/ui/common/stack.js +0 -184
  334. package/src/app/ui/editor-client/src/js/ui/common/tabs.js +0 -805
  335. package/src/app/ui/editor-client/src/js/ui/common/treeList.js +0 -170
  336. package/src/app/ui/editor-client/src/js/ui/common/typedInput.js +0 -819
  337. package/src/app/ui/editor-client/src/js/ui/common/typedInputLong.js +0 -829
  338. package/src/app/ui/editor-client/src/js/ui/deploy.js +0 -422
  339. package/src/app/ui/editor-client/src/js/ui/diff.js +0 -2225
  340. package/src/app/ui/editor-client/src/js/ui/editor.js +0 -3021
  341. package/src/app/ui/editor-client/src/js/ui/editors/buffer.js +0 -195
  342. package/src/app/ui/editor-client/src/js/ui/editors/expression.js +0 -655
  343. package/src/app/ui/editor-client/src/js/ui/editors/js.js +0 -90
  344. package/src/app/ui/editor-client/src/js/ui/editors/json.js +0 -107
  345. package/src/app/ui/editor-client/src/js/ui/editors/markdown.js +0 -267
  346. package/src/app/ui/editor-client/src/js/ui/editors/string.js +0 -75
  347. package/src/app/ui/editor-client/src/js/ui/event-log.js +0 -107
  348. package/src/app/ui/editor-client/src/js/ui/header.js +0 -373
  349. package/src/app/ui/editor-client/src/js/ui/keyboard.js +0 -565
  350. package/src/app/ui/editor-client/src/js/ui/library.js +0 -570
  351. package/src/app/ui/editor-client/src/js/ui/logviewer.js +0 -137
  352. package/src/app/ui/editor-client/src/js/ui/notifications.js +0 -282
  353. package/src/app/ui/editor-client/src/js/ui/palette-editor.js +0 -1061
  354. package/src/app/ui/editor-client/src/js/ui/palette-navigator.js +0 -144
  355. package/src/app/ui/editor-client/src/js/ui/palette-nodes.js +0 -789
  356. package/src/app/ui/editor-client/src/js/ui/palette.js +0 -62
  357. package/src/app/ui/editor-client/src/js/ui/project-info.js +0 -234
  358. package/src/app/ui/editor-client/src/js/ui/projects/projectSettings.js +0 -1651
  359. package/src/app/ui/editor-client/src/js/ui/projects/projectUserSettings.js +0 -404
  360. package/src/app/ui/editor-client/src/js/ui/projects/projects.js +0 -2395
  361. package/src/app/ui/editor-client/src/js/ui/projects/tab-versionControl.js +0 -1383
  362. package/src/app/ui/editor-client/src/js/ui/search.js +0 -374
  363. package/src/app/ui/editor-client/src/js/ui/sidebar.js +0 -341
  364. package/src/app/ui/editor-client/src/js/ui/state.js +0 -14
  365. package/src/app/ui/editor-client/src/js/ui/subflow.js +0 -748
  366. package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +0 -1427
  367. package/src/app/ui/editor-client/src/js/ui/tab-azure.js +0 -852
  368. package/src/app/ui/editor-client/src/js/ui/tab-config.js +0 -452
  369. package/src/app/ui/editor-client/src/js/ui/tab-context.js +0 -406
  370. package/src/app/ui/editor-client/src/js/ui/tab-git.js +0 -320
  371. package/src/app/ui/editor-client/src/js/ui/tab-info.js +0 -661
  372. package/src/app/ui/editor-client/src/js/ui/tab-kumohub.js +0 -827
  373. package/src/app/ui/editor-client/src/js/ui/tab-nodeInfo.js +0 -60
  374. package/src/app/ui/editor-client/src/js/ui/tab-test.js +0 -987
  375. package/src/app/ui/editor-client/src/js/ui/terminal.js +0 -240
  376. package/src/app/ui/editor-client/src/js/ui/touch/radialMenu.js +0 -170
  377. package/src/app/ui/editor-client/src/js/ui/tray.js +0 -411
  378. package/src/app/ui/editor-client/src/js/ui/typeSearch.js +0 -411
  379. package/src/app/ui/editor-client/src/js/ui/ui-settings.js +0 -499
  380. package/src/app/ui/editor-client/src/js/ui/update-panel.js +0 -84
  381. package/src/app/ui/editor-client/src/js/ui/userSettings.js +0 -673
  382. package/src/app/ui/editor-client/src/js/ui/utils.js +0 -1287
  383. package/src/app/ui/editor-client/src/js/ui/view-navigator.js +0 -169
  384. package/src/app/ui/editor-client/src/js/ui/view-tools.js +0 -123
  385. package/src/app/ui/editor-client/src/js/ui/view.js +0 -5428
  386. package/src/app/ui/editor-client/src/js/ui/workspaces.js +0 -555
  387. package/src/app/ui/editor-client/src/js/user.js +0 -282
  388. package/src/app/ui/editor-client/src/js/validators.js +0 -54
  389. package/src/app/ui/editor-client/src/kumologica-app.png +0 -0
  390. package/src/app/ui/editor-client/src/sass/ace.scss +0 -29
  391. package/src/app/ui/editor-client/src/sass/bootstrap.scss +0 -21
  392. package/src/app/ui/editor-client/src/sass/colors.scss +0 -78
  393. package/src/app/ui/editor-client/src/sass/debug.scss +0 -383
  394. package/src/app/ui/editor-client/src/sass/diff.scss +0 -695
  395. package/src/app/ui/editor-client/src/sass/dragdrop.scss +0 -37
  396. package/src/app/ui/editor-client/src/sass/dropdownMenu.scss +0 -93
  397. package/src/app/ui/editor-client/src/sass/editor.scss +0 -691
  398. package/src/app/ui/editor-client/src/sass/flow.scss +0 -330
  399. package/src/app/ui/editor-client/src/sass/forms.scss +0 -1093
  400. package/src/app/ui/editor-client/src/sass/header.scss +0 -524
  401. package/src/app/ui/editor-client/src/sass/jquery.scss +0 -152
  402. package/src/app/ui/editor-client/src/sass/keyboard.scss +0 -136
  403. package/src/app/ui/editor-client/src/sass/library.scss +0 -54
  404. package/src/app/ui/editor-client/src/sass/mixins.scss +0 -283
  405. package/src/app/ui/editor-client/src/sass/modals/modalHome.scss +0 -138
  406. package/src/app/ui/editor-client/src/sass/modals/modalNewProject.scss +0 -96
  407. package/src/app/ui/editor-client/src/sass/modals/modalNewTab.scss +0 -96
  408. package/src/app/ui/editor-client/src/sass/modals/modalNodeLibrary.scss +0 -131
  409. package/src/app/ui/editor-client/src/sass/modals/modalWelcome.scss +0 -102
  410. package/src/app/ui/editor-client/src/sass/notifications.scss +0 -118
  411. package/src/app/ui/editor-client/src/sass/palette-editor.scss +0 -275
  412. package/src/app/ui/editor-client/src/sass/palette.scss +0 -383
  413. package/src/app/ui/editor-client/src/sass/panels.scss +0 -61
  414. package/src/app/ui/editor-client/src/sass/popover.scss +0 -166
  415. package/src/app/ui/editor-client/src/sass/project-info.scss +0 -74
  416. package/src/app/ui/editor-client/src/sass/projects.scss +0 -875
  417. package/src/app/ui/editor-client/src/sass/search.scss +0 -201
  418. package/src/app/ui/editor-client/src/sass/sidebar.scss +0 -201
  419. package/src/app/ui/editor-client/src/sass/style.scss +0 -172
  420. package/src/app/ui/editor-client/src/sass/tab-azure.scss +0 -68
  421. package/src/app/ui/editor-client/src/sass/tab-cloud.scss +0 -67
  422. package/src/app/ui/editor-client/src/sass/tab-config.scss +0 -100
  423. package/src/app/ui/editor-client/src/sass/tab-context.scss +0 -54
  424. package/src/app/ui/editor-client/src/sass/tab-git.scss +0 -54
  425. package/src/app/ui/editor-client/src/sass/tab-info.scss +0 -307
  426. package/src/app/ui/editor-client/src/sass/tab-kumohub.scss +0 -68
  427. package/src/app/ui/editor-client/src/sass/tab-test.scss +0 -262
  428. package/src/app/ui/editor-client/src/sass/tabs.scss +0 -420
  429. package/src/app/ui/editor-client/src/sass/terminal.scss +0 -247
  430. package/src/app/ui/editor-client/src/sass/ui/common/checkboxSet.scss +0 -29
  431. package/src/app/ui/editor-client/src/sass/ui/common/editableList.scss +0 -81
  432. package/src/app/ui/editor-client/src/sass/ui/common/nodeList.scss +0 -65
  433. package/src/app/ui/editor-client/src/sass/ui/common/searchBox.scss +0 -78
  434. package/src/app/ui/editor-client/src/sass/ui/common/stack.scss +0 -26
  435. package/src/app/ui/editor-client/src/sass/ui/common/treeList.scss +0 -108
  436. package/src/app/ui/editor-client/src/sass/ui/common/typedInput.scss +0 -181
  437. package/src/app/ui/editor-client/src/sass/ui/common/typedInputLong.scss +0 -183
  438. package/src/app/ui/editor-client/src/sass/ui-settings.scss +0 -125
  439. package/src/app/ui/editor-client/src/sass/update-panel.scss +0 -18
  440. package/src/app/ui/editor-client/src/sass/userSettings.scss +0 -93
  441. package/src/app/ui/editor-client/src/sass/widgetStyle.scss +0 -23
  442. package/src/app/ui/editor-client/src/sass/workspace.scss +0 -123
  443. package/src/app/ui/editor-client/src/sass/workspaceToolbar.scss +0 -85
  444. package/src/app/ui/editor-client/src/vendor/ace/LICENSE +0 -24
  445. package/src/app/ui/editor-client/src/vendor/ace/ace.js +0 -17
  446. package/src/app/ui/editor-client/src/vendor/ace/ext-language_tools.js +0 -8
  447. package/src/app/ui/editor-client/src/vendor/ace/ext-searchbox.js +0 -8
  448. package/src/app/ui/editor-client/src/vendor/ace/mode-css.js +0 -8
  449. package/src/app/ui/editor-client/src/vendor/ace/mode-handlebars.js +0 -8
  450. package/src/app/ui/editor-client/src/vendor/ace/mode-html.js +0 -8
  451. package/src/app/ui/editor-client/src/vendor/ace/mode-javascript.js +0 -8
  452. package/src/app/ui/editor-client/src/vendor/ace/mode-json.js +0 -8
  453. package/src/app/ui/editor-client/src/vendor/ace/mode-markdown.js +0 -8
  454. package/src/app/ui/editor-client/src/vendor/ace/mode-properties.js +0 -8
  455. package/src/app/ui/editor-client/src/vendor/ace/mode-python.js +0 -8
  456. package/src/app/ui/editor-client/src/vendor/ace/mode-sql.js +0 -8
  457. package/src/app/ui/editor-client/src/vendor/ace/mode-swift.js +0 -8
  458. package/src/app/ui/editor-client/src/vendor/ace/mode-text.js +0 -8
  459. package/src/app/ui/editor-client/src/vendor/ace/mode-xml.js +0 -8
  460. package/src/app/ui/editor-client/src/vendor/ace/mode-yaml.js +0 -8
  461. package/src/app/ui/editor-client/src/vendor/ace/snippets/css.js +0 -8
  462. package/src/app/ui/editor-client/src/vendor/ace/snippets/handlebars.js +0 -8
  463. package/src/app/ui/editor-client/src/vendor/ace/snippets/html.js +0 -8
  464. package/src/app/ui/editor-client/src/vendor/ace/snippets/javascript.js +0 -8
  465. package/src/app/ui/editor-client/src/vendor/ace/snippets/json.js +0 -8
  466. package/src/app/ui/editor-client/src/vendor/ace/snippets/markdown.js +0 -8
  467. package/src/app/ui/editor-client/src/vendor/ace/snippets/properties.js +0 -8
  468. package/src/app/ui/editor-client/src/vendor/ace/snippets/python.js +0 -8
  469. package/src/app/ui/editor-client/src/vendor/ace/snippets/sql.js +0 -8
  470. package/src/app/ui/editor-client/src/vendor/ace/snippets/swift.js +0 -8
  471. package/src/app/ui/editor-client/src/vendor/ace/snippets/text.js +0 -8
  472. package/src/app/ui/editor-client/src/vendor/ace/snippets/xml.js +0 -8
  473. package/src/app/ui/editor-client/src/vendor/ace/snippets/yaml.js +0 -8
  474. package/src/app/ui/editor-client/src/vendor/ace/theme-chrome.js +0 -8
  475. package/src/app/ui/editor-client/src/vendor/ace/theme-tomorrow.js +0 -8
  476. package/src/app/ui/editor-client/src/vendor/ace/worker-css.js +0 -1
  477. package/src/app/ui/editor-client/src/vendor/ace/worker-html.js +0 -1
  478. package/src/app/ui/editor-client/src/vendor/ace/worker-javascript.js +0 -1
  479. package/src/app/ui/editor-client/src/vendor/ace/worker-json.js +0 -1
  480. package/src/app/ui/editor-client/src/vendor/ace/worker-xml.js +0 -1
  481. package/src/app/ui/editor-client/src/vendor/beautifyjs/beautify.min.js +0 -1
  482. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.css +0 -5406
  483. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.min.css +0 -9
  484. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  485. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  486. package/src/app/ui/editor-client/src/vendor/bootstrap/js/bootstrap.min.js +0 -6
  487. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/active-line.js +0 -72
  488. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/coffeescript-lint.js +0 -47
  489. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-hint.js +0 -157
  490. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-lint.js +0 -63
  491. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/jshint.js +0 -29591
  492. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.css +0 -73
  493. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.js +0 -252
  494. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.css +0 -36
  495. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.js +0 -460
  496. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/sql-hint.js +0 -304
  497. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.css +0 -350
  498. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.js +0 -9800
  499. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/javascript.js +0 -927
  500. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/sql.js +0 -494
  501. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/base16-dark.css +0 -38
  502. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/monokai.css +0 -42
  503. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/solarized.css +0 -168
  504. package/src/app/ui/editor-client/src/vendor/d3/d3.v3.min.js +0 -4
  505. package/src/app/ui/editor-client/src/vendor/d3/d3.v4.min.js +0 -2
  506. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.css +0 -43
  507. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.js +0 -86
  508. package/src/app/ui/editor-client/src/vendor/easy-json-schema/index.js +0 -88
  509. package/src/app/ui/editor-client/src/vendor/electron-tabs/electron-tabs.js +0 -2907
  510. package/src/app/ui/editor-client/src/vendor/font-awesome/css/font-awesome.min.css +0 -4
  511. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  512. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  513. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
  514. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  515. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  516. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  517. package/src/app/ui/editor-client/src/vendor/i18next/i18next.min.js +0 -5
  518. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.eot +0 -0
  519. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.svg +0 -2105
  520. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.ttf +0 -0
  521. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff +0 -0
  522. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff2 +0 -0
  523. package/src/app/ui/editor-client/src/vendor/icofont/icofont.min.css +0 -7
  524. package/src/app/ui/editor-client/src/vendor/jqtree/jqTreeContextMenu.js +0 -98
  525. package/src/app/ui/editor-client/src/vendor/jqtree/jqtree.css +0 -209
  526. package/src/app/ui/editor-client/src/vendor/jqtree/tree.jquery.js +0 -21
  527. package/src/app/ui/editor-client/src/vendor/jqtree/tree.jquery.js.map +0 -1
  528. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  529. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  530. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  531. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  532. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  533. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  534. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  535. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  536. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  537. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  538. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  539. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  540. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  541. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  542. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +0 -5
  543. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js +0 -5
  544. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js +0 -7
  545. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js +0 -11
  546. package/src/app/ui/editor-client/src/vendor/jquery-contextMenu/jquery-contextMenu.css +0 -309
  547. package/src/app/ui/editor-client/src/vendor/jquery-contextMenu/jquery-contextMenu.js +0 -2134
  548. package/src/app/ui/editor-client/src/vendor/jquery-contextMenu/jquery-ui-position.js +0 -513
  549. package/src/app/ui/editor-client/src/vendor/jsonata/formatter.js +0 -190
  550. package/src/app/ui/editor-client/src/vendor/jsonata/mode-jsonata.js +0 -134
  551. package/src/app/ui/editor-client/src/vendor/jsonata/snippets-jsonata.js +0 -11
  552. package/src/app/ui/editor-client/src/vendor/jsonata/worker-jsonata.js +0 -2140
  553. package/src/app/ui/editor-client/src/vendor/kumologica/http-test-case.js +0 -131
  554. package/src/app/ui/editor-client/src/vendor/marked/marked.min.js +0 -6
  555. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.css +0 -181
  556. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.js +0 -48
  557. package/src/app/ui/editor-client/templates/index.mst +0 -284
  558. package/src/app/ui/editor-client/templates/modals/modalHome.mst +0 -107
  559. package/src/app/ui/editor-client/templates/modals/modalNewProject.mst +0 -104
  560. package/src/app/ui/editor-client/templates/modals/modalNewTab.mst +0 -78
  561. package/src/app/ui/editor-client/templates/modals/modalNodeLibrary.mst +0 -72
  562. package/src/app/ui/editor-client/templates/modals/modalWelcome.mst +0 -111
  563. package/src/app/util.js +0 -9
  564. package/src/assets/eula.txt +0 -170
  565. package/src/assets/icon.icns +0 -0
  566. package/src/assets/kumologica-app.png +0 -0
  567. package/src/assets/license_en.txt +0 -170
  568. /package/{cli/commands/test-utils → src/api/tools/test/lib}/fixtures/example3-flow.json +0 -0
  569. /package/{cli/commands/test-utils → src/api/tools/test/lib}/fixtures/package.json +0 -0
  570. /package/{cli/commands/test-utils → src/api/tools/test/lib}/fixtures/s3-event.js +0 -0
@@ -1,3021 +0,0 @@
1
- /**
2
- * @namespace RED.editor
3
- */
4
- RED.editor = (function () {
5
- var editStack = [];
6
- let nodeInfoEditor = null;
7
-
8
- let latestNodeSelected = null; // Keep track of latest node selected, so the sidebar can adjust the horizontal position, so it is visible after sidebar is shown.
9
-
10
- var customEditTypes = {};
11
-
12
- var editTrayWidthCache = {};
13
-
14
- function getCredentialsURL(nodeType, nodeID) {
15
- var dashedType = nodeType.replace(/\s+/g, '-');
16
- return 'credentials/' + dashedType + '/' + nodeID;
17
- }
18
-
19
-
20
- function getLatestNodeSelected() {
21
- return latestNodeSelected;
22
- }
23
-
24
- function setLatestNodeSelected(newLatestNodeSelected){
25
- // console.log('[editor] setLatestNodeSelected=', newLatestNodeSelected);
26
- latestNodeSelected = newLatestNodeSelected;
27
- }
28
-
29
- /**
30
- * Validate a node
31
- * @param node - the node being validated
32
- * @returns {boolean} whether the node is valid. Sets node.dirty if needed
33
- */
34
- function validateNode(node) {
35
- var oldValue = node.valid;
36
- var oldChanged = node.changed;
37
- node.valid = true;
38
- var subflow;
39
- var isValid;
40
- var hasChanged;
41
- if (node.type.indexOf('subflow:') === 0) {
42
- subflow = RED.nodes.subflow(node.type.substring(8));
43
- isValid = subflow.valid;
44
- hasChanged = subflow.changed;
45
- if (isValid === undefined) {
46
- isValid = validateNode(subflow);
47
- hasChanged = subflow.changed;
48
- }
49
- node.valid =
50
- isValid && validateNodeProperties(node, node._def.defaults, node);
51
- node.changed = node.changed || hasChanged;
52
- } else if (node._def) {
53
- node.valid = validateNodeProperties(node, node._def.defaults, node);
54
- // console.log(`[editor] Node ${node.name}. Valid: ${node.valid}`);
55
- if (node._def._creds) {
56
- node.valid =
57
- node.valid &&
58
- validateNodeProperties(node, node._def.credentials, node._def._creds);
59
- }
60
- } else if (node.type == 'subflow') {
61
- var subflowNodes = RED.nodes.filterNodes({ z: node.id });
62
- for (var i = 0; i < subflowNodes.length; i++) {
63
- isValid = subflowNodes[i].valid;
64
- hasChanged = subflowNodes[i].changed;
65
- if (isValid === undefined) {
66
- isValid = validateNode(subflowNodes[i]);
67
- hasChanged = subflowNodes[i].changed;
68
- }
69
- node.valid = node.valid && isValid;
70
- node.changed = node.changed || hasChanged;
71
- }
72
- var subflowInstances = RED.nodes.filterNodes({
73
- type: 'subflow:' + node.id,
74
- });
75
- var modifiedTabs = {};
76
- for (i = 0; i < subflowInstances.length; i++) {
77
- subflowInstances[i].valid = node.valid;
78
- subflowInstances[i].changed =
79
- subflowInstances[i].changed || node.changed;
80
- subflowInstances[i].dirty = true;
81
- modifiedTabs[subflowInstances[i].z] = true;
82
- }
83
- Object.keys(modifiedTabs).forEach(function (id) {
84
- var subflow = RED.nodes.subflow(id);
85
- if (subflow) {
86
- validateNode(subflow);
87
- }
88
- });
89
- }
90
- if (oldValue !== node.valid || oldChanged !== node.changed) {
91
- node.dirty = true;
92
- subflow = RED.nodes.subflow(node.z);
93
- if (subflow) {
94
- validateNode(subflow);
95
- }
96
- }
97
- // console.log('[editor] node valid?', node.valid)
98
- return node.valid;
99
- }
100
-
101
- /**
102
- * Validate a node's properties for the given set of property definitions
103
- * @param node - the node being validated
104
- * @param definition - the node property definitions (either def.defaults or def.creds)
105
- * @param properties - the node property values to validate
106
- * @returns {boolean} whether the node's properties are valid
107
- */
108
- function validateNodeProperties(node, definition, properties) {
109
- var isValid = true;
110
- for (var prop in definition) {
111
- if (definition.hasOwnProperty(prop)) {
112
- if (!validateNodeProperty(node, definition, prop, properties[prop])) {
113
- isValid = false;
114
- }
115
- }
116
- }
117
- // console.log(`[editor] Validating properties for node: ${node.name}. Valid? ${isValid}`)
118
- return isValid;
119
- }
120
-
121
- /**
122
- * Validate a individual node property
123
- * @param node - the node being validated
124
- * @param definition - the node property definitions (either def.defaults or def.creds)
125
- * @param property - the property name being validated
126
- * @param value - the property value being validated
127
- * @returns {boolean} whether the node proprty is valid
128
- */
129
- function validateNodeProperty(node, definition, property, value) {
130
- var valid = true;
131
- if (/^\$\([a-zA-Z_][a-zA-Z0-9_]*\)$/.test(value)) {
132
- return true;
133
- }
134
- if (/^\$\{[a-zA-Z_][a-zA-Z0-9_]*\}$/.test(value)) {
135
- return true;
136
- }
137
- if ('required' in definition[property] && definition[property].required) {
138
- valid = value !== '';
139
- }
140
- if (valid && 'validate' in definition[property]) {
141
- try {
142
- valid = definition[property].validate.call(node, value);
143
- } catch (err) {
144
- console.log(
145
- 'Validation error:',
146
- node.type,
147
- node.id,
148
- 'property: ' + property,
149
- 'value:',
150
- value,
151
- err
152
- );
153
- }
154
- }
155
- if (
156
- valid &&
157
- definition[property].type &&
158
- RED.nodes.getType(definition[property].type) &&
159
- !('validate' in definition[property])
160
- ) {
161
- if (!value || value == '_ADD_') {
162
- valid =
163
- definition[property].hasOwnProperty('required') &&
164
- !definition[property].required;
165
- } else {
166
- var configNode = RED.nodes.node(value);
167
- valid =
168
- configNode !== null && (configNode.valid == null || configNode.valid);
169
- }
170
- }
171
- return valid;
172
- }
173
-
174
- function validateNodeEditor(node, prefix) {
175
- for (var prop in node._def.defaults) {
176
- if (node._def.defaults.hasOwnProperty(prop)) {
177
- validateNodeEditorProperty(node, node._def.defaults, prop, prefix);
178
- }
179
- }
180
- if (node._def.credentials) {
181
- for (prop in node._def.credentials) {
182
- if (node._def.credentials.hasOwnProperty(prop)) {
183
- validateNodeEditorProperty(node, node._def.credentials, prop, prefix);
184
- }
185
- }
186
- }
187
- }
188
-
189
- function validateNodeEditorProperty(node, defaults, property, prefix) {
190
- var input = $('#' + prefix + '-' + property);
191
- if (input.length > 0) {
192
- var value = input.val();
193
- if (
194
- defaults[property].hasOwnProperty('format') &&
195
- defaults[property].format !== '' &&
196
- input[0].nodeName === 'DIV'
197
- ) {
198
- value = input.text();
199
- }
200
- if (!validateNodeProperty(node, defaults, property, value)) {
201
- input.addClass('input-error');
202
- } else {
203
- input.removeClass('input-error');
204
- }
205
- }
206
- }
207
-
208
- /**
209
- * Called when the node's properties have changed.
210
- * Marks the node as dirty and needing a size check.
211
- * Removes any links to non-existant outputs.
212
- * @param node - the node that has been updated
213
- * @param outputMap - (optional) a map of old->new port numbers if wires should be moved
214
- * @returns {array} the links that were removed due to this update
215
- */
216
- function updateNodeProperties(node, outputMap) {
217
- node.resize = true;
218
- node.dirty = true;
219
- var removedLinks = [];
220
- if (node.ports) {
221
- if (outputMap) {
222
- RED.nodes.eachLink(function (l) {
223
- if (l.source === node && outputMap.hasOwnProperty(l.sourcePort)) {
224
- if (outputMap[l.sourcePort] === '-1') {
225
- removedLinks.push(l);
226
- } else {
227
- l.sourcePort = outputMap[l.sourcePort];
228
- }
229
- }
230
- });
231
- }
232
- if (node.outputs < node.ports.length) {
233
- while (node.outputs < node.ports.length) {
234
- node.ports.pop();
235
- }
236
- RED.nodes.eachLink(function (l) {
237
- if (
238
- l.source === node &&
239
- l.sourcePort >= node.outputs &&
240
- removedLinks.indexOf(l) === -1
241
- ) {
242
- removedLinks.push(l);
243
- }
244
- });
245
- } else if (node.outputs > node.ports.length) {
246
- while (node.outputs > node.ports.length) {
247
- node.ports.push(node.ports.length);
248
- }
249
- }
250
- }
251
- if (node.inputs === 0) {
252
- removedLinks.concat(RED.nodes.filterLinks({ target: node }));
253
- }
254
- for (var l = 0; l < removedLinks.length; l++) {
255
- RED.nodes.removeLink(removedLinks[l]);
256
- }
257
- return removedLinks;
258
- }
259
-
260
- /**
261
- * Create a config-node select box for this property
262
- * @param node - the node being edited
263
- * @param property - the name of the field
264
- * @param type - the type of the config-node
265
- */
266
- function prepareConfigNodeSelect(node, property, type, prefix) {
267
- var input = $('#' + prefix + '-' + property);
268
- if (input.length === 0) {
269
- return;
270
- }
271
- var newWidth = input.width();
272
- var attrStyle = input.attr('style');
273
- var m;
274
- if ((m = /width\s*:\s*(\d+(%|[a-z]+))/i.exec(attrStyle)) !== null) {
275
- newWidth = m[1];
276
- } else {
277
- newWidth = '70%';
278
- }
279
- var outerWrap = $('<div></div>').css({
280
- display: 'inline-block',
281
- position: 'relative',
282
- });
283
- var selectWrap = $('<div></div>')
284
- .css({ position: 'absolute', left: 0, right: '40px' })
285
- .appendTo(outerWrap);
286
- var select = $(
287
- '<select id="' + prefix + '-' + property + '"></select>'
288
- ).appendTo(selectWrap);
289
-
290
- outerWrap.width(newWidth).height(input.height());
291
- if (outerWrap.width() === 0) {
292
- outerWrap.width('70%');
293
- }
294
- input.replaceWith(outerWrap);
295
- // set the style attr directly - using width() on FF causes a value of 114%...
296
- select.attr('style', 'width:100%');
297
- updateConfigNodeSelect(property, type, node[property], prefix);
298
- $(
299
- '<a id="' +
300
- prefix +
301
- '-lookup-' +
302
- property +
303
- '" class="editor-button"><i class="fa fa-pencil"></i></a>'
304
- )
305
- .css({ position: 'absolute', right: 0, top: 0 })
306
- .appendTo(outerWrap);
307
- $('#' + prefix + '-lookup-' + property).click(function (e) {
308
- showEditConfigNodeDialog(
309
- property,
310
- type,
311
- select.find(':selected').val(),
312
- prefix
313
- );
314
- e.preventDefault();
315
- });
316
- var label = '';
317
- var configNode = RED.nodes.node(node[property]);
318
- var node_def = RED.nodes.getType(type);
319
-
320
- if (configNode) {
321
- label = RED.utils.getNodeLabel(configNode, configNode.id);
322
- }
323
- input.val(label);
324
- }
325
-
326
- /**
327
- * Create a config-node button for this property
328
- * @param node - the node being edited
329
- * @param property - the name of the field
330
- * @param type - the type of the config-node
331
- */
332
- function prepareConfigNodeButton(node, property, type, prefix) {
333
- var input = $('#' + prefix + '-' + property);
334
- input.val(node[property]);
335
- input.attr('type', 'hidden');
336
-
337
- var button = $('<a>', {
338
- id: prefix + '-edit-' + property,
339
- class: 'editor-button',
340
- });
341
- input.after(button);
342
-
343
- if (node[property]) {
344
- button.text('Edit');
345
- } else {
346
- button.text('Add');
347
- }
348
-
349
- button.click(function (e) {
350
- showEditConfigNodeDialog(property, type, input.val() || '_ADD_', prefix);
351
- e.preventDefault();
352
- });
353
- }
354
-
355
- /**
356
- * Populate the editor dialog input field for this property
357
- * @param node - the node being edited
358
- * @param property - the name of the field
359
- * @param prefix - the prefix to use in the input element ids (node-input|node-config-input)
360
- * @param definition - the definition of the field
361
- */
362
- function preparePropertyEditor(node, property, prefix, definition) {
363
- var input = $('#' + prefix + '-' + property);
364
- if (input.length === 0) {
365
- return;
366
- }
367
- if (input.attr('type') === 'checkbox') {
368
- input.prop('checked', node[property]);
369
- } else {
370
- var val = node[property];
371
- if (val == null) {
372
- val = '';
373
- }
374
- if (
375
- definition !== undefined &&
376
- definition[property].hasOwnProperty('format') &&
377
- definition[property].format !== '' &&
378
- input[0].nodeName === 'DIV'
379
- ) {
380
- input.html(
381
- RED.text.format.getHtml(
382
- val,
383
- definition[property].format,
384
- {},
385
- false,
386
- 'en'
387
- )
388
- );
389
- RED.text.format.attach(
390
- input[0],
391
- definition[property].format,
392
- {},
393
- false,
394
- 'en'
395
- );
396
- } else {
397
- input.val(val);
398
- if (input[0].nodeName === 'INPUT' || input[0].nodeName === 'TEXTAREA') {
399
- RED.text.bidi.prepareInput(input);
400
- }
401
- }
402
- }
403
- }
404
-
405
- /**
406
- * Add an on-change handler to revalidate a node field
407
- * @param node - the node being edited
408
- * @param definition - the definition of the node
409
- * @param property - the name of the field
410
- * @param prefix - the prefix to use in the input element ids (node-input|node-config-input)
411
- */
412
- function attachPropertyChangeHandler(node, definition, property, prefix) {
413
- var input = $('#' + prefix + '-' + property);
414
-
415
- // Make visual mark that field supports template
416
- if (
417
- definition[property].hasOwnProperty('templateable') &&
418
- definition[property].templateable
419
- ) {
420
- input.addClass('templateable');
421
-
422
- // Add the icon of dynamic expression
423
-
424
- //input
425
- //.parent()
426
- // .append(
427
- // '<span style="display:none;float:right;position:relative;top:-23px;right:5px;color:#9c27b0;font-size:14px" class="fa fa-bolt icon-templatable"></span>'
428
- // );
429
-
430
- RED.popover.tooltip(
431
- input.parent().find($('span.icon-templatable')),
432
- 'Dynamic Expression Enabled'
433
- );
434
-
435
- input.focusin(() => {
436
- input.parent().find($('span.icon-templatable')).show();
437
- });
438
-
439
- input.focusout(() => {
440
- input.parent().find($('span.icon-templatable')).hide();
441
- });
442
-
443
- // $('<span class="fa fa-book"></span>').after(input);
444
- }
445
-
446
- if (
447
- definition !== undefined &&
448
- 'format' in definition[property] &&
449
- definition[property].format !== '' &&
450
- input[0].nodeName === 'DIV'
451
- ) {
452
- $('#' + prefix + '-' + property).on('change keyup', function (
453
- event,
454
- skipValidation
455
- ) {
456
- if (!skipValidation) {
457
- validateNodeEditor(node, prefix);
458
- }
459
- });
460
- } else {
461
- $('#' + prefix + '-' + property).change(function (event, skipValidation) {
462
- if (!skipValidation) {
463
- validateNodeEditor(node, prefix);
464
- }
465
- });
466
- }
467
- }
468
-
469
- /**
470
- * Assign the value to each credential field
471
- * @param node
472
- * @param credDef
473
- * @param credData
474
- * @param prefix
475
- */
476
- function populateCredentialsInputs(node, credDef, credData, prefix) {
477
- var cred;
478
- for (cred in credDef) {
479
- if (credDef.hasOwnProperty(cred)) {
480
- if (credDef[cred].type == 'password') {
481
- if (credData[cred]) {
482
- $('#' + prefix + '-' + cred).val(credData[cred]);
483
- } else if (credData['has_' + cred]) {
484
- $('#' + prefix + '-' + cred).val('__PWRD__');
485
- } else {
486
- $('#' + prefix + '-' + cred).val('');
487
- }
488
- } else {
489
- preparePropertyEditor(credData, cred, prefix, credDef);
490
- }
491
- attachPropertyChangeHandler(node, credDef, cred, prefix);
492
- }
493
- }
494
- }
495
-
496
- /**
497
- * Update the node credentials from the edit form
498
- * @param node - the node containing the credentials
499
- * @param credDefinition - definition of the credentials
500
- * @param prefix - prefix of the input fields
501
- * @return {boolean} whether anything has changed
502
- */
503
- function updateNodeCredentials(node, credDefinition, prefix) {
504
- var changed = false;
505
- if (!node.credentials) {
506
- node.credentials = { _: {} };
507
- }
508
-
509
- for (var cred in credDefinition) {
510
- if (credDefinition.hasOwnProperty(cred)) {
511
- var input = $('#' + prefix + '-' + cred);
512
- var value = input.val();
513
- if (credDefinition[cred].type == 'password') {
514
- node.credentials['has_' + cred] = value !== '';
515
- if (value == '__PWRD__') {
516
- continue;
517
- }
518
- changed = true;
519
- }
520
- node.credentials[cred] = value;
521
- if (value != node.credentials._[cred]) {
522
- changed = true;
523
- }
524
- }
525
- }
526
- return changed;
527
- }
528
-
529
- /**
530
- * Prepare all of the editor dialog fields
531
- * @param node - the node being edited
532
- * @param definition - the node definition
533
- * @param prefix - the prefix to use in the input element ids (node-input|node-config-input)
534
- */
535
- function prepareEditDialog(node, definition, prefix, done) {
536
- for (var d in definition.defaults) {
537
- if (definition.defaults.hasOwnProperty(d)) {
538
- if (definition.defaults[d].type) {
539
- var configTypeDef = RED.nodes.getType(definition.defaults[d].type);
540
- if (configTypeDef) {
541
- if (configTypeDef.exclusive) {
542
- prepareConfigNodeButton(
543
- node,
544
- d,
545
- definition.defaults[d].type,
546
- prefix
547
- );
548
- } else {
549
- prepareConfigNodeSelect(
550
- node,
551
- d,
552
- definition.defaults[d].type,
553
- prefix
554
- );
555
- }
556
- } else {
557
- console.log('Unknown type:', definition.defaults[d].type);
558
- preparePropertyEditor(node, d, prefix, definition.defaults);
559
- }
560
- } else {
561
- preparePropertyEditor(node, d, prefix, definition.defaults);
562
- }
563
- attachPropertyChangeHandler(node, definition.defaults, d, prefix);
564
- }
565
- }
566
- var completePrepare = function () {
567
- if (definition.oneditprepare) {
568
- try {
569
- definition.oneditprepare.call(node);
570
- } catch (err) {
571
- console.log('oneditprepare', node.id, node.type, err.toString());
572
- }
573
- }
574
- // Now invoke any change handlers added to the fields - passing true
575
- // to prevent full node validation from being triggered each time
576
- for (var d in definition.defaults) {
577
- if (definition.defaults.hasOwnProperty(d)) {
578
- $('#' + prefix + '-' + d).trigger('change', [true]);
579
- }
580
- }
581
- if (definition.credentials) {
582
- for (d in definition.credentials) {
583
- if (definition.credentials.hasOwnProperty(d)) {
584
- $('#' + prefix + '-' + d).trigger('change', [true]);
585
- }
586
- }
587
- }
588
- validateNodeEditor(node, prefix);
589
- if (done) {
590
- done();
591
- }
592
- };
593
-
594
- if (definition.credentials) {
595
- if (node.credentials) {
596
- populateCredentialsInputs(
597
- node,
598
- definition.credentials,
599
- node.credentials,
600
- prefix
601
- );
602
- completePrepare();
603
- } else {
604
- $.getJSON(getCredentialsURL(node.type, node.id), function (data) {
605
- node.credentials = data;
606
- node.credentials._ = $.extend(true, {}, data);
607
- populateCredentialsInputs(
608
- node,
609
- definition.credentials,
610
- node.credentials,
611
- prefix
612
- );
613
- completePrepare();
614
- });
615
- }
616
- } else {
617
- completePrepare();
618
- }
619
- }
620
-
621
- function getNodeIconPath() {
622
- var nodeIconPath;
623
- for (var i = editStack.length - 1; i < editStack.length; i++) {
624
- var node = editStack[i];
625
- var iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
626
- defaultIcon = iconPath.module + '/' + iconPath.file;
627
- if (iconPath.module === 'kumologica-core') {
628
- nodeIconPath = `icons/${iconPath.module}/${iconPath.file}`;
629
- }
630
- }
631
- return nodeIconPath;
632
- }
633
-
634
- function getEditStackTitle() {
635
- var label;
636
- for (var i = editStack.length - 1; i < editStack.length; i++) {
637
- var node = editStack[i];
638
- label = node.type;
639
- // Commented out as not sure why so much control over here.
640
- // anyway, we only need to use the node title as label for the properties window
641
-
642
- // if (node.type === '_expression') {
643
- // label = RED._('expressionEditor.title');
644
- // } else if (node.type === '_js') {
645
- // label = RED._('jsEditor.title');
646
- // } else if (node.type === '_json') {
647
- // label = RED._('jsonEditor.title');
648
- // } else if (node.type === '_markdown') {
649
- // label = RED._('markdownEditor.title');
650
- // } else if (node.type === '_buffer') {
651
- // label = RED._('bufferEditor.title');
652
- // } else if (node.type === 'subflow') {
653
- // label = RED._('subflow.editSubflow', {
654
- // name: RED.utils.sanitize(node.name)
655
- // });
656
- // } else if (node.type.indexOf('subflow:') === 0) {
657
- // var subflow = RED.nodes.subflow(node.type.substring(8));
658
- // label = RED._('subflow.editSubflowInstance', {
659
- // name: RED.utils.sanitize(subflow.name)
660
- // });
661
- // } else if (node._def !== undefined) {
662
- // if (typeof node._def.paletteLabel !== 'undefined') {
663
- // try {
664
- // label = RED.utils.sanitize(
665
- // (typeof node._def.paletteLabel === 'function'
666
- // ? node._def.paletteLabel.call(node._def)
667
- // : node._def.paletteLabel) || ''
668
- // );
669
- // } catch (err) {
670
- // console.log(
671
- // 'Definition error: ' + node.type + '.paletteLabel',
672
- // err
673
- // );
674
- // }
675
- // }
676
- // if (i === editStack.length - 1) {
677
- // if (RED.nodes.node(node.id)) {
678
- // label = RED._('editor.editNode', {
679
- // type: RED.utils.sanitize(label)
680
- // });
681
- // } else {
682
- // label = RED._('editor.addNewConfig', {
683
- // type: RED.utils.sanitize(label)
684
- // });
685
- // }
686
- // }
687
- // }
688
- }
689
- //console.log('editor.js - getEditStackTitle is label AFTER=', label);
690
- return label;
691
- }
692
-
693
- function buildEnvForm(container, node) {
694
- var env_container = $('#node-input-env-container');
695
- env_container
696
- .css({
697
- 'min-height': '150px',
698
- 'min-width': '450px',
699
- })
700
- .editableList({
701
- addItem: function (container, i, opt) {
702
- var row = $('<div/>').appendTo(container);
703
- if (opt.parent) {
704
- $('<div/>', {
705
- class: 'uneditable-input',
706
- style: 'margin-left: 5px; width: calc(40% - 8px)',
707
- })
708
- .appendTo(row)
709
- .text(opt.name);
710
- } else {
711
- $('<input/>', {
712
- class: 'node-input-env-name',
713
- type: 'text',
714
- style: 'margin-left: 5px; width: calc(40% - 8px)',
715
- placeholder: 'Name',
716
- })
717
- .appendTo(row)
718
- .val(opt.name);
719
- }
720
- var valueField = $('<input/>', {
721
- class: 'node-input-env-value',
722
- type: 'text',
723
- style: 'margin-left: 5px; width: calc(60% - 8px)',
724
- }).appendTo(row);
725
-
726
- valueField.typedInput({
727
- default: 'str',
728
- types: ['str', 'num', 'bool', 'json', 'bin', 'env'],
729
- });
730
-
731
- valueField.typedInput(
732
- 'type',
733
- opt.parent ? opt.type || opt.parent.type : opt.type
734
- );
735
- valueField.typedInput(
736
- 'value',
737
- opt.parent
738
- ? opt.value !== undefined
739
- ? opt.value
740
- : opt.parent.value
741
- : opt.value
742
- );
743
-
744
- var actionButton = $('<a/>', {
745
- href: '#',
746
- class:
747
- 'red-ui-editableList-item-remove editor-button editor-button-small',
748
- }).appendTo(container);
749
- $('<i/>', {
750
- class: 'fa ' + (opt.parent ? 'fa-reply' : 'fa-remove'),
751
- }).appendTo(actionButton);
752
- container.parent().addClass('red-ui-editableList-item-removable');
753
- if (opt.parent) {
754
- if (
755
- opt.value !== undefined &&
756
- (opt.value !== opt.parent.value || opt.type !== opt.parent.type)
757
- ) {
758
- actionButton.show();
759
- } else {
760
- actionButton.hide();
761
- }
762
- var restoreTip = RED.popover.tooltip(
763
- actionButton, 'Restore to subflow default');
764
-
765
- valueField.change(function (evt) {
766
- var newType = valueField.typedInput('type');
767
- var newValue = valueField.typedInput('value');
768
- if (
769
- newType === opt.parent.type &&
770
- newValue === opt.parent.value
771
- ) {
772
- actionButton.hide();
773
- } else {
774
- actionButton.show();
775
- }
776
- });
777
- actionButton.click(function (evt) {
778
- evt.preventDefault();
779
- restoreTip.close();
780
- valueField.typedInput('type', opt.parent.type);
781
- valueField.typedInput('value', opt.parent.value);
782
- });
783
- } else {
784
- var removeTip = RED.popover.tooltip(
785
- actionButton,
786
- "Remove environment variable"
787
- );
788
- actionButton.click(function (evt) {
789
- evt.preventDefault();
790
- removeTip.close();
791
- container.parent().addClass('red-ui-editableList-item-deleting');
792
- container.fadeOut(300, function () {
793
- env_container.editableList('removeItem', opt);
794
- });
795
- });
796
- }
797
- },
798
- sortable: false,
799
- removable: false,
800
- });
801
- var parentEnv = {};
802
- var envList = [];
803
- if (/^subflow:/.test(node.type)) {
804
- var subflowDef = RED.nodes.subflow(node.type.substring(8));
805
- if (subflowDef.env) {
806
- subflowDef.env.forEach(function (env) {
807
- var item = {
808
- name: env.name,
809
- parent: {
810
- type: env.type,
811
- value: env.value,
812
- },
813
- };
814
- envList.push(item);
815
- parentEnv[env.name] = item;
816
- });
817
- }
818
- }
819
-
820
- if (node.env) {
821
- for (var i = 0; i < node.env.length; i++) {
822
- var env = node.env[i];
823
- if (parentEnv.hasOwnProperty(env.name)) {
824
- parentEnv[env.name].type = env.type;
825
- parentEnv[env.name].value = env.value;
826
- } else {
827
- envList.push({
828
- name: env.name,
829
- type: env.type,
830
- value: env.value,
831
- });
832
- }
833
- }
834
- }
835
- envList.forEach(function (env) {
836
- env_container.editableList('addItem', env);
837
- });
838
- }
839
-
840
- function exportEnvList(list) {
841
- if (list) {
842
- var env = [];
843
- list.each(function (i) {
844
- var entry = $(this);
845
- var item = entry.data('data');
846
- var name = (item.parent
847
- ? item.name
848
- : entry.find('.node-input-env-name').val()
849
- ).trim();
850
- if (name !== '') {
851
- var valueInput = entry.find('.node-input-env-value');
852
- var value = valueInput.typedInput('value');
853
- var type = valueInput.typedInput('type');
854
- if (
855
- !item.parent ||
856
- item.parent.value !== value ||
857
- item.parent.type !== type
858
- ) {
859
- var item = {
860
- name: name,
861
- type: type,
862
- value: value,
863
- };
864
- env.push(item);
865
- }
866
- }
867
- });
868
- return env;
869
- }
870
- return null;
871
- }
872
-
873
- function isSameEnv(env0, env1) {
874
- return JSON.stringify(env0) === JSON.stringify(env1);
875
- }
876
-
877
- function buildEditForm(container, formId, type, ns, node) {
878
- var dialogForm = $(
879
- '<form id="' +
880
- formId +
881
- '" class="form-horizontal" autocomplete="off"></form>'
882
- ).appendTo(container);
883
- dialogForm.html($("script[data-template-name='" + type + "']").html());
884
- ns = ns || 'kumologica-core';
885
- dialogForm.find('[data-i18n]').each(function () {
886
- var current = $(this).attr('data-i18n');
887
- var keys = current.split(';');
888
- for (var i = 0; i < keys.length; i++) {
889
- var key = keys[i];
890
- if (key.indexOf(':') === -1) {
891
- var prefix = '';
892
- if (key.indexOf('[') === 0) {
893
- var parts = key.split(']');
894
- prefix = parts[0] + ']';
895
- key = parts[1];
896
- }
897
- keys[i] = prefix + ns + ':' + key;
898
- }
899
- }
900
- $(this).attr('data-i18n', keys.join(';'));
901
- });
902
-
903
- if (type === 'subflow' || type === 'subflow-template') {
904
- buildEnvForm(dialogForm, node);
905
- }
906
-
907
- // Add dummy fields to prevent 'Enter' submitting the form in some
908
- // cases, and also prevent browser auto-fill of password
909
- // Add in reverse order as they are prepended...
910
- $('<input type="password" style="display: none;" />').prependTo(dialogForm);
911
- $('<input type="text" style="display: none;" />').prependTo(dialogForm);
912
- dialogForm.submit(function (e) {
913
- e.preventDefault();
914
- });
915
- return dialogForm;
916
- }
917
-
918
- function refreshLabelForm(container, node) {
919
- var inputPlaceholder = node._def.inputLabels
920
- ? 'use default label'
921
- : 'none';
922
- var outputPlaceholder = node._def.outputLabels
923
- ? 'use default label'
924
- : 'none';
925
-
926
- var inputsDiv = $('#node-label-form-inputs');
927
- var outputsDiv = $('#node-label-form-outputs');
928
-
929
- var inputCount;
930
- if (node.type === 'subflow') {
931
- inputCount = node.in.length;
932
- } else {
933
- inputCount = node.inputs || node._def.inputs || 0;
934
- }
935
-
936
- var children = inputsDiv.children();
937
- var childCount = children.length;
938
- if (childCount === 1 && $(children[0]).hasClass('node-label-form-none')) {
939
- childCount--;
940
- }
941
-
942
- if (childCount < inputCount) {
943
- if (childCount === 0) {
944
- // remove the 'none' placeholder
945
- $(children[0]).remove();
946
- }
947
- for (i = childCount; i < inputCount; i++) {
948
- buildLabelRow('input', i, '', inputPlaceholder).appendTo(inputsDiv);
949
- }
950
- } else if (childCount > inputCount) {
951
- for (i = inputCount; i < childCount; i++) {
952
- $(children[i]).remove();
953
- }
954
- if (inputCount === 0) {
955
- buildLabelRow().appendTo(inputsDiv);
956
- }
957
- }
958
-
959
- var outputCount;
960
- var i;
961
- var formOutputs = $('#node-input-outputs').val();
962
-
963
- if (formOutputs === undefined) {
964
- if (node.type === 'subflow') {
965
- outputCount = node.out.length;
966
- } else {
967
- inputCount = node.outputs || node._def.outputs || 0;
968
- }
969
- } else if (isNaN(formOutputs)) {
970
- var outputMap = JSON.parse(formOutputs);
971
- var keys = Object.keys(outputMap);
972
- children = outputsDiv.children();
973
- childCount = children.length;
974
- if (childCount === 1 && $(children[0]).hasClass('node-label-form-none')) {
975
- childCount--;
976
- }
977
-
978
- outputCount = 0;
979
- var rows = [];
980
- keys.forEach(function (p) {
981
- var row = $('#node-label-form-output-' + p).parent();
982
- if (row.length === 0 && outputMap[p] !== -1) {
983
- if (childCount === 0) {
984
- $(children[0]).remove();
985
- childCount = -1;
986
- }
987
- row = buildLabelRow('output', p, '', outputPlaceholder);
988
- } else {
989
- row.detach();
990
- }
991
- if (outputMap[p] !== -1) {
992
- outputCount++;
993
- rows.push({ i: parseInt(outputMap[p]), r: row });
994
- }
995
- });
996
- rows.sort(function (A, B) {
997
- return A.i - B.i;
998
- });
999
- rows.forEach(function (r, i) {
1000
- r.r.find('label').text(i + 1 + '.');
1001
- r.r.appendTo(outputsDiv);
1002
- });
1003
- if (rows.length === 0) {
1004
- buildLabelRow('output', i, '').appendTo(outputsDiv);
1005
- } else {
1006
- }
1007
- } else {
1008
- outputCount = Math.max(0, parseInt(formOutputs));
1009
- }
1010
- children = outputsDiv.children();
1011
- childCount = children.length;
1012
- if (childCount === 1 && $(children[0]).hasClass('node-label-form-none')) {
1013
- childCount--;
1014
- }
1015
- if (childCount < outputCount) {
1016
- if (childCount === 0) {
1017
- // remove the 'none' placeholder
1018
- $(children[0]).remove();
1019
- }
1020
- for (i = childCount; i < outputCount; i++) {
1021
- buildLabelRow('output', i, '').appendTo(outputsDiv);
1022
- }
1023
- } else if (childCount > outputCount) {
1024
- for (i = outputCount; i < childCount; i++) {
1025
- $(children[i]).remove();
1026
- }
1027
- if (outputCount === 0) {
1028
- buildLabelRow().appendTo(outputsDiv);
1029
- }
1030
- }
1031
- }
1032
- function buildLabelRow(type, index, value, placeHolder) {
1033
- var result = $('<div>', { class: 'node-label-form-row' });
1034
- if (type === undefined) {
1035
- $('<span>').text('none').appendTo(result);
1036
- result.addClass('node-label-form-none');
1037
- } else {
1038
- result.addClass('');
1039
- var id = 'node-label-form-' + type + '-' + index;
1040
- $('<label>', { for: id })
1041
- .text(index + 1 + '.')
1042
- .appendTo(result);
1043
- var input = $('<input>', {
1044
- type: 'text',
1045
- id: id,
1046
- placeholder: placeHolder,
1047
- })
1048
- .val(value)
1049
- .appendTo(result);
1050
- var clear = $(
1051
- '<button type="button" class="editor-button editor-button-small"><i class="fa fa-times"></i></button>'
1052
- ).appendTo(result);
1053
- clear.click(function (evt) {
1054
- evt.preventDefault();
1055
- input.val('');
1056
- });
1057
- }
1058
- return result;
1059
- }
1060
- function showIconPicker(container, node, iconPath, done) {
1061
- var containerPos = container.offset();
1062
- var pickerBackground = $('<div>')
1063
- .css({
1064
- position: 'absolute',
1065
- top: 0,
1066
- bottom: 0,
1067
- left: 0,
1068
- right: 0,
1069
- zIndex: 20,
1070
- })
1071
- .appendTo('body');
1072
-
1073
- var top = containerPos.top - 30;
1074
-
1075
- if (top + 280 > $(window).height()) {
1076
- top = $(window).height() - 280;
1077
- }
1078
- var picker = $('<div class="red-ui-icon-picker">')
1079
- .css({
1080
- top: top + 'px',
1081
- left: containerPos.left + 'px',
1082
- })
1083
- .appendTo('body');
1084
-
1085
- var hide = function () {
1086
- pickerBackground.remove();
1087
- picker.remove();
1088
- RED.keyboard.remove('escape');
1089
- };
1090
- RED.keyboard.add('*', 'escape', function () {
1091
- hide();
1092
- });
1093
- pickerBackground.on('mousedown', hide);
1094
-
1095
- var searchDiv = $('<div>', { class: 'red-ui-search-container' }).appendTo(
1096
- picker
1097
- );
1098
- searchInput = $('<input type="text">')
1099
- .attr('placeholder', 'Search icons')
1100
- .appendTo(searchDiv)
1101
- .searchBox({
1102
- delay: 50,
1103
- change: function () {
1104
- var searchTerm = $(this).val().trim();
1105
- if (searchTerm === '') {
1106
- iconList.find('.red-ui-icon-list-module').show();
1107
- iconList.find('.red-ui-icon-list-icon').show();
1108
- } else {
1109
- iconList.find('.red-ui-icon-list-module').hide();
1110
- iconList.find('.red-ui-icon-list-icon').each(function (i, n) {
1111
- if ($(n).data('icon').indexOf(searchTerm) === -1) {
1112
- $(n).hide();
1113
- } else {
1114
- $(n).show();
1115
- }
1116
- });
1117
- }
1118
- },
1119
- });
1120
-
1121
- var row = $('<div>').appendTo(picker);
1122
- var iconList = $('<div class="red-ui-icon-list">').appendTo(picker);
1123
- var metaRow = $('<div class="red-ui-icon-meta"></div>').appendTo(picker);
1124
- var summary = $('<span>').appendTo(metaRow);
1125
- var resetButton = $(
1126
- '<button type="button" class="editor-button editor-button-small">' +
1127
- 'use default' +
1128
- '</button>'
1129
- )
1130
- .appendTo(metaRow)
1131
- .click(function (e) {
1132
- e.preventDefault();
1133
- hide();
1134
- done(null);
1135
- });
1136
- var iconSets = RED.nodes.getIconSets();
1137
- Object.keys(iconSets).forEach(function (moduleName) {
1138
- var icons = iconSets[moduleName];
1139
- if (icons.length > 0) {
1140
- // selectIconModule.append($("<option></option>").val(moduleName).text(moduleName));
1141
- var header = $('<div class="red-ui-icon-list-module"></div>')
1142
- .text(moduleName)
1143
- .appendTo(iconList);
1144
- $('<i class="fa fa-cube"></i>').prependTo(header);
1145
- icons.forEach(function (icon) {
1146
- var iconDiv = $('<div>', { class: 'red-ui-icon-list-icon' }).appendTo(
1147
- iconList
1148
- );
1149
- var nodeDiv = $('<div>', {
1150
- class: 'red-ui-search-result-node',
1151
- }).appendTo(iconDiv);
1152
- var colour = RED.utils.getNodeColor(node.type, node._def);
1153
- var icon_url =
1154
- RED.settings.apiRootUrl + 'icons/' + moduleName + '/' + icon;
1155
- iconDiv.data('icon', icon_url);
1156
- nodeDiv.css('backgroundColor', colour);
1157
- var iconContainer = $('<div/>', {
1158
- class: 'palette_icon_container',
1159
- }).appendTo(nodeDiv);
1160
- RED.utils.createIconElement(icon_url, iconContainer, true);
1161
-
1162
- if (iconPath.module === moduleName && iconPath.file === icon) {
1163
- iconDiv.addClass('selected');
1164
- }
1165
- iconDiv.on('mouseover', function () {
1166
- summary.text(icon);
1167
- });
1168
- iconDiv.on('mouseout', function () {
1169
- summary.html('&nbsp;');
1170
- });
1171
- iconDiv.click(function () {
1172
- hide();
1173
- done(moduleName + '/' + icon);
1174
- });
1175
- });
1176
- }
1177
- });
1178
- picker.slideDown(100);
1179
- searchInput.focus();
1180
- }
1181
-
1182
- function buildAppearanceForm(container, node) {
1183
- var dialogForm = $(
1184
- '<form class="dialog-form form-horizontal" autocomplete="off"></form>'
1185
- ).appendTo(container);
1186
-
1187
- var i, row;
1188
-
1189
- $(
1190
- '<div class="form-row">' +
1191
- '<label for="node-input-show-label-btn" data-i18n="editor.label"></label>' +
1192
- '<button type="button" id="node-input-show-label-btn" class="editor-button" style="min-width: 80px; text-align: left;" type="button"><i id="node-input-show-label-btn-i" class="fa fa-toggle-on"></i> <span id="node-input-show-label-label"></span></button> ' +
1193
- '<input type="checkbox" id="node-input-show-label" style="display: none;"/>' +
1194
- '</div>'
1195
- ).appendTo(dialogForm);
1196
-
1197
- var setToggleState = function (state) {
1198
- var i = $('#node-input-show-label-btn-i');
1199
- if (!state) {
1200
- i.addClass('fa-toggle-off');
1201
- i.removeClass('fa-toggle-on');
1202
- $('#node-input-show-label').prop('checked', false);
1203
- $('#node-input-show-label-label').text('Hide');
1204
- } else {
1205
- i.addClass('fa-toggle-on');
1206
- i.removeClass('fa-toggle-off');
1207
- $('#node-input-show-label').prop('checked', true);
1208
- $('#node-input-show-label-label').text('Show');
1209
- }
1210
- };
1211
- dialogForm.find('#node-input-show-label-btn').on('click', function (e) {
1212
- e.preventDefault();
1213
- var i = $('#node-input-show-label-btn-i');
1214
- setToggleState(i.hasClass('fa-toggle-off'));
1215
- });
1216
-
1217
- // if (!node.hasOwnProperty('l')) {
1218
- // // Show label if type not link
1219
- // node.l = !/^link (in|out)$/.test(node._def.type);
1220
- // }
1221
- // setToggleState(node.l);
1222
-
1223
- // If a node has icon property in defaults, the icon of the node cannot be modified. (e.g, ui_button node in dashboard)
1224
- if (!node._def.defaults || !node._def.defaults.hasOwnProperty('icon')) {
1225
- var iconRow = $('<div class="form-row"></div>').appendTo(dialogForm);
1226
- $('<label data-i18n="editor.settingIcon">').appendTo(iconRow);
1227
-
1228
- var iconButton = $(
1229
- '<button type="button" class="editor-button" id="node-settings-icon-button">'
1230
- ).appendTo(iconRow);
1231
-
1232
- var nodeDiv = $('<div>', { class: 'red-ui-search-result-node' }).appendTo(
1233
- iconButton
1234
- );
1235
- var colour = RED.utils.getNodeColor(node.type, node._def);
1236
- var icon_url = RED.utils.getNodeIcon(node._def, node);
1237
- nodeDiv.css('backgroundColor', colour);
1238
- var iconContainer = $('<div/>', {
1239
- class: 'palette_icon_container',
1240
- }).appendTo(nodeDiv);
1241
- RED.utils.createIconElement(icon_url, iconContainer, true);
1242
-
1243
- iconButton.click(function (e) {
1244
- e.preventDefault();
1245
- var iconPath;
1246
- var icon = $('#node-settings-icon').text() || '';
1247
- if (icon) {
1248
- iconPath = RED.utils.separateIconPath(icon);
1249
- } else {
1250
- iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
1251
- }
1252
- showIconPicker(iconRow, node, iconPath, function (newIcon) {
1253
- $('#node-settings-icon').text(newIcon || '');
1254
- var icon_url = RED.utils.getNodeIcon(node._def, {
1255
- type: node.type,
1256
- icon: newIcon,
1257
- });
1258
- RED.utils.createIconElement(icon_url, iconContainer, true);
1259
- });
1260
- });
1261
- $('<div id="node-settings-icon">').text(node.icon).appendTo(iconButton);
1262
- }
1263
-
1264
- $(
1265
- '<div class="form-row"><span data-i18n="editor.portLabels"></span></div>'
1266
- ).appendTo(dialogForm);
1267
-
1268
- var inputCount = node.inputs || node._def.inputs || 0;
1269
- var outputCount = node.outputs || node._def.outputs || 0;
1270
- if (node.type === 'subflow') {
1271
- inputCount = node.in.length;
1272
- outputCount = node.out.length;
1273
- }
1274
-
1275
- var inputLabels = node.inputLabels || [];
1276
- var outputLabels = node.outputLabels || [];
1277
-
1278
- var inputPlaceholder = node._def.inputLabels
1279
- ? 'use default label'
1280
- : 'none';
1281
- var outputPlaceholder = node._def.outputLabels
1282
- ? 'use default label'
1283
- : 'none';
1284
-
1285
- $(
1286
- '<div class="form-row"><span style="margin-left: 50px;" data-i18n="editor.labelInputs"></span><div id="node-label-form-inputs"></div></div>'
1287
- ).appendTo(dialogForm);
1288
- var inputsDiv = $('#node-label-form-inputs');
1289
- if (inputCount > 0) {
1290
- for (i = 0; i < inputCount; i++) {
1291
- buildLabelRow('input', i, inputLabels[i], inputPlaceholder).appendTo(
1292
- inputsDiv
1293
- );
1294
- }
1295
- } else {
1296
- buildLabelRow().appendTo(inputsDiv);
1297
- }
1298
- $(
1299
- '<div class="form-row"><span style="margin-left: 50px;" data-i18n="editor.labelOutputs"></span><div id="node-label-form-outputs"></div></div>'
1300
- ).appendTo(dialogForm);
1301
- var outputsDiv = $('#node-label-form-outputs');
1302
- if (outputCount > 0) {
1303
- for (i = 0; i < outputCount; i++) {
1304
- buildLabelRow('output', i, outputLabels[i], outputPlaceholder).appendTo(
1305
- outputsDiv
1306
- );
1307
- }
1308
- } else {
1309
- buildLabelRow().appendTo(outputsDiv);
1310
- }
1311
- }
1312
-
1313
- function updateLabels(editing_node, changes, outputMap) {
1314
- var inputLabels = $('#node-label-form-inputs').children().find('input');
1315
- var outputLabels = $('#node-label-form-outputs').children().find('input');
1316
-
1317
- var hasNonBlankLabel = false;
1318
- var changed = false;
1319
- var newValue = inputLabels
1320
- .map(function () {
1321
- var v = $(this).val();
1322
- hasNonBlankLabel = hasNonBlankLabel || v !== '';
1323
- return v;
1324
- })
1325
- .toArray()
1326
- .slice(0, editing_node.inputs);
1327
- if (
1328
- (editing_node.inputLabels === undefined && hasNonBlankLabel) ||
1329
- (editing_node.inputLabels !== undefined &&
1330
- JSON.stringify(newValue) !== JSON.stringify(editing_node.inputLabels))
1331
- ) {
1332
- changes.inputLabels = editing_node.inputLabels;
1333
- editing_node.inputLabels = newValue;
1334
- changed = true;
1335
- }
1336
- hasNonBlankLabel = false;
1337
- newValue = new Array(editing_node.outputs);
1338
- outputLabels.each(function () {
1339
- var index = $(this).attr('id').substring(23); // node-label-form-output-<index>
1340
- if (outputMap && outputMap.hasOwnProperty(index)) {
1341
- index = parseInt(outputMap[index]);
1342
- if (index === -1) {
1343
- return;
1344
- }
1345
- }
1346
- var v = $(this).val();
1347
- hasNonBlankLabel = hasNonBlankLabel || v !== '';
1348
- newValue[index] = v;
1349
- });
1350
-
1351
- if (
1352
- (editing_node.outputLabels === undefined && hasNonBlankLabel) ||
1353
- (editing_node.outputLabels !== undefined &&
1354
- JSON.stringify(newValue) !== JSON.stringify(editing_node.outputLabels))
1355
- ) {
1356
- changes.outputLabels = editing_node.outputLabels;
1357
- editing_node.outputLabels = newValue;
1358
- changed = true;
1359
- }
1360
- return changed;
1361
- }
1362
-
1363
- function buildDescriptionForm(container, node) {
1364
- var dialogForm = $(
1365
- '<form class="dialog-form form-horizontal" style="padding: 5px 10px;" autocomplete="off"></form>'
1366
- ).appendTo(container);
1367
- var toolbarRow = $('<div></div>').appendTo(dialogForm);
1368
- var row = $(
1369
- `<div class="form-row node-text-editor-row" style="position:relative; padding-top: 4px; height: 100%"></div>
1370
- <div class="form-row node-text-editor-preview" style="display: none; padding: 0px 20px;"></div>
1371
- `
1372
- ).appendTo(dialogForm);
1373
- $(
1374
- '<div style="height: 100%" class="node-text-editor" id="node-info-input-info-editor" ></div>'
1375
- ).appendTo(row);
1376
-
1377
- // console.log('[editor] Creating notes editor...')
1378
- nodeInfoEditor = RED.editor.createEditor({
1379
- id: 'node-info-input-info-editor',
1380
- mode: 'ace/mode/markdown',
1381
- value: node.info || '',
1382
- lineNumbers: false,
1383
- toolbar: false,
1384
- onChange: function(delta) {
1385
- // console.log('[editor] InfoTab changed. Delta=', delta);
1386
- notifyChanges(getLatestNodeSelected());
1387
- }
1388
- });
1389
-
1390
- return nodeInfoEditor;
1391
- }
1392
-
1393
- function resetEditor(){
1394
- editStack.pop();
1395
- RED.sidebar.nodeinfo.emptyTab();
1396
- RED.actions.invoke('core:hide-sidebar');
1397
- }
1398
-
1399
- function forceNotifyChanges() {
1400
- notifyChanges(getLatestNodeSelected());
1401
- }
1402
-
1403
- function notifyChanges(nodeSelected){
1404
- console.log('[editor] notifyChanges with nodeSelected: ', nodeSelected);
1405
- let editing_node = nodeSelected;
1406
- let node = nodeSelected;
1407
-
1408
- var changes = {};
1409
- var changed = false;
1410
- var wasDirty = RED.nodes.dirty();
1411
- var d;
1412
- var outputMap;
1413
-
1414
- if (editing_node._def.oneditsave) {
1415
- var oldValues = {};
1416
- for (d in editing_node._def.defaults) {
1417
- if (editing_node._def.defaults.hasOwnProperty(d)) {
1418
- if (
1419
- typeof editing_node[d] === 'string' ||
1420
- typeof editing_node[d] === 'number'
1421
- ) {
1422
- oldValues[d] = editing_node[d];
1423
- } else {
1424
- oldValues[d] = $.extend(true, {}, { v: editing_node[d] }).v;
1425
- }
1426
- }
1427
- }
1428
- try {
1429
- var rc = editing_node._def.oneditsave.call(editing_node);
1430
- if (rc === true) {
1431
- changed = true;
1432
- }
1433
- } catch (err) {
1434
- console.log(
1435
- 'oneditsave',
1436
- editing_node.id,
1437
- editing_node.type,
1438
- err.toString()
1439
- );
1440
- }
1441
-
1442
- for (d in editing_node._def.defaults) {
1443
- if (editing_node._def.defaults.hasOwnProperty(d)) {
1444
- if (
1445
- oldValues[d] === null ||
1446
- typeof oldValues[d] === 'string' ||
1447
- typeof oldValues[d] === 'number'
1448
- ) {
1449
- if (oldValues[d] !== editing_node[d]) {
1450
- changes[d] = oldValues[d];
1451
- changed = true;
1452
- }
1453
- } else {
1454
- if (
1455
- JSON.stringify(oldValues[d]) !==
1456
- JSON.stringify(editing_node[d])
1457
- ) {
1458
- changes[d] = oldValues[d];
1459
- changed = true;
1460
- }
1461
- }
1462
- }
1463
- }
1464
- }
1465
-
1466
- var newValue;
1467
- if (editing_node._def.defaults) {
1468
- for (d in editing_node._def.defaults) {
1469
- if (editing_node._def.defaults.hasOwnProperty(d)) {
1470
- var input = $('#node-input-' + d);
1471
- if (input.attr('type') === 'checkbox') {
1472
- newValue = input.prop('checked');
1473
- } else if (
1474
- input.prop('nodeName') === 'select' &&
1475
- input.attr('multiple') === 'multiple'
1476
- ) {
1477
- // An empty select-multiple box returns null.
1478
- // Need to treat that as an empty array.
1479
- newValue = input.val();
1480
- if (newValue == null) {
1481
- newValue = [];
1482
- }
1483
- } else if (
1484
- 'format' in editing_node._def.defaults[d] &&
1485
- editing_node._def.defaults[d].format !== '' &&
1486
- input[0].nodeName === 'DIV'
1487
- ) {
1488
- newValue = input.text();
1489
- } else {
1490
- newValue = input.val();
1491
- }
1492
- if (newValue != null) {
1493
- if (d === 'outputs') {
1494
- if (newValue.trim() === '') {
1495
- continue;
1496
- }
1497
- if (isNaN(newValue)) {
1498
- outputMap = JSON.parse(newValue);
1499
- var outputCount = 0;
1500
- var outputsChanged = false;
1501
- var keys = Object.keys(outputMap);
1502
- keys.forEach(function (p) {
1503
- if (isNaN(p)) {
1504
- // New output;
1505
- outputCount++;
1506
- delete outputMap[p];
1507
- } else {
1508
- outputMap[p] = outputMap[p] + '';
1509
- if (outputMap[p] !== '-1') {
1510
- outputCount++;
1511
- if (outputMap[p] !== p) {
1512
- // Output moved
1513
- outputsChanged = true;
1514
- } else {
1515
- delete outputMap[p];
1516
- }
1517
- } else {
1518
- // Output removed
1519
- outputsChanged = true;
1520
- }
1521
- }
1522
- });
1523
-
1524
- newValue = outputCount;
1525
- if (outputsChanged) {
1526
- changed = true;
1527
- }
1528
- } else {
1529
- newValue = parseInt(newValue);
1530
- }
1531
- }
1532
- if (editing_node[d] != newValue) {
1533
- if (editing_node._def.defaults[d].type) {
1534
- if (newValue == '_ADD_') {
1535
- newValue = '';
1536
- }
1537
- // Change to a related config node
1538
- var configNode = RED.nodes.node(editing_node[d]);
1539
- if (configNode) {
1540
- var users = configNode.users;
1541
- users.splice(users.indexOf(editing_node), 1);
1542
- }
1543
- configNode = RED.nodes.node(newValue);
1544
- if (configNode) {
1545
- configNode.users.push(editing_node);
1546
- }
1547
- }
1548
- changes[d] = editing_node[d];
1549
- editing_node[d] = newValue;
1550
- changed = true;
1551
- }
1552
- }
1553
- }
1554
- }
1555
- }
1556
- if (editing_node._def.credentials) {
1557
- var prefix = 'node-input';
1558
- var credDefinition = editing_node._def.credentials;
1559
- var credsChanged = updateNodeCredentials(
1560
- editing_node,
1561
- credDefinition,
1562
- prefix
1563
- );
1564
- changed = changed || credsChanged;
1565
- }
1566
- if (editing_node.hasOwnProperty("_outputs")) {
1567
- outputMap = editing_node._outputs;
1568
- delete editing_node._outputs;
1569
- if (Object.keys(outputMap).length > 0) {
1570
- changed = true;
1571
- }
1572
- }
1573
- var removedLinks = updateNodeProperties(editing_node, outputMap);
1574
-
1575
- if (updateLabels(editing_node, changes, outputMap)) {
1576
- changed = true;
1577
- }
1578
-
1579
- // deleted all references about the l property (not needed as we have decommisioned the link node), it was about hiding the label for link type;
1580
-
1581
- node.resize = true;
1582
-
1583
- var oldInfo = node.info;
1584
- if (nodeInfoEditor) {
1585
- var newInfo = nodeInfoEditor.getValue();
1586
- if (!!oldInfo) {
1587
- // Has existing info property
1588
- if (newInfo.trim() === '') {
1589
- // New value is blank - remove the property
1590
- changed = true;
1591
- changes.info = oldInfo;
1592
- delete node.info;
1593
- } else if (newInfo !== oldInfo) {
1594
- // New value is different
1595
- changed = true;
1596
- changes.info = oldInfo;
1597
- node.info = newInfo;
1598
- }
1599
- } else {
1600
- // No existing info
1601
- if (newInfo.trim() !== '') {
1602
- // New value is not blank
1603
- changed = true;
1604
- changes.info = undefined;
1605
- node.info = newInfo;
1606
- }
1607
- }
1608
- }
1609
-
1610
-
1611
- if (changed) {
1612
- console.log('[editor] Editing node detected a change. Saving required.');
1613
- var wasChanged = editing_node.changed;
1614
- editing_node.changed = true;
1615
- RED.nodes.dirty(true);
1616
-
1617
- var activeSubflow = RED.nodes.subflow(RED.workspaces.active());
1618
- var subflowInstances = null;
1619
- if (activeSubflow) {
1620
- subflowInstances = [];
1621
- RED.nodes.eachNode(function (n) {
1622
- if (n.type == 'subflow:' + RED.workspaces.active()) {
1623
- subflowInstances.push({
1624
- id: n.id,
1625
- changed: n.changed,
1626
- });
1627
- n.changed = true;
1628
- n.dirty = true;
1629
- updateNodeProperties(n);
1630
- }
1631
- });
1632
- }
1633
- var historyEvent = {
1634
- t: 'edit',
1635
- node: editing_node,
1636
- changes: changes,
1637
- links: removedLinks,
1638
- dirty: wasDirty,
1639
- changed: wasChanged,
1640
- };
1641
- if (outputMap) {
1642
- historyEvent.outputMap = outputMap;
1643
- }
1644
- if (subflowInstances) {
1645
- historyEvent.subflow = {
1646
- instances: subflowInstances,
1647
- };
1648
- }
1649
- RED.history.push(historyEvent);
1650
- editing_node.dirty = true;
1651
- validateNode(editing_node);
1652
- setLatestNodeSelected(editing_node);
1653
- // console.log('[editor] Node changed. Required to be saved', editing_node);
1654
- RED.events.emit('editor:save', editing_node);
1655
- }else{
1656
- console.log('[editor] Editing node is same as current node. No saving required');
1657
- return;
1658
- }
1659
-
1660
- }
1661
-
1662
- function attachListenerToFieldsChange() {
1663
- // console.log('[editor] Node properties changed. Event: keyup change');
1664
- notifyChanges(getLatestNodeSelected());
1665
- // Wait until the DOM has been modified as part of the click event, to set the new listener to the new elements
1666
- setTimeout(()=> {
1667
- listenEditorChanges();
1668
- }, 300);
1669
- }
1670
-
1671
- function attachListenerToClickBtn() {
1672
- // console.log('[editor] Node properties changed. Event: a click');
1673
-
1674
- // Wait until the DOM has been modified as part of the click event, to set the new listener to the new elements
1675
- setTimeout(()=> {
1676
- notifyChanges(getLatestNodeSelected());
1677
- listenEditorChanges();
1678
- }, 300);
1679
- }
1680
-
1681
- function listenEditorChanges(){
1682
- // console.log('[editor] Setting new listeners...')
1683
- $('#editor-stack :input').off('keyup change', attachListenerToFieldsChange);
1684
- $('#editor-stack :input').on('keyup change', attachListenerToFieldsChange);
1685
-
1686
- $('#editor-stack a').off('click', attachListenerToClickBtn)
1687
- $('#editor-stack a').on('click', attachListenerToClickBtn)
1688
- }
1689
-
1690
- function showEditDialog(node) {
1691
- if (RED.sidebar.isDragging()){
1692
- return;
1693
- }
1694
-
1695
- let editing_node;
1696
- if (Object.keys(node).length === 0 && node.constructor === Object){
1697
- resetEditor();
1698
- return;
1699
- }
1700
- // Case selection is about a `link`
1701
- if (node && node.hasOwnProperty('link')){
1702
- return;
1703
- }
1704
-
1705
- // Case selection is about a `node`
1706
- if (node && node.hasOwnProperty('nodes') && node.nodes.length === 1) { // Single node selection
1707
- // Ignore if sidebar is not visible - only double click will pull initially the sidebar
1708
- if (RED.sidebar.isSidebarVisible()){
1709
- editing_node = node.nodes[0];
1710
- } else {
1711
- setLatestNodeSelected(node.nodes[0]);
1712
- return;
1713
- }
1714
-
1715
- } else if (node && node.hasOwnProperty('nodes') && Array.isArray(node.nodes)){ // Multinode selection
1716
- return;
1717
- } else { // Double click on node
1718
- editing_node = node;
1719
- }
1720
-
1721
- node = editing_node; // backwards compatibility
1722
- setLatestNodeSelected(node);
1723
- var finishedBuilding = false;
1724
-
1725
- // console.log('[editor] Before editStack.push() =', editStack);
1726
- editStack.pop();
1727
- editStack.push(node);
1728
-
1729
- //RED.view.state(RED.state.EDITING);
1730
- var type = node.type;
1731
-
1732
- if (node.type.substring(0, 8) == 'subflow:') {
1733
- type = 'subflow';
1734
- }
1735
-
1736
- var trayOptions = {
1737
- nodeId: node.id,
1738
- title: getEditStackTitle(),
1739
- nodeIconPath: getNodeIconPath(),
1740
- buttons: [
1741
- ],
1742
- resize: function (dimensions) {
1743
- editTrayWidthCache[type] = dimensions.width;
1744
- $('.editor-tray-content').height(dimensions.height - 50);
1745
- var form = $('.editor-tray-content form').height(
1746
- dimensions.height - 50 - 40
1747
- );
1748
- if (editing_node && editing_node._def.oneditresize) {
1749
- try {
1750
- editing_node._def.oneditresize.call(editing_node, {
1751
- width: form.width(),
1752
- height: form.height(),
1753
- });
1754
- } catch (err) {
1755
- console.log(
1756
- 'oneditresize',
1757
- editing_node.id,
1758
- editing_node.type,
1759
- err.toString()
1760
- );
1761
- }
1762
- }
1763
- },
1764
- open: function (tray, done) {
1765
- var trayFooter = tray.find('.editor-tray-footer');
1766
- var trayBody = tray.find('.editor-tray-body');
1767
- trayBody.parent().css('overflow', 'hidden');
1768
-
1769
- var editorTabEl = $('<ul></ul>').appendTo(trayBody);
1770
- var editorContent = $('<div id="editorContent"></div>').appendTo(trayBody);
1771
-
1772
- var editorTabs = RED.tabs.create({
1773
- element: editorTabEl,
1774
- onchange: function (tab) {
1775
- editorContent.children().hide();
1776
- if (tab.onchange) {
1777
- tab.onchange.call(tab);
1778
- }
1779
- tab.content.show();
1780
- if (finishedBuilding) {
1781
- RED.tray.resize();
1782
- }
1783
- },
1784
- collapsible: true,
1785
- menu: false,
1786
- });
1787
- if (editing_node) {
1788
- RED.sidebar.info.refresh(editing_node);
1789
- }
1790
- var ns;
1791
- if (node._def.set.module === 'kumologica-core') {
1792
- ns = 'kumologica-core';
1793
- } else {
1794
- ns = node._def.set.id;
1795
- }
1796
-
1797
- var iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
1798
- defaultIcon = iconPath.module + '/' + iconPath.file;
1799
- if (iconPath.module === 'kumologica-core') {
1800
- nodeIconPath = `icons/${iconPath.module}/${iconPath.file}`;
1801
- isDefaultIcon = true;
1802
- } else {
1803
- isDefaultIcon = false;
1804
- }
1805
-
1806
- // Properties tab
1807
- var nodePropertiesTab = {
1808
- id: 'editor-tab-properties',
1809
- label: 'Properties',
1810
- name: 'Properties',
1811
- content: $('<div>', {
1812
- class: 'editor-tray-content',
1813
- id: 'properties-tab',
1814
- })
1815
- .appendTo(editorContent)
1816
- .hide(),
1817
- iconClass: 'fa fa-cog',
1818
- };
1819
- buildEditForm(nodePropertiesTab.content, 'dialog-form', type, ns, node);
1820
- editorTabs.addTab(nodePropertiesTab);
1821
-
1822
- // Help tab
1823
- let helpTab = {
1824
- id: 'editor-tab-help',
1825
- label: 'Help',
1826
- name: 'Help',
1827
- content: $('<div>', {
1828
- class: 'editor-tray-content',
1829
- id: 'help-tab',
1830
- })
1831
- .appendTo(editorContent)
1832
- .hide(),
1833
- iconClass: 'fa fa-cog',
1834
- }
1835
- editorTabs.addTab(helpTab);
1836
- let editorTabContent = $('#help-tab');
1837
-
1838
- let helpText =
1839
- $("script[data-help-name='" + node.type + "']").html() ||
1840
- '<span class="node-info-none">' +
1841
- 'None' +
1842
- '</span>';
1843
-
1844
- $(`<div class="node-help">${helpText}</div>`).appendTo(editorTabContent);
1845
-
1846
- // Notes tab
1847
- if (!node._def.defaults || !node._def.defaults.hasOwnProperty('info')) {
1848
- var descriptionTab = {
1849
- id: 'editor-tab-description',
1850
- label: 'Description',
1851
- name: 'Description',
1852
- content: $('<div>', {
1853
- class: 'editor-tray-content',
1854
- id: 'documentation-tab',
1855
- })
1856
- .appendTo(editorContent)
1857
- .hide(),
1858
- iconClass: 'fa fa-file-text-o',
1859
- onchange: function () {
1860
- if (nodeInfoEditor) {
1861
- nodeInfoEditor.focus();
1862
- } else {
1863
- console.log('WARN - nodeInfoEditor is undefined');
1864
- }
1865
- },
1866
- };
1867
- editorTabs.addTab(descriptionTab);
1868
- nodeInfoEditor = buildDescriptionForm(descriptionTab.content, node);
1869
- }
1870
-
1871
- var appearanceTab = {
1872
- id: 'editor-tab-appearance',
1873
- label: 'Appearance',
1874
- name: 'Appearance',
1875
- content: $('<div>', { class: 'editor-tray-content' })
1876
- .appendTo(editorContent)
1877
- .hide(),
1878
- iconClass: 'fa fa-object-group',
1879
- onchange: function () {
1880
- refreshLabelForm(this.content, node);
1881
- },
1882
- };
1883
- buildAppearanceForm(appearanceTab.content, node);
1884
- //editorTabs.addTab(appearanceTab);
1885
-
1886
- prepareEditDialog(node, node._def, 'node-input', function () {
1887
- trayBody.i18n();
1888
- finishedBuilding = true;
1889
- done();
1890
- });
1891
- },
1892
- close: function () {
1893
- // console.log('[editor] trayoptions->close')
1894
- if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
1895
- RED.view.state(RED.state.DEFAULT);
1896
- }
1897
- if (editing_node) {
1898
- RED.sidebar.info.refresh(editing_node);
1899
- }
1900
- RED.workspaces.refresh();
1901
- if (nodeInfoEditor) {
1902
- nodeInfoEditor.destroy();
1903
- nodeInfoEditor = null;
1904
- }
1905
- RED.view.redraw(true);
1906
- editStack.pop();
1907
- },
1908
- show: function () {
1909
- if (editing_node) {
1910
- // console.log('[editor] Showing editor ...')
1911
- RED.sidebar.info.refresh(editing_node);
1912
- // activate the save button when node properties have changed
1913
- setTimeout( ()=> {
1914
- listenEditorChanges();
1915
- }, 300);
1916
- }
1917
- },
1918
- };
1919
-
1920
- // if (editTrayWidthCache.hasOwnProperty(type)) {
1921
- // trayOptions.width = editTrayWidthCache[type];
1922
- // }
1923
- RED.actions.invoke('core:show-sidebar', { selectIndex: 0 });
1924
- RED.tray.show(trayOptions);
1925
-
1926
- // // activate the save button when node properties have changed
1927
- // listenEditorChanges(latestNodeSelected);
1928
- }
1929
-
1930
- /**
1931
- * name - name of the property that holds this config node
1932
- * type - type of config node
1933
- * id - id of config node to edit. _ADD_ for a new one
1934
- * prefix - the input prefix of the parent property
1935
- */
1936
- function showEditConfigNodeDialog(name, type, id, prefix) {
1937
- var adding = id == '_ADD_';
1938
- var node_def = RED.nodes.getType(type);
1939
- var editing_config_node = RED.nodes.node(id);
1940
- var nodeInfoEditor;
1941
- var finishedBuilding = false;
1942
-
1943
- var ns;
1944
- if (node_def.set.module === 'kumologica-core') {
1945
- ns = 'kumologica-core';
1946
- } else {
1947
- ns = node_def.set.id;
1948
- }
1949
- var configNodeScope = ''; // default to global
1950
- var activeSubflow = RED.nodes.subflow(RED.workspaces.active());
1951
- if (activeSubflow) {
1952
- configNodeScope = activeSubflow.id;
1953
- }
1954
- if (editing_config_node == null) {
1955
- editing_config_node = {
1956
- id: RED.nodes.id(),
1957
- _def: node_def,
1958
- type: type,
1959
- z: configNodeScope,
1960
- users: [],
1961
- };
1962
- for (var d in node_def.defaults) {
1963
- if (node_def.defaults[d].value) {
1964
- editing_config_node[d] = JSON.parse(
1965
- JSON.stringify(node_def.defaults[d].value)
1966
- );
1967
- }
1968
- }
1969
- editing_config_node['_'] = node_def._;
1970
- }
1971
- editStack.push(editing_config_node);
1972
-
1973
- RED.view.state(RED.state.EDITING);
1974
- var trayOptions = {
1975
- title: getEditStackTitle(),
1976
- nodeIconPath: getNodeIconPath(),
1977
- resize: function (dimensions) {
1978
- $('.editor-tray-content').height(dimensions.height - 50);
1979
- if (editing_config_node && editing_config_node._def.oneditresize) {
1980
- var form = $('#node-config-dialog-edit-form');
1981
- try {
1982
- editing_config_node._def.oneditresize.call(editing_config_node, {
1983
- width: form.width(),
1984
- height: form.height(),
1985
- });
1986
- } catch (err) {
1987
- console.log(
1988
- 'oneditresize',
1989
- editing_config_node.id,
1990
- editing_config_node.type,
1991
- err.toString()
1992
- );
1993
- }
1994
- }
1995
- },
1996
- open: function (tray, done) {
1997
- var trayHeader = tray.find('.editor-tray-header');
1998
- var trayBody = tray.find('.editor-tray-body');
1999
- var trayFooter = tray.find('.editor-tray-footer');
2000
-
2001
- if (node_def.hasUsers !== false) {
2002
- trayFooter.prepend(
2003
- '<div id="node-config-dialog-user-count"><i class="fa fa-info-circle"></i> <span></span></div>'
2004
- );
2005
- }
2006
- trayFooter.append(
2007
- '<span id="node-config-dialog-scope-container"><span id="node-config-dialog-scope-warning" data-i18n="[title]editor.errors.scopeChange"><i class="fa fa-warning"></i></span><select id="node-config-dialog-scope"></select></span>'
2008
- );
2009
-
2010
- //var editorTabEl = $('<ul></ul>').appendTo(trayBody);
2011
- var editorContent = $('<div id="editorContent"></div>').appendTo(trayBody);
2012
-
2013
- var editorTabs = RED.tabs.create({
2014
- element: editorTabEl,
2015
- onchange: function (tab) {
2016
- editorContent.children().hide();
2017
- if (tab.onchange) {
2018
- tab.onchange.call(tab);
2019
- }
2020
- tab.content.show();
2021
- if (finishedBuilding) {
2022
- RED.tray.resize();
2023
- }
2024
- },
2025
- collapsible: true,
2026
- });
2027
-
2028
- var nodePropertiesTab = {
2029
- id: 'editor-tab-cproperties',
2030
- label: 'Properties',
2031
- name: 'Properties',
2032
- content: $('<div>', {
2033
- class: 'editor-tray-content',
2034
- })
2035
- .appendTo(editorContent)
2036
- .hide(),
2037
- iconClass: 'fa fa-cog',
2038
- };
2039
- editorTabs.addTab(nodePropertiesTab);
2040
- buildEditForm(
2041
- nodePropertiesTab.content,
2042
- 'node-config-dialog-edit-form',
2043
- type,
2044
- ns
2045
- );
2046
-
2047
- if (!node_def.defaults || !node_def.defaults.hasOwnProperty('info')) {
2048
- var descriptionTab = {
2049
- id: 'editor-tab-description',
2050
- label: 'Description',
2051
- name: 'Description',
2052
- content: $('<div>', { class: 'editor-tray-content' })
2053
- .appendTo(editorContent)
2054
- .hide(),
2055
- iconClass: 'fa fa-file-text-o',
2056
- onchange: function () {
2057
- nodeInfoEditor.focus();
2058
- },
2059
- };
2060
- editorTabs.addTab(descriptionTab);
2061
- nodeInfoEditor = buildDescriptionForm(
2062
- descriptionTab.content,
2063
- editing_config_node
2064
- );
2065
- }
2066
-
2067
- prepareEditDialog(
2068
- editing_config_node,
2069
- node_def,
2070
- 'node-config-input',
2071
- function () {
2072
- if (editing_config_node._def.exclusive) {
2073
- $('#node-config-dialog-scope').hide();
2074
- } else {
2075
- $('#node-config-dialog-scope').show();
2076
- }
2077
- $('#node-config-dialog-scope-warning').hide();
2078
-
2079
- var nodeUserFlows = {};
2080
- editing_config_node.users.forEach(function (n) {
2081
- nodeUserFlows[n.z] = true;
2082
- });
2083
- var flowCount = Object.keys(nodeUserFlows).length;
2084
- var tabSelect = $('#node-config-dialog-scope').empty();
2085
- tabSelect.off('change');
2086
- tabSelect.append(
2087
- '<option value=""' +
2088
- (!editing_config_node.z ? ' selected' : '') +
2089
- ' data-i18n="sidebar.config.global"></option>'
2090
- );
2091
- tabSelect.append(
2092
- '<option disabled data-i18n="sidebar.config.flows"></option>'
2093
- );
2094
- RED.nodes.eachWorkspace(function (ws) {
2095
- var workspaceLabel = ws.label;
2096
- if (nodeUserFlows[ws.id]) {
2097
- workspaceLabel = '* ' + workspaceLabel;
2098
- }
2099
- $(
2100
- '<option value="' +
2101
- ws.id +
2102
- '"' +
2103
- (ws.id == editing_config_node.z ? ' selected' : '') +
2104
- '></option>'
2105
- )
2106
- .text(workspaceLabel)
2107
- .appendTo(tabSelect);
2108
- });
2109
- tabSelect.append(
2110
- '<option disabled data-i18n="sidebar.config.subflows"></option>'
2111
- );
2112
- RED.nodes.eachSubflow(function (ws) {
2113
- var workspaceLabel = ws.name;
2114
- if (nodeUserFlows[ws.id]) {
2115
- workspaceLabel = '* ' + workspaceLabel;
2116
- }
2117
- $(
2118
- '<option value="' +
2119
- ws.id +
2120
- '"' +
2121
- (ws.id == editing_config_node.z ? ' selected' : '') +
2122
- '></option>'
2123
- )
2124
- .text(workspaceLabel)
2125
- .appendTo(tabSelect);
2126
- });
2127
- if (flowCount > 0) {
2128
- tabSelect.on('change', function () {
2129
- var newScope = $(this).val();
2130
- if (newScope === '') {
2131
- // global scope - everyone can use it
2132
- $('#node-config-dialog-scope-warning').hide();
2133
- } else if (!nodeUserFlows[newScope] || flowCount > 1) {
2134
- // a user will loose access to it
2135
- $('#node-config-dialog-scope-warning').show();
2136
- } else {
2137
- $('#node-config-dialog-scope-warning').hide();
2138
- }
2139
- });
2140
- }
2141
- if (node_def.hasUsers !== false) {
2142
- $('#node-config-dialog-user-count')
2143
- .find('span')
2144
- .text(`${editing_config_node.users.length} nodes use this config`)
2145
- .parent()
2146
- .show();
2147
- }
2148
- trayBody.i18n();
2149
- trayFooter.i18n();
2150
- finishedBuilding = true;
2151
- done();
2152
- }
2153
- );
2154
- },
2155
- close: function () {
2156
- RED.workspaces.refresh();
2157
- if (nodeInfoEditor) {
2158
- nodeInfoEditor.destroy();
2159
- nodeInfoEditor = null;
2160
- }
2161
- editStack.pop();
2162
- },
2163
- show: function () {
2164
- if (editing_config_node) {
2165
- RED.sidebar.info.refresh(editing_config_node);
2166
- }
2167
- },
2168
- };
2169
- trayOptions.buttons = [
2170
- {
2171
- id: 'node-config-dialog-cancel',
2172
- text: 'Cancel',
2173
- click: function () {
2174
- var configType = type;
2175
- var configId = editing_config_node.id;
2176
- var configAdding = adding;
2177
- var configTypeDef = RED.nodes.getType(configType);
2178
-
2179
- if (configTypeDef.oneditcancel) {
2180
- // TODO: what to pass as this to call
2181
- if (configTypeDef.oneditcancel) {
2182
- var cn = RED.nodes.node(configId);
2183
- if (cn) {
2184
- try {
2185
- configTypeDef.oneditcancel.call(cn, false);
2186
- } catch (err) {
2187
- console.log('oneditcancel', cn.id, cn.type, err.toString());
2188
- }
2189
- } else {
2190
- try {
2191
- configTypeDef.oneditcancel.call({ id: configId }, true);
2192
- } catch (err) {
2193
- console.log(
2194
- 'oneditcancel',
2195
- configId,
2196
- configType,
2197
- err.toString()
2198
- );
2199
- }
2200
- }
2201
- }
2202
- }
2203
- RED.tray.close();
2204
- },
2205
- },
2206
- {
2207
- id: 'node-config-dialog-ok',
2208
- text: adding ? 'Add' : 'Update',
2209
- class: 'primary',
2210
- click: function () {
2211
- var configProperty = name;
2212
- var configId = editing_config_node.id;
2213
- var configType = type;
2214
- var configAdding = adding;
2215
- var configTypeDef = RED.nodes.getType(configType);
2216
- var d;
2217
- var input;
2218
- var scope = $('#node-config-dialog-scope').val();
2219
-
2220
- if (configTypeDef.oneditsave) {
2221
- try {
2222
- configTypeDef.oneditsave.call(editing_config_node);
2223
- } catch (err) {
2224
- console.log(
2225
- 'oneditsave',
2226
- editing_config_node.id,
2227
- editing_config_node.type,
2228
- err.toString()
2229
- );
2230
- }
2231
- }
2232
-
2233
- for (d in configTypeDef.defaults) {
2234
- if (configTypeDef.defaults.hasOwnProperty(d)) {
2235
- var newValue;
2236
- input = $('#node-config-input-' + d);
2237
- if (input.attr('type') === 'checkbox') {
2238
- newValue = input.prop('checked');
2239
- } else if (
2240
- 'format' in configTypeDef.defaults[d] &&
2241
- configTypeDef.defaults[d].format !== '' &&
2242
- input[0].nodeName === 'DIV'
2243
- ) {
2244
- newValue = input.text();
2245
- } else {
2246
- newValue = input.val();
2247
- }
2248
- if (newValue != null && newValue !== editing_config_node[d]) {
2249
- if (editing_config_node._def.defaults[d].type) {
2250
- if (newValue == '_ADD_') {
2251
- newValue = '';
2252
- }
2253
- // Change to a related config node
2254
- var configNode = RED.nodes.node(editing_config_node[d]);
2255
- if (configNode) {
2256
- var users = configNode.users;
2257
- users.splice(users.indexOf(editing_config_node), 1);
2258
- }
2259
- configNode = RED.nodes.node(newValue);
2260
- if (configNode) {
2261
- configNode.users.push(editing_config_node);
2262
- }
2263
- }
2264
- editing_config_node[d] = newValue;
2265
- }
2266
- }
2267
- }
2268
-
2269
- if (nodeInfoEditor) {
2270
- editing_config_node.info = nodeInfoEditor.getValue();
2271
-
2272
- var oldInfo = editing_config_node.info;
2273
- if (nodeInfoEditor) {
2274
- var newInfo = nodeInfoEditor.getValue();
2275
- if (!!oldInfo) {
2276
- // Has existing info property
2277
- if (newInfo.trim() === '') {
2278
- // New value is blank - remove the property
2279
- delete editing_config_node.info;
2280
- } else if (newInfo !== oldInfo) {
2281
- // New value is different
2282
- editing_config_node.info = newInfo;
2283
- }
2284
- } else {
2285
- // No existing info
2286
- if (newInfo.trim() !== '') {
2287
- // New value is not blank
2288
- editing_config_node.info = newInfo;
2289
- }
2290
- }
2291
- }
2292
- }
2293
- editing_config_node.label = configTypeDef.label;
2294
- editing_config_node.z = scope;
2295
-
2296
- if (scope) {
2297
- // Search for nodes that use this one that are no longer
2298
- // in scope, so must be removed
2299
- editing_config_node.users = editing_config_node.users.filter(
2300
- function (n) {
2301
- var keep = true;
2302
- for (var d in n._def.defaults) {
2303
- if (n._def.defaults.hasOwnProperty(d)) {
2304
- if (
2305
- n._def.defaults[d].type === editing_config_node.type &&
2306
- n[d] === editing_config_node.id &&
2307
- n.z !== scope
2308
- ) {
2309
- keep = false;
2310
- // Remove the reference to this node
2311
- // and revalidate
2312
- n[d] = null;
2313
- n.dirty = true;
2314
- n.changed = true;
2315
- validateNode(n);
2316
- }
2317
- }
2318
- }
2319
- return keep;
2320
- }
2321
- );
2322
- }
2323
-
2324
- if (configAdding) {
2325
- RED.nodes.add(editing_config_node);
2326
- }
2327
-
2328
- if (configTypeDef.credentials) {
2329
- updateNodeCredentials(
2330
- editing_config_node,
2331
- configTypeDef.credentials,
2332
- 'node-config-input'
2333
- );
2334
- }
2335
- validateNode(editing_config_node);
2336
- var validatedNodes = {};
2337
- validatedNodes[editing_config_node.id] = true;
2338
-
2339
- var userStack = editing_config_node.users.slice();
2340
- while (userStack.length > 0) {
2341
- var user = userStack.pop();
2342
- if (!validatedNodes[user.id]) {
2343
- validatedNodes[user.id] = true;
2344
- if (user.users) {
2345
- userStack = userStack.concat(user.users);
2346
- }
2347
- validateNode(user);
2348
- }
2349
- }
2350
- RED.nodes.dirty(true);
2351
- RED.view.redraw(true);
2352
- if (!configAdding) {
2353
- RED.events.emit('editor:save', editing_config_node);
2354
- }
2355
- RED.tray.close(function () {
2356
- updateConfigNodeSelect(
2357
- configProperty,
2358
- configType,
2359
- editing_config_node.id,
2360
- prefix
2361
- );
2362
- });
2363
- },
2364
- },
2365
- ];
2366
-
2367
- if (!adding) {
2368
- trayOptions.buttons.unshift({
2369
- class: 'leftButton',
2370
- text: 'Delete', //'<i class="fa fa-trash"></i>',
2371
- click: function () {
2372
- var configProperty = name;
2373
- var configId = editing_config_node.id;
2374
- var configType = type;
2375
- var configTypeDef = RED.nodes.getType(configType);
2376
-
2377
- try {
2378
- if (configTypeDef.ondelete) {
2379
- // Deprecated: never documented but used by some early nodes
2380
- console.log(
2381
- 'Deprecated API warning: config node type ',
2382
- configType,
2383
- ' has an ondelete function - should be oneditdelete'
2384
- );
2385
- configTypeDef.ondelete.call(editing_config_node);
2386
- }
2387
- if (configTypeDef.oneditdelete) {
2388
- configTypeDef.oneditdelete.call(editing_config_node);
2389
- }
2390
- } catch (err) {
2391
- console.log(
2392
- 'oneditdelete',
2393
- editing_config_node.id,
2394
- editing_config_node.type,
2395
- err.toString()
2396
- );
2397
- }
2398
-
2399
- var historyEvent = {
2400
- t: 'delete',
2401
- nodes: [editing_config_node],
2402
- changes: {},
2403
- dirty: RED.nodes.dirty(),
2404
- };
2405
- for (var i = 0; i < editing_config_node.users.length; i++) {
2406
- var user = editing_config_node.users[i];
2407
- historyEvent.changes[user.id] = {
2408
- changed: user.changed,
2409
- valid: user.valid,
2410
- };
2411
- for (var d in user._def.defaults) {
2412
- if (user._def.defaults.hasOwnProperty(d) && user[d] == configId) {
2413
- historyEvent.changes[user.id][d] = configId;
2414
- user[d] = '';
2415
- user.changed = true;
2416
- user.dirty = true;
2417
- }
2418
- }
2419
- validateNode(user);
2420
- }
2421
- RED.nodes.remove(configId);
2422
- RED.nodes.dirty(true);
2423
- RED.view.redraw(true);
2424
- RED.history.push(historyEvent);
2425
- RED.tray.close(function () {
2426
- updateConfigNodeSelect(configProperty, configType, '', prefix);
2427
- });
2428
- },
2429
- });
2430
- }
2431
-
2432
- RED.tray.show(trayOptions);
2433
- }
2434
-
2435
- function defaultConfigNodeSort(A, B) {
2436
- if (A.__label__ < B.__label__) {
2437
- return -1;
2438
- } else if (A.__label__ > B.__label__) {
2439
- return 1;
2440
- }
2441
- return 0;
2442
- }
2443
-
2444
- function updateConfigNodeSelect(name, type, value, prefix) {
2445
- // if prefix is null, there is no config select to update
2446
- if (prefix) {
2447
- var button = $('#' + prefix + '-edit-' + name);
2448
- if (button.length) {
2449
- if (value) {
2450
- button.text('Edit');
2451
- } else {
2452
- button.text('Add');
2453
- }
2454
- $('#' + prefix + '-' + name).val(value);
2455
- } else {
2456
- var select = $('#' + prefix + '-' + name);
2457
- var node_def = RED.nodes.getType(type);
2458
- select.children().remove();
2459
-
2460
- var activeWorkspace = RED.nodes.workspace(RED.workspaces.active());
2461
- if (!activeWorkspace) {
2462
- activeWorkspace = RED.nodes.subflow(RED.workspaces.active());
2463
- }
2464
-
2465
- var configNodes = [];
2466
-
2467
- RED.nodes.eachConfig(function (config) {
2468
- if (
2469
- config.type == type &&
2470
- (!config.z || config.z === activeWorkspace.id)
2471
- ) {
2472
- var label = RED.utils.getNodeLabel(config, config.id);
2473
- config.__label__ = label;
2474
- configNodes.push(config);
2475
- }
2476
- });
2477
- var configSortFn = defaultConfigNodeSort;
2478
- if (typeof node_def.sort == 'function') {
2479
- configSortFn = node_def.sort;
2480
- }
2481
- try {
2482
- configNodes.sort(configSortFn);
2483
- } catch (err) {
2484
- console.log('Definition error: ' + node_def.type + '.sort', err);
2485
- }
2486
-
2487
- configNodes.forEach(function (cn) {
2488
- $(
2489
- '<option value="' +
2490
- cn.id +
2491
- '"' +
2492
- (value == cn.id ? ' selected' : '') +
2493
- '></option>'
2494
- )
2495
- .text(RED.text.bidi.enforceTextDirectionWithUCC(cn.__label__))
2496
- .appendTo(select);
2497
- delete cn.__label__;
2498
- });
2499
-
2500
- select.append(
2501
- '<option value="_ADD_"' +
2502
- (value === '' ? ' selected' : '') +
2503
- '>' + `Add new ${type}...` +
2504
- '</option>'
2505
- );
2506
- window.setTimeout(function () {
2507
- select.change();
2508
- }, 50);
2509
- }
2510
- }
2511
- }
2512
-
2513
- function showEditSubflowDialog(subflow) {
2514
- var editing_node = subflow;
2515
- editStack.push(subflow);
2516
- RED.view.state(RED.state.EDITING);
2517
- var subflowEditor;
2518
- var finishedBuilding = false;
2519
- var trayOptions = {
2520
- title: getEditStackTitle(),
2521
- buttons: [
2522
- {
2523
- id: 'node-dialog-cancel',
2524
- text: 'Close',
2525
- click: function () {
2526
- RED.tray.close();
2527
- },
2528
- },
2529
- {
2530
- id: 'node-dialog-ok',
2531
- class: 'primary',
2532
- text: 'Save',
2533
- click: function () {
2534
- var i;
2535
- var changes = {};
2536
- var changed = false;
2537
- var wasDirty = RED.nodes.dirty();
2538
-
2539
- var newName = $('#subflow-input-name').val();
2540
-
2541
- if (newName != editing_node.name) {
2542
- changes['name'] = editing_node.name;
2543
- editing_node.name = newName;
2544
- changed = true;
2545
- }
2546
-
2547
- var newDescription = subflowEditor.getValue();
2548
-
2549
- if (newDescription != editing_node.info) {
2550
- changes['info'] = editing_node.info;
2551
- editing_node.info = newDescription;
2552
- changed = true;
2553
- }
2554
- if (updateLabels(editing_node, changes, null)) {
2555
- changed = true;
2556
- }
2557
- var icon = $('#node-settings-icon').text() || '';
2558
- if (
2559
- (editing_node.icon === undefined &&
2560
- icon !== 'kumologica-core/subflow.png') ||
2561
- (editing_node.icon !== undefined && editing_node.icon !== icon)
2562
- ) {
2563
- changes.icon = editing_node.icon;
2564
- editing_node.icon = icon;
2565
- changed = true;
2566
- }
2567
- var newCategory = $('#subflow-input-category').val().trim();
2568
- if (newCategory === '_custom_') {
2569
- newCategory = $('#subflow-input-custom-category').val().trim();
2570
- if (newCategory === '') {
2571
- newCategory = editing_node.category;
2572
- }
2573
- }
2574
- if (newCategory === 'subflows') {
2575
- newCategory = '';
2576
- }
2577
- if (newCategory != editing_node.category) {
2578
- changes['category'] = editing_node.category;
2579
- editing_node.category = newCategory;
2580
- changed = true;
2581
- }
2582
-
2583
- var old_env = editing_node.env;
2584
- var new_env = exportEnvList(
2585
- $('#node-input-env-container').editableList('items')
2586
- );
2587
- if (!isSameEnv(old_env, new_env)) {
2588
- editing_node.env = new_env;
2589
- changes.env = editing_node.env;
2590
- changed = true;
2591
- }
2592
-
2593
- RED.palette.nodes.refresh();
2594
-
2595
- if (changed) {
2596
- var wasChanged = editing_node.changed;
2597
- editing_node.changed = true;
2598
- validateNode(editing_node);
2599
- var subflowInstances = [];
2600
- RED.nodes.eachNode(function (n) {
2601
- if (n.type == 'subflow:' + editing_node.id) {
2602
- subflowInstances.push({
2603
- id: n.id,
2604
- changed: n.changed,
2605
- });
2606
- n.changed = true;
2607
- n.dirty = true;
2608
- updateNodeProperties(n);
2609
- validateNode(n);
2610
- }
2611
- });
2612
- RED.nodes.dirty(true);
2613
- var historyEvent = {
2614
- t: 'edit',
2615
- node: editing_node,
2616
- changes: changes,
2617
- dirty: wasDirty,
2618
- changed: wasChanged,
2619
- subflow: {
2620
- instances: subflowInstances,
2621
- },
2622
- };
2623
-
2624
- RED.history.push(historyEvent);
2625
- }
2626
- editing_node.dirty = true;
2627
- RED.tray.close();
2628
- },
2629
- },
2630
- ],
2631
- resize: function (size) {
2632
- $('.editor-tray-content').height(size.height - 50);
2633
- // var form = $(".editor-tray-content form").height(size.height - 50 - 40);
2634
- var rows = $('#dialog-form>div:not(.node-input-env-container-row)');
2635
- var height = size.height;
2636
- for (var i = 0; i < rows.size(); i++) {
2637
- height -= $(rows[i]).outerHeight(true);
2638
- }
2639
- var editorRow = $('#dialog-form>div.node-input-env-container-row');
2640
- height -=
2641
- parseInt(editorRow.css('marginTop')) +
2642
- parseInt(editorRow.css('marginBottom'));
2643
- $('#node-input-env-container').editableList('height', height - 80);
2644
- },
2645
- open: function (tray) {
2646
- var trayFooter = tray.find('.editor-tray-footer');
2647
- var trayBody = tray.find('.editor-tray-body');
2648
- trayBody.parent().css('overflow', 'hidden');
2649
-
2650
- if (editing_node) {
2651
- RED.sidebar.info.refresh(editing_node);
2652
- }
2653
-
2654
- var editorTabEl = $('<ul></ul>').appendTo(trayBody);
2655
- var editorContent = $('<div></div>').appendTo(trayBody);
2656
-
2657
- var editorTabs = RED.tabs.create({
2658
- element: editorTabEl,
2659
- onchange: function (tab) {
2660
- editorContent.children().hide();
2661
- if (tab.onchange) {
2662
- tab.onchange.call(tab);
2663
- }
2664
- tab.content.show();
2665
- if (finishedBuilding) {
2666
- RED.tray.resize();
2667
- }
2668
- },
2669
- collapsible: true,
2670
- });
2671
-
2672
- var nodePropertiesTab = {
2673
- id: 'editor-tab-properties',
2674
- label: 'Properties',
2675
- name: 'Properties',
2676
- content: $('<div>', { class: 'editor-tray-content' })
2677
- .appendTo(editorContent)
2678
- .hide(),
2679
- iconClass: 'fa fa-cog',
2680
- };
2681
- buildEditForm(
2682
- nodePropertiesTab.content,
2683
- 'dialog-form',
2684
- 'subflow-template',
2685
- undefined,
2686
- editing_node
2687
- );
2688
- editorTabs.addTab(nodePropertiesTab);
2689
-
2690
- var descriptionTab = {
2691
- id: 'editor-tab-description',
2692
- label: 'Description',
2693
- name: 'Description',
2694
- content: $('<div>', { class: 'editor-tray-content' })
2695
- .appendTo(editorContent)
2696
- .hide(),
2697
- iconClass: 'fa fa-file-text-o',
2698
- onchange: function () {
2699
- subflowEditor.focus();
2700
- },
2701
- };
2702
- editorTabs.addTab(descriptionTab);
2703
- subflowEditor = buildDescriptionForm(
2704
- descriptionTab.content,
2705
- editing_node
2706
- );
2707
-
2708
- var appearanceTab = {
2709
- id: 'editor-tab-appearance',
2710
- label: 'Apperance',
2711
- name: 'Apperance',
2712
- content: $('<div>', { class: 'editor-tray-content' })
2713
- .appendTo(editorContent)
2714
- .hide(),
2715
- iconClass: 'fa fa-object-group',
2716
- onchange: function () {
2717
- refreshLabelForm(this.content, editing_node);
2718
- },
2719
- };
2720
- buildAppearanceForm(appearanceTab.content, editing_node);
2721
- editorTabs.addTab(appearanceTab);
2722
-
2723
- $('#subflow-input-name').val(subflow.name);
2724
- RED.text.bidi.prepareInput($('#subflow-input-name'));
2725
-
2726
- $('#subflow-input-category').empty();
2727
- var categories = RED.palette.nodes.getCategories();
2728
- categories.sort(function (A, B) {
2729
- return A.label.localeCompare(B.label);
2730
- });
2731
- categories.forEach(function (cat) {
2732
- $('#subflow-input-category').append(
2733
- $('<option></option>').val(cat.id).text(cat.label)
2734
- );
2735
- });
2736
- $('#subflow-input-category').append(
2737
- $('<option></option>').attr('disabled', true).text('---')
2738
- );
2739
- $('#subflow-input-category').append(
2740
- $('<option></option>')
2741
- .val('_custom_')
2742
- .text('Add new...')
2743
- );
2744
-
2745
- $('#subflow-input-category').change(function () {
2746
- var val = $(this).val();
2747
- if (val === '_custom_') {
2748
- $('#subflow-input-category').width(120);
2749
- $('#subflow-input-custom-category').show();
2750
- } else {
2751
- $('#subflow-input-category').width(250);
2752
- $('#subflow-input-custom-category').hide();
2753
- }
2754
- });
2755
-
2756
- $('#subflow-input-category').val(subflow.category || 'subflows');
2757
- var userCount = 0;
2758
- var subflowType = 'subflow:' + editing_node.id;
2759
-
2760
- RED.nodes.eachNode(function (n) {
2761
- if (n.type === subflowType) {
2762
- userCount++;
2763
- }
2764
- });
2765
- $('#subflow-dialog-user-count')
2766
- .text(`There is ${userCount} instance of this subflow template`)
2767
- .show();
2768
-
2769
- // trayBody.i18n();
2770
- finishedBuilding = true;
2771
- },
2772
- close: function () {
2773
- if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
2774
- RED.view.state(RED.state.DEFAULT);
2775
- }
2776
- RED.sidebar.info.refresh(editing_node);
2777
- RED.workspaces.refresh();
2778
- subflowEditor.destroy();
2779
- subflowEditor = null;
2780
- editStack.pop();
2781
- editing_node = null;
2782
- },
2783
- show: function () {},
2784
- };
2785
- RED.tray.show(trayOptions);
2786
- }
2787
-
2788
- function showTypeEditor(type, options) {
2789
- if (customEditTypes.hasOwnProperty(type)) {
2790
- if (editStack.length > 0) {
2791
- options.parent = editStack[editStack.length - 1].id;
2792
- }
2793
- editStack.push({ type: type });
2794
- options.title = options.title || getEditStackTitle();
2795
- options.onclose = function () {
2796
- editStack.pop();
2797
- };
2798
- customEditTypes[type].show(options);
2799
- } else {
2800
- console.log('Unknown type editor:', type);
2801
- }
2802
- }
2803
-
2804
- function createEditor(options) {
2805
- var el = options.element || $('#' + options.id)[0];
2806
- var toolbarRow = $('<div>').appendTo(el);
2807
- el = $('<div>').appendTo(el).addClass('node-text-editor-container')[0];
2808
- var editor = ace.edit(el);
2809
- editor.setTheme('ace/theme/tomorrow');
2810
- var session = editor.getSession();
2811
-
2812
- session.on('changeAnnotation', function () {
2813
- var annotations = session.getAnnotations() || [];
2814
- var i = annotations.length;
2815
- var len = annotations.length;
2816
- while (i--) {
2817
- if (/doctype first\. Expected/.test(annotations[i].text)) {
2818
- annotations.splice(i, 1);
2819
- } else if (
2820
- /Unexpected End of file\. Expected/.test(annotations[i].text)
2821
- ) {
2822
- annotations.splice(i, 1);
2823
- }
2824
- }
2825
- if (len > annotations.length) {
2826
- session.setAnnotations(annotations);
2827
- }
2828
- });
2829
- if (options.mode) {
2830
- session.setMode(options.mode);
2831
- }
2832
- if (options.foldStyle) {
2833
- session.setFoldStyle(options.foldStyle);
2834
- } else {
2835
- session.setFoldStyle('markbeginend');
2836
- }
2837
- if (options.options) {
2838
- editor.setOptions(options.options);
2839
- } else {
2840
- editor.setOptions({
2841
- enableBasicAutocompletion: true,
2842
- enableSnippets: true,
2843
- tooltipFollowsMouse: false,
2844
- });
2845
- }
2846
- if (options.readOnly) {
2847
- editor.setOption('readOnly', options.readOnly);
2848
- editor.container.classList.add('ace_read-only');
2849
- }
2850
- if (options.hasOwnProperty('lineNumbers')) {
2851
- editor.renderer.setOption('showGutter', options.lineNumbers);
2852
- }
2853
- editor.$blockScrolling = Infinity;
2854
- if (options.value) {
2855
- session.setValue(options.value, -1);
2856
- }
2857
- if (options.globals) {
2858
- setTimeout(function () {
2859
- if (!!session.$worker) {
2860
- session.$worker.send('setOptions', [
2861
- {
2862
- globals: options.globals,
2863
- esversion: 6,
2864
- sub: true,
2865
- asi: true,
2866
- maxerr: 1000,
2867
- },
2868
- ]);
2869
- }
2870
- }, 100);
2871
- }
2872
- if (options.mode === 'ace/mode/markdown') {
2873
- $(el).addClass('node-text-editor-container-toolbar');
2874
- if (options.toolbar === false ){
2875
- // do not show the toolbar
2876
- } else {
2877
- editor.toolbar = customEditTypes['_markdown'].buildToolbar(
2878
- toolbarRow,
2879
- editor
2880
- );
2881
- }
2882
-
2883
-
2884
- if (options.expandable !== false) {
2885
- // var previewButton = $(
2886
- // '<button type="button" class="editor-button md-option" style="float: right; outline: none">Preview</button>'
2887
- // ).appendTo(editor.toolbar);
2888
-
2889
- // previewButton.click(function (e) {
2890
- // e.preventDefault();
2891
- // let $this = $(e.currentTarget); // handle to the preview button
2892
- // $('.node-text-editor-preview').html(marked(editor.getValue()));
2893
- // clickPreview($this);
2894
- // });
2895
- }
2896
- // var helpButton = $(
2897
- // '<button type="button" class="node-text-editor-help editor-button editor-button-small"><i class="fa fa-question"></i></button>'
2898
- // ).appendTo($(el).parent());
2899
- // RED.popover.create({
2900
- // target: helpButton,
2901
- // trigger: 'click',
2902
- // size: 'small',
2903
- // direction: 'left',
2904
- // content: 'Formatted with markdown',
2905
- // autoClose: 50,
2906
- // });
2907
- }
2908
- if (options.onChange){
2909
- session.on("change", function(delta){
2910
- options.onChange(delta);
2911
- })
2912
- }
2913
- return editor;
2914
- }
2915
-
2916
- function clickPreview(previewButton) {
2917
- let previewShow = previewButton.hasClass('buttonSelected');
2918
- if (previewShow) {
2919
- // editor part
2920
- $('.node-text-editor-row').height('100%');
2921
- $('.node-text-editor-container').show();
2922
- // $('.node-text-editor-help').show(); -- this is the question mark on the bottom right. No need for the time being
2923
-
2924
- // preview part
2925
- $('.node-text-editor-preview').hide();
2926
-
2927
- // toolbar part
2928
- $('.md-option').show();
2929
- previewButton.html('Preview');
2930
- previewButton.removeClass('buttonSelected');
2931
- } else {
2932
- // editor part
2933
- $('.node-text-editor-row').height('35px'); // hack to show only the toolbar, but hiding the rest of the editor.
2934
- $('.node-text-editor-container').hide();
2935
- $('.node-text-editor-help').hide();
2936
-
2937
- // preview part
2938
- $('.node-text-editor-preview').show();
2939
-
2940
- // toolbar part
2941
- $('.md-option').hide();
2942
- previewButton.html('Hide Preview');
2943
- previewButton.addClass('buttonSelected');
2944
- }
2945
- }
2946
-
2947
- return {
2948
- init: function () {
2949
- RED.tray.init();
2950
- RED.actions.add('core:confirm-edit-tray', function () {
2951
- // console.log('[editor] core:confirm-editor-tray -- invoked!!!')
2952
- $('#node-dialog-ok').click();
2953
- $('#node-config-dialog-ok').click();
2954
- });
2955
- RED.actions.add('core:cancel-edit-tray', function () {
2956
- $('#node-dialog-cancel').click();
2957
- $('#node-config-dialog-cancel').click();
2958
- });
2959
- },
2960
- edit: showEditDialog,
2961
- editConfig: showEditConfigNodeDialog,
2962
- editSubflow: showEditSubflowDialog,
2963
- editJavaScript: function (options) {
2964
- showTypeEditor('_js', options);
2965
- },
2966
- editExpression: function (options) {
2967
- showTypeEditor('_expression', options);
2968
- },
2969
- editJSON: function (options) {
2970
- showTypeEditor('_json', options);
2971
- },
2972
- editMarkdown: function (options) {
2973
- showTypeEditor('_markdown', options);
2974
- },
2975
- editBuffer: function (options) {
2976
- showTypeEditor('_buffer', options);
2977
- },
2978
- editText: function(options){
2979
- showTypeEditor('_string', options);
2980
- },
2981
- buildEditForm: buildEditForm,
2982
- validateNode: validateNode,
2983
- updateNodeProperties: updateNodeProperties, // TODO: only exposed for edit-undo
2984
-
2985
- /**
2986
- * Show a type editor.
2987
- * @param {string} type - the type to display
2988
- * @param {object} options - options for the editor
2989
- * @function
2990
- * @memberof RED.editor
2991
- */
2992
- showTypeEditor: showTypeEditor,
2993
-
2994
- /**
2995
- * Register a type editor.
2996
- * @param {string} type - the type name
2997
- * @param {object} options - the editor definition
2998
- * @function
2999
- * @memberof RED.editor
3000
- */
3001
- registerTypeEditor: function (type, definition) {
3002
- customEditTypes[type] = definition;
3003
- },
3004
-
3005
- /**
3006
- * Create a editor ui component
3007
- * @param {object} options - the editor options
3008
- * @function
3009
- * @memberof RED.editor
3010
- */
3011
- createEditor: createEditor,
3012
-
3013
- getLatestNodeSelected: getLatestNodeSelected,
3014
-
3015
- notifyChanges: notifyChanges,
3016
-
3017
- resetEditor: resetEditor,
3018
- forceNotifyChanges: forceNotifyChanges
3019
-
3020
- };
3021
- })();