Compare commits

...

275 Commits

Author SHA1 Message Date
Nick O'Leary
2feb290ae3
Merge pull request #5060 from gorenje/patch-3
Add .editorconfig to .gitignore
2025-02-25 09:57:04 +00:00
Nick O'Leary
45bcb74dae
Merge pull request #5062 from GogoVega/tab-config-changed-badge
Add the `changed` badge to the config node
2025-02-25 09:55:45 +00:00
GogoVega
6da890bf88
Manage badge locations with pure CSS + cleanup 2025-02-24 21:09:44 +01:00
GogoVega
b8eeef182c
Add changed badge for category header + fix cropped badge 2025-02-24 21:09:11 +01:00
GogoVega
54e0de64a7
Add the changed badge for the config node 2025-02-24 21:08:43 +01:00
Gerrit Riessen
3bd1b58217
Add .editorconfig to .gitignore
I use [EditorConfig](https://editorconfig.org/) to adjust my editor settings for indentation.

My settings should probably be best ignored, unless there is a desire to have a project wide .editorconfig
2025-02-24 19:01:17 +01:00
Nick O'Leary
71f8de94b0
Merge pull request #5056 from gorenje/master
Support text drag & drop into markdown editor
2025-02-24 16:26:19 +00:00
Nick O'Leary
4723378f2f
Merge pull request #5054 from GogoVega/deployment-ignore-disabled
Ignore state of disabled nodes/flows during deployment
2025-02-24 16:11:55 +00:00
Nick O'Leary
8837597ff5
Merge pull request #5053 from matiseni51/fix-include-label-themeSettings-config
fix: set label in themeSettings.deployButton despite type attribute
2025-02-24 16:08:47 +00:00
Gerrit Riessen
473b93f497
Support text drag & drop into markdown editor
Along with image drop, this change adds text drop into the editor. 

This is useful for highlighting text and then drag that text into the description of a node. Similar creating a mermaid diagram using a third-party tool and then drag the text into the description.

Also drop text files is also supported for longer texts.
2025-02-20 09:30:50 +01:00
GogoVega
d9c5144fe2
Ignore state of disabled nodes/flows during deployment 2025-02-17 14:05:51 +01:00
matiseni51
cbc91a9ac8
Merge branch 'master' into fix-include-label-themeSettings-config 2025-02-16 14:03:24 +01:00
matiseni51
88c946d401 fix: set label in themeSettings.deployButton despite type attribute 2025-02-16 13:44:22 +01:00
Nick O'Leary
ff565bacb4
Merge pull request #5052 from node-red/rel409
Update for 4.0.9
2025-02-14 17:07:27 +00:00
Nick O'Leary
e55301c073
Update for 4.0.9 2025-02-14 17:03:13 +00:00
Nick O'Leary
dc69226944
Merge pull request #5050 from aikitori/mqtt-update-translation
Add details for the dynamic subscription to match the English docs
2025-02-14 16:27:12 +00:00
Nick O'Leary
bf6b18b8a6
Merge pull request #5051 from GogoVega/typedInput-tooltip
Fix tooltip snapping based on `typedInput` type
2025-02-14 16:26:52 +00:00
GogoVega
e1b591d761
Fix tooltip snapping based on input type 2025-02-13 13:59:06 +01:00
aikitori
27463197cd
Add details for the dynamic subscription to match the English documentation 2025-02-13 08:55:10 +01:00
Nick O'Leary
854460db56
Merge pull request #5049 from node-red/Steve-Mcl-patch-1
Prevent symbol usage warning in monaco
2025-02-12 17:02:49 +00:00
Stephen McLaughlin
4984af48f1
Update monaco.js for symbol error 2025-02-12 09:42:55 +00:00
Nick O'Leary
e9dab46de8
Merge pull request #5025 from node-red/browse-subflow-flow-context
Show subflow flow context under node section of sidebar
2025-02-10 16:51:55 +00:00
Nick O'Leary
4605f01c5d
Merge pull request #5030 from matiseni51/add-editorTheme-custom-label-default-deploy-button
feat: Add custom label for default deploy button in settings.editorTheme
2025-02-10 16:51:45 +00:00
Nick O'Leary
a0ddf96e03
Merge pull request #5042 from node-red/5028-improve-auto-complete-long-keys
Handle long auto-complete suggests
2025-02-10 16:51:31 +00:00
Nick O'Leary
16d25b9d41
Merge pull request #5043 from node-red/5036-fix-undefined-username
Handle undefined username when generating user icon
2025-02-10 16:51:20 +00:00
Nick O'Leary
77c4ccf8fb
Handle undefined username when generating user icon
Fixes #5036
2025-02-10 16:41:18 +00:00
Nick O'Leary
7d9e09f5a7
Handle long auto-complete suggests
Fixes #5028
2025-02-10 16:23:13 +00:00
matiseni51
f4c184af4d
Merge branch 'master' into add-editorTheme-custom-label-default-deploy-button 2025-02-03 20:52:23 +01:00
Nick O'Leary
9694c8bdfa
Merge pull request #5027 from node-red/5026-fix-splice-group-add
Handle dragging node into group and splicing link at same time
2025-02-03 16:04:33 +00:00
matiseni51
ca61efc986 feat: Add custom label for default deploy button in settings.editorTheme 2025-02-01 11:44:57 +01:00
Nick O'Leary
ffdbd94927
Handle dragging node into group and splicing link at same time
Fixes #5026
2025-01-29 14:22:44 +00:00
Nick O'Leary
43df2318d4
Show subflow flow context under node section of sidebar 2025-01-27 16:36:57 +00:00
Nick O'Leary
21612a5215
Merge pull request #5021 from node-red/5008-remember-context-tree-state
Remember context sidebar tree state when refreshing
2025-01-27 15:58:43 +00:00
Nick O'Leary
756485e308
Merge pull request #5023 from node-red/5010-update-instance-envvars
Update sf instance env vars when removed from template
2025-01-27 15:58:30 +00:00
Nick O'Leary
efbe38f509
Merge pull request #5022 from node-red/5020-quick-add-group-select
Do not select group when triggering quick-add within it
2025-01-27 15:58:17 +00:00
Nick O'Leary
daa76e6e5f
Update sf instance env vars when removed from template 2025-01-22 10:25:24 +00:00
Nick O'Leary
48d2d269a5
Do not select group when triggering quick-add within it 2025-01-21 16:15:13 +00:00
Nick O'Leary
13cac1b5ef
Remember context sidebar tree state when refreshing
Closes #5008
2025-01-21 13:56:44 +00:00
Nick O'Leary
479b7e756d
Merge pull request #5016 from node-red/5009-fix-env-context-access
Allow env var access to context
2025-01-20 11:32:55 +00:00
Nick O'Leary
503ef62cf5
Merge pull request #5018 from node-red/fix-debug-status-if-null
fix debug status reporting if null
2025-01-20 11:32:43 +00:00
Nick O'Leary
b355a37378
Merge pull request #5017 from node-red/5004-icon-fix-2
Fix library icon handling within library browser component
2025-01-20 11:32:05 +00:00
Dave Conway-Jones
1acc16c9ef
fix debug status reporting if null 2025-01-19 10:57:58 +00:00
Nick O'Leary
4cbf672b26
Fix library icon handling within library browser component
Closes #5004
2025-01-17 17:07:58 +00:00
Nick O'Leary
272355a48e
Merge pull request #5014 from node-red/5013-switch-call-stack-fix
Avoid exceeding call stack when draining message group in Switch
2025-01-17 16:48:17 +00:00
Nick O'Leary
e2981f2970
Allow env var access to context 2025-01-17 16:45:44 +00:00
Nick O'Leary
804551000a
Merge pull request #5015 from node-red/fix-nodemon
Fix grunt dev via better ndoemon ignore rules
2025-01-15 14:43:08 +00:00
Nick O'Leary
254b6a1e23
Fix grunt dev via better ndoemon ignore rules 2025-01-15 10:32:10 +00:00
Nick O'Leary
3838e4e605
Merge pull request #5007 from natcl/patch-7
Fix typo in CHANGELOG (4.0.7-->4.0.8)
2025-01-13 16:44:29 +00:00
Nick O'Leary
953b7584a3
Avoid exceeding call stack when draining message group in Switch
Fixes #5013
2025-01-13 16:37:35 +00:00
Nathanaël Lécaudé
3da22882e9
Fix typo in CHANGELOG (4.0.7-->4.0.8) 2025-01-07 11:30:35 -05:00
Nick O'Leary
1e8f840993
Merge pull request #5001 from node-red/rel408
Bump for 4.0.8
2024-12-20 11:12:47 +00:00
Nick O'Leary
4845a1f7eb
Bump for 4.0.8 2024-12-20 11:06:08 +00:00
Nick O'Leary
a0952d9a07
Merge pull request #5000 from node-red/fix-config-node-import
Fix config node sort order when importing
2024-12-20 11:04:58 +00:00
Nick O'Leary
7fa4e60c82
Fix config node sort order when importing 2024-12-20 09:54:13 +00:00
Nick O'Leary
30eead76e6
Merge pull request #4998 from node-red/rel407
Bump for 4.0.7
2024-12-18 10:27:56 +00:00
Nick O'Leary
100e5244c8
Bump for 4.0.7 2024-12-17 17:08:56 +00:00
Nick O'Leary
ed0399b855
Merge pull request #4997 from GogoVega/fix-def-import
Fix def can be undefined if the type is missing
2024-12-17 17:04:52 +00:00
Nick O'Leary
27e9c18a4e
Merge pull request #4995 from GogoVega/fix-4994
Fix the user list of nested config node
2024-12-17 17:01:41 +00:00
GogoVega
c6895713ed
Fix def can be undefined if the type is missing 2024-12-17 17:57:01 +01:00
Nick O'Leary
965ca97ad1
Merge pull request #4993 from node-red/login-prompt
Support custom login message and button
2024-12-17 16:40:03 +00:00
GogoVega
7785ce0dc0
Fix the user list of nested config node 2024-12-17 15:36:51 +01:00
Nick O'Leary
1a47e2fc76
Fix login image auth setting 2024-12-16 17:09:31 +00:00
Nick O'Leary
b7e96ce6bc
Support custom login message and button 2024-12-16 16:58:13 +00:00
Nick O'Leary
7a3741165b
Merge pull request #4990 from node-red/rel406
Update for 4.0.6
2024-12-16 13:56:46 +00:00
Nick O'Leary
e9d5d20e2d
Update for 4.0.6 2024-12-16 11:35:14 +00:00
Nick O'Leary
867a6ad2da
Merge pull request #4975 from node-red/gg-changes
Roll up various fixes on config node change history
2024-12-16 11:29:11 +00:00
Nick O'Leary
03507c2a1f
Merge pull request #4949 from AGhorab-upland/master
Add qoutes when installing local tgz to fix spacing in the file path
2024-12-16 09:44:28 +00:00
Nick O'Leary
aa79aa5479
Merge pull request #4982 from node-red/4977-fix-csv-sep
Ensure node.sep is honoured when generating CSV
2024-12-16 09:16:29 +00:00
Steve-Mcl
16005a462d update tests to check msg.columns is strictly RFC compliant 2024-12-12 16:44:16 +00:00
Steve-Mcl
82c756b091 add test for correct CSV output when separator in non-comma 2024-12-12 16:43:38 +00:00
Steve-Mcl
b139eb4a18 update CSV to adhere to strict rfc compliance on msg.columns 2024-12-12 16:42:11 +00:00
Steve-Mcl
6af3c8c2a9 revert changes to csv parser 2024-12-12 16:41:26 +00:00
Steve-Mcl
2c3fbb1467 revert changes to legacy mode 2024-12-12 16:40:43 +00:00
Stephen McLaughlin
01716119e6
Merge branch 'master' into 4977-fix-csv-sep 2024-12-12 10:26:24 +00:00
Nick O'Leary
a50a37ac26
Merge pull request #4983 from node-red/gg-changes-2
Rework saving of credentials to undo history
2024-12-10 15:43:08 +00:00
Nick O'Leary
11c4277466
Update packages/node_modules/@node-red/editor-client/src/js/ui/editor.js
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-10 15:42:59 +00:00
Nick O'Leary
7d284ce157
Update packages/node_modules/@node-red/editor-client/src/js/ui/editor.js
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-10 15:42:42 +00:00
Nick O'Leary
aa1d5ad06b
Merge pull request #4987 from node-red/update-deps-3
Update dependencies
2024-12-10 15:34:14 +00:00
Nick O'Leary
00a3010933
Update dependencies 2024-12-10 15:25:23 +00:00
Dave Conway-Jones
56a4530ec6
Fix delay node not dropping when nodeMessageBufferMaxLength is set (#4973)
* Fix delay node not dropping when nodeMessageBufferMaxLength is set

to close #4966

* Rmove redundant codes

* Tidy up code removal

---------

Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-12-06 22:22:37 +00:00
Nick O'Leary
89e40a0b8f
Rework saving of credentials to undo history 2024-12-06 16:15:37 +00:00
Nick O'Leary
66bd1feb47
Apply suggestions from code review
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-06 13:45:48 +00:00
Nick O'Leary
b419e2e303
Merge branch 'master' into master 2024-12-05 16:32:19 +00:00
Nick O'Leary
dae4ba8044
Merge pull request #4964 from node-red/4962-import-warning-tidy
Validate json dropped into editor to avoid unhelpful error messages
2024-12-05 16:31:33 +00:00
Nick O'Leary
fe22afea6a
Merge pull request #4974 from node-red/4969-fix-junction-insert-location
Fix junction insert position via context menu
2024-12-05 16:23:51 +00:00
Nick O'Leary
69753a9940
Merge pull request #4981 from node-red/4978-zoom-annotation-fix
Apply zoom scale when calculating annotation positions
2024-12-05 16:23:36 +00:00
Nick O'Leary
f6e565ba04
Merge pull request #4980 from braincube-io/feat/fadoli/MakeFileReadFast
Performance : make reading single buffer / string file faster by not re-allocating and handling huge buffers
2024-12-05 16:17:52 +00:00
Nick O'Leary
e4fdf24545
Ensure node.sep is honoured when generating CSV 2024-12-05 16:00:54 +00:00
Nick O'Leary
43a9a3c3b1
Apply zoom scale when calculating annotation positions
Fixes #4978
2024-12-05 15:34:24 +00:00
Franck
bfd98aaf22 PERF : make single buffer / string file reading faster 2024-12-05 12:24:22 +01:00
Nick O'Leary
4e61c54be5
Update packages/node_modules/@node-red/editor-client/src/js/ui/editor.js
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-04 15:49:39 +00:00
Nick O'Leary
39a85c721d
Update packages/node_modules/@node-red/editor-client/src/js/history.js 2024-12-04 13:10:48 +00:00
Nick O'Leary
f9877f8d0b
Update packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-04 10:41:27 +00:00
Nick O'Leary
92dff4bacd
Apply suggestions from code review
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-04 10:41:10 +00:00
Nick O'Leary
338ddf17de
Update packages/node_modules/@node-red/editor-client/src/js/nodes.js
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-04 09:55:09 +00:00
Nick O'Leary
4e6c8ea367
Merge pull request #4947 from GogoVega/fix-conf-type-env
Handle subflow node as user of config nodes
2024-12-03 17:21:57 +00:00
Nick O'Leary
5f92bc83fd
Merge branch 'gg-changes' into fix-conf-type-env 2024-12-03 17:21:24 +00:00
Nick O'Leary
5e429f3be0
Merge pull request #4819 from GogoVega/validate-users-in-history
Validate user nodes into history when editing a config node
2024-12-03 17:14:32 +00:00
Nick O'Leary
2a71175cd4
Merge pull request #4807 from GogoVega/fix-user-count
Fix the config node users count
2024-12-03 17:14:20 +00:00
Nick O'Leary
aee531bf16
Update packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js
Co-authored-by: Gauthier Dandele <92022724+GogoVega@users.noreply.github.com>
2024-12-03 17:14:04 +00:00
Nick O'Leary
2c99909353
Merge pull request #4808 from GogoVega/fix-invalid-outputs
Fix a node with an invalid number of outputs
2024-12-03 14:56:46 +00:00
Nick O'Leary
50e821d5d7
Merge pull request #4793 from GogoVega/fix-creds-props-pane
Fix save and history of credentials for panes
2024-12-03 14:56:02 +00:00
Nick O'Leary
06f3f3c0be
Merge branch 'gg-changes' into validate-users-in-history 2024-12-03 14:54:50 +00:00
Nick O'Leary
0b09cf5fa9
Update packages/node_modules/@node-red/editor-client/src/js/nodes.js 2024-12-03 14:51:32 +00:00
Nick O'Leary
93102837dd
Merge pull request #4797 from GogoVega/config-node-history
Add config node to `RED.history` and handle `changed` prop
2024-12-03 14:48:23 +00:00
Nick O'Leary
e8d81d814c
Apply scaleFactor when calculating junction slice positions 2024-12-03 10:15:59 +00:00
Nick O'Leary
f6cf051282
Fix junction insert position via context menu 2024-12-02 17:03:14 +00:00
AGhorab-upland
328390c2a9
Merge branch 'master' into master 2024-11-26 21:11:33 +02:00
GogoVega
6194285b6e
Add a guard to check if wires exist 2024-11-25 21:07:42 +01:00
Nick O'Leary
84a2fbed2e
Merge pull request #4811 from GogoVega/handle-bad-subflow
Handle the import of an incomplete Subflow
2024-11-25 16:49:32 +00:00
Nick O'Leary
5ce3cdb845
Merge branch 'master' into handle-bad-subflow 2024-11-25 16:27:41 +00:00
Nick O'Leary
3e0b5f2fe8
Merge pull request #4809 from GogoVega/fix-subflow-name
Fix updating the Subflow name during a copy
2024-11-25 16:22:31 +00:00
Nick O'Leary
94e3fdd7a9
Validate json dropped into editor to avoid unhelpful error messages
Fixes #4962
2024-11-18 17:12:28 +00:00
Nick O'Leary
69b413040f
Merge pull request #4963 from node-red/rename-var
Rename variable to avoid confusion in view.js
2024-11-18 16:39:52 +00:00
Nick O'Leary
ffecf86281
Merge pull request #4960 from GogoVega/fix-4942
Get the env config node from the parent subflow
2024-11-18 16:39:37 +00:00
Nick O'Leary
4cb3ccc984
Rename variable to avoid confusion in view.js 2024-11-18 16:20:58 +00:00
Nick O'Leary
47e1389548
Merge pull request #4959 from hungtcs/master
Change groups.length to groups.size
2024-11-18 16:18:27 +00:00
GogoVega
6d6e6fa416
Get the env config node from the parent subflow 2024-11-15 14:30:47 +01:00
鸿则
ad615a76c8
Change groups.length to groups.size
Fix wrong length attribute of Set
2024-11-14 16:31:36 +08:00
Nick O'Leary
e48607c743
Merge pull request #4940 from node-red/Delay-node-not-send-on-reset-if-queue-empty
Make delay node rate limit reset consistent - not send on reset.
2024-11-11 13:49:41 +00:00
Ahmed Ghorab
046d56d692 Add qoutes when installing local tgz to fix spacing in the file path 2024-11-10 13:30:41 +02:00
Nick O'Leary
604c70ec04
Merge pull request #4946 from GogoVega/fix-quickAddDialog
Remove disabled node types from QuickAddDialog list
2024-11-08 13:46:19 +00:00
Gauthier Dandele
59a133cc13
Need to guard against subflows that doesn't have a set property
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-11-08 12:28:40 +01:00
Nick O'Leary
0590d81e80
Merge pull request #4939 from GogoVega/fix-4831
Fix `setModulePendingUpdated` with plugins
2024-11-08 11:26:52 +00:00
GogoVega
c8a02d53e8
Ensure the node added to config node users is the proxy object 2024-11-07 22:06:45 +01:00
GogoVega
deccfdf654
Handle users of env config nodes when undo subflow node changes 2024-11-07 22:00:36 +01:00
GogoVega
f2d72b1050
Handle users of env config nodes when saving subflow node config 2024-11-07 21:59:14 +01:00
GogoVega
3d9bc265dd
Handle users of env config nodes when adding/removing subflow node 2024-11-07 21:58:11 +01:00
GogoVega
abe0b60bf7
Remove disabled node types from QuickAddDialog list 2024-11-06 17:28:51 +01:00
Nick O'Leary
54bf3f4402
Merge pull request #4934 from ersinpw/patch-1
Missing getSubscriptions in the docs while its implemented
2024-11-01 09:06:36 +00:00
Dave Conway-Jones
d3219f0600
do add to queue in case it needs to also be flushed 2024-10-31 17:21:53 +00:00
Nick O'Leary
348ec34446
Merge pull request #4925 from GogoVega/fix-4923
Apply `envVarExcludes` setting to `util.getSetting` into the function node
2024-10-31 17:18:32 +00:00
Dave Conway-Jones
33a5b2527c
Make delay node rate limit reset consistent - not send on reset.
to fix #4830
2024-10-31 17:06:13 +00:00
GogoVega
443492d6eb
Fix setModulePendingUpdated with plugins 2024-10-31 17:12:13 +01:00
Ersin
a7ee31307e
missing getSubscriptions in the docs while its implemented
See:
https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/nodes/core/network/10-mqtt.js#L1288
2024-10-29 13:38:32 +01:00
Gauthier Dandele
f67268b89a
Revert and force getSetting to use the local node
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-10-28 18:01:42 +01:00
Nick O'Leary
42382e1a03
Merge pull request #4932 from GogoVega/fix-envVarList-sortable
Fix `envVar` editable list should be sortable
2024-10-28 16:35:56 +00:00
Nick O'Leary
419dfbf08b
Merge pull request #4915 from node-red/Fix-for-trigger-node-date-handling
Fix trigger node date handling for latest time type input
2024-10-28 16:17:38 +00:00
GogoVega
70aed23ef0
Fix envVarList sortable value 2024-10-28 16:31:36 +01:00
GogoVega
966064328f
Add oneditsave credentials changes to history 2024-10-25 23:33:19 +02:00
GogoVega
83696abf9d
Fixes and improvements with comments 2024-10-25 17:34:51 +02:00
GogoVega
2fd7aee4da
Move envVarExcludes to the top scope 2024-10-24 13:44:40 +02:00
GogoVega
7555e0644f
Apply envVarExcludes setting to RED.util.getSetting into the function node 2024-10-23 12:15:24 +02:00
Nick O'Leary
c363f375b6
Merge pull request #4912 from GogoVega/improve-node-name
Improve the node name auto-generated with the first available number
2024-10-21 16:42:04 +01:00
Nick O'Leary
2220956007
Ensure trigger second output is revaluated for date types 2024-10-21 16:35:11 +01:00
Nick O'Leary
b3aff3a3e6
Ensure trigger node properties work with evaluateNodeProperty 2024-10-21 16:26:03 +01:00
Nick O'Leary
d0ad62a82b
Revert trigger node fix 2024-10-21 16:24:21 +01:00
Dave Conway-Jones
892933ff75
Update 89-trigger_spec.js 2024-10-12 17:22:24 +01:00
Dave Conway-Jones
61fd01b871
And add some tests 2024-10-12 17:09:18 +01:00
Dave Conway-Jones
2eba754801
Fix trigger node date handling for latest time type input
to fix #4914
2024-10-12 16:49:09 +01:00
GogoVega
a7b1ce0cf8
Improve the node name auto-generated with the first available nb 2024-10-10 15:47:42 +02:00
Nick O'Leary
2854351909
Merge pull request #4910 from node-red/rel405
Bump for 4.0.5
2024-10-10 11:11:54 +01:00
Nick O'Leary
fe9354d10b
Bump for 4.0.5 2024-10-10 11:05:08 +01:00
Nick O'Leary
71cfa87303
Merge pull request #4908 from GogoVega/refix-4891
Refix link call node can call out of a subflow
2024-10-10 10:57:51 +01:00
GogoVega
802b116b01
Refix link call node can call out of a subflow 2024-10-10 08:53:33 +02:00
Nick O'Leary
27b54199f5
Merge pull request #4904 from node-red/rel404
Bump for 4.0.4 release
2024-10-09 11:10:29 +01:00
Nick O'Leary
90ea3c15b3
Bump for 4.0.4 release 2024-10-09 10:56:14 +01:00
Nick O'Leary
acd500fe3d
Merge pull request #4893 from node-red/update-deps
Update dev dependencies
2024-10-09 10:30:56 +01:00
Nick O'Leary
8988176c22
Merge pull request #4900 from hardillb/allow-number-user-properties-mqtt
Allow msg.userProperties to have number values
2024-10-09 10:28:55 +01:00
Nick O'Leary
35f35705a5
Merge pull request #4889 from GogoVega/fix-4888
Fix wrong unlock state when event is triggered after deployment
2024-10-09 10:28:17 +01:00
Nick O'Leary
a0033697ea
Update cookie 2024-10-09 10:25:35 +01:00
GogoVega
49a3eded59
Apply code review + add comments
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-10-08 18:10:28 +02:00
Ben Hardill
d50ccea017
Update packages/node_modules/@node-red/nodes/core/network/10-mqtt.js
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-10-08 16:51:09 +01:00
Nick O'Leary
3ef205fb33
Merge pull request #4903 from joebordes/joebordes/i18n_002
i18n(App) update with latest language file changes
2024-10-08 16:49:14 +01:00
Nick O'Leary
b1bfba8b01
Merge pull request #4892 from GogoVega/fix-4891
Fix `link call` node can call out of a subflow
2024-10-08 16:39:19 +01:00
Ben Hardill
21832a0bd0
Merge remote-tracking branch 'refs/remotes/origin/allow-number-user-properties-mqtt' into allow-number-user-properties-mqtt 2024-10-08 13:59:01 +01:00
Ben Hardill
a0b4fc8372
Convert to string 2024-10-08 13:58:29 +01:00
GogoVega
3812ed5ed3
Link call node cannot call a link in a subflow
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-10-07 21:13:13 +02:00
Nick O'Leary
bdb545d6eb
Update dependencies 2024-10-07 16:30:38 +01:00
Joe Bordes
7650620a78 i18n(App) update with latest language file changes 2024-10-04 18:06:01 +02:00
Ben Hardill
34d8b3ed5e
Merge branch 'master' into allow-number-user-properties-mqtt 2024-10-01 16:35:56 +01:00
Ben Hardill
e3acc49d5e
Allow msg.userProperties to have number values
fixes #4899
2024-10-01 16:31:28 +01:00
Nick O'Leary
c3da827222
Merge pull request #4895 from dxdc/patch-1
fix typo: depreciated
2024-09-27 10:40:14 +01:00
Daniel Caspi
1053fc5121
fix typo: depreciated 2024-09-27 04:35:51 -05:00
Nick O'Leary
cec7a86b54
Update dev dependencies 2024-09-27 09:42:07 +01:00
GogoVega
16c49306f3
Fix link call node can call out of a subflow 2024-09-26 19:01:44 +02:00
GogoVega
32540dd0e6
Fix wrong unlock state when event is triggered 2024-09-23 16:16:53 +02:00
Nick O'Leary
a3c5b75368
Merge pull request #4884 from node-red/rel403
Bump for 4.0.3
2024-09-17 15:24:13 +01:00
Nick O'Leary
f7a43f83e5
Bump for 4.0.3 2024-09-17 14:23:43 +01:00
Nick O'Leary
98ca0f163e
Merge pull request #4850 from kazuhitoyokoi/master-fixpagetitle
Refresh page title after changing tab name
2024-09-17 14:19:56 +01:00
Nick O'Leary
5a3e6925e5
Update packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js 2024-09-17 14:15:42 +01:00
Nick O'Leary
d270da74b4
Merge pull request #4853 from kazuhitoyokoi/master-addjpn
Add Japanese translations for v4.0.2 (again)
2024-09-17 13:53:22 +01:00
Nick O'Leary
204e0f636b
Merge pull request #4874 from node-red/update-dependencies
Update dependencies
2024-09-17 13:52:08 +01:00
Nick O'Leary
1132d39118
Merge pull request #4883 from node-red/4881-fix-quickAdd-state
Stay in quick-add mode following context menu insert
2024-09-17 13:51:54 +01:00
Nick O'Leary
f2227c8f65
Merge pull request #4854 from kazuhitoyokoi/master-fixexample
Fix typo in flow example name
2024-09-17 13:49:05 +01:00
Nick O'Leary
55cfd6fa99
Merge pull request #4882 from hardillb/tls-update
Move SNI, ALPN and Verify Server cert out of check
2024-09-17 13:45:18 +01:00
Nick O'Leary
83b30f1c18
Fix linting 2024-09-16 16:45:22 +01:00
Nick O'Leary
aa74d8160a
Stay in quick-add mode following context menu insert
Fixes #4881
2024-09-16 16:39:41 +01:00
Ben Hardill
f44868384e
Move SNI, ALPN and Verify Server cert out of check
This moves the SNI, ALPN and the Verify Server Cert check out
of the check for if the supplied certs/key are actually valid
as these may be still required for correct behaviour.

part of #4877
2024-09-16 11:55:05 +01:00
Nick O'Leary
674eb36e15
Merge pull request #4861 from lobis/master
GitHub: Add citation file to enable "Cite this repository" feature
2024-09-13 15:00:00 +01:00
Nick O'Leary
e6882337c1
Merge pull request #4879 from node-red/fix-link-quick-add
Do not include Junction type in quick-add for virtual links
2024-09-13 14:58:47 +01:00
Nick O'Leary
d48594220e
Merge pull request #4875 from node-red/remove-util-log
Remove use of util.log
2024-09-13 14:58:03 +01:00
Nick O'Leary
64cdee6d36
Update express 2024-09-13 14:57:09 +01:00
Nick O'Leary
a16c72b6a8
Merge pull request #4878 from node-red/4876-mqtt-status
Set status of mqtt nodes to "disconnected" when deregistered from broker
2024-09-13 14:41:16 +01:00
Nick O'Leary
89839f433b
Do not include Junction type in quick-add for virtual links 2024-09-13 14:35:46 +01:00
Steve-Mcl
3597759692 set status of mqtt nodes when deregistered from broker 2024-09-12 14:40:39 +01:00
Nick O'Leary
d4b001a74e
Fix tests for util.log removal 2024-09-11 18:28:35 +01:00
Nick O'Leary
d76b0d39cd
Remove use of util.log 2024-09-11 17:47:26 +01:00
Nick O'Leary
92911f6714
Update tough-cookie 2024-09-11 17:37:50 +01:00
Nick O'Leary
380d3be819
Merge pull request #4845 from node-red/multiplayer-cursor
Multiplayer cursor tracking
2024-09-11 17:13:39 +01:00
Nick O'Leary
6dfc5e0a41
Merge pull request #4869 from node-red/4864-hide-flow-add-options
Hide add-flow options when disabled via editorTheme
2024-09-11 17:13:08 +01:00
Nick O'Leary
d4f18c1731
Merge pull request #4872 from node-red/4863-fix-multi-env-config-select
Fix env-var config select when multiple defined
2024-09-11 17:12:55 +01:00
Nick O'Leary
e5a0d4094f
Merge pull request #4873 from node-red/4858-ensure-mqtt-will-payload-is-string
Ensure will payload is a string
2024-09-11 17:12:40 +01:00
Nick O'Leary
163c1c5b98
Merge pull request #4857 from GogoVega/refix-4749
Fix subflow outbound-link filter
2024-09-11 16:12:30 +01:00
Gauthier Dandele
912a30b28d
Improve the filter to handle all cases + comments
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-09-11 17:02:18 +02:00
Nick O'Leary
de0546b251
Update packages/node_modules/@node-red/nodes/core/network/10-mqtt.js
Co-authored-by: Stephen McLaughlin <44235289+Steve-Mcl@users.noreply.github.com>
2024-09-11 15:23:03 +01:00
Nick O'Leary
1b375b81f3
Merge pull request #4856 from GogoVega/french-translations
Add French translations for v4.0.2
2024-09-11 14:11:57 +01:00
Nick O'Leary
b4bbae247d
Merge branch 'master' into master-addjpn 2024-09-11 14:11:46 +01:00
Nick O'Leary
20ae4a7272
Update dependencies 2024-09-11 13:58:16 +01:00
Nick O'Leary
7f77a414ec
Ensure will payload is a string 2024-09-11 12:10:37 +01:00
Nick O'Leary
2e5a3f4949
Fix env-var config select when multiple defined 2024-09-11 11:28:42 +01:00
Nick O'Leary
593726ecb8
Hide actionList in context menu if disabled 2024-09-11 10:41:23 +01:00
Nick O'Leary
9745904c5b
Remove duplicate key 2024-09-09 16:52:45 +01:00
Nick O'Leary
8c53d95610
Hide add-flow options when disabled via editorTheme 2024-09-09 16:49:17 +01:00
Luis Antonio Obis Aparicio
27604fef23
add citation file 2024-08-31 04:32:01 +02:00
GogoVega
2c4dc3334d
Fix subflow outbound-link filter 2024-08-27 15:46:48 +02:00
GogoVega
1ebb66f6ca
Add French translations for properties in info sidebar 2024-08-18 13:11:56 +02:00
GogoVega
aed9a868ab
Add French translations for batch and join nodes 2024-08-18 12:55:28 +02:00
GogoVega
e6ca3af1ed
Add French translations for Project feature 2024-08-18 12:53:55 +02:00
Kazuhito Yokoi
edc01552f9
Fix invalid property error in range node example (#4855) 2024-08-14 19:42:07 +01:00
Kazuhito Yokoi
b4d29d4d4a Fix typo in flow example name 2024-08-14 00:25:59 +09:00
Kazuhito Yokoi
b5785dab9c Add Japanese translations for v4.0.2 (again) 2024-08-13 23:48:28 +09:00
Nick O'Leary
e67afb2611
Merge pull request #4851 from node-red/4839-fix-moving-link-wires
Fix moving link wires
2024-08-12 19:38:53 +01:00
Nick O'Leary
f88e536ee0
Merge pull request #4844 from node-red/4843-quick-add-placement
Adjust type search dialog position to prevent x-overflow
2024-08-12 19:38:40 +01:00
Nick O'Leary
509d609020
Fix moving link wires 2024-08-12 16:53:23 +01:00
Nick O'Leary
a4ec0f7959
Merge pull request #4838 from lorenz-maurer/lorenz-maurer-patch-1
fix: modulesInUse might be undefined
2024-08-12 09:26:38 +01:00
Nick O'Leary
884c887e0d
Merge pull request #4849 from kazuhitoyokoi/master-addjpn
Add Japanese translations for v4.0.2
2024-08-12 09:18:44 +01:00
Kazuhito Yokoi
e0059943df Add Japanese translations for project feature 2024-08-12 00:19:21 +09:00
Kazuhito Yokoi
d11934beeb Add Japanese translations for batch and join nodes 2024-08-12 00:14:28 +09:00
Nick O'Leary
964271f9c7
Multiplayer: add real-time cursor tracking 2024-08-05 16:18:05 +01:00
Steve-Mcl
97b773d257 Merge branch '4843-quick-add-placement' of github.com:node-red/node-red into 4843-quick-add-placement 2024-08-04 11:38:17 +01:00
Stephen McLaughlin
b6a25518e3
Merge branch 'master' into 4843-quick-add-placement 2024-08-04 11:38:04 +01:00
Steve-Mcl
b62c17f94b use workspace width to contain the search box 2024-08-04 11:34:29 +01:00
Steve-Mcl
886fb45ad2 Adjust type search dialog position to prevent x-overflow
fixes #4843
2024-08-04 11:30:48 +01:00
Lorenz
7b95e64a60
fix: modulesInUse might be undefined 2024-07-22 14:13:09 +02:00
Kazuhito Yokoi
af42664d73 Refresh page title after changing tab name 2024-07-20 13:36:37 +09:00
Nick O'Leary
8af821d380
Merge pull request #4837 from node-red/knolleary-patch-1
Back off node 22.5
2024-07-18 17:22:32 +01:00
Nick O'Leary
97ee6c6745
Back off node 22.5 2024-07-18 17:17:50 +01:00
Nick O'Leary
b5fb15cd9b
Merge pull request #4828 from GogoVega/fix-menu-selection
Fix menu to enable/disable selection when it's a group
2024-07-18 16:36:02 +01:00
Nick O'Leary
998219ae9a
Merge pull request #4829 from node-red/Let-Batch-node-honour-parts-to-close-early
Let batch node terminate "early" if msg.parts set to end of sequence
2024-07-18 16:34:46 +01:00
Nick O'Leary
e8f0f80f65
Merge pull request #4835 from node-red/Fix-Split-Node-Name-Caps
Fix unintentional Capitalisation in Split node name
2024-07-18 16:33:48 +01:00
Dave Conway-Jones
ff35c46d5d
Fix unintentianal Capitalisation in Split node
to close #4832
2024-07-16 14:37:16 +01:00
Dave Conway-Jones
05c924a9df
Let batch node terminate "early" if msg.parts set to end of sequence
(ie index = count -1). Useful to close at end of files etc.
2024-07-04 15:09:55 +01:00
GogoVega
14ac309b6e
Fix menu to enable/disable selection when it's a group 2024-07-02 11:38:56 +02:00
GogoVega
8aec038c24
Remove duplicate type definition 2024-07-01 17:59:28 +02:00
Nick O'Leary
29b128e5e0
Merge pull request #4825 from node-red/rel402
Bump for 4.0.2
2024-07-01 16:49:13 +01:00
Gauthier Dandele
bda9f249bc
Update packages/node_modules/@node-red/editor-client/src/js/nodes.js
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
2024-07-01 17:43:39 +02:00
Nick O'Leary
c0f1581370
Bump for 4.0.2 2024-07-01 16:38:28 +01:00
Nick O'Leary
9420a52ec7
Merge pull request #4818 from bonanitech/header-border
Use a more subtle border on the header
2024-07-01 12:52:09 +01:00
Mauricio Bonani
c113b3de13 Use a not-so-dark color for the header border 2024-07-01 06:18:17 -04:00
Mauricio Bonani
29058c163a
Merge branch 'master' into header-border 2024-07-01 06:14:35 -04:00
Nick O'Leary
bb110ea230
Merge pull request #4824 from GogoVega/improve-french-translations
Improve the editor's French translations
2024-07-01 10:55:33 +01:00
Nick O'Leary
785f220cd8
Merge pull request #4821 from node-red/orphaned-monco-editors
Clean up orphaned editors
2024-07-01 10:48:49 +01:00
GogoVega
16570410a5
Improve French translations 2024-07-01 09:43:42 +02:00
GogoVega
8085eda431
Add missing French translations from v4 2024-06-30 22:27:38 +02:00
Steve-Mcl
6503498f0a Clean up orphaned editors
closes #4820
2024-06-29 18:14:54 +01:00
GogoVega
10ac7fc369
Validate user nodes into history when editing a config node 2024-06-29 16:08:04 +02:00
Nick O'Leary
da787a9993
Merge pull request #4812 from GogoVega/fix-required-prop
Fix node validation if the property is not required
2024-06-28 17:21:40 +01:00
Nick O'Leary
c873b57094
Merge pull request #4815 from node-red/update-cookie-auth
Allow auth cookie name to be customised
2024-06-28 16:58:36 +01:00
Nick O'Leary
93974ccd92
Merge pull request #4816 from node-red/4814-multiplayer-uncaught
Guard against undefined sessions in multiplayer
2024-06-28 16:58:25 +01:00
Nick O'Leary
d7aa792f97
Merge pull request #4817 from node-red/mermaid-caching
Ensure mermaid.min.js is cached properly between loads of the editor
2024-06-28 16:58:14 +01:00
Mauricio Bonani
375fa9da64 Use a more subtle border on the header 2024-06-28 09:51:23 -04:00
Nick O'Leary
28c41e17ad
Ensure mermaid.min.js is cached properly between loads of the editor 2024-06-28 14:37:51 +01:00
Nick O'Leary
da3ad40968
Add more guards for undefined session 2024-06-28 14:19:18 +01:00
GogoVega
2464d9ad95
Check required prop for each case instead of top level 2024-06-28 14:15:51 +02:00
Nick O'Leary
011b47a108
Guard against undefined sessions in multiplayer 2024-06-28 11:41:05 +01:00
Nick O'Leary
ea747711c3
Allow auth cookie name to be customised 2024-06-28 10:24:51 +01:00
GogoVega
19a8fa09a8
Fix node validation if property is not required 2024-06-27 09:16:03 +02:00
GogoVega
bea08706cc
Handle the import of an incomplete Subflow 2024-06-26 22:51:08 +02:00
GogoVega
7950ee1241
Fix updating the subflow name during a copy 2024-06-26 21:16:59 +02:00
GogoVega
a743764345
Fix a node with an invalid number of outputs 2024-06-26 19:42:26 +02:00
GogoVega
cc1c87387b
Fix the config node users count 2024-06-26 19:10:55 +02:00
GogoVega
ed4b98b598
Fix adding users to history if multiple props modified 2024-06-26 09:22:01 +02:00
GogoVega
53e092e484
Add config node to history + handling changed prop 2024-06-25 15:06:58 +02:00
GogoVega
eab512ef22
Fix save and history of credentials for panes 2024-06-24 17:55:23 +02:00
96 changed files with 2261 additions and 907 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ docs
.nyc_output
sync.ffs_db
package-lock.json
.editorconfig

View File

@ -1,4 +0,0 @@
/Gruntfile.js
/.git/*
*.backup
/public/*

View File

@ -1,3 +1,149 @@
#### 4.0.9: Maintenance Release
Editor
- Add details for the dynamic subscription to match the English docs (#5050) @aikitori
- Fix tooltip snapping based on `typedInput` type (#5051) @GogoVega
- Prevent symbol usage warning in monaco (#5049) @Steve-Mcl
- Show subflow flow context under node section of sidebar (#5025) @knolleary
- feat: Add custom label for default deploy button in settings.editorTheme (#5030) @matiseni51
- Handle long auto-complete suggests (#5042) @knolleary
- Handle undefined username when generating user icon (#5043) @knolleary
- Handle dragging node into group and splicing link at same time (#5027) @knolleary
- Remember context sidebar tree state when refreshing (#5021) @knolleary
- Update sf instance env vars when removed from template (#5023) @knolleary
- Do not select group when triggering quick-add within it (#5022) @knolleary
- Fix library icon handling within library browser component (#5017) @knolleary
Runtime
- Allow env var access to context (#5016) @knolleary
- fix debug status reporting if null (#5018) @dceejay
- Fix grunt dev via better ndoemon ignore rules (#5015) @knolleary
- Fix typo in CHANGELOG (4.0.7-->4.0.8) (#5007) @natcl
Nodes
- Switch: Avoid exceeding call stack when draining message group in Switch (#5014) @knolleary
#### 4.0.8: Maintenance Release
Editor
- Fix config node sort order when importing (#5000) @knolleary
#### 4.0.7: Maintenance Release
Editor
- Fix def can be undefined if the type is missing (#4997) @GogoVega
- Fix the user list of nested config node (#4995) @GogoVega
- Support custom login message and button (#4993) @knolleary
#### 4.0.6: Maintenance Release
Editor
- Roll up various fixes on config node change history (#4975) @knolleary
- Add quotes when installing local tgz to fix spacing in the file path (#4949) @AGhorab-upland
- Validate json dropped into editor to avoid unhelpful error messages (#4964) @knolleary
- Fix junction insert position via context menu (#4974) @knolleary
- Apply zoom scale when calculating annotation positions (#4981) @knolleary
- Handle the import of an incomplete Subflow (#4811) @GogoVega
- Fix updating the Subflow name during a copy (#4809) @GogoVega
- Rename variable to avoid confusion in view.js (#4963) @knolleary
- Change groups.length to groups.size (#4959) @hungtcs
- Remove disabled node types from QuickAddDialog list (#4946) @GogoVega
- Fix `setModulePendingUpdated` with plugins (#4939) @GogoVega
- Missing getSubscriptions in the docs while its implemented (#4934) @ersinpw
- Apply `envVarExcludes` setting to `util.getSetting` into the function node (#4925) @GogoVega
- Fix `envVar` editable list should be sortable (#4932) @GogoVega
- Improve the node name auto-generated with the first available number (#4912) @GogoVega
Runtime
- Get the env config node from the parent subflow (#4960) @GogoVega
- Update dependencies (#4987) @knolleary
Nodes
- Performance : make reading single buffer / string file faster by not re-allocating and handling huge buffers (#4980) @Fadoli
- Make delay node rate limit reset consistent - not send on reset. (#4940) @dceejay
- Fix trigger node date handling for latest time type input (#4915) @dceejay
- Fix delay node not dropping when nodeMessageBufferMaxLength is set (#4973)
- Ensure node.sep is honoured when generating CSV (#4982) @knolleary
#### 4.0.5: Maintenance Release
Editor
- Refix link call node can call out of a subflow (#4908) @GogoVega
#### 4.0.4: Maintenance Release
Editor
- Fix `link call` node can call out of a subflow (#4892) @GogoVega
- Fix wrong unlock state when event is triggered after deployment (#4889) @GogoVega
- i18n(App) update with latest language file changes (#4903) @joebordes
- fix typo: depreciated (#4895) @dxdc
Runtime
- Update dev dependencies (#4893) @knolleary
Nodes
- MQTT: Allow msg.userProperties to have number values (#4900) @hardillb
#### 4.0.3: Maintenance Release
Editor
- Refresh page title after changing tab name (#4850) @kazuhitoyokoi
- Add Japanese translations for v4.0.2 (again) (#4853) @kazuhitoyokoi
- Stay in quick-add mode following context menu insert (#4883) @knolleary
- Do not include Junction type in quick-add for virtual links (#4879) @knolleary
- Multiplayer cursor tracking (#4845) @knolleary
- Hide add-flow options when disabled via editorTheme (#4869) @knolleary
- Fix env-var config select when multiple defined (#4872) @knolleary
- Fix subflow outbound-link filter (#4857) @GogoVega
- Add French translations for v4.0.2 (#4856) @GogoVega
- Fix moving link wires (#4851) @knolleary
- Adjust type search dialog position to prevent x-overflow (#4844) @Steve-Mcl
- fix: modulesInUse might be undefined (#4838) @lorenz-maurer
- Add Japanese translations for v4.0.2 (#4849) @kazuhitoyokoi
- Fix menu to enable/disable selection when it's a group (#4828) @GogoVega
Runtime
- Update dependencies (#4874) @knolleary
- GitHub: Add citation file to enable "Cite this repository" feature (#4861) @lobis
- Remove use of util.log (#4875) @knolleary
Nodes
- Fix invalid property error in range node example (#4855)
- Fix typo in flow example name (#4854) @kazuhitoyokoi
- Move SNI, ALPN and Verify Server cert out of check (#4882) @hardillb
- Set status of mqtt nodes to "disconnected" when deregistered from broker (#4878) @Steve-Mcl
- MQTT: Ensure will payload is a string (#4873) @knolleary
- Let batch node terminate "early" if msg.parts set to end of sequence (#4829) @dceejay
- Fix unintentional Capitalisation in Split node name (#4835) @dceejay
#### 4.0.2: Maintenance Release
Editor
- Use a more subtle border on the header (#4818) @bonanitech
- Improve the editor's French translations (#4824) @GogoVega
- Clean up orphaned editors (#4821) @Steve-Mcl
- Fix node validation if the property is not required (#4812) @GogoVega
- Ensure mermaid.min.js is cached properly between loads of the editor (#4817) @knolleary
Runtime
- Allow auth cookie name to be customised (#4815) @knolleary
- Guard against undefined sessions in multiplayer (#4816) @knolleary
#### 4.0.1: Maintenance Release
Editor

7
CITATION.cff Normal file
View File

@ -0,0 +1,7 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "Node-RED"
authors:
- family-names: "OpenJS Foundation"
- family-names: "Contributors"
url: "https://nodered.org"

16
nodemon.json Normal file
View File

@ -0,0 +1,16 @@
{
"ignoreRoot": [
".git",
".nyc_output",
".sass-cache",
"bower-components",
"coverage"
],
"ignore": [
"/Gruntfile.js",
"/.git/*",
"*.backup",
"/public/*"
]
}

View File

@ -1,6 +1,6 @@
{
"name": "node-red",
"version": "4.0.1",
"version": "4.0.9",
"description": "Low-code programming for event-driven applications",
"homepage": "https://nodered.org",
"license": "Apache-2.0",
@ -26,26 +26,26 @@
}
],
"dependencies": {
"acorn": "8.11.3",
"acorn-walk": "8.3.2",
"ajv": "8.14.0",
"acorn": "8.12.1",
"acorn-walk": "8.3.4",
"ajv": "8.17.1",
"async-mutex": "0.5.0",
"basic-auth": "2.0.1",
"bcryptjs": "2.4.3",
"body-parser": "1.20.2",
"body-parser": "1.20.3",
"cheerio": "1.0.0-rc.10",
"clone": "2.1.2",
"content-type": "1.0.5",
"cookie": "0.6.0",
"cookie-parser": "1.4.6",
"cookie": "0.7.2",
"cookie-parser": "1.4.7",
"cors": "2.8.5",
"cronosjs": "1.7.1",
"denque": "2.1.0",
"express": "4.19.2",
"express-session": "1.18.0",
"express": "4.21.2",
"express-session": "1.18.1",
"form-data": "4.0.0",
"fs-extra": "11.2.0",
"got": "12.6.0",
"got": "12.6.1",
"hash-sum": "2.0.0",
"hpagent": "1.2.0",
"https-proxy-agent": "5.0.1",
@ -60,11 +60,11 @@
"memorystore": "1.6.7",
"mime": "3.0.0",
"moment": "2.30.1",
"moment-timezone": "0.5.45",
"moment-timezone": "0.5.46",
"mqtt": "5.7.0",
"multer": "1.4.5-lts.1",
"mustache": "4.2.0",
"node-red-admin": "^4.0.0",
"node-red-admin": "^4.0.1",
"node-watch": "0.7.4",
"nopt": "5.0.0",
"oauth2orize": "1.12.0",
@ -72,11 +72,11 @@
"passport": "0.7.0",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
"raw-body": "2.5.2",
"raw-body": "3.0.0",
"rfdc": "^1.3.1",
"semver": "7.5.4",
"tar": "7.2.0",
"tough-cookie": "4.1.4",
"semver": "7.6.3",
"tar": "7.4.3",
"tough-cookie": "^5.0.0",
"uglify-js": "3.17.4",
"uuid": "9.0.1",
"ws": "7.5.10",
@ -86,10 +86,10 @@
"@node-rs/bcrypt": "1.10.4"
},
"devDependencies": {
"dompurify": "2.4.1",
"dompurify": "2.5.7",
"grunt": "1.6.1",
"grunt-chmod": "~1.1.1",
"grunt-cli": "~1.4.3",
"grunt-cli": "~1.5.0",
"grunt-concurrent": "3.0.0",
"grunt-contrib-clean": "2.0.1",
"grunt-contrib-compress": "2.0.0",
@ -100,7 +100,7 @@
"grunt-contrib-watch": "1.1.0",
"grunt-jsdoc": "2.4.1",
"grunt-jsdoc-to-markdown": "6.0.0",
"grunt-jsonlint": "2.1.3",
"grunt-jsonlint": "3.0.0",
"grunt-mkdir": "~1.1.0",
"grunt-npm-command": "~0.1.2",
"grunt-sass": "~3.1.0",
@ -110,11 +110,11 @@
"jquery-i18next": "1.2.1",
"jsdoc-nr-template": "github:node-red/jsdoc-nr-template",
"marked": "4.3.0",
"mermaid": "^10.4.0",
"mermaid": "11.3.0",
"minami": "1.2.3",
"mocha": "9.2.2",
"node-red-node-test-helper": "^0.3.3",
"nodemon": "2.0.20",
"nodemon": "3.1.7",
"proxy": "^1.0.2",
"sass": "1.62.1",
"should": "13.2.3",

View File

@ -126,6 +126,14 @@ async function login(req,res) {
if (themeContext.login && themeContext.login.image) {
response.image = themeContext.login.image;
}
if (themeContext.login?.message) {
response.loginMessage = themeContext.login?.message
}
if (themeContext.login?.button) {
response.prompts = [
{ type: "button", ...themeContext.login.button }
]
}
}
res.json(response);
}
@ -182,6 +190,10 @@ function genericStrategy(adminApp,strategy) {
maxAge: null,
...settings.httpAdminCookieOptions
}
if (sessionOptions.cookie.name){
sessionOptions.name = sessionOptions.cookie.name
delete sessionOptions.cookie.name
}
}
adminApp.use(session(sessionOptions));
//TODO: all passport references ought to be in ./auth
@ -217,10 +229,10 @@ function genericStrategy(adminApp,strategy) {
adminApp.get('/auth/strategy',
passport.authenticate(strategy.name, {
session:false,
failureMessage: true,
failureRedirect: settings.httpAdminRoot + '?session_message=Login Failed'
failWithError: true,
failureMessage: true
}),
completeGenerateStrategyAuth,
completeGenericStrategyAuth,
handleStrategyError
);
@ -232,14 +244,14 @@ function genericStrategy(adminApp,strategy) {
passport.authenticate(strategy.name, {
session:false,
failureMessage: true,
failureRedirect: settings.httpAdminRoot + '?session_message=Login Failed'
failWithError: true
}),
completeGenerateStrategyAuth,
completeGenericStrategyAuth,
handleStrategyError
);
}
function completeGenerateStrategyAuth(req,res) {
function completeGenericStrategyAuth(req,res) {
var tokens = req.user.tokens;
delete req.user.tokens;
// Successful authentication, redirect home.
@ -249,6 +261,8 @@ function handleStrategyError(err, req, res, next) {
if (res.headersSent) {
return next(err)
}
// Remove the header that passport auto-adds as we don't need it
res.removeHeader('WWW-Authenticate')
log.audit({event: "auth.login.fail.oauth",error:err.toString()});
res.redirect(settings.httpAdminRoot + '?session_message='+err.toString());
}

View File

@ -185,13 +185,12 @@ module.exports = {
}
if (theme.deployButton) {
themeSettings.deployButton = {};
if (theme.deployButton.label) {
themeSettings.deployButton.label = theme.deployButton.label;
}
if (theme.deployButton.type == "simple") {
themeSettings.deployButton = {
type: "simple"
}
if (theme.deployButton.label) {
themeSettings.deployButton.label = theme.deployButton.label;
}
themeSettings.deployButton.type = theme.deployButton.type;
if (theme.deployButton.icon) {
url = serveFile(themeApp,"/deploy/",theme.deployButton.icon);
if (url) {
@ -206,14 +205,26 @@ module.exports = {
}
if (theme.login) {
let themeContextLogin = {}
let hasLoginTheme = false
if (theme.login.image) {
url = serveFile(themeApp,"/login/",theme.login.image);
if (url) {
themeContext.login = {
image: url
}
themeContextLogin.image = url
hasLoginTheme = true
}
}
if (theme.login.message) {
themeContextLogin.message = theme.login.message
hasLoginTheme = true
}
if (theme.login.button) {
themeContextLogin.button = theme.login.button
hasLoginTheme = true
}
if (hasLoginTheme) {
themeContext.login = themeContextLogin
}
}
themeApp.get("/", async function(req,res) {
const themePluginList = await runtimeAPI.plugins.getPluginsByType({type:"node-red-theme"});

View File

@ -1,6 +1,6 @@
{
"name": "@node-red/editor-api",
"version": "4.0.1",
"version": "4.0.9",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@ -16,14 +16,14 @@
}
],
"dependencies": {
"@node-red/util": "4.0.1",
"@node-red/editor-client": "4.0.1",
"@node-red/util": "4.0.9",
"@node-red/editor-client": "4.0.9",
"bcryptjs": "2.4.3",
"body-parser": "1.20.2",
"body-parser": "1.20.3",
"clone": "2.1.2",
"cors": "2.8.5",
"express-session": "1.18.0",
"express": "4.19.2",
"express-session": "1.18.1",
"express": "4.21.2",
"memorystore": "1.6.7",
"mime": "3.0.0",
"multer": "1.4.5-lts.1",

View File

@ -375,7 +375,10 @@
"flowAdded": "flow added",
"moved": "moved",
"movedTo": "moved to __id__",
"movedFrom": "moved from __id__"
"movedFrom": "moved from __id__",
"none": "none",
"position": "position",
"wires": "wires"
},
"nodeCount": "__count__ node",
"nodeCount_plural": "__count__ nodes",
@ -384,9 +387,14 @@
"reviewChanges": "Review Changes",
"noBinaryFileShowed": "Cannot show binary file contents",
"viewCommitDiff": "View Commit Changes",
"commit": "Commit",
"compareChanges": "Compare Changes",
"saveConflict": "Save conflict resolution",
"conflictHeader": "<span>__resolved__</span> of <span>__unresolved__</span> conflicts resolved",
"localChanges": "Local Changes",
"remoteChanges": "Remote Changes",
"useLocalChanges": "use local changes",
"useRemoteChanges": "use remote changes",
"commonVersionError": "Common Version doesn't contain valid JSON:",
"oldVersionError": "Old Version doesn't contain valid JSON:",
"newVersionError": "New Version doesn't contain valid JSON:"
@ -554,7 +562,9 @@
"types": {
"local": "Local",
"examples": "Examples"
}
},
"type": "Type",
"name": "Name"
},
"palette": {
"noInfo": "no information available",
@ -803,6 +813,7 @@
"branches": "Branches",
"noBranches": "No branches",
"deleteConfirm": "Are you sure you want to delete the local branch '__name__'? This cannot be undone.",
"deleteBranch": "Delete branch",
"unmergedConfirm": "The local branch '__name__' has unmerged changes that will be lost. Are you sure you want to delete it?",
"deleteUnmergedBranch": "Delete unmerged branch",
"gitRemotes": "Git remotes",

View File

@ -27,7 +27,8 @@
"lock": "Bloquear",
"unlock": "Desbloquear",
"locked": "Bloqueado",
"unlocked": "Desbloqueado"
"unlocked": "Desbloqueado",
"format": "Formato"
},
"type": {
"string": "texto",
@ -303,7 +304,8 @@
"missingType": "La entrada no es un flujo válido - elemento __index__ falta la propiedad 'type'"
},
"conflictNotification1": "Algunos de los nodos que estás importando ya existen en tu espacio de trabajo.",
"conflictNotification2": "Selecciona qué nodos importar y si reemplazar los nodos existentes o importar una copia de los mismos."
"conflictNotification2": "Selecciona qué nodos importar y si reemplazar los nodos existentes o importar una copia de los mismos.",
"alreadyExists": "Este nodo ya existe"
},
"copyMessagePath": "Ruta copiada",
"copyMessageValue": "Valor copiado",
@ -371,8 +373,12 @@
"deleted": "eliminado",
"flowDeleted": "flujo eliminado",
"flowAdded": "flujo añadido",
"moved": "movido",
"movedTo": "movido a __id__",
"movedFrom": "movido desde __id__"
"movedFrom": "movido desde __id__",
"none": "ninguno",
"position": "posición",
"wires": "conectores"
},
"nodeCount": "__count__ nodo",
"nodeCount_plural": "__count__ nodos",
@ -381,9 +387,14 @@
"reviewChanges": "Revisar Cambios",
"noBinaryFileShowed": "No se puede mostrar el contenido del archivo binario",
"viewCommitDiff": "Ver cambios de commit",
"commit": "Commit",
"compareChanges": "Comparar Cambios",
"saveConflict": "Guardar resolución de conflictos",
"conflictHeader": "<span>__resolved__</span> de <span>__unresolved__</span> conflictos resueltos",
"localChanges": "Cambios Locales",
"remoteChanges": "Cambios Remotos",
"useLocalChanges": "utilizar cambios locales",
"useRemoteChanges": "utilizar cambios remotos",
"commonVersionError": "La versión común no contiene JSON válido:",
"oldVersionError": "La versión anterior no contiene JSON válido:",
"newVersionError": "La versión nueva no contiene JSON válido:"
@ -551,7 +562,9 @@
"types": {
"local": "Local",
"examples": "Ejemplos"
}
},
"type": "Tipo",
"name": "Nombre"
},
"palette": {
"noInfo": "no hay información disponible",
@ -613,6 +626,8 @@
},
"nodeCount": "__label__ nodo",
"nodeCount_plural": "__label__ nodos",
"pluginCount": "__count__ extensión",
"pluginCount_plural": "__count__ extensiones",
"moduleCount": "__count__ módulo disponible",
"moduleCount_plural": "__count__ módulos disponibles",
"inuse": "en uso",
@ -640,6 +655,7 @@
"errors": {
"catalogLoadFailed": "<p>La carga del catálogo de nodos ha fallado</p><p>Revise la consola del navegador para mas información</p>",
"installFailed": "<p>Fallo al instalar: __module__</p><p>__message__</p><p>Revise el log para mas información</p>",
"installTimeout": "<p>La instalación continúa en segundo plano.</p><p>Los nodos aparecerán en la paleta cuando finalice. Consulta el registro para obtener más información.</p>",
"removeFailed": "<p>Fallo al eliminar: __module__</p><p>__message__</p><p>Revise el log para mas información</p>",
"updateFailed": "<p>Fallo al actualizar: __module__</p><p>__message__</p><p>Revise el log para mas información</p>",
"enableFailed": "<p>Fallo al activar: __module__</p><p>__message__</p><p>Revise el log para mas información</p>",
@ -654,6 +670,9 @@
"body":"<p>Eliminando '__module__'</p><p>La eliminación del nodo lo desinstalará de Node-RED. Es posible que el nodo siga utilizando recursos hasta que Node-RED sea reiniciado.</p>",
"title": "Eliminar nodos"
},
"removePlugin": {
"body": "<p>Extensión __module__ eliminada. Vuelve a cargar el editor para borrar los elementos sobrantes.</p>"
},
"update": {
"body":"<p>Actualizando '__module__'</p><p>La actualización del nodo requerirá un reinicio manual de Node-RED para completarse. Debe ser reiniciado manualmente.</p>",
"title": "Actualizar nodos"
@ -665,7 +684,8 @@
"review": "Abrir información del nodo",
"install": "Instalar",
"remove": "Eliminar",
"update": "Actualizar"
"update": "Actualizar",
"understood": "Entendido"
}
}
}
@ -718,6 +738,7 @@
"nodeHelp": "Ayuda de nodo",
"showHelp": "Mostrar ayuda",
"showInOutline": "Mostrar en controno",
"hideTopics": "Esconder temas",
"showTopics": "Mostrar temas",
"noHelp": "No hay ningun tema de ayuda seleccionado",
"changeLog": "Registro de Cambios"
@ -792,6 +813,7 @@
"branches": "Ramas",
"noBranches": "Sin ramas",
"deleteConfirm": "¿Estás seguro de que quieres eliminar la rama local '__name__'? Esta acción no puede deshacerse.",
"deleteBranch": "Eliminar rama",
"unmergedConfirm": "La rama local '__name__' tiene cambios no fusionados que se perderán. ¿Estás seguro de que quieres eliminarla?",
"deleteUnmergedBranch": "Eliminar rama no fusionada",
"gitRemotes": "Git remotes",
@ -913,6 +935,8 @@
}
},
"typedInput": {
"selected": "__count__ seleccionado",
"selected_plural": "__count__ seleccionados",
"type": {
"str": "texto",
"num": "número",
@ -923,7 +947,14 @@
"date": "marca tiempo",
"jsonata": "expresión",
"env": "variable de entorno",
"cred": "credencial"
"cred": "credencial",
"conf-types": "nodo configuración"
},
"date": {
"format": {
"timestamp": "milisegundos desde epoch",
"object": "Objeto de fecha de JavaScript"
}
}
},
"editableList": {
@ -1205,6 +1236,18 @@
"diagnostics": {
"title": "Información Sistema"
},
"languages": {
"de": "Deutsch",
"en-US": "English",
"es-ES": "Español (España)",
"fr": "Français",
"ja": "日本語",
"ko": "Korean",
"pt-BR": "Português (Brasil)",
"ru": "Русский",
"zh-CN": "简体中文",
"zh-TW": "繁體中文"
},
"validator": {
"errors": {
"invalid-json": "Datos JSON inválidos: __error__",

View File

@ -27,7 +27,8 @@
"lock": "Verrouiller",
"unlock": "Déverrouiller",
"locked": "Verrouillé",
"unlocked": "Déverrouillé"
"unlocked": "Déverrouillé",
"format": "Format"
},
"type": {
"string": "chaîne de caractères",
@ -54,10 +55,10 @@
"workspace": {
"defaultName": "Flux __number__",
"editFlow": "Modifier le flux : __name__",
"confirmDelete": "Confirmation de la suppression",
"delete": "Etes-vous sûr de vouloir supprimer '__label__'?",
"dropFlowHere": "Déposer le flux ici",
"dropImageHere": "Déposer l'image ici",
"confirmDelete": "Confirmer la suppression",
"delete": "Êtes-vous sûr de vouloir supprimer '__label__' ?",
"dropFlowHere": "Lâchez le flux ici",
"dropImageHere": "Lâchez l'image ici",
"addFlow": "Ajouter un flux",
"addFlowToRight": "Ajouter un flux à droite",
"closeFlow": "Fermer le flux",
@ -74,7 +75,7 @@
"enabled": "Activé",
"disabled": "Désactivé",
"info": "Description",
"selectNodes": "Cliquer sur les noeuds pour sélectionner",
"selectNodes": "Cliquer pour sélectionner",
"enableFlow": "Activer le flux",
"disableFlow": "Désactiver le flux",
"lockFlow": "Verrouiller le flux",
@ -98,7 +99,7 @@
"rtl": "De droite à gauche",
"auto": "Contextuel",
"language": "Langue",
"browserDefault": "Navigateur par défaut"
"browserDefault": "Par défaut du Navigateur"
},
"sidebar": {
"show": "Afficher la barre latérale"
@ -134,7 +135,7 @@
"disableSelectedNodes": "Désactiver les noeuds sélectionnés",
"showSelectedNodeLabels": "Afficher les étiquettes des noeuds sélectionnés",
"hideSelectedNodeLabels": "Masquer les étiquettes des noeuds sélectionnés",
"showWelcomeTours": "Afficher les visites guidées pour les nouvelles versions",
"showWelcomeTours": "Afficher les visites guidées des nouvelles versions",
"help": "Site web de Node-RED",
"projects": "Projets",
"projects-new": "Nouveau projet",
@ -143,7 +144,7 @@
"showNodeLabelDefault": "Afficher l'étiquette des noeuds nouvellement ajoutés",
"codeEditor": "Éditeur de code",
"groups": "Groupes",
"groupSelection": "Grouper cette sélection",
"groupSelection": "Grouper la sélection",
"ungroupSelection": "Dégrouper la sélection",
"groupMergeSelection": "Fusionner la sélection",
"groupRemoveSelection": "Supprimer du groupe",
@ -155,7 +156,7 @@
"alignMiddle": "Aligner au milieu",
"alignBottom": "Aligner en bas",
"distributeHorizontally": "Répartir horizontalement",
"distributeVertically": "Distribuer verticalement",
"distributeVertically": "Répartir verticalement",
"moveToBack": "Déplacer vers l'arrière",
"moveToFront": "Déplacer vers l'avant",
"moveBackwards": "Reculer",
@ -163,21 +164,21 @@
}
},
"actions": {
"toggle-navigator": "Basculer de navigateur",
"zoom-out": "Dézoomer",
"zoom-reset": "Réinitialiser le zoom",
"toggle-navigator": "Basculer l'affichage du navigateur",
"zoom-out": "Réduire",
"zoom-reset": "Réinitialiser",
"zoom-in": "Agrandir",
"search-flows": "Rechercher le flux",
"search-prev": "Précédent",
"search-next": "Suivant",
"search-counter": "\"__term__\" __result__ de __count__"
"search-counter": "\"__term__\" __result__ sur __count__"
},
"user": {
"loggedInAs": "Connecté en tant que __name__",
"username": "Nom d'utilisateur",
"password": "Mot de passe",
"login": "Connexion",
"loginFailed": "Échec de la connexion",
"login": "Se connecter",
"loginFailed": "Échec de connexion",
"notAuthorized": "Pas autorisé",
"errors": {
"settings": "Vous devez être connecté pour accéder aux paramètres",
@ -193,16 +194,16 @@
"warning": "<strong>Attention</strong> : __message__",
"warnings": {
"undeployedChanges": "Le noeud a des modifications non déployées",
"nodeActionDisabled": "Actions de noeud désactivées",
"nodeActionDisabledSubflow": "Actions de noeud désactivées dans le sous-flux",
"nodeActionDisabled": "Les actions du noeud sont désactivées",
"nodeActionDisabledSubflow": "Les actions de noeud sont désactivées à l'intérieur du sous-flux",
"missing-types": "<p>Flux arrêtés en raison de types de noeuds manquants.</p>",
"missing-modules": "<p>Flux arrêtés en raison de modules manquants.</p>",
"safe-mode": "<p>Flux arrêtés en mode sans échec.</p><p>Vous pouvez modifier vos flux et déployer les changements pour redémarrer.</p>",
"safe-mode": "<p>Flux arrêtés en mode sans échec.</p><p>Vous pouvez modifier vos flux et déployer ensuite les changements afin de démarrer vos flux.</p>",
"restartRequired": "Node-RED doit être redémarré pour mettre à jour les modules",
"credentials_load_failed": "<p>Les flux se sont arrêtés car les informations d'identification n'ont pas pu être déchiffrées.</p><p>Le fichier d'informations d'identification du flux est chiffré, mais la clé de chiffrement du projet est manquante ou invalide.</p>",
"credentials_load_failed_reset": "<p>Les informations d'identification n'ont pas pu être déchiffrées</p><p>Le fichier d'informations d'identification du flux est chiffré, mais la clé de chiffrement du projet est manquante ou invalide.</p><p>Le fichier d'informations d'identification du flux sera réinitialisé lors du prochain déploiement. Toutes les informations d'identification de flux existantes seront perdues.</p>",
"credentials_load_failed": "<p>Les flux se sont arrêtés car les informations d'identification n'ont pas pu être déchiffrées.</p><p>Le fichier d'informations d'identification du flux est chiffré mais la clé de chiffrement du projet est manquante ou invalide.</p>",
"credentials_load_failed_reset": "<p>Les informations d'identification n'ont pas pu être déchiffrées</p><p>Le fichier d'informations d'identification du flux est chiffré mais la clé de chiffrement du projet est manquante ou invalide.</p><p>Le fichier d'informations d'identification du flux sera réinitialisé lors du prochain déploiement. Toutes les informations d'identification des flux existants seront perdues.</p>",
"missing_flow_file": "<p>Fichier contenant les flux introuvable.</p><p>Le projet n'est pas configuré avec un fichier de flux.</p>",
"missing_package_file": "<p>Fichier de paquetage du projet introuvable.</p><p>Il manque au projet un fichier package.json.</p>",
"missing_package_file": "<p>Fichier de paquetage du projet introuvable.</p><p>Il manque au projet le fichier <code>package.json</code>.</p>",
"project_empty": "<p>Le projet est vide.</p><p>Voulez-vous créer un ensemble de fichiers de projet par défaut ?<br/>Sinon, vous devrez ajouter manuellement des fichiers au projet (en dehors de l'éditeur).</p>",
"project_not_found": "<p>Le projet '__project__' est introuvable.</p>",
"git_merge_conflict": "<p>La fusion automatique des modifications a échoué.</p><p>Corriger les conflits non fusionnés, puis valider le résultat.</p>"
@ -219,7 +220,7 @@
},
"project": {
"change-branch": "Changer pour une branche locale '__project__'",
"merge-abort": "Git fusion abandonnée",
"merge-abort": "Fusion Git abandonnée",
"loaded": "Projet '__project__' chargé",
"updated": "Projet '__project__' mis à jour",
"pull": "Projet '__project__' rechargé",
@ -352,7 +353,7 @@
"backgroundUpdate": "Les flux sur le serveur ont été mis à jour.",
"conflictChecking": "Vérifier si les modifications peuvent être fusionnées automatiquement",
"conflictAutoMerge": "Les modifications n'incluent aucun conflit et peuvent être fusionnées automatiquement.",
"conflictManualMerge": "Les changements incluent des conflits qui doivent être résolus avant de pouvoir être déployés.",
"conflictManualMerge": "Les modifications incluent des conflits qui doivent être résolus avant de pouvoir être déployées.",
"plusNMore": "+ __count__ en plus"
}
},
@ -372,19 +373,28 @@
"deleted": "supprimé",
"flowDeleted": "flux supprimé",
"flowAdded": "flux ajouté",
"moved": "déplacé",
"movedTo": "déplacé vers __id__",
"movedFrom": "déplacé depuis __id__"
"movedFrom": "déplacé depuis __id__",
"none": "aucun",
"position": "position",
"wires": "câbles"
},
"nodeCount": "__count__ noeud",
"nodeCount_plural": "__count__ noeuds",
"local": "Changements locaux",
"remote": "Modifications à distance",
"remote": "Changements distants",
"reviewChanges": "Examiner les modifications",
"noBinaryFileShowed": "Impossible d'afficher le contenu du fichier binaire",
"viewCommitDiff": "Afficher les modifications de validation",
"viewCommitDiff": "Afficher les modifications de la validation",
"commit": "Validation",
"compareChanges": "Comparer les modifications",
"saveConflict": "Enregistrer la résolution des conflits",
"conflictHeader": "<span>__resolved__</span> sur <span>__unresolved__</span> conflit(s) résolu(s)",
"localChanges": "Modifications locales",
"remoteChanges": "Modifications distantes",
"useLocalChanges": "utiliser les modifications locales",
"useRemoteChanges": "utiliser les modifications distantes",
"commonVersionError": "La version commune ne contient pas de JSON valide :",
"oldVersionError": "L'ancienne version ne contient pas de JSON valide :",
"newVersionError": "La nouvelle version ne contient pas de JSON valide :"
@ -395,9 +405,9 @@
"edit": "Modifier le modèle du sous-flux",
"subflowInstances": "Il existe __count__ instance de ce modèle de sous-flux",
"subflowInstances_plural": "Il existe __count__ instances de ce modèle de sous-flux",
"editSubflowProperties": "modifier les propriétés",
"input": "Entrées:",
"output": "Sorties:",
"editSubflowProperties": "Modifier les propriétés",
"input": "Entrées :",
"output": "Sorties :",
"status": "Statut du noeud",
"deleteSubflow": "Supprimer le sous-flux",
"confirmDelete": "Voulez-vous vraiment supprimer ce sous-flux ?",
@ -411,7 +421,7 @@
"version": "Version",
"versionPlaceholder": "x.y.z",
"keys": "Mots clés",
"keysPlaceholder": "Mots clés séparés par des virgules",
"keysPlaceholder": "Mots clés séparés par une virgule",
"author": "Auteur",
"authorPlaceholder": "Votre nom <email@exemple.com>",
"desc": "Description",
@ -468,7 +478,7 @@
"select": "sélection",
"checkbox": "case à cocher",
"spinner": "valeurs à défiler",
"none": "aucune",
"none": "aucun",
"hidden": "masquer la propriété"
},
"types": {
@ -496,7 +506,7 @@
"max": "Maximum"
},
"errors": {
"scopeChange": "La modification de la portée la rendra indisponible pour les noeuds d'autres flux qui l'utilisent",
"scopeChange": "La modification de la portée rendra indisponible ce noeud de configuration aux noeuds d'autres flux qui l'utilisent",
"invalidProperties": "Propriétés invalides :",
"credentialLoadFailed": "Échec du chargement des identifiants du noeud"
}
@ -510,7 +520,7 @@
"unassigned": "Non attribué",
"global": "Global",
"workspace": "Espace de travail",
"editor": "Boîte de dialogue d'édition",
"editor": "Boîte d'édition",
"selectAll": "Tout sélectionner",
"selectNone": "Ne rien sélectionner",
"selectAllConnected": "Sélectionner tous les éléments connectés",
@ -541,7 +551,7 @@
"openLibrary": "Ouvrir la bibliothèque...",
"saveToLibrary": "Enregistrer dans la bibliothèque...",
"typeLibrary": "__type__ bibliothèque",
"unnamedType": "Innomé __type__",
"unnamedType": "Sans nom __type__",
"exportedToLibrary": "Noeuds exportés vers la bibliothèque",
"dialogSaveOverwrite": "Une __libraryType__ appelée __libraryName__ existe déjà. Écraser ?",
"invalidFilename": "Nom de fichier non valide",
@ -552,13 +562,15 @@
"types": {
"local": "Local",
"examples": "Exemples"
}
},
"type": "Type",
"name": "Nom"
},
"palette": {
"noInfo": "Pas d'information disponible",
"filter": "Rechercher le noeud",
"search": "Rechercher les modules",
"addCategory": "Ajouter un nouveau...",
"addCategory": "Ajouter une nouvelle...",
"label": {
"subflows": "Sous-flux",
"network": "Réseau",
@ -638,7 +650,7 @@
"sortAZ": "A-Z",
"sortRecent": "Récent",
"more": "+ __count__ en plus",
"upload": "Charger le fichier tgz du module",
"upload": "Charger le fichier .tgz du module",
"refresh": "Actualiser la liste des modules",
"errors": {
"catalogLoadFailed": "<p>Échec du chargement du catalogue de noeuds.</p><p>Vérifier la console du navigateur pour plus d'informations</p>",
@ -651,7 +663,7 @@
},
"confirm": {
"install": {
"body": "<p>Installation de '__module__'</p><p>Avant l'installation, veuiller lire la documentation du noeud. Certains noeuds ont des dépendances qui ne peuvent pas être résolues automatiquement et peuvent nécessiter un redémarrage de Node-RED.</p>",
"body": "<p>Installation de '__module__'</p><p>Avant l'installation, veuillez lire la documentation du noeud. Certains noeuds ont des dépendances qui ne peuvent pas être résolues automatiquement et peuvent nécessiter un redémarrage de Node-RED.</p>",
"title": "Installer les noeuds"
},
"remove": {
@ -666,7 +678,7 @@
"title": "Mettre à jour les noeuds"
},
"cannotUpdate": {
"body": "Une mise à jour pour ce noeud est disponible, mais il n'est pas installé dans un emplacement que le gestionnaire de palette peut mettre à jour.<br/><br/>Veuiller vous référer à la documentation pour savoir comment mettre à jour ce noeud."
"body": "Une mise à jour pour ce noeud est disponible, mais il n'est pas installé dans un emplacement que le gestionnaire de palette peut mettre à jour.<br/><br/>Veuillez vous référer à la documentation pour savoir comment mettre à jour ce noeud."
},
"button": {
"review": "Ouvrir la documentation",
@ -708,8 +720,8 @@
"nodeHelp": "Aide sur les noeuds",
"none": "Aucun",
"arrayItems": "__count__ éléments",
"showTips": "Vous pouvez ouvrir les astuces à partir du panneau des paramètres",
"outline": "Plan",
"showTips": "Vous pouvez afficher les astuces à partir du panneau des paramètres",
"outline": "Contour",
"empty": "Vide",
"globalConfig": "Noeuds de configuration globale",
"triggerAction": "Déclencher une action",
@ -722,7 +734,7 @@
"help": {
"name": "Aide",
"label": "Aide",
"search": "Aide à la recherche",
"search": "Rechercher l'aide",
"nodeHelp": "Aide sur les noeuds",
"showHelp": "Afficher l'aide",
"showInOutline": "Afficher dans les grandes lignes",
@ -801,7 +813,8 @@
"branches": "Branches",
"noBranches": "Pas de branche",
"deleteConfirm": "Êtes-vous sûr de vouloir supprimer la branche locale '__name__' ? Ça ne peut pas être annulé.",
"unmergedConfirm": "La branche locale '__name__' contient des modifications non fusionnées qui seront perdues. Etes-vous sûr de vouloir la supprimer?",
"deleteBranch": "Supprimer la branche",
"unmergedConfirm": "La branche locale '__name__' contient des modifications non fusionnées qui seront perdues. Êtes-vous sûr de vouloir la supprimer?",
"deleteUnmergedBranch": "Supprimer la branche non fusionnée",
"gitRemotes": "Git distant",
"addRemote": "Ajout distant",
@ -845,17 +858,17 @@
"deleteConfirm": "Êtes-vous sûr de vouloir supprimer la clé SSH __name__ ? Ça ne peut pas être annulé."
},
"versionControl": {
"unstagedChanges": "Abandon des changements",
"stagedChanges": "Changement mis en place",
"unstageChange": "Ne pas mettre en place le changement",
"stageChange": "Mettre en place le changement",
"unstageAllChange": "Ne pas mettre en place tous les changements",
"stageAllChange": "Mettre en place tous les changements",
"unstagedChanges": "Changements non indexés",
"stagedChanges": "Changements indexés",
"unstageChange": "Annuler l'indexation des changements",
"stageChange": "Indexer les changements",
"unstageAllChange": "Annuler l'indexation de tous les changements",
"stageAllChange": "Indexer tous les changements",
"commitChanges": "Valider les changements",
"resolveConflicts": "Résoudre les conflits",
"head": "En-tête",
"staged": "Mis en place",
"unstaged": "Non mis en place",
"staged": "Indexé",
"unstaged": "Non indexé",
"local": "Local",
"remote": "Distant",
"revert": "Voulez-vous vraiment annuler les modifications apportées à '__file__' ? Ça ne peut pas être annulé.",
@ -889,11 +902,11 @@
"pushFailed": "L'envoi a échoué car la branche a des validations plus récentes. Tirer et fusionner d'abord, puis envoyer à nouveau.",
"push": "Envoyer",
"pull": "Tirer",
"unablePull": "<p>Impossible d'extraire les modifications à distance ; vos modifications locales non mises en place seraient écrasées.</p><p>Valider vos modifications et réessayer.</p>",
"showUnstagedChanges": "Afficher les modifications non mise en place",
"unablePull": "<p>Impossible d'extraire les modifications à distance; vos modifications locales non mises en place seraient écrasées.</p><p>Valider vos modifications et réessayer.</p>",
"showUnstagedChanges": "Afficher les modifications non indexées",
"connectionFailed": "Impossible de se connecter au référentiel distant: ",
"pullUnrelatedHistory": "<p>Le réferentiel distant a un historique de validations sans rapport.</p><p>Êtes-vous sûr de vouloir extraire les modifications dans votre référentiel local ?</p>",
"pullChanges": "Tirer les changements",
"pullChanges": "Tirer les changements distants",
"history": "Historique",
"projectHistory": "Historique du projet",
"daysAgo": "il y a __count__ jour",
@ -974,7 +987,7 @@
"result": "Résultat",
"format": "Format",
"compatMode": "Mode de compatibilité activé",
"compatModeDesc": "<h3>Mode de compatibilité JSONata</h3><p> L'expression actuelle semble toujours faire référence à <code>msg</code> et sera donc évaluée en mode de compatibilité. Veuiller mettre à jour l'expression pour ne pas utiliser <code>msg</code> car ce mode sera supprimé à l'avenir.</p><p> Lorsque la prise en charge de JSONata a été ajoutée pour la première fois à Node-RED, il fallait que l'expression référencie l'objet <code>msg</code>. Par exemple, <code>msg.payload</code> serait utilisé pour accéder à la charge utile.</p><p> Cela n'est plus nécessaire car l'expression sera évaluée directement par rapport au message. Pour accéder à la charge utile, l'expression doit être simplement <code>charge utile</code>.</p>",
"compatModeDesc": "<h3>Mode de compatibilité JSONata</h3><p> L'expression actuelle semble toujours faire référence à <code>msg</code> et sera donc évaluée en mode de compatibilité. Veuillez mettre à jour l'expression pour ne pas utiliser <code>msg</code> car ce mode sera supprimé à l'avenir.</p><p> Lorsque la prise en charge de JSONata a été ajoutée pour la première fois à Node-RED, il fallait que l'expression référencie l'objet <code>msg</code>. Par exemple, <code>msg.payload</code> serait utilisé pour accéder à la charge utile.</p><p> Cela n'est plus nécessaire car l'expression sera évaluée directement par rapport au message. Pour accéder à la charge utile, l'expression doit être simplement <code>charge utile</code>.</p>",
"noMatch": "Aucun résultat correspondant",
"errors": {
"invalid-expr": "Expression JSONata non valide :\n __message__",
@ -997,7 +1010,7 @@
},
"jsonEditor": {
"title": "Éditeur JSON",
"format": "Format JSON",
"format": "Formatter JSON",
"rawMode": "Modifier JSON",
"uiMode": "Afficher l'éditeur",
"rawMode-readonly": "JSON",
@ -1016,7 +1029,7 @@
"markdownEditor": {
"title": "Éditeur Markdown",
"expand": "Développer",
"format": "Formaté avec Markdown",
"format": "Formatter avec Markdown",
"heading1": "Rubrique 1",
"heading2": "Rubrique 2",
"heading3": "Rubrique 3",
@ -1090,7 +1103,7 @@
"credential-key": "Clé de chiffrement des identifiants",
"cant-get-ssh-key": "Erreur! Impossible d'obtenir le chemin de la clé SSH sélectionnée.",
"already-exists2": "Existe déjà",
"git-error": "Erreur git",
"git-error": "Erreur Git",
"connection-failed": "La connexion a échoué",
"not-git-repo": "Ce n'est pas un dépôt Git",
"repo-not-found": "Référentiel introuvable"
@ -1104,7 +1117,7 @@
"credentials-file": "Fichier d'identifiants"
},
"encryption-config": {
"setup": "Configuration du chiffrage de votre fichier d'informations d'identification",
"setup": "Configuration du chiffrement de votre fichier d'informations d'identification",
"desc0": "Votre fichier d'informations d'identification de flux peut être chiffré pour sécuriser son contenu.",
"desc1": "Si vous souhaitez stocker ces identifiants dans un référentiel Git public, vous devez les chiffrer en fournissant une phrase clé secrète.",
"desc2": "Votre fichier d'identifiants de flux n'est actuellement pas chiffré.",
@ -1161,9 +1174,9 @@
"add-ssh-key": "Ajouter une clé ssh",
"credentials-encryption-key": "Clé de chiffrement des identifiants",
"already-exists-2": "Existe déjà",
"git-error": "Erreur git",
"git-error": "Erreur Git",
"con-failed": "La connexion a échoué",
"not-git": "Ce n'est pas un dépôt git",
"not-git": "Ce n'est pas un dépôt Git",
"no-resource": "Référentiel introuvable",
"cant-get-ssh-key-path": "Erreur! Impossible d'obtenir le chemin de la clé SSH sélectionnée.",
"unexpected_error": "Erreur inattendue",
@ -1201,7 +1214,7 @@
},
"errors": {
"no-username-email": "Votre client Git n'est pas configuré avec un nom d'utilisateur/e-mail.",
"unexpected": "Une erreur inattendue est apparue",
"unexpected": "Une erreur inattendue est survenue",
"code": "Code"
}
},
@ -1270,7 +1283,7 @@
"list-modified-nodes": "Afficher les flux modifiés",
"list-hidden-flows": "Afficher les flux cachés",
"list-flows": "Lister les flux",
"list-subflows": "Liste les sous-flux",
"list-subflows": "Lister les sous-flux",
"go-to-previous-location": "Aller à l'emplacement précédent",
"go-to-next-location": "Aller à l'emplacement suivant",
"copy-selection-to-internal-clipboard": "Copier la sélection dans le presse-papiers",
@ -1330,8 +1343,8 @@
"align-selection-to-bottom": "Aligner la sélection vers le bas",
"align-selection-to-middle": "Aligner la sélection au centre verticalement",
"align-selection-to-center": "Aligner la sélection au centre horizontalement",
"distribute-selection-horizontally": "Distribuer la sélection horizontalement",
"distribute-selection-vertical": "Distribuer la sélection verticalement",
"distribute-selection-horizontally": "Répartir la sélection horizontalement",
"distribute-selection-vertical": "Répartir la sélection verticalement",
"wire-series-of-nodes": "Connecter les noeuds en série",
"wire-node-to-multiple": "Connecter les noeuds à plusieurs",
"wire-multiple-to-node": "Connecter plusieurs au noeud",

View File

@ -375,7 +375,10 @@
"flowAdded": "追加されたフロー",
"moved": "移動",
"movedTo": "__id__ へ移動",
"movedFrom": "__id__ から移動"
"movedFrom": "__id__ から移動",
"none": "なし",
"position": "位置",
"wires": "ワイヤー"
},
"nodeCount": "__count__ 個のノード",
"nodeCount_plural": "__count__ 個のノード",
@ -384,9 +387,14 @@
"reviewChanges": "変更を表示",
"noBinaryFileShowed": "バイナリファイルの中身は表示することができません",
"viewCommitDiff": "コミットの内容を表示",
"commit": "コミット",
"compareChanges": "変更を比較",
"saveConflict": "解決して保存",
"conflictHeader": "<span>__unresolved__</span> 個中 <span>__resolved__</span> 個のコンフリクトを解決",
"localChanges": "ローカルの変更",
"remoteChanges": "リモートの変更",
"useLocalChanges": "ローカルの変更を使用",
"useRemoteChanges": "リモートの変更を使用",
"commonVersionError": "共通バージョンは正しいJSON形式ではありません:",
"oldVersionError": "古いバージョンは正しいJSON形式ではありません:",
"newVersionError": "新しいバージョンは正しいJSON形式ではありません:"
@ -554,7 +562,9 @@
"types": {
"local": "ローカル",
"examples": "サンプル"
}
},
"type": "型",
"name": "名前"
},
"palette": {
"noInfo": "情報がありません",
@ -803,6 +813,7 @@
"branches": "ブランチ",
"noBranches": "ブランチなし",
"deleteConfirm": "本当にローカルブランチ'__name__'を削除しますか?削除すると元に戻すことはできません。",
"deleteBranch": "ブランチを削除",
"unmergedConfirm": "ローカルブランチ'__name__'にはマージされていない変更があります。この変更は削除されます。本当に削除しますか?",
"deleteUnmergedBranch": "マージされていないブランチを削除",
"gitRemotes": "Gitリモート",

View File

@ -1,6 +1,6 @@
{
"name": "@node-red/editor-client",
"version": "4.0.1",
"version": "4.0.9",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -453,10 +453,61 @@ RED.history = (function() {
RED.events.emit("nodes:change",newConfigNode);
}
});
} else if (i === "env" && ev.node.type.indexOf("subflow:") === 0) {
// Subflow can have config node in node.env
let nodeList = ev.node.env || [];
nodeList = nodeList.reduce((list, prop) => {
if (prop.type === "conf-type" && prop.value) {
list.push(prop.value);
}
return list;
}, []);
nodeList.forEach(function(id) {
const configNode = RED.nodes.node(id);
if (configNode) {
if (configNode.users.indexOf(ev.node) !== -1) {
configNode.users.splice(configNode.users.indexOf(ev.node), 1);
RED.events.emit("nodes:change", configNode);
}
}
});
nodeList = ev.changes.env || [];
nodeList = nodeList.reduce((list, prop) => {
if (prop.type === "conf-type" && prop.value) {
list.push(prop.value);
}
return list;
}, []);
nodeList.forEach(function(id) {
const configNode = RED.nodes.node(id);
if (configNode) {
if (configNode.users.indexOf(ev.node) === -1) {
configNode.users.push(ev.node);
RED.events.emit("nodes:change", configNode);
}
}
});
}
if (i === "credentials" && ev.changes[i]) {
// Reset - Only want to keep the changes
inverseEv.changes[i] = {};
for (const [key, value] of Object.entries(ev.changes[i])) {
// Edge case: node.credentials is cleared after a deploy, so we can't
// capture values for the inverse event when undoing past a deploy
if (ev.node.credentials) {
inverseEv.changes[i][key] = ev.node.credentials[key];
}
ev.node.credentials[key] = value;
}
} else {
ev.node[i] = ev.changes[i];
}
ev.node[i] = ev.changes[i];
}
}
ev.node.dirty = true;
ev.node.changed = ev.changed;
@ -536,6 +587,24 @@ RED.history = (function() {
RED.editor.updateNodeProperties(ev.node,outputMap);
RED.editor.validateNode(ev.node);
}
// If it's a Config Node, validate user nodes too.
// NOTE: The Config Node must be validated before validating users.
if (ev.node.users) {
const validatedNodes = new Set();
const userStack = ev.node.users.slice();
validatedNodes.add(ev.node.id);
while (userStack.length) {
const node = userStack.pop();
if (!validatedNodes.has(node.id)) {
validatedNodes.add(node.id);
if (node.users) {
userStack.push(...node.users);
}
RED.editor.validateNode(node);
}
}
}
if (ev.links) {
inverseEv.createdLinks = [];
for (i=0;i<ev.links.length;i++) {

View File

@ -100,16 +100,36 @@ RED.multiplayer = (function () {
break
}
}
if (isInWorkspace) {
const chart = $('#red-ui-workspace-chart')
const chartOffset = chart.offset()
const scaleFactor = RED.view.scale()
location.cursor = {
x: (lastPosition[0] - chartOffset.left + chart.scrollLeft()) / scaleFactor,
y: (lastPosition[1] - chartOffset.top + chart.scrollTop()) / scaleFactor
}
}
return location
}
let publishLocationTimeout
let lastPosition = [0,0]
let isInWorkspace = false
function publishLocation () {
const location = getLocation()
if (location.workspace !== 0) {
log('send', 'multiplayer/location', location)
RED.comms.send('multiplayer/location', location)
if (!publishLocationTimeout) {
publishLocationTimeout = setTimeout(() => {
const location = getLocation()
if (location.workspace !== 0) {
log('send', 'multiplayer/location', location)
RED.comms.send('multiplayer/location', location)
}
publishLocationTimeout = null
}, 100)
}
}
function revealUser(location, skipWorkspace) {
if (location.node) {
// Need to check if this is a known node, so we can fall back to revealing
@ -271,7 +291,16 @@ RED.multiplayer = (function () {
function removeUserLocation (sessionId) {
updateUserLocation(sessionId, {})
removeUserCursor(sessionId)
}
function removeUserCursor (sessionId) {
// return
if (sessions[sessionId]?.cursor) {
sessions[sessionId].cursor.parentNode.removeChild(sessions[sessionId].cursor)
delete sessions[sessionId].cursor
}
}
function updateUserLocation (sessionId, location) {
let viewTouched = false
const oldLocation = sessions[sessionId].location
@ -291,6 +320,28 @@ RED.multiplayer = (function () {
// console.log(`updateUserLocation sessionId:${sessionId} oldWS:${oldLocation?.workspace} newWS:${location.workspace}`)
if (location.workspace) {
getWorkspaceTray(location.workspace).addUser(sessionId)
if (location.cursor && location.workspace === RED.workspaces.active()) {
if (!sessions[sessionId].cursor) {
const user = sessions[sessionId].user
const cursorIcon = document.createElementNS("http://www.w3.org/2000/svg","g");
cursorIcon.setAttribute("class", "red-ui-multiplayer-annotation")
cursorIcon.appendChild(createAnnotationUser(user, true))
$(cursorIcon).css({
transform: `translate( ${location.cursor.x}px, ${location.cursor.y}px)`,
transition: 'transform 0.1s linear'
})
$("#red-ui-workspace-chart svg").append(cursorIcon)
sessions[sessionId].cursor = cursorIcon
} else {
const cursorIcon = sessions[sessionId].cursor
$(cursorIcon).css({
transform: `translate( ${location.cursor.x}px, ${location.cursor.y}px)`
})
}
} else if (sessions[sessionId].cursor) {
removeUserCursor(sessionId)
}
}
if (location.node) {
addUserToNode(sessionId, location.node)
@ -309,67 +360,68 @@ RED.multiplayer = (function () {
// }
// }
function createAnnotationUser(user, pointer = false) {
const radius = 20
const halfRadius = radius/2
const group = document.createElementNS("http://www.w3.org/2000/svg","g");
const badge = document.createElementNS("http://www.w3.org/2000/svg","path");
let shapePath
if (!pointer) {
shapePath = `M 0 ${halfRadius} a ${halfRadius} ${halfRadius} 0 1 1 ${radius} 0 a ${halfRadius} ${halfRadius} 0 1 1 -${radius} 0 z`
} else {
shapePath = `M 0 0 h ${halfRadius} a ${halfRadius} ${halfRadius} 0 1 1 -${halfRadius} ${halfRadius} z`
}
badge.setAttribute('d', shapePath)
badge.setAttribute("class", "red-ui-multiplayer-annotation-background")
group.appendChild(badge)
if (user && user.profileColor !== undefined) {
badge.setAttribute("class", "red-ui-multiplayer-annotation-background red-ui-user-profile-color-" + user.profileColor)
}
if (user && user.image) {
const image = document.createElementNS("http://www.w3.org/2000/svg","image");
image.setAttribute("width", radius)
image.setAttribute("height", radius)
image.setAttribute("href", user.image)
image.setAttribute("clip-path", "circle("+Math.floor(radius/2)+")")
group.appendChild(image)
} else if (user && user.anonymous) {
const anonIconHead = document.createElementNS("http://www.w3.org/2000/svg","circle");
anonIconHead.setAttribute("cx", radius/2)
anonIconHead.setAttribute("cy", radius/2 - 2)
anonIconHead.setAttribute("r", 2.4)
anonIconHead.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
group.appendChild(anonIconHead)
const anonIconBody = document.createElementNS("http://www.w3.org/2000/svg","path");
anonIconBody.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
// anonIconBody.setAttribute("d",`M ${radius/2 - 4} ${radius/2 + 1} h 8 v4 h -8 z`);
anonIconBody.setAttribute("d",`M ${radius/2} ${radius/2 + 5} h -2.5 c -2 1 -2 -5 0.5 -4.5 c 2 1 2 1 4 0 c 2.5 -0.5 2.5 5.5 0 4.5 z`);
group.appendChild(anonIconBody)
} else {
const label = document.createElementNS("http://www.w3.org/2000/svg","text");
if (user.username || user.email) {
label.setAttribute("class","red-ui-multiplayer-annotation-label");
label.textContent = (user.username || user.email).substring(0,2)
} else {
label.setAttribute("class","red-ui-multiplayer-annotation-label red-ui-multiplayer-user-count")
label.textContent = 'nr'
}
label.setAttribute("text-anchor", "middle")
label.setAttribute("x",radius/2);
label.setAttribute("y",radius/2 + 3);
group.appendChild(label)
}
const border = document.createElementNS("http://www.w3.org/2000/svg","path");
border.setAttribute('d', shapePath)
border.setAttribute("class", "red-ui-multiplayer-annotation-border")
group.appendChild(border)
return group
}
return {
init: function () {
function createAnnotationUser(user) {
const group = document.createElementNS("http://www.w3.org/2000/svg","g");
const badge = document.createElementNS("http://www.w3.org/2000/svg","circle");
const radius = 20
badge.setAttribute("cx",radius/2);
badge.setAttribute("cy",radius/2);
badge.setAttribute("r",radius/2);
badge.setAttribute("class", "red-ui-multiplayer-annotation-background")
group.appendChild(badge)
if (user && user.profileColor !== undefined) {
badge.setAttribute("class", "red-ui-multiplayer-annotation-background red-ui-user-profile-color-" + user.profileColor)
}
if (user && user.image) {
const image = document.createElementNS("http://www.w3.org/2000/svg","image");
image.setAttribute("width", radius)
image.setAttribute("height", radius)
image.setAttribute("href", user.image)
image.setAttribute("clip-path", "circle("+Math.floor(radius/2)+")")
group.appendChild(image)
} else if (user && user.anonymous) {
const anonIconHead = document.createElementNS("http://www.w3.org/2000/svg","circle");
anonIconHead.setAttribute("cx", radius/2)
anonIconHead.setAttribute("cy", radius/2 - 2)
anonIconHead.setAttribute("r", 2.4)
anonIconHead.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
group.appendChild(anonIconHead)
const anonIconBody = document.createElementNS("http://www.w3.org/2000/svg","path");
anonIconBody.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
// anonIconBody.setAttribute("d",`M ${radius/2 - 4} ${radius/2 + 1} h 8 v4 h -8 z`);
anonIconBody.setAttribute("d",`M ${radius/2} ${radius/2 + 5} h -2.5 c -2 1 -2 -5 0.5 -4.5 c 2 1 2 1 4 0 c 2.5 -0.5 2.5 5.5 0 4.5 z`);
group.appendChild(anonIconBody)
} else {
const labelText = user.username ? user.username.substring(0,2) : user
const label = document.createElementNS("http://www.w3.org/2000/svg","text");
if (user.username) {
label.setAttribute("class","red-ui-multiplayer-annotation-label");
label.textContent = user.username.substring(0,2)
} else {
label.setAttribute("class","red-ui-multiplayer-annotation-label red-ui-multiplayer-user-count")
label.textContent = user
}
label.setAttribute("text-anchor", "middle")
label.setAttribute("x",radius/2);
label.setAttribute("y",radius/2 + 3);
group.appendChild(label)
}
const border = document.createElementNS("http://www.w3.org/2000/svg","circle");
border.setAttribute("cx",radius/2);
border.setAttribute("cy",radius/2);
border.setAttribute("r",radius/2);
border.setAttribute("class", "red-ui-multiplayer-annotation-border")
group.appendChild(border)
return group
}
RED.view.annotations.register("red-ui-multiplayer",{
type: 'badge',
@ -479,6 +531,24 @@ RED.multiplayer = (function () {
RED.comms.send('multiplayer/disconnect', disconnectInfo)
RED.settings.removeLocal('multiplayer:sessionId')
})
const chart = $('#red-ui-workspace-chart')
chart.on('mousemove', function (evt) {
lastPosition[0] = evt.clientX
lastPosition[1] = evt.clientY
publishLocation()
})
chart.on('scroll', function (evt) {
publishLocation()
})
chart.on('mouseenter', function () {
isInWorkspace = true
publishLocation()
})
chart.on('mouseleave', function () {
isInWorkspace = false
publishLocation()
})
}
}

View File

@ -73,7 +73,13 @@ RED.nodes = (function() {
var exports = {
setModulePendingUpdated: function(module,version) {
moduleList[module].pending_version = version;
if (!!RED.plugins.getModule(module)) {
// The module updated is a plugin
RED.plugins.getModule(module).pending_version = version;
} else {
moduleList[module].pending_version = version;
}
RED.events.emit("registry:module-updated",{module:module,version:version});
},
getModule: function(module) {
@ -701,12 +707,15 @@ RED.nodes = (function() {
}
n["_"] = RED._;
}
// Both node and config node can use a config node
updateConfigNodeUsers(newNode, { action: "add" });
if (n._def.category == "config") {
configNodes[n.id] = n;
configNodes[n.id] = newNode;
} else {
if (n.wires && (n.wires.length > n.outputs)) { n.outputs = n.wires.length; }
n.dirty = true;
updateConfigNodeUsers(n);
if (n._def.category == "subflows" && typeof n.i === "undefined") {
var nextId = 0;
RED.nodes.eachNode(function(node) {
@ -768,9 +777,11 @@ RED.nodes = (function() {
var removedLinks = [];
var removedNodes = [];
var node;
if (id in configNodes) {
node = configNodes[id];
delete configNodes[id];
updateConfigNodeUsers(node, { action: "remove" });
RED.events.emit('nodes:remove',node);
RED.workspaces.refresh();
} else if (allNodes.hasNode(id)) {
@ -779,6 +790,9 @@ RED.nodes = (function() {
delete nodeLinks[id];
removedLinks = links.filter(function(l) { return (l.source === node) || (l.target === node); });
removedLinks.forEach(removeLink);
updateConfigNodeUsers(node, { action: "remove" });
// TODO: Legacy code for exclusive config node
var updatedConfigNode = false;
for (var d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d)) {
@ -792,10 +806,6 @@ RED.nodes = (function() {
if (configNode._def.exclusive) {
removeNode(node[d]);
removedNodes.push(configNode);
} else {
var users = configNode.users;
users.splice(users.indexOf(node),1);
RED.events.emit('nodes:change',configNode)
}
}
}
@ -1032,23 +1042,34 @@ RED.nodes = (function() {
return {nodes:removedNodes,links:removedLinks, groups: removedGroups, junctions: removedJunctions};
}
/**
* Add a Subflow to the Workspace
*
* @param {object} sf The Subflow to add.
* @param {boolean|undefined} createNewIds Whether to update the name.
*/
function addSubflow(sf, createNewIds) {
if (createNewIds) {
var subflowNames = Object.keys(subflows).map(function(sfid) {
return subflows[sfid].name;
});
// Update the Subflow name to highlight that this is a copy
const subflowNames = Object.keys(subflows).map(function (sfid) {
return subflows[sfid].name || "";
})
subflowNames.sort()
subflowNames.sort();
var copyNumber = 1;
var subflowName = sf.name;
let copyNumber = 1;
let subflowName = sf.name;
subflowNames.forEach(function(name) {
if (subflowName == name) {
subflowName = sf.name + " (" + copyNumber + ")";
copyNumber++;
subflowName = sf.name+" ("+copyNumber+")";
}
});
sf.name = subflowName;
}
sf.instances = [];
subflows[sf.id] = sf;
allNodes.addTab(sf.id);
linkTabMap[sf.id] = [];
@ -1101,7 +1122,7 @@ RED.nodes = (function() {
module: "node-red"
}
});
sf.instances = [];
sf._def = RED.nodes.getType("subflow:"+sf.id);
RED.events.emit("subflows:add",sf);
}
@ -1743,7 +1764,8 @@ RED.nodes = (function() {
// Remove the old subflow definition - but leave the instances in place
var removalResult = RED.subflow.removeSubflow(n.id, true);
// Create the list of nodes for the new subflow def
var subflowNodes = [n].concat(zMap[n.id]);
// Need to sort the list in order to remove missing nodes
var subflowNodes = [n].concat(zMap[n.id]).filter((s) => !!s);
// Import the new subflow - no clashes should occur as we've removed
// the old version
var result = importNodes(subflowNodes);
@ -1780,9 +1802,20 @@ RED.nodes = (function() {
// Replace config nodes
//
configNodeIds.forEach(function(id) {
removedNodes = removedNodes.concat(convertNode(getNode(id)));
const configNode = getNode(id);
const currentUserCount = configNode.users;
// Add a snapshot of the Config Node
removedNodes = removedNodes.concat(convertNode(configNode));
// Remove the Config Node instance
removeNode(id);
importNodes([newConfigNodes[id]])
// Import the new one
importNodes([newConfigNodes[id]]);
// Re-attributes the user count
getNode(id).users = currentUserCount;
});
return {
@ -2023,6 +2056,8 @@ RED.nodes = (function() {
if (matchingSubflow) {
subflow_denylist[n.id] = matchingSubflow;
} else {
const oldId = n.id;
subflow_map[n.id] = n;
if (createNewIds || options.importMap[n.id] === "copy") {
nid = getID();
@ -2050,7 +2085,7 @@ RED.nodes = (function() {
n.status.id = getID();
}
new_subflows.push(n);
addSubflow(n,createNewIds || options.importMap[n.id] === "copy");
addSubflow(n,createNewIds || options.importMap[oldId] === "copy");
}
}
}
@ -2064,6 +2099,8 @@ RED.nodes = (function() {
activeWorkspace = RED.workspaces.active();
}
const pendingConfigNodes = []
const pendingConfigNodeIds = new Set()
// Find all config nodes and add them
for (i=0;i<newNodes.length;i++) {
n = newNodes[i];
@ -2123,7 +2160,8 @@ RED.nodes = (function() {
type:n.type,
info: n.info,
users:[],
_config:{}
_config:{},
_configNodeReferences: new Set()
};
if (!n.z) {
delete configNode.z;
@ -2138,6 +2176,9 @@ RED.nodes = (function() {
if (def.defaults.hasOwnProperty(d)) {
configNode[d] = n[d];
configNode._config[d] = JSON.stringify(n[d]);
if (def.defaults[d].type) {
configNode._configNodeReferences.add(n[d])
}
}
}
if (def.hasOwnProperty('credentials') && n.hasOwnProperty('credentials')) {
@ -2154,11 +2195,55 @@ RED.nodes = (function() {
configNode.id = getID();
}
node_map[n.id] = configNode;
new_nodes.push(configNode);
pendingConfigNodes.push(configNode);
pendingConfigNodeIds.add(configNode.id)
}
}
}
// We need to sort new_nodes (which only contains config nodes at this point)
// to ensure they get added in the right order. If NodeA depends on NodeB, then
// NodeB must be added first.
// Limit us to 5 full iterations of the list - this should be more than
// enough to process the list as config->config node relationships are
// not very common
let iterationLimit = pendingConfigNodes.length * 5
const handledConfigNodes = new Set()
while (pendingConfigNodes.length > 0 && iterationLimit > 0) {
const node = pendingConfigNodes.shift()
let hasPending = false
// Loop through the nodes referenced by this node to see if anything
// is pending
node._configNodeReferences.forEach(id => {
if (pendingConfigNodeIds.has(id) && !handledConfigNodes.has(id)) {
// This reference is for a node we know is in this import, but
// it isn't added yet - flag as pending
hasPending = true
}
})
if (!hasPending) {
// This node has no pending config node references - safe to add
delete node._configNodeReferences
new_nodes.push(node)
handledConfigNodes.add(node.id)
} else {
// This node has pending config node references
// Put to the back of the queue
pendingConfigNodes.push(node)
}
iterationLimit--
}
if (pendingConfigNodes.length > 0) {
// We exceeded the iteration count. Could be due to reference loops
// between the config nodes. At this point, just add the remaining
// nodes as-is
pendingConfigNodes.forEach(node => {
delete node._configNodeReferences
new_nodes.push(node)
})
}
// Find regular flow nodes and subflow instances
for (i=0;i<newNodes.length;i++) {
n = newNodes[i];
@ -2170,7 +2255,7 @@ RED.nodes = (function() {
x:parseFloat(n.x || 0),
y:parseFloat(n.y || 0),
z:n.z,
type:0,
type: n.type,
info: n.info,
changed:false,
_config:{}
@ -2231,7 +2316,6 @@ RED.nodes = (function() {
}
}
}
node.type = n.type;
node._def = def;
if (node.type === "group") {
node._def = RED.group.def;
@ -2261,6 +2345,15 @@ RED.nodes = (function() {
outputs: n.outputs|| (n.wires && n.wires.length) || 0,
set: registry.getNodeSet("node-red/unknown")
}
var orig = {};
for (var p in n) {
if (n.hasOwnProperty(p) && p!="x" && p!="y" && p!="z" && p!="id" && p!="wires") {
orig[p] = n[p];
}
}
node._orig = orig;
node.name = n.type;
node.type = "unknown";
} else {
if (subflow_denylist[parentId] || createNewIds || options.importMap[n.id] === "copy") {
parentId = subflow.id;
@ -2321,29 +2414,31 @@ RED.nodes = (function() {
node.type = "unknown";
}
if (node._def.category != "config") {
if (n.hasOwnProperty('inputs')) {
node.inputs = n.inputs;
if (n.hasOwnProperty('inputs') && node._def.defaults.hasOwnProperty("inputs")) {
node.inputs = parseInt(n.inputs, 10);
node._config.inputs = JSON.stringify(n.inputs);
} else {
node.inputs = node._def.inputs;
}
if (n.hasOwnProperty('outputs')) {
node.outputs = n.outputs;
if (n.hasOwnProperty('outputs') && node._def.defaults.hasOwnProperty("outputs")) {
node.outputs = parseInt(n.outputs, 10);
node._config.outputs = JSON.stringify(n.outputs);
} else {
node.outputs = node._def.outputs;
}
if (node.hasOwnProperty('wires') && node.wires.length > node.outputs) {
if (!node._def.defaults.hasOwnProperty("outputs") || !isNaN(parseInt(n.outputs))) {
// If 'wires' is longer than outputs, clip wires
console.log("Warning: node.wires longer than node.outputs - trimming wires:",node.id," wires:",node.wires.length," outputs:",node.outputs);
node.wires = node.wires.slice(0,node.outputs);
} else {
// The node declares outputs in its defaults, but has not got a valid value
// Defer to the length of the wires array
// The node declares outputs in its defaults, but has not got a valid value
// Defer to the length of the wires array
if (node.hasOwnProperty('wires')) {
if (isNaN(node.outputs)) {
node.outputs = node.wires.length;
} else if (node.wires.length > node.outputs) {
// If 'wires' is longer than outputs, clip wires
console.log("Warning: node.wires longer than node.outputs - trimming wires:", node.id, " wires:", node.wires.length, " outputs:", node.outputs);
node.wires = node.wires.slice(0, node.outputs);
}
}
for (d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d) && d !== 'inputs' && d !== 'outputs') {
node[d] = n[d];
@ -2406,11 +2501,28 @@ RED.nodes = (function() {
} else {
delete n.g
}
// If importing into a subflow, ensure an outbound-link doesn't get added
if (activeSubflow && /^link /.test(n.type) && n.links) {
// If importing a link node, ensure both ends of each link are either:
// - not in a subflow
// - both in the same subflow (not for link call node)
if (/^link /.test(n.type) && n.links) {
n.links = n.links.filter(function(id) {
const otherNode = node_map[id] || RED.nodes.node(id);
return (otherNode && otherNode.z === activeWorkspace);
if (!otherNode) {
// Cannot find other end - remove the link
return false
}
if (otherNode.z === n.z) {
// Both ends in the same flow/subflow
return true
} else if (n.type === "link call" && !getSubflow(otherNode.z)) {
// Link call node can call out of a subflow as long as otherNode is
// not in a subflow
return true
} else if (!!getSubflow(n.z) || !!getSubflow(otherNode.z)) {
// One end is in a subflow - remove the link
return false
}
return true
});
}
for (var d3 in n._def.defaults) {
@ -2423,11 +2535,6 @@ RED.nodes = (function() {
nodeList = nodeList.map(function(id) {
var node = node_map[id];
if (node) {
if (node._def.category === 'config') {
if (node.users.indexOf(n) === -1) {
node.users.push(n);
}
}
return node.id;
}
return id;
@ -2441,9 +2548,11 @@ RED.nodes = (function() {
n = new_subflows[i];
n.in.forEach(function(input) {
input.wires.forEach(function(wire) {
var link = {source:input, sourcePort:0, target:node_map[wire.id]};
addLink(link);
new_links.push(link);
if (node_map.hasOwnProperty(wire.id)) {
var link = {source:input, sourcePort:0, target:node_map[wire.id]};
addLink(link);
new_links.push(link);
}
});
delete input.wires;
});
@ -2452,11 +2561,13 @@ RED.nodes = (function() {
var link;
if (subflow_map[wire.id] && subflow_map[wire.id].id == n.id) {
link = {source:n.in[wire.port], sourcePort:wire.port,target:output};
} else {
} else if (node_map.hasOwnProperty(wire.id) || subflow_map.hasOwnProperty(wire.id)) {
link = {source:node_map[wire.id]||subflow_map[wire.id], sourcePort:wire.port,target:output};
}
addLink(link);
new_links.push(link);
if (link) {
addLink(link);
new_links.push(link);
}
});
delete output.wires;
});
@ -2465,11 +2576,13 @@ RED.nodes = (function() {
var link;
if (subflow_map[wire.id] && subflow_map[wire.id].id == n.id) {
link = {source:n.in[wire.port], sourcePort:wire.port,target:n.status};
} else {
} else if (node_map.hasOwnProperty(wire.id) || subflow_map.hasOwnProperty(wire.id)) {
link = {source:node_map[wire.id]||subflow_map[wire.id], sourcePort:wire.port,target:n.status};
}
addLink(link);
new_links.push(link);
if (link) {
addLink(link);
new_links.push(link);
}
});
delete n.status.wires;
}
@ -2648,25 +2761,79 @@ RED.nodes = (function() {
return result;
}
// Update any config nodes referenced by the provided node to ensure their 'users' list is correct
function updateConfigNodeUsers(n) {
for (var d in n._def.defaults) {
if (n._def.defaults.hasOwnProperty(d)) {
var property = n._def.defaults[d];
/**
* Update any config nodes referenced by the provided node to ensure
* their 'users' list is correct.
*
* @param {object} node The node in which to check if it contains references
* @param {object} options Options to apply.
* @param {"add" | "remove"} [options.action] Add or remove the node from
* the Config Node users list. Default `add`.
* @param {boolean} [options.emitEvent] Emit the `nodes:changes` event.
* Default true.
*/
function updateConfigNodeUsers(node, options) {
const defaultOptions = { action: "add", emitEvent: true };
options = Object.assign({}, defaultOptions, options);
for (var d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d)) {
var property = node._def.defaults[d];
if (property.type) {
var type = registry.getNodeType(property.type);
// Need to ensure the type is a config node to not treat links nodes
if (type && type.category == "config") {
var configNode = configNodes[n[d]];
var configNode = configNodes[node[d]];
if (configNode) {
if (configNode.users.indexOf(n) === -1) {
configNode.users.push(n);
RED.events.emit('nodes:change',configNode)
if (options.action === "add") {
if (configNode.users.indexOf(node) === -1) {
configNode.users.push(node);
if (options.emitEvent) {
RED.events.emit('nodes:change', configNode);
}
}
} else if (options.action === "remove") {
if (configNode.users.indexOf(node) !== -1) {
const users = configNode.users;
users.splice(users.indexOf(node), 1);
if (options.emitEvent) {
RED.events.emit('nodes:change', configNode);
}
}
}
}
}
}
}
}
// Subflows can have config node env
if (node.type.indexOf("subflow:") === 0) {
node.env?.forEach((prop) => {
if (prop.type === "conf-type" && prop.value) {
// Add the node to the config node users
const configNode = getNode(prop.value);
if (configNode) {
if (options.action === "add") {
if (configNode.users.indexOf(node) === -1) {
configNode.users.push(node);
if (options.emitEvent) {
RED.events.emit('nodes:change', configNode);
}
}
} else if (options.action === "remove") {
if (configNode.users.indexOf(node) !== -1) {
const users = configNode.users;
users.splice(users.indexOf(node), 1);
if (options.emitEvent) {
RED.events.emit('nodes:change', configNode);
}
}
}
}
}
});
}
}
function flowVersion(version) {

View File

@ -205,7 +205,9 @@ RED.actionList = (function() {
}
function init() {
RED.actions.add("core:show-action-list",show);
if (RED.settings.theme("menu.menu-item-action-list", true)) {
RED.actions.add("core:show-action-list",show);
}
RED.events.on("editor:open",function() { disabled = true; });
RED.events.on("editor:close",function() { disabled = false; });

View File

@ -334,6 +334,30 @@ RED.clipboard = (function() {
},100);
}
/**
* Validates if the provided string looks like valid flow json
* @param {string} flowString the string to validate
* @returns If valid, returns the node array
*/
function validateFlowString(flowString) {
const res = JSON.parse(flowString)
if (!Array.isArray(res)) {
throw new Error(RED._("clipboard.import.errors.notArray"));
}
for (let i = 0; i < res.length; i++) {
if (typeof res[i] !== "object") {
throw new Error(RED._("clipboard.import.errors.itemNotObject",{index:i}));
}
if (!Object.hasOwn(res[i], 'id')) {
throw new Error(RED._("clipboard.import.errors.missingId",{index:i}));
}
if (!Object.hasOwn(res[i], 'type')) {
throw new Error(RED._("clipboard.import.errors.missingType",{index:i}));
}
}
return res
}
var validateImportTimeout;
function validateImport() {
if (activeTab === "red-ui-clipboard-dialog-import-tab-clipboard") {
@ -351,21 +375,7 @@ RED.clipboard = (function() {
return;
}
try {
if (!/^\[[\s\S]*\]$/m.test(v)) {
throw new Error(RED._("clipboard.import.errors.notArray"));
}
var res = JSON.parse(v);
for (var i=0;i<res.length;i++) {
if (typeof res[i] !== "object") {
throw new Error(RED._("clipboard.import.errors.itemNotObject",{index:i}));
}
if (!res[i].hasOwnProperty('id')) {
throw new Error(RED._("clipboard.import.errors.missingId",{index:i}));
}
if (!res[i].hasOwnProperty('type')) {
throw new Error(RED._("clipboard.import.errors.missingType",{index:i}));
}
}
validateFlowString(v)
currentPopoverError = null;
popover.close(true);
importInput.removeClass("input-error");
@ -998,16 +1008,16 @@ RED.clipboard = (function() {
}
function importNodes(nodesStr,addFlow) {
var newNodes = nodesStr;
let newNodes = nodesStr;
if (typeof nodesStr === 'string') {
try {
nodesStr = nodesStr.trim();
if (nodesStr.length === 0) {
return;
}
newNodes = JSON.parse(nodesStr);
newNodes = validateFlowString(nodesStr)
} catch(err) {
var e = new Error(RED._("clipboard.invalidFlow",{message:err.message}));
const e = new Error(RED._("clipboard.invalidFlow",{message:err.message}));
e.code = "NODE_RED";
throw e;
}
@ -1342,6 +1352,7 @@ RED.clipboard = (function() {
}
}
} catch(err) {
console.warn('Import failed: ', err)
// Ensure any errors throw above doesn't stop the drop target from
// being hidden.
}

View File

@ -61,7 +61,7 @@
}
this.menu = RED.popover.menu({
tabSelect: true,
width: 300,
width: Math.max(300, this.element.width()),
maxHeight: 200,
class: "red-ui-autoComplete-container",
options: completions,

View File

@ -63,6 +63,7 @@
pre: value.substring(0,idx),
match: value.substring(idx,idx+len),
post: value.substring(idx+len),
exact: idx === 0 && value.length === searchValue.length
}
}
function generateSpans(match) {
@ -83,7 +84,7 @@
const srcMatch = getMatch(optSrc, val);
if (valMatch.found || srcMatch.found) {
const element = $('<div>',{style: "display: flex"});
const valEl = $('<div/>',{style:"font-family: var(--red-ui-monospace-font); white-space:nowrap; overflow: hidden; flex-grow:1"});
const valEl = $('<div/>',{ class: "red-ui-autoComplete-completion" });
valEl.append(generateSpans(valMatch));
valEl.appendTo(element);
if (optSrc) {
@ -159,7 +160,7 @@
if (valMatch.found) {
const optSrc = envVarsMap[v]
const element = $('<div>',{style: "display: flex"});
const valEl = $('<div/>',{style:"font-family: var(--red-ui-monospace-font); white-space:nowrap; overflow: hidden; flex-grow:1"});
const valEl = $('<div/>',{ class: "red-ui-autoComplete-completion" });
valEl.append(generateSpans(valMatch))
valEl.appendTo(element)
@ -201,7 +202,7 @@
const that = this
const getContextKeysFromRuntime = function(scope, store, searchKey, done) {
contextKnownKeys[scope] = contextKnownKeys[scope] || {}
contextKnownKeys[scope][store] = contextKnownKeys[scope][store] || new Set()
contextKnownKeys[scope][store] = contextKnownKeys[scope][store] || new Map()
if (searchKey.length > 0) {
try {
RED.utils.normalisePropertyExpression(searchKey)
@ -223,11 +224,12 @@
const result = data[store] || {}
const keys = result.keys || []
const keyPrefix = searchKey + (searchKey.length > 0 ? '.' : '')
keys.forEach(key => {
keys.forEach(keyInfo => {
const key = keyInfo.key
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(key)) {
contextKnownKeys[scope][store].add(keyPrefix + key)
contextKnownKeys[scope][store].set(keyPrefix + key, keyInfo)
} else {
contextKnownKeys[scope][store].add(searchKey + "[\""+key.replace(/"/,"\\\"")+"\"]")
contextKnownKeys[scope][store].set(searchKey + "[\""+key.replace(/"/,"\\\"")+"\"]", keyInfo)
}
})
done()
@ -242,14 +244,14 @@
// Get the flow id of the node we're editing
const editStack = RED.editor.getEditStack()
if (editStack.length === 0) {
done([])
done(new Map())
return
}
const editingNode = editStack.pop()
if (editingNode.z) {
scope = `${scope}/${editingNode.z}`
} else {
done([])
done(new Map())
return
}
}
@ -269,17 +271,29 @@
return function(val, done) {
getContextKeys(val, function (keys) {
const matches = []
keys.forEach(v => {
keys.forEach((keyInfo, v) => {
let optVal = v
let valMatch = getMatch(optVal, val);
if (!valMatch.found && val.length > 0 && val.endsWith('.')) {
// Search key ends in '.' - but doesn't match. Check again
// with [" at the end instead so we match bracket notation
valMatch = getMatch(optVal, val.substring(0, val.length - 1) + '["')
if (!valMatch.found && val.length > 0) {
if (val.endsWith('.')) {
// Search key ends in '.' - but doesn't match. Check again
// with [" at the end instead so we match bracket notation
valMatch = getMatch(optVal, val.substring(0, val.length - 1) + '["')
// } else if (val.endsWith('[') && /^array/.test(keyInfo.format)) {
// console.log('this case')
}
}
if (valMatch.found) {
const element = $('<div>',{style: "display: flex"});
const valEl = $('<div/>',{style:"font-family: var(--red-ui-monospace-font); white-space:nowrap; overflow: hidden; flex-grow:1"});
const valEl = $('<div/>',{ class: "red-ui-autoComplete-completion" });
// if (keyInfo.format) {
// valMatch.post += ' ' + keyInfo.format
// }
if (valMatch.exact && /^array/.test(keyInfo.format)) {
valMatch.post += `[0-${keyInfo.length}]`
optVal += '['
}
valEl.append(generateSpans(valMatch))
valEl.appendTo(element)
matches.push({
@ -1567,7 +1581,8 @@
if (tooltip) {
tooltip.setContent(valid);
} else {
tooltip = RED.popover.tooltip(this.elementDiv, valid);
const target = this.typeMap[type]?.options ? this.optionSelectLabel : this.elementDiv;
tooltip = RED.popover.tooltip(target, valid);
this.element.data("tooltip", tooltip);
}
}

View File

@ -32,39 +32,44 @@ RED.contextMenu = (function () {
const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
let hasGroup, isAllGroups = true, hasDisabledNode, hasEnabledNode, hasLabeledNode, hasUnlabeledNode;
if (hasSelection) {
selection.nodes.forEach(n => {
const nodes = selection.nodes.slice();
while (nodes.length) {
const n = nodes.shift();
if (n.type === 'group') {
hasGroup = true;
nodes.push(...n.nodes);
} else {
isAllGroups = false;
}
if (n.d) {
hasDisabledNode = true;
} else {
hasEnabledNode = true;
if (n.d) {
hasDisabledNode = true;
} else {
hasEnabledNode = true;
}
}
if (n.l === undefined || n.l) {
hasLabeledNode = true;
} else {
hasUnlabeledNode = true;
}
});
}
}
const offset = $("#red-ui-workspace-chart").offset()
let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
let addY = options.y - offset.top + $("#red-ui-workspace-chart").scrollTop()
const scale = RED.view.scale()
const offset = $("#red-ui-workspace-chart").offset()
let addX = (options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()) / scale
let addY = (options.y - offset.top + $("#red-ui-workspace-chart").scrollTop()) / scale
if (RED.view.snapGrid) {
const gridSize = RED.view.gridSize()
addX = gridSize * Math.floor(addX / gridSize)
addY = gridSize * Math.floor(addY / gridSize)
addX = gridSize * Math.round(addX / gridSize)
addY = gridSize * Math.round(addY / gridSize)
}
menuItems.push(
{ onselect: 'core:show-action-list', label: RED._("contextMenu.showActionList"), onpostselect: function () { } }
)
if (RED.settings.theme("menu.menu-item-action-list", true)) {
menuItems.push(
{ onselect: 'core:show-action-list', label: RED._("contextMenu.showActionList"), onpostselect: function () { } }
)
}
const insertOptions = []
menuItems.push({ label: RED._("contextMenu.insert"), options: insertOptions })
insertOptions.push(
@ -82,7 +87,9 @@ RED.contextMenu = (function () {
},
(hasLinks) ? { // has least 1 wire selected
label: RED._("contextMenu.junction"),
onselect: 'core:split-wires-with-junctions',
onselect: function () {
RED.actions.invoke('core:split-wires-with-junctions', { x: addX, y: addY })
},
disabled: !canEdit || !hasLinks
} : {
label: RED._("contextMenu.junction"),

View File

@ -44,6 +44,7 @@ RED.deploy = (function() {
/**
* options:
* type: "default" - Button with drop-down options - no further customisation available
* label: the text to display - default: "Deploy"
* type: "simple" - Button without dropdown. Customisations:
* label: the text to display - default: "Deploy"
* icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.svg"
@ -51,13 +52,14 @@ RED.deploy = (function() {
function init(options) {
options = options || {};
var type = options.type || "default";
var label = options.label || RED._("deploy.deploy");
if (type == "default") {
$('<li><span class="red-ui-deploy-button-group button-group">'+
'<a id="red-ui-header-button-deploy" class="red-ui-deploy-button disabled" href="#">'+
'<span class="red-ui-deploy-button-content">'+
'<img id="red-ui-header-button-deploy-icon" src="red/images/deploy-full-o.svg"> '+
'<span>'+RED._("deploy.deploy")+'</span>'+
'<span>'+label+'</span>'+
'</span>'+
'<span class="red-ui-deploy-button-spinner hide">'+
'<img src="red/images/spin.svg"/>'+
@ -78,7 +80,6 @@ RED.deploy = (function() {
mainMenuItems.push({id:"deploymenu-item-reload", icon:"red/images/deploy-reload.svg",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"})
RED.menu.init({id:"red-ui-header-button-deploy-options", options: mainMenuItems });
} else if (type == "simple") {
var label = options.label || RED._("deploy.deploy");
var icon = 'red/images/deploy-full-o.svg';
if (options.hasOwnProperty('icon')) {
icon = options.icon;
@ -424,11 +425,15 @@ RED.deploy = (function() {
const unknownNodes = [];
const invalidNodes = [];
const isDisabled = function (node) {
return (node.d || RED.nodes.workspace(node.z)?.disabled);
};
RED.nodes.eachConfig(function (node) {
if (node.valid === undefined) {
RED.editor.validateNode(node);
}
if (!node.valid && !node.d) {
if (!node.valid && !isDisabled(node)) {
invalidNodes.push(getNodeInfo(node));
}
if (node.type === "unknown") {
@ -438,7 +443,7 @@ RED.deploy = (function() {
}
});
RED.nodes.eachNode(function (node) {
if (!node.valid && !node.d) {
if (!node.valid && !isDisabled(node)) {
invalidNodes.push(getNodeInfo(node));
}
if (node.type === "unknown") {
@ -452,7 +457,7 @@ RED.deploy = (function() {
const unusedConfigNodes = [];
RED.nodes.eachConfig(function (node) {
if ((node._def.hasUsers !== false) && (node.users.length === 0)) {
if ((node._def.hasUsers !== false) && (node.users.length === 0) && !isDisabled(node)) {
unusedConfigNodes.push(getNodeInfo(node));
hasUnusedConfig = true;
}
@ -589,7 +594,9 @@ RED.deploy = (function() {
RED.notify('<p>' + RED._("deploy.successfulDeploy") + '</p>', "success");
}
const flowsToLock = new Set()
// Node's properties cannot be modified if its workspace is locked.
function ensureUnlocked(id) {
// TODO: `RED.nodes.subflow` is useless
const flow = id && (RED.nodes.workspace(id) || RED.nodes.subflow(id) || null);
const isLocked = flow ? flow.locked : false;
if (flow && isLocked) {
@ -642,6 +649,7 @@ RED.deploy = (function() {
delete confNode.credentials;
}
});
// Subflow cannot be locked
RED.nodes.eachSubflow(function (subflow) {
if (subflow.changed) {
subflow.changed = false;
@ -650,12 +658,18 @@ RED.deploy = (function() {
});
RED.nodes.eachWorkspace(function (ws) {
if (ws.changed || ws.added) {
ensureUnlocked(ws.z)
// Ensure the Workspace is unlocked to modify its properties.
ensureUnlocked(ws.id);
ws.changed = false;
delete ws.added
if (flowsToLock.has(ws)) {
ws.locked = true;
flowsToLock.delete(ws);
}
RED.events.emit("flows:change", ws)
}
});
// Ensures all workspaces to be locked have been locked.
flowsToLock.forEach(flow => {
flow.locked = true
})

View File

@ -497,7 +497,7 @@ RED.diff = (function() {
}
})
if (c === 0) {
result.text("none");
result.text(RED._("diff.type.none"));
} else {
list.appendTo(result);
}
@ -821,7 +821,7 @@ RED.diff = (function() {
conflict = true;
}
row = $("<tr>").appendTo(nodePropertiesTableBody);
$("<td>",{class:"red-ui-diff-list-cell-label"}).text("position").appendTo(row);
$("<td>",{class:"red-ui-diff-list-cell-label"}).text(RED._("diff.type.position")).appendTo(row);
localCell = $("<td>",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row);
if (localNode) {
localCell.addClass("red-ui-diff-status-"+(localChanged?"moved":"unchanged"));
@ -899,7 +899,7 @@ RED.diff = (function() {
conflict = true;
}
row = $("<tr>").appendTo(nodePropertiesTableBody);
$("<td>",{class:"red-ui-diff-list-cell-label"}).text("wires").appendTo(row);
$("<td>",{class:"red-ui-diff-list-cell-label"}).text(RED._("diff.type.wires")).appendTo(row);
localCell = $("<td>",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row);
if (localNode) {
if (!conflict) {
@ -2029,15 +2029,14 @@ RED.diff = (function() {
if (!isSeparator) {
var isOurs = /^..<<<<<<</.test(lineText);
if (isOurs) {
$('<span>').text("<<<<<<< Local Changes").appendTo(line);
$('<span>').text("<<<<<<< " + RED._("diff.localChanges")).appendTo(line);
hunk.localChangeStart = actualLineNumber;
} else {
hunk.remoteChangeEnd = actualLineNumber;
$('<span>').text(">>>>>>> Remote Changes").appendTo(line);
$('<span>').text(">>>>>>> " + RED._("diff.remoteChanges")).appendTo(line);
}
diffRow.addClass("mergeHeader-"+(isOurs?"ours":"theirs"));
$('<button class="red-ui-button red-ui-button-small" style="float: right; margin-right: 20px;"><i class="fa fa-angle-double-'+(isOurs?"down":"up")+'"></i> use '+(isOurs?"local":"remote")+' changes</button>')
$('<button class="red-ui-button red-ui-button-small" style="float: right; margin-right: 20px;"><i class="fa fa-angle-double-'+(isOurs?"down":"up")+'"></i> '+RED._(isOurs?"diff.useLocalChanges":"diff.useRemoteChanges")+'</button>')
.appendTo(line)
.on("click", function(evt) {
evt.preventDefault();
@ -2119,7 +2118,7 @@ RED.diff = (function() {
$("<h3>").text(commit.title).appendTo(content);
$('<div class="commit-body"></div>').text(commit.comment).appendTo(content);
var summary = $('<div class="commit-summary"></div>').appendTo(content);
$('<div style="float: right">').text("Commit "+commit.sha).appendTo(summary);
$('<div style="float: right">').text(RED._('diff.commit')+" "+commit.sha).appendTo(summary);
$('<div>').text((commit.authorName||commit.author)+" - "+options.date).appendTo(summary);
if (commit.files) {

View File

@ -157,6 +157,12 @@ RED.editor = (function() {
}
}
if (valid && "validate" in definition[property]) {
if (definition[property].hasOwnProperty("required") &&
definition[property].required === false) {
if (value === "") {
return true;
}
}
try {
var opt = {};
if (label) {
@ -183,6 +189,11 @@ RED.editor = (function() {
});
}
} else if (valid) {
if (definition[property].hasOwnProperty("required") && definition[property].required === false) {
if (value === "") {
return true;
}
}
// If the validator is not provided in node property => Check if the input has a validator
if ("category" in node._def) {
const isConfig = node._def.category === "config";
@ -797,6 +808,20 @@ RED.editor = (function() {
}
}
const oldCreds = {};
if (editing_node._def.credentials) {
for (const prop in editing_node._def.credentials) {
if (Object.prototype.hasOwnProperty.call(editing_node._def.credentials, prop)) {
if (editing_node._def.credentials[prop].type === 'password') {
oldCreds['has_' + prop] = editing_node.credentials['has_' + prop];
}
if (prop in editing_node.credentials) {
oldCreds[prop] = editing_node.credentials[prop];
}
}
}
}
try {
const rc = editing_node._def.oneditsave.call(editing_node);
if (rc === true) {
@ -828,6 +853,25 @@ RED.editor = (function() {
}
}
}
if (editing_node._def.credentials) {
for (const prop in editing_node._def.credentials) {
if (Object.prototype.hasOwnProperty.call(editing_node._def.credentials, prop)) {
if (oldCreds[prop] !== editing_node.credentials[prop]) {
if (editing_node.credentials[prop] === '__PWRD__') {
// The password may not exist in oldCreds
// The value '__PWRD__' means the password exists,
// so ignore this change
continue;
}
editState.changes.credentials = editState.changes.credentials || {};
editState.changes.credentials['has_' + prop] = oldCreds['has_' + prop];
editState.changes.credentials[prop] = oldCreds[prop];
editState.changed = true;
}
}
}
}
}
}
@ -888,7 +932,7 @@ RED.editor = (function() {
const labelText = RED.editor.envVarList.lookupLabel(labels, labels["en-US"] || tenv.name, locale)
const config = {
env: tenv,
id: '${' + parentEnv[0].name + '}',
id: '${' + tenv.name + '}',
type: type,
label: labelText,
__label__: `[env] ${labelText}`
@ -1470,134 +1514,181 @@ RED.editor = (function() {
},
{
id: "node-config-dialog-ok",
text: adding?RED._("editor.configAdd"):RED._("editor.configUpdate"),
text: adding ? RED._("editor.configAdd") : RED._("editor.configUpdate"),
class: "primary",
click: function() {
var editState = {
// TODO: Already defined
const configProperty = name;
const configType = type;
const configTypeDef = RED.nodes.getType(configType);
const wasChanged = editing_config_node.changed;
const editState = {
changes: {},
changed: false,
outputMap: null
};
var configProperty = name;
var configId = editing_config_node.id;
var configType = type;
var configAdding = adding;
var configTypeDef = RED.nodes.getType(configType);
var d;
var input;
// Call `oneditsave` and search for changes
handleEditSave(editing_config_node, editState);
if (configTypeDef.oneditsave) {
try {
configTypeDef.oneditsave.call(editing_config_node);
} catch(err) {
console.warn("oneditsave",editing_config_node.id,editing_config_node.type,err.toString());
}
}
for (d in configTypeDef.defaults) {
if (configTypeDef.defaults.hasOwnProperty(d)) {
var newValue;
input = $("#node-config-input-"+d);
if (input.attr('type') === "checkbox") {
newValue = input.prop('checked');
} else if ("format" in configTypeDef.defaults[d] && configTypeDef.defaults[d].format !== "" && input[0].nodeName === "DIV") {
newValue = input.text();
} else {
newValue = input.val();
}
if (newValue != null && newValue !== editing_config_node[d]) {
if (editing_config_node._def.defaults[d].type) {
if (newValue == "_ADD_") {
newValue = "";
}
// Change to a related config node
var configNode = RED.nodes.node(editing_config_node[d]);
if (configNode) {
var users = configNode.users;
users.splice(users.indexOf(editing_config_node),1);
RED.events.emit("nodes:change",configNode);
}
configNode = RED.nodes.node(newValue);
if (configNode) {
configNode.users.push(editing_config_node);
RED.events.emit("nodes:change",configNode);
}
}
editing_config_node[d] = newValue;
}
}
}
activeEditPanes.forEach(function(pane) {
// Search for changes in the edit box (panes)
activeEditPanes.forEach(function (pane) {
if (pane.apply) {
pane.apply.call(pane, editState);
}
})
});
editing_config_node.label = configTypeDef.label;
var scope = $("#red-ui-editor-config-scope").val();
editing_config_node.z = scope;
// TODO: Why?
editing_config_node.label = configTypeDef.label
// Check if disabled has changed
if ($("#node-config-input-node-disabled").prop('checked')) {
if (editing_config_node.d !== true) {
editState.changes.d = editing_config_node.d;
editState.changed = true;
editing_config_node.d = true;
}
} else {
if (editing_config_node.d === true) {
editState.changes.d = editing_config_node.d;
editState.changed = true;
delete editing_config_node.d;
}
}
// NOTE: must be undefined if no scope used
const scope = $("#red-ui-editor-config-scope").val() || undefined;
// Check if the scope has changed
if (editing_config_node.z !== scope) {
editState.changes.z = editing_config_node.z;
editState.changed = true;
editing_config_node.z = scope;
}
// Search for nodes that use this config node that are no longer
// in scope, so must be removed
const historyEvents = [];
if (scope) {
// Search for nodes that use this one that are no longer
// in scope, so must be removed
editing_config_node.users = editing_config_node.users.filter(function(n) {
var keep = true;
for (var d in n._def.defaults) {
if (n._def.defaults.hasOwnProperty(d)) {
if (n._def.defaults[d].type === editing_config_node.type &&
n[d] === editing_config_node.id &&
n.z !== scope) {
keep = false;
// Remove the reference to this node
// and revalidate
n[d] = null;
n.dirty = true;
n.changed = true;
validateNode(n);
const newUsers = editing_config_node.users.filter(function (node) {
let keepNode = false;
let nodeModified = null;
for (const d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d)) {
if (node._def.defaults[d].type === editing_config_node.type) {
if (node[d] === editing_config_node.id) {
if (node.z === editing_config_node.z) {
// The node is kept only if at least one property uses
// this config node in the correct scope.
keepNode = true;
} else {
if (!nodeModified) {
nodeModified = {
t: "edit",
node: node,
changes: { [d]: node[d] },
changed: node.changed,
dirty: node.dirty
};
} else {
nodeModified.changes[d] = node[d];
}
// Remove the reference to the config node
node[d] = "";
}
}
}
}
}
return keep;
});
}
if (configAdding) {
RED.nodes.add(editing_config_node);
}
validateNode(editing_config_node);
var validatedNodes = {};
validatedNodes[editing_config_node.id] = true;
var userStack = editing_config_node.users.slice();
while(userStack.length > 0) {
var user = userStack.pop();
if (!validatedNodes[user.id]) {
validatedNodes[user.id] = true;
if (user.users) {
userStack = userStack.concat(user.users);
// Add the node modified to the history
if (nodeModified) {
historyEvents.push(nodeModified);
}
validateNode(user);
// Mark as changed and revalidate this node
if (!keepNode) {
node.changed = true;
node.dirty = true;
validateNode(node);
RED.events.emit("nodes:change", node);
}
return keepNode;
});
// Check if users are changed
if (editing_config_node.users.length !== newUsers.length) {
editState.changes.users = editing_config_node.users;
editState.changed = true;
editing_config_node.users = newUsers;
}
}
RED.nodes.dirty(true);
RED.view.redraw(true);
if (!configAdding) {
RED.events.emit("editor:save",editing_config_node);
RED.events.emit("nodes:change",editing_config_node);
if (editState.changed) {
// Set the congig node as changed
editing_config_node.changed = true;
}
// Now, validate the config node
validateNode(editing_config_node);
// And validate nodes using this config node too
const validatedNodes = new Set();
const userStack = editing_config_node.users.slice();
validatedNodes.add(editing_config_node.id);
while (userStack.length) {
const node = userStack.pop();
if (!validatedNodes.has(node.id)) {
validatedNodes.add(node.id);
if (node.users) {
userStack.push(...node.users);
}
validateNode(node);
}
}
let historyEvent = {
t: "edit",
node: editing_config_node,
changes: editState.changes,
changed: wasChanged,
dirty: RED.nodes.dirty()
};
if (historyEvents.length) {
// Need a multi events
historyEvent = {
t: "multi",
events: [historyEvent].concat(historyEvents),
dirty: historyEvent.dirty
};
}
if (!adding) {
// This event is triggered when the edit box is saved,
// regardless of whether there are any modifications.
RED.events.emit("editor:save", editing_config_node);
}
if (editState.changed) {
if (adding) {
RED.history.push({ t: "add", nodes: [editing_config_node.id], dirty: RED.nodes.dirty() });
// Add the new config node and trigger the `nodes:add` event
RED.nodes.add(editing_config_node);
} else {
RED.history.push(historyEvent);
RED.events.emit("nodes:change", editing_config_node);
}
RED.nodes.dirty(true);
RED.view.redraw(true);
}
RED.tray.close(function() {
var filter = null;
// when editing a config via subflow edit panel, the `configProperty` will not
@ -1745,8 +1836,18 @@ RED.editor = (function() {
}
});
}
let envToRemove = new Set()
if (!isSameObj(old_env, new_env)) {
// Get a list of env properties that have been removed
// by comparing old_env and new_env
if (old_env) {
old_env.forEach(env => { envToRemove.add(env.name) })
}
if (new_env) {
new_env.forEach(env => {
envToRemove.delete(env.name)
})
}
editState.changes.env = editing_node.env;
editing_node.env = new_env;
editState.changed = true;
@ -1755,10 +1856,11 @@ RED.editor = (function() {
if (editState.changed) {
var wasChanged = editing_node.changed;
let wasChanged = editing_node.changed;
editing_node.changed = true;
validateNode(editing_node);
var subflowInstances = [];
let subflowInstances = [];
let instanceHistoryEvents = []
RED.nodes.eachNode(function(n) {
if (n.type == "subflow:"+editing_node.id) {
subflowInstances.push({
@ -1768,13 +1870,35 @@ RED.editor = (function() {
n._def.color = editing_node.color;
n.changed = true;
n.dirty = true;
if (n.env) {
const oldEnv = n.env
const newEnv = []
let envChanged = false
n.env.forEach((env, index) => {
if (envToRemove.has(env.name)) {
envChanged = true
} else {
newEnv.push(env)
}
})
if (envChanged) {
instanceHistoryEvents.push({
t: 'edit',
node: n,
changes: { env: oldEnv },
dirty: n.dirty,
changed: n.changed
})
n.env = newEnv
}
}
updateNodeProperties(n);
validateNode(n);
}
});
RED.events.emit("subflows:change",editing_node);
RED.nodes.dirty(true);
var historyEvent = {
let historyEvent = {
t:'edit',
node:editing_node,
changes:editState.changes,
@ -1784,7 +1908,13 @@ RED.editor = (function() {
instances:subflowInstances
}
};
if (instanceHistoryEvents.length > 0) {
historyEvent = {
t: 'multi',
events: [ historyEvent, ...instanceHistoryEvents ],
dirty: wasDirty
}
}
RED.history.push(historyEvent);
}
editing_node.dirty = true;

View File

@ -165,7 +165,13 @@ RED.editor.codeEditor.monaco = (function() {
//Handles orphaned models
//ensure loaded models that are not explicitly destroyed by a call to .destroy() are disposed
RED.events.on("editor:close",function() {
let models = window.monaco ? monaco.editor.getModels() : null;
if (!window.monaco) { return; }
const editors = window.monaco.editor.getEditors()
const orphanEditors = editors.filter(editor => editor && !document.body.contains(editor.getDomNode()))
orphanEditors.forEach(editor => {
editor.dispose();
});
let models = monaco.editor.getModels()
if(models && models.length) {
console.warn("Cleaning up monaco models left behind. Any node that calls createEditor() should call .destroy().")
for (let index = 0; index < models.length; index++) {
@ -685,6 +691,7 @@ RED.editor.codeEditor.monaco = (function() {
2322, //Type 'unknown' is not assignable to type 'string'
2339, //property does not exist on
2345, //Argument of type xxx is not assignable to parameter of type 'DateTimeFormatOptions'
2538, //Ignore symbols as index property error.
7043, //i forget what this one is,
80001, //Convert to ES6 module
80004, //JSDoc types may be moved to TypeScript types.
@ -1124,6 +1131,7 @@ RED.editor.codeEditor.monaco = (function() {
$(el).remove();
$(toolbarRow).remove();
ed.dispose();
}
ed.resize = function resize() {

View File

@ -131,7 +131,7 @@ RED.editor.envVarList = (function() {
nameField.trigger('change');
}
},
sortable: ".red-ui-editableList-item-handle",
sortable: true,
removable: false
});
var parentEnv = {};

View File

@ -27,6 +27,12 @@
reader.readAsDataURL(file);
}
function file2Text(file,cb) {
file.arrayBuffer().then(d => {
cb( new TextDecoder().decode(d) )
}).catch(ex => { cb(`error: ${ex}`) })
}
var initialized = false;
var currentEditor = null;
/**
@ -52,7 +58,8 @@
if (files.length === 1) {
var file = files[0];
var name = file.name.toLowerCase();
var fileType = file.type.toLowerCase();
if (name.match(/\.(apng|avif|gif|jpeg|png|svg|webp)$/)) {
file2base64Image(file, function (image) {
var session = currentEditor.getSession();
@ -63,7 +70,30 @@
});
return;
}
if ( fileType.startsWith("text/") ) {
file2Text(file, function (txt) {
var session = currentEditor.getSession();
var pos = session.getCursorPosition();
session.insert(pos, txt);
$("#red-ui-image-drop-target").hide();
});
return;
}
}
} else if ($.inArray("text/plain", ev.originalEvent.dataTransfer.types) != -1) {
let item = Object.values(ev.originalEvent.dataTransfer.items).filter(d => d.type == "text/plain")[0]
if (item) {
item.getAsString(txt => {
var session = currentEditor.getSession();
var pos = session.getCursorPosition();
session.insert(pos, txt);
$("#red-ui-image-drop-target").hide();
})
return
}
}
$("#red-ui-image-drop-target").hide();
});

View File

@ -11,9 +11,22 @@ RED.editor.mermaid = (function () {
if (!initializing) {
initializing = true
$.getScript(
'vendor/mermaid/mermaid.min.js',
function (data, stat, jqxhr) {
// Find the cache-buster:
let cacheBuster
$('script').each(function (i, el) {
if (!cacheBuster) {
const src = el.getAttribute('src')
const m = /\?v=(.+)$/.exec(src)
if (m) {
cacheBuster = m[1]
}
}
})
$.ajax({
url: `vendor/mermaid/mermaid.min.js?v=${cacheBuster}`,
dataType: "script",
cache: true,
success: function (data, stat, jqxhr) {
mermaid.initialize({
startOnLoad: false,
theme: RED.settings.get('mermaid', {}).theme
@ -24,7 +37,7 @@ RED.editor.mermaid = (function () {
render(pending)
}
}
)
});
}
} else {
const nodes = document.querySelectorAll(selector)

View File

@ -20,10 +20,31 @@
apply: function(editState) {
var old_env = node.env;
var new_env = [];
if (/^subflow:/.test(node.type)) {
// Get the list of environment variables from the node properties
new_env = RED.subflow.exportSubflowInstanceEnv(node);
}
if (old_env && old_env.length) {
old_env.forEach(function (prop) {
if (prop.type === "conf-type" && prop.value) {
const stillInUse = new_env?.some((p) => p.type === "conf-type" && p.name === prop.name && p.value === prop.value);
if (!stillInUse) {
// Remove the node from the config node users
// Only for empty value or modified
const configNode = RED.nodes.node(prop.value);
if (configNode) {
if (configNode.users.indexOf(node) !== -1) {
configNode.users.splice(configNode.users.indexOf(node), 1);
RED.events.emit('nodes:change', configNode)
}
}
}
}
});
}
// Get the values from the Properties table tab
var items = this.list.editableList('items');
items.each(function (i,el) {
@ -41,7 +62,6 @@
}
});
if (new_env && new_env.length > 0) {
new_env.forEach(function(prop) {
if (prop.type === "cred") {
@ -52,6 +72,15 @@
editState.changed = true;
}
delete prop.value;
} else if (prop.type === "conf-type" && prop.value) {
const configNode = RED.nodes.node(prop.value);
if (configNode) {
if (configNode.users.indexOf(node) === -1) {
// Add the node to the config node users
configNode.users.push(node);
RED.events.emit('nodes:change', configNode);
}
}
}
});
}

View File

@ -44,6 +44,7 @@
apply: function(editState) {
var newValue;
var d;
// If the node is a subflow, the node's properties (exepts name) are saved by `envProperties`
if (node._def.defaults) {
for (d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d)) {
@ -131,9 +132,16 @@
}
}
if (node._def.credentials) {
var credDefinition = node._def.credentials;
var credsChanged = updateNodeCredentials(node,credDefinition,this.inputClass);
editState.changed = editState.changed || credsChanged;
const credDefinition = node._def.credentials;
const credChanges = updateNodeCredentials(node, credDefinition, this.inputClass);
if (Object.keys(credChanges).length) {
editState.changed = true;
editState.changes.credentials = {
...(editState.changes.credentials || {}),
...credChanges
};
}
}
}
}
@ -161,10 +169,11 @@
* @param node - the node containing the credentials
* @param credDefinition - definition of the credentials
* @param prefix - prefix of the input fields
* @return {boolean} whether anything has changed
* @return {object} an object containing the modified properties
*/
function updateNodeCredentials(node, credDefinition, prefix) {
var changed = false;
const changes = {};
if (!node.credentials) {
node.credentials = {_:{}};
} else if (!node.credentials._) {
@ -177,22 +186,33 @@
if (input.length > 0) {
var value = input.val();
if (credDefinition[cred].type == 'password') {
node.credentials['has_' + cred] = (value !== "");
if (value == '__PWRD__') {
continue;
if (value === '__PWRD__') {
// A cred value exists - no changes
} else if (value === '' && node.credentials['has_' + cred] === false) {
// Empty cred value exists - no changes
} else if (value === node.credentials[cred]) {
// A cred value exists locally in the editor - no changes
// Like the user sets a value, saves the config,
// reopens the config and save the config again
} else {
changes['has_' + cred] = node.credentials['has_' + cred];
changes[cred] = node.credentials[cred];
node.credentials[cred] = value;
}
changed = true;
}
node.credentials[cred] = value;
if (value != node.credentials._[cred]) {
changed = true;
node.credentials['has_' + cred] = (value !== '');
} else {
// Since these creds are loaded by the editor,
// values can be directly compared
if (value !== node.credentials[cred]) {
changes[cred] = node.credentials[cred];
node.credentials[cred] = value;
}
}
}
}
}
return changed;
return changes;
}
})();

View File

@ -245,10 +245,15 @@ RED.library = (function() {
if (lib.types && lib.types.indexOf(options.url) === -1) {
return;
}
let icon = 'fa fa-hdd-o';
if (lib.icon) {
const fullIcon = RED.utils.separateIconPath(lib.icon);
icon = (fullIcon.module==="font-awesome"?"fa ":"")+fullIcon.file;
}
listing.push({
library: lib.id,
type: options.url,
icon: lib.icon || 'fa fa-hdd-o',
icon,
label: RED._(lib.label||lib.id),
path: "",
expanded: true,
@ -303,10 +308,15 @@ RED.library = (function() {
if (lib.types && lib.types.indexOf(options.url) === -1) {
return;
}
let icon = 'fa fa-hdd-o';
if (lib.icon) {
const fullIcon = RED.utils.separateIconPath(lib.icon);
icon = (fullIcon.module==="font-awesome"?"fa ":"")+fullIcon.file;
}
listing.push({
library: lib.id,
type: options.url,
icon: lib.icon || 'fa fa-hdd-o',
icon,
label: RED._(lib.label||lib.id),
path: "",
expanded: true,
@ -839,10 +849,10 @@ RED.library = (function() {
if (file && file.label && !file.children) {
$.get("library/"+file.library+"/"+file.type+"/"+file.path, function(data) {
//TODO: nls + sanitize
var propRow = $('<tr class="red-ui-help-info-row"><td>Type</td><td></td></tr>').appendTo(table);
var propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("library.type")+'</td><td></td></tr>').appendTo(table);
$(propRow.children()[1]).text(activeLibrary.type);
if (file.props.hasOwnProperty('name')) {
propRow = $('<tr class="red-ui-help-info-row"><td>Name</td><td>'+file.props.name+'</td></tr>').appendTo(table);
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("library.name")+'</td><td>'+file.props.name+'</td></tr>').appendTo(table);
$(propRow.children()[1]).text(file.props.name);
}
for (var p in file.props) {

View File

@ -308,7 +308,7 @@ RED.projects.settings = (function() {
if (activeProject.dependencies) {
for (var m in activeProject.dependencies) {
if (activeProject.dependencies.hasOwnProperty(m)) {
var installed = !!RED.nodes.registry.getModule(m) && activeProject.dependencies[m] === modulesInUse[m].version;
var installed = !!RED.nodes.registry.getModule(m) && activeProject.dependencies[m] === modulesInUse[m]?.version;
depsList.editableList('addItem',{
id: m,
version: activeProject.dependencies[m], //RED.nodes.registry.getModule(module).version,
@ -1256,7 +1256,7 @@ RED.projects.settings = (function() {
notification.close();
}
},{
text: 'Delete branch',
text: RED._("sidebar.project.projectSettings.deleteBranch"),
click: function() {
notification.close();
var url = "projects/"+activeProject.name+"/branches/"+entry.name;

View File

@ -1362,7 +1362,7 @@ RED.subflow = (function() {
item.value = ""+input.prop("checked");
break;
case "conf-types":
item.value = input.val()
item.value = input.val() === "_ADD_" ? "" : input.val();
item.type = "conf-type"
}
if (ui.type === "cred" || item.type !== data.parent.type || item.value !== data.parent.value) {

View File

@ -56,7 +56,16 @@ RED.sidebar.config = (function() {
} else {
$('<span class="red-ui-palette-node-config-label" data-i18n="sidebar.config.'+name+'">').appendTo(header);
}
$('<span class="red-ui-sidebar-node-config-filter-info"></span>').appendTo(header);
const changeBadgeContainer = $('<svg class="red-ui-sidebar-config-category-changed red-ui-flow-node-changed" width="10" height="10" viewBox="-1 -1 12 12"></svg>').appendTo(header);
const changeBadge = document.createElementNS("http://www.w3.org/2000/svg", "circle");
changeBadge.setAttribute("cx", "5");
changeBadge.setAttribute("cy", "5");
changeBadge.setAttribute("r", "5");
changeBadgeContainer.append(changeBadge);
category = $('<ul class="red-ui-palette-content red-ui-sidebar-node-config-list"></ul>').appendTo(container);
category.on("click", function(e) {
$(content).find(".red-ui-palette-node").removeClass("selected");
@ -150,9 +159,6 @@ RED.sidebar.config = (function() {
$('<li class="red-ui-palette-node-config-type">'+node.type+'</li>').appendTo(list);
currentType = node.type;
}
if (node.changed) {
labelText += "!!"
}
var entry = $('<li class="red-ui-palette-node_id_'+node.id.replace(/\./g,"-")+'"></li>').appendTo(list);
var nodeDiv = $('<div class="red-ui-palette-node-config red-ui-palette-node"></div>').appendTo(entry);
entry.data('node',node.id);
@ -181,15 +187,29 @@ RED.sidebar.config = (function() {
}
}
if (node.changed) {
const nodeDivAnnotations = $('<svg class="red-ui-palette-node-annotations red-ui-flow-node-changed" width="10" height="10" viewBox="-1 -1 12 12"></svg>').appendTo(nodeDiv);
const changeBadge = document.createElementNS("http://www.w3.org/2000/svg", "circle");
changeBadge.setAttribute("cx", "5");
changeBadge.setAttribute("cy", "5");
changeBadge.setAttribute("r", "5");
nodeDivAnnotations.append($(changeBadge));
const categoryHeader = list.parent().find(".red-ui-sidebar-config-tray-header.red-ui-palette-header");
categoryHeader.addClass("red-ui-sidebar-config-changed");
nodeDiv.addClass("red-ui-palette-node-config-changed");
}
if (!node.valid) {
nodeDiv.addClass("red-ui-palette-node-config-invalid")
const nodeDivAnnotations = $('<svg class="red-ui-palette-node-annotations red-ui-flow-node-error" width="10" height="10"></svg>').appendTo(nodeDiv)
const errorBadge = document.createElementNS("http://www.w3.org/2000/svg","path");
errorBadge.setAttribute("d","M 0,9 l 10,0 -5,-8 z");
nodeDivAnnotations.append($(errorBadge))
const nodeDivAnnotations = $('<svg class="red-ui-palette-node-annotations red-ui-flow-node-error" width="10" height="10"></svg>').appendTo(nodeDiv);
const errorBadge = document.createElementNS("http://www.w3.org/2000/svg", "path");
errorBadge.setAttribute("d", "M 0,9 l 10,0 -5,-8 z");
nodeDivAnnotations.append($(errorBadge));
nodeDiv.addClass("red-ui-palette-node-config-invalid");
RED.popover.tooltip(nodeDivAnnotations, function () {
if (node.validationErrors && node.validationErrors.length > 0) {
return RED._("editor.errors.invalidProperties")+"<br> - "+node.validationErrors.join("<br> - ")
return RED._("editor.errors.invalidProperties") + "<br> - " + node.validationErrors.join("<br> - ");
}
})
}
@ -252,6 +272,10 @@ RED.sidebar.config = (function() {
$(this).remove();
delete categories[id];
}
// Remove the `changed` badge from the category header
const categoryHeader = $(this).find(".red-ui-sidebar-config-tray-header.red-ui-palette-header");
categoryHeader.removeClass("red-ui-sidebar-config-changed");
})
var globalConfigNodes = [];
var configList = {};

View File

@ -18,8 +18,6 @@ RED.sidebar.context = (function() {
var content;
var sections;
var localCache = {};
var flowAutoRefresh;
var nodeAutoRefresh;
var nodeSection;
@ -27,6 +25,8 @@ RED.sidebar.context = (function() {
var flowSection;
var globalSection;
const expandedPaths = {}
var currentNode;
var currentFlow;
@ -212,14 +212,41 @@ RED.sidebar.context = (function() {
var l = keys.length;
for (var i = 0; i < l; i++) {
sortedData[keys[i]].forEach(function(v) {
var k = keys[i];
var l2 = sortedData[k].length;
var propRow = $('<tr class="red-ui-help-info-row"><td class="red-ui-sidebar-context-property"></td><td></td></tr>').appendTo(container);
var obj = $(propRow.children()[0]);
const k = keys[i];
let payload = v.msg;
let format = v.format;
const tools = $('<span class="button-group"></span>');
expandedPaths[id + "." + k] = expandedPaths[id + "." + k] || new Set()
const objectElementOptions = {
typeHint: format,
sourceId: id + "." + k,
tools,
path: k,
rootPath: k,
exposeApi: true,
ontoggle: function(path,state) {
path = path.substring(k.length+1)
if (state) {
expandedPaths[id+"."+k].add(path)
} else {
// if 'a' has been collapsed, we want to remove 'a.b' and 'a[0]...' from the set
// of collapsed paths
for (let expandedPath of expandedPaths[id+"."+k]) {
if (expandedPath.startsWith(path+".") || expandedPath.startsWith(path+"[")) {
expandedPaths[id+"."+k].delete(expandedPath)
}
}
expandedPaths[id+"."+k].delete(path)
}
},
expandPaths: [ ...expandedPaths[id+"."+k] ].sort(),
expandLeafNodes: true
}
const propRow = $('<tr class="red-ui-help-info-row"><td class="red-ui-sidebar-context-property"></td><td></td></tr>').appendTo(container);
const obj = $(propRow.children()[0]);
obj.text(k);
var tools = $('<span class="button-group"></span>');
const urlSafeK = encodeURIComponent(k)
var refreshItem = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-refresh"></i></button>').appendTo(tools).on("click", function(e) {
const refreshItem = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-refresh"></i></button>').appendTo(tools).on("click", function(e) {
e.preventDefault();
e.stopPropagation();
$.getJSON(baseUrl+"/"+urlSafeK+"?store="+v.store, function(data) {
@ -229,16 +256,14 @@ RED.sidebar.context = (function() {
tools.detach();
$(propRow.children()[1]).empty();
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
...objectElementOptions,
typeHint: data.format,
sourceId: id+"."+k,
tools: tools,
path: k
}).appendTo(propRow.children()[1]);
}
})
});
RED.popover.tooltip(refreshItem,RED._("sidebar.context.refrsh"));
var deleteItem = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-trash"></i></button>').appendTo(tools).on("click", function(e) {
const deleteItem = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-trash"></i></button>').appendTo(tools).on("click", function(e) {
e.preventDefault();
e.stopPropagation();
var popover = RED.popover.create({
@ -246,7 +271,7 @@ RED.sidebar.context = (function() {
target: propRow,
direction: "left",
content: function() {
var content = $('<div>');
const content = $('<div>');
$('<p data-i18n="sidebar.context.deleteConfirm"></p>').appendTo(content);
var row = $('<p>').appendTo(content);
var bg = $('<span class="button-group"></span>').appendTo(row);
@ -269,16 +294,15 @@ RED.sidebar.context = (function() {
if (container.children().length === 0) {
$('<tr class="red-ui-help-info-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.empty"></td></tr>').appendTo(container).i18n();
}
delete expandedPaths[id + "." + k]
} else {
payload = data.msg;
format = data.format;
tools.detach();
$(propRow.children()[1]).empty();
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
typeHint: data.format,
sourceId: id+"."+k,
tools: tools,
path: k
...objectElementOptions,
typeHint: data.format
}).appendTo(propRow.children()[1]);
}
});
@ -293,14 +317,7 @@ RED.sidebar.context = (function() {
});
RED.popover.tooltip(deleteItem,RED._("sidebar.context.delete"));
var payload = v.msg;
var format = v.format;
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
typeHint: v.format,
sourceId: id+"."+k,
tools: tools,
path: k
}).appendTo(propRow.children()[1]);
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), objectElementOptions).appendTo(propRow.children()[1]);
if (contextStores.length > 1) {
$("<span>",{class:"red-ui-sidebar-context-property-storename"}).text(v.store).appendTo($(propRow.children()[0]))
}

View File

@ -204,7 +204,7 @@ RED.sidebar.info = (function() {
propertiesPanelHeaderIcon.empty();
RED.utils.createNodeIcon({type:"_selection_"}).appendTo(propertiesPanelHeaderIcon);
propertiesPanelHeaderLabel.text("Selection");
propertiesPanelHeaderLabel.text(RED._("sidebar.info.selection"));
propertiesPanelHeaderReveal.hide();
propertiesPanelHeaderHelp.hide();
propertiesPanelHeaderCopyLink.hide();

View File

@ -279,6 +279,11 @@ RED.typeSearch = (function() {
if ($("#red-ui-main-container").height() - opts.y - 195 < 0) {
opts.y = opts.y - 275;
}
const dialogWidth = dialog.width() || 300 // default is 300 (defined in class .red-ui-search)
const workspaceWidth = $('#red-ui-workspace').width()
if (workspaceWidth > dialogWidth && workspaceWidth - opts.x - dialogWidth < 0) {
opts.x = opts.x - (dialogWidth - RED.view.node_width)
}
dialog.css({left:opts.x+"px",top:opts.y+"px"}).show();
searchResultsDiv.slideDown(300);
setTimeout(function() {
@ -330,13 +335,25 @@ RED.typeSearch = (function() {
}
}
function applyFilter(filter,type,def) {
return !def || !filter ||
(
(!filter.spliceMultiple) &&
(!filter.type || type === filter.type) &&
(!filter.input || type === 'junction' || def.inputs > 0) &&
(!filter.output || type === 'junction' || def.outputs > 0)
)
if (!filter) {
// No filter; allow everything
return true
}
if (type === 'junction') {
// Only allow Junction is there's no specific type filter
return !filter.type
}
if (filter.type) {
// Handle explicit type filter
return filter.type === type
}
if (!def) {
// No node definition available - allow it
return true
}
// Check if the filter is for input/outputs and apply
return (!filter.input || def.inputs > 0) &&
(!filter.output || def.outputs > 0)
}
function refreshTypeList(opts) {
var i;
@ -365,7 +382,7 @@ RED.typeSearch = (function() {
var items = [];
RED.nodes.registry.getNodeTypes().forEach(function(t) {
var def = RED.nodes.getType(t);
if (def.category !== 'config' && t !== 'unknown' && t !== 'tab') {
if (def.set?.enabled !== false && def.category !== 'config' && t !== 'unknown' && t !== 'tab') {
items.push({type:t,def: def, label:getTypeLabel(t,def)});
}
});

View File

@ -230,7 +230,7 @@ RED.utils = (function() {
var pinnedPaths = {};
var formattedPaths = {};
function addMessageControls(obj,sourceId,key,msg,rootPath,strippedKey,extraTools) {
function addMessageControls(obj,sourceId,key,msg,rootPath,strippedKey,extraTools,enablePinning) {
if (!pinnedPaths.hasOwnProperty(sourceId)) {
pinnedPaths[sourceId] = {}
}
@ -250,7 +250,7 @@ RED.utils = (function() {
RED.clipboard.copyText(msg,copyPayload,"clipboard.copyMessageValue");
})
RED.popover.tooltip(copyPayload,RED._("node-red:debug.sidebar.copyPayload"));
if (strippedKey !== undefined && strippedKey !== '') {
if (enablePinning && strippedKey !== undefined && strippedKey !== '') {
var isPinned = pinnedPaths[sourceId].hasOwnProperty(strippedKey);
var pinPath = $('<button class="red-ui-button red-ui-button-small red-ui-debug-msg-tools-pin"><i class="fa fa-map-pin"></i></button>').appendTo(tools).on("click", function(e) {
@ -281,13 +281,16 @@ RED.utils = (function() {
}
}
}
function checkExpanded(strippedKey,expandPaths,minRange,maxRange) {
function checkExpanded(strippedKey, expandPaths, { minRange, maxRange, expandLeafNodes }) {
if (expandPaths && expandPaths.length > 0) {
if (strippedKey === '' && minRange === undefined) {
return true;
}
for (var i=0;i<expandPaths.length;i++) {
var p = expandPaths[i];
if (expandLeafNodes && p === strippedKey) {
return true
}
if (p.indexOf(strippedKey) === 0 && (p[strippedKey.length] === "." || p[strippedKey.length] === "[") ) {
if (minRange !== undefined && p[strippedKey.length] === "[") {
@ -394,6 +397,8 @@ RED.utils = (function() {
var sourceId = options.sourceId;
var rootPath = options.rootPath;
var expandPaths = options.expandPaths;
const enablePinning = options.enablePinning
const expandLeafNodes = options.expandLeafNodes;
var ontoggle = options.ontoggle;
var exposeApi = options.exposeApi;
var tools = options.tools;
@ -416,11 +421,11 @@ RED.utils = (function() {
}
header = $('<span class="red-ui-debug-msg-row"></span>').appendTo(element);
if (sourceId) {
addMessageControls(header,sourceId,path,obj,rootPath,strippedKey,tools);
addMessageControls(header,sourceId,path,obj,rootPath,strippedKey,tools, enablePinning);
}
if (!key) {
element.addClass("red-ui-debug-msg-top-level");
if (sourceId) {
if (sourceId && !expandPaths) {
var pinned = pinnedPaths[sourceId];
expandPaths = [];
if (pinned) {
@ -476,7 +481,7 @@ RED.utils = (function() {
$('<span class="red-ui-debug-msg-type-meta red-ui-debug-msg-object-type-header"></span>').text(typeHint||'string').appendTo(header);
var row = $('<div class="red-ui-debug-msg-object-entry collapsed"></div>').appendTo(element);
$('<pre class="red-ui-debug-msg-type-string"></pre>').text(obj).appendTo(row);
},function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey,expandPaths));
},function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey, expandPaths, { expandLeafNodes }));
}
e = $('<span class="red-ui-debug-msg-type-string red-ui-debug-msg-object-header"></span>').html('"'+formatString(sanitize(obj))+'"').appendTo(entryObj);
if (/^#[0-9a-f]{6}$/i.test(obj)) {
@ -592,14 +597,16 @@ RED.utils = (function() {
typeHint: type==='buffer'?'hex':false,
hideKey: false,
path: path+"["+i+"]",
sourceId: sourceId,
rootPath: rootPath,
expandPaths: expandPaths,
ontoggle: ontoggle,
exposeApi: exposeApi,
sourceId,
rootPath,
expandPaths,
expandLeafNodes,
ontoggle,
exposeApi,
// tools: tools // Do not pass tools down as we
// keep them attached to the top-level header
nodeSelector: options.nodeSelector,
enablePinning
}
).appendTo(row);
}
@ -623,21 +630,23 @@ RED.utils = (function() {
typeHint: type==='buffer'?'hex':false,
hideKey: false,
path: path+"["+i+"]",
sourceId: sourceId,
rootPath: rootPath,
expandPaths: expandPaths,
ontoggle: ontoggle,
exposeApi: exposeApi,
sourceId,
rootPath,
expandPaths,
expandLeafNodes,
ontoggle,
exposeApi,
// tools: tools // Do not pass tools down as we
// keep them attached to the top-level header
nodeSelector: options.nodeSelector,
enablePinning
}
).appendTo(row);
}
}
})(),
(function() { var path = path+"["+i+"]"; return function(state) {if (ontoggle) { ontoggle(path,state);}}})(),
checkExpanded(strippedKey,expandPaths,minRange,Math.min(fullLength-1,(minRange+9))));
checkExpanded(strippedKey,expandPaths,{ minRange, maxRange: Math.min(fullLength-1,(minRange+9)), expandLeafNodes}));
$('<span class="red-ui-debug-msg-object-key"></span>').html("["+minRange+" &hellip; "+Math.min(fullLength-1,(minRange+9))+"]").appendTo(header);
}
if (fullLength < originalLength) {
@ -646,7 +655,7 @@ RED.utils = (function() {
}
},
function(state) {if (ontoggle) { ontoggle(path,state);}},
checkExpanded(strippedKey,expandPaths));
checkExpanded(strippedKey, expandPaths, { expandLeafNodes }));
}
} else if (typeof obj === 'object') {
element.addClass('collapsed');
@ -680,14 +689,16 @@ RED.utils = (function() {
typeHint: false,
hideKey: false,
path: newPath,
sourceId: sourceId,
rootPath: rootPath,
expandPaths: expandPaths,
ontoggle: ontoggle,
exposeApi: exposeApi,
sourceId,
rootPath,
expandPaths,
expandLeafNodes,
ontoggle,
exposeApi,
// tools: tools // Do not pass tools down as we
// keep them attached to the top-level header
nodeSelector: options.nodeSelector,
enablePinning
}
).appendTo(row);
}
@ -696,7 +707,7 @@ RED.utils = (function() {
}
},
function(state) {if (ontoggle) { ontoggle(path,state);}},
checkExpanded(strippedKey,expandPaths));
checkExpanded(strippedKey, expandPaths, { expandLeafNodes }));
}
if (key) {
$('<span class="red-ui-debug-msg-type-meta"></span>').text(type).appendTo(entryObj);

View File

@ -11,7 +11,7 @@ RED.view.annotations = (function() {
}
let badgeRDX = 0;
let badgeLDX = 0;
const scale = RED.view.scale()
for (let i=0,l=evt.el.__annotations__.length;i<l;i++) {
const annotation = evt.el.__annotations__[i];
if (annotations.hasOwnProperty(annotation.id)) {
@ -42,15 +42,17 @@ RED.view.annotations = (function() {
}
if (isBadge) {
if (showAnnotation) {
const rect = annotation.element.getBoundingClientRect();
// getBoundingClientRect is in real-world scale so needs to be adjusted according to
// the current scale factor
const rectWidth = annotation.element.getBoundingClientRect().width / scale;
let annotationX
if (!opts.align || opts.align === 'right') {
annotationX = evt.node.w - 3 - badgeRDX - rect.width
badgeRDX += rect.width + 4;
annotationX = evt.node.w - 3 - badgeRDX - rectWidth
badgeRDX += rectWidth + 4;
} else if (opts.align === 'left') {
annotationX = 3 + badgeLDX
badgeLDX += rect.width + 4;
badgeLDX += rectWidth + 4;
}
annotation.element.setAttribute("transform", "translate("+annotationX+", -8)");
}

View File

@ -1102,18 +1102,27 @@ RED.view.tools = (function() {
const paletteLabel = RED.utils.getPaletteLabel(n.type, nodeDef)
const defaultNodeNameRE = new RegExp('^'+paletteLabel.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+' (\\d+)$')
if (!typeIndex.hasOwnProperty(n.type)) {
const existingNodes = RED.nodes.filterNodes({type: n.type})
let maxNameNumber = 0;
existingNodes.forEach(n => {
let match = defaultNodeNameRE.exec(n.name)
const existingNodes = RED.nodes.filterNodes({ type: n.type });
const existingIds = existingNodes.reduce((ids, node) => {
let match = defaultNodeNameRE.exec(node.name);
if (match) {
let nodeNumber = parseInt(match[1])
if (nodeNumber > maxNameNumber) {
maxNameNumber = nodeNumber
const nodeNumber = parseInt(match[1], 10);
if (!ids.includes(nodeNumber)) {
ids.push(nodeNumber);
}
}
})
typeIndex[n.type] = maxNameNumber + 1
return ids;
}, []).sort((a, b) => a - b);
let availableNameNumber = 1;
for (let i = 0; i < existingIds.length; i++) {
if (existingIds[i] !== availableNameNumber) {
break;
}
availableNameNumber++;
}
typeIndex[n.type] = availableNameNumber;
}
if ((options.renameBlank && n.name === '') || (options.renameClash && defaultNodeNameRE.test(n.name))) {
if (generateHistory) {
@ -1145,11 +1154,11 @@ RED.view.tools = (function() {
}
}
function addJunctionsToWires(wires) {
function addJunctionsToWires(options = {}) {
if (RED.workspaces.isLocked()) {
return
}
let wiresToSplit = wires || (RED.view.selection().links && RED.view.selection().links.filter(e => !e.link));
let wiresToSplit = options.wires || (RED.view.selection().links && RED.view.selection().links.filter(e => !e.link));
if (!wiresToSplit) {
return
}
@ -1197,21 +1206,26 @@ RED.view.tools = (function() {
if (links.length === 0) {
return
}
let pointCount = 0
links.forEach(function(l) {
if (l._sliceLocation) {
junction.x += l._sliceLocation.x
junction.y += l._sliceLocation.y
delete l._sliceLocation
pointCount++
} else {
junction.x += l.source.x + l.source.w/2 + l.target.x - l.target.w/2
junction.y += l.source.y + l.target.y
pointCount += 2
}
})
junction.x = Math.round(junction.x/pointCount)
junction.y = Math.round(junction.y/pointCount)
if (addedJunctions.length === 0 && Object.hasOwn(options, 'x') && Object.hasOwn(options, 'y')) {
junction.x = options.x
junction.y = options.y
} else {
let pointCount = 0
links.forEach(function(l) {
if (l._sliceLocation) {
junction.x += l._sliceLocation.x
junction.y += l._sliceLocation.y
delete l._sliceLocation
pointCount++
} else {
junction.x += l.source.x + l.source.w/2 + l.target.x - l.target.w/2
junction.y += l.source.y + l.target.y
pointCount += 2
}
})
junction.x = Math.round(junction.x/pointCount)
junction.y = Math.round(junction.y/pointCount)
}
if (RED.view.snapGrid) {
let gridSize = RED.view.gridSize()
junction.x = (gridSize*Math.round(junction.x/gridSize));
@ -1401,7 +1415,7 @@ RED.view.tools = (function() {
RED.actions.add("core:wire-multiple-to-node", function() { wireMultipleToNode() })
RED.actions.add("core:split-wire-with-link-nodes", function () { splitWiresWithLinkNodes() });
RED.actions.add("core:split-wires-with-junctions", function () { addJunctionsToWires() });
RED.actions.add("core:split-wires-with-junctions", function (options) { addJunctionsToWires(options) });
RED.actions.add("core:generate-node-names", generateNodeNames )

View File

@ -288,7 +288,7 @@ RED.view = (function() {
}
selectedLinks.clearUnselected()
},
length: () => groups.length,
length: () => groups.size,
forEach: (func) => { groups.forEach(func) },
toArray: () => [...groups],
clear: function () {
@ -321,8 +321,8 @@ RED.view = (function() {
evt.stopPropagation()
RED.contextMenu.show({
type: 'workspace',
x:evt.clientX-5,
y:evt.clientY-5
x: evt.clientX,
y: evt.clientY
})
return false
})
@ -1209,7 +1209,10 @@ RED.view = (function() {
lasso = null;
}
if (d3.event.touches || d3.event.button === 0) {
if ((mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey)) {
if (
(mouse_mode === 0 && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey)) ||
mouse_mode === RED.state.QUICK_JOINING
) {
// Trigger quick add dialog
d3.event.stopPropagation();
clearSelection();
@ -1262,11 +1265,6 @@ RED.view = (function() {
var targetGroup = options.group;
var touchTrigger = options.touchTrigger;
if (targetGroup) {
selectedGroups.add(targetGroup,false);
RED.view.redraw();
}
// `point` is the place in the workspace the mouse has clicked.
// This takes into account scrolling and scaling of the workspace.
var ox = point[0];
@ -1285,7 +1283,6 @@ RED.view = (function() {
}
var mainPos = $("#red-ui-main-container").position();
if (mouse_mode !== RED.state.QUICK_JOINING) {
mouse_mode = RED.state.QUICK_JOINING;
$(window).on('keyup',disableQuickJoinEventHandler);
@ -1589,9 +1586,6 @@ RED.view = (function() {
// auto select dropped node - so info shows (if visible)
clearSelection();
nn.selected = true;
if (targetGroup) {
selectedGroups.add(targetGroup,false);
}
movingSet.add(nn);
updateActiveNodes();
updateSelection();
@ -2176,19 +2170,24 @@ RED.view = (function() {
n.n.moved = true;
}
}
// Check to see if we need to splice a link
// If a node has moved and ends up being spliced into a link, keep
// track of which historyEvent to add the splice info to
let targetSpliceEvent = null
if (moveEvent.nodes.length > 0) {
historyEvent.events.push(moveEvent)
if (activeSpliceLink) {
var linkToSplice = d3.select(activeSpliceLink).data()[0];
spliceLink(linkToSplice, movingSet.get(0).n, moveEvent)
}
targetSpliceEvent = moveEvent
}
if (moveAndChangedGroupEvent.nodes.length > 0) {
historyEvent.events.push(moveAndChangedGroupEvent)
targetSpliceEvent = moveAndChangedGroupEvent
}
// activeSpliceLink will only be set if the movingSet has a single
// node that is able to splice.
if (targetSpliceEvent && activeSpliceLink) {
var linkToSplice = d3.select(activeSpliceLink).data()[0];
spliceLink(linkToSplice, movingSet.get(0).n, targetSpliceEvent)
}
// Only continue if something has moved
if (historyEvent.events.length > 0) {
RED.nodes.dirty(true);
@ -2687,22 +2686,21 @@ RED.view = (function() {
addToRemovedLinks(reconnectResult.removedLinks)
}
var startDirty = RED.nodes.dirty();
var startChanged = false;
var selectedGroups = [];
const startDirty = RED.nodes.dirty();
let movingSelectedGroups = [];
if (movingSet.length() > 0) {
for (var i=0;i<movingSet.length();i++) {
node = movingSet.get(i).n;
if (node.type === "group") {
selectedGroups.push(node);
movingSelectedGroups.push(node);
}
}
// Make sure we have identified all groups about to be deleted
for (i=0;i<selectedGroups.length;i++) {
selectedGroups[i].nodes.forEach(function(n) {
if (n.type === "group" && selectedGroups.indexOf(n) === -1) {
selectedGroups.push(n);
for (i=0;i<movingSelectedGroups.length;i++) {
movingSelectedGroups[i].nodes.forEach(function(n) {
if (n.type === "group" && movingSelectedGroups.indexOf(n) === -1) {
movingSelectedGroups.push(n);
}
})
}
@ -2719,7 +2717,7 @@ RED.view = (function() {
addToRemovedLinks(removedEntities.links);
if (node.g) {
var group = RED.nodes.group(node.g);
if (selectedGroups.indexOf(group) === -1) {
if (movingSelectedGroups.indexOf(group) === -1) {
// Don't use RED.group.removeFromGroup as that emits
// a change event on the node - but we're deleting it
var index = group.nodes.indexOf(node);
@ -2733,7 +2731,7 @@ RED.view = (function() {
removedLinks = removedLinks.concat(result.links);
if (node.g) {
var group = RED.nodes.group(node.g);
if (selectedGroups.indexOf(group) === -1) {
if (movingSelectedGroups.indexOf(group) === -1) {
// Don't use RED.group.removeFromGroup as that emits
// a change event on the node - but we're deleting it
var index = group.nodes.indexOf(node);
@ -2755,8 +2753,8 @@ RED.view = (function() {
// Groups must be removed in the right order - from inner-most
// to outermost.
for (i = selectedGroups.length-1; i>=0; i--) {
var g = selectedGroups[i];
for (i = movingSelectedGroups.length-1; i>=0; i--) {
var g = movingSelectedGroups[i];
removedGroups.push(g);
RED.nodes.removeGroup(g);
}
@ -3057,8 +3055,8 @@ RED.view = (function() {
}
function disableQuickJoinEventHandler(evt) {
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari)
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91) {
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari), or Escape
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91 || evt.keyCode === 27) {
resetMouseVars();
hideDragLines();
redraw();
@ -3189,27 +3187,59 @@ RED.view = (function() {
for (i=0;i<drag_lines.length;i++) {
if (portType != drag_lines[i].portType && mouseup_node !== drag_lines[i].node) {
var drag_line = drag_lines[i];
var src,dst,src_port;
let drag_line = drag_lines[i];
let src,dst,src_port;
let oldDst;
let oldSrc;
if (drag_line.portType === PORT_TYPE_OUTPUT) {
src = drag_line.node;
src_port = drag_line.port;
dst = mouseup_node;
oldSrc = src;
if (drag_line.link) {
oldDst = drag_line.link.target;
}
} else if (drag_line.portType === PORT_TYPE_INPUT) {
src = mouseup_node;
dst = drag_line.node;
src_port = portIndex || 0;
oldSrc = dst;
if (drag_line.link) {
oldDst = drag_line.link.source
}
}
var link = {source: src, sourcePort:src_port, target: dst};
if (drag_line.virtualLink) {
if (/^link (in|out)$/.test(src.type) && /^link (in|out)$/.test(dst.type) && src.type !== dst.type) {
if (src.links.indexOf(dst.id) === -1 && dst.links.indexOf(src.id) === -1) {
var oldSrcLinks = $.extend(true,{},{v:src.links}).v
var oldDstLinks = $.extend(true,{},{v:dst.links}).v
var oldSrcLinks = [...src.links]
var oldDstLinks = [...dst.links]
src.links.push(dst.id);
dst.links.push(src.id);
if (oldDst) {
src.links = src.links.filter(id => id !== oldDst.id)
dst.links = dst.links.filter(id => id !== oldDst.id)
var oldOldDstLinks = [...oldDst.links]
oldDst.links = oldDst.links.filter(id => id !== oldSrc.id)
oldDst.dirty = true;
modifiedNodes.push(oldDst);
linkEditEvents.push({
t:'edit',
node: oldDst,
dirty: RED.nodes.dirty(),
changed: oldDst.changed,
changes: {
links:oldOldDstLinks
}
});
oldDst.changed = true;
}
src.dirty = true;
dst.dirty = true;
modifiedNodes.push(src);
modifiedNodes.push(dst);
@ -3237,6 +3267,7 @@ RED.view = (function() {
links:oldDstLinks
}
});
src.changed = true;
dst.changed = true;
}
@ -5140,8 +5171,8 @@ RED.view = (function() {
var delta = Infinity;
for (var i = 0; i < lineLength; i++) {
var linePos = pathLine.getPointAtLength(i);
var posDeltaX = Math.abs(linePos.x-d3.event.offsetX)
var posDeltaY = Math.abs(linePos.y-d3.event.offsetY)
var posDeltaX = Math.abs(linePos.x-(d3.event.offsetX / scaleFactor))
var posDeltaY = Math.abs(linePos.y-(d3.event.offsetY / scaleFactor))
var posDelta = posDeltaX*posDeltaX + posDeltaY*posDeltaY
if (posDelta < delta) {
pos = linePos

View File

@ -183,25 +183,29 @@ RED.workspaces = (function() {
},
null)
}
menuItems.push(
{
id:"red-ui-tabs-menu-option-add-flow",
label: RED._("workspace.addFlow"),
onselect: "core:add-flow"
}
)
if (isMenuButton || !!tab) {
if (RED.settings.theme("menu.menu-item-workspace-add", true)) {
menuItems.push(
{
id:"red-ui-tabs-menu-option-add-flow-right",
label: RED._("workspace.addFlowToRight"),
shortcut: RED.keyboard.getShortcut("core:add-flow-to-right"),
onselect: function() {
RED.actions.invoke("core:add-flow-to-right", tab)
}
},
null
id:"red-ui-tabs-menu-option-add-flow",
label: RED._("workspace.addFlow"),
onselect: "core:add-flow"
}
)
}
if (isMenuButton || !!tab) {
if (RED.settings.theme("menu.menu-item-workspace-add", true)) {
menuItems.push(
{
id:"red-ui-tabs-menu-option-add-flow-right",
label: RED._("workspace.addFlowToRight"),
shortcut: RED.keyboard.getShortcut("core:add-flow-to-right"),
onselect: function() {
RED.actions.invoke("core:add-flow-to-right", tab)
}
},
null
)
}
if (activeWorkspace && activeWorkspace.type === 'tab') {
menuItems.push(
isFlowDisabled ? {
@ -255,7 +259,9 @@ RED.workspaces = (function() {
}
)
}
menuItems.push(null)
if (menuItems.length > 0) {
menuItems.push(null)
}
if (isMenuButton || !!tab) {
menuItems.push(
{
@ -299,19 +305,24 @@ RED.workspaces = (function() {
}
)
if (tab) {
menuItems.push(null)
if (RED.settings.theme("menu.menu-item-workspace-delete", true)) {
menuItems.push(
{
label: RED._("common.label.delete"),
onselect: function() {
if (tab.type === 'tab') {
RED.workspaces.delete(tab)
} else if (tab.type === 'subflow') {
RED.subflow.delete(tab.id)
}
},
disabled: isCurrentLocked || (workspaceTabCount === 1)
}
)
}
menuItems.push(
null,
{
label: RED._("common.label.delete"),
onselect: function() {
if (tab.type === 'tab') {
RED.workspaces.delete(tab)
} else if (tab.type === 'subflow') {
RED.subflow.delete(tab.id)
}
},
disabled: isCurrentLocked || (workspaceTabCount === 1)
},
{
label: RED._("menu.label.export"),
shortcut: RED.keyboard.getShortcut("core:show-export-dialog"),
@ -468,7 +479,7 @@ RED.workspaces = (function() {
},
minimumActiveTabWidth: 150,
scrollable: true,
addButton: "core:add-flow",
addButton: RED.settings.theme("menu.menu-item-workspace-add", true) ? "core:add-flow" : undefined,
addButtonCaption: RED._("workspace.addFlow"),
menu: function() { return getMenuItems(true) },
contextmenu: function(tab) { return getMenuItems(false, tab) }
@ -525,19 +536,24 @@ RED.workspaces = (function() {
$(window).on("resize", function() {
workspace_tabs.resize();
});
RED.actions.add("core:add-flow",function(opts) { addWorkspace(undefined,undefined,opts?opts.index:undefined)});
RED.actions.add("core:add-flow-to-right",function(workspace) {
let index
if (workspace) {
index = workspace_tabs.getTabIndex(workspace.id)+1
} else {
index = workspace_tabs.activeIndex()+1
}
addWorkspace(undefined,undefined,index)
});
RED.actions.add("core:edit-flow",editWorkspace);
RED.actions.add("core:remove-flow",removeWorkspace);
if (RED.settings.theme("menu.menu-item-workspace-add", true)) {
RED.actions.add("core:add-flow",function(opts) { addWorkspace(undefined,undefined,opts?opts.index:undefined)});
RED.actions.add("core:add-flow-to-right",function(workspace) {
let index
if (workspace) {
index = workspace_tabs.getTabIndex(workspace.id)+1
} else {
index = workspace_tabs.activeIndex()+1
}
addWorkspace(undefined,undefined,index)
});
}
if (RED.settings.theme("menu.menu-item-workspace-edit", true)) {
RED.actions.add("core:edit-flow",editWorkspace);
}
if (RED.settings.theme("menu.menu-item-workspace-delete", true)) {
RED.actions.add("core:remove-flow",removeWorkspace);
}
RED.actions.add("core:enable-flow",enableWorkspace);
RED.actions.add("core:disable-flow",disableWorkspace);
RED.actions.add("core:lock-flow",lockWorkspace);
@ -904,6 +920,17 @@ RED.workspaces = (function() {
}
},
refresh: function() {
var workspace = RED.nodes.workspace(RED.workspaces.active());
if (workspace) {
document.title = `${documentTitle} : ${workspace.label}`;
} else {
var subflow = RED.nodes.subflow(RED.workspaces.active());
if (subflow) {
document.title = `${documentTitle} : ${subflow.name}`;
} else {
document.title = documentTitle
}
}
RED.nodes.eachWorkspace(function(ws) {
workspace_tabs.renameTab(ws.id,ws.label);
$("#red-ui-tab-"+(ws.id.replace(".","-"))).attr("flowname",ws.label)

View File

@ -168,6 +168,37 @@ RED.user = (function() {
}
} else {
if (data.prompts) {
if (data.loginMessage) {
const sessionMessages = $("<div/>",{class:"form-row",style:"text-align: center"}).appendTo("#node-dialog-login-fields");
$('<div>').text(data.loginMessage).appendTo(sessionMessages);
}
i = 0;
for (;i<data.prompts.length;i++) {
var field = data.prompts[i];
var row = $("<div/>",{class:"form-row",style:"text-align: center"}).appendTo("#node-dialog-login-fields");
var loginButton = $('<a href="#" class="red-ui-button"></a>',{style: "padding: 10px"}).appendTo(row).on("click", function() {
document.location = field.url;
});
if (field.image) {
$("<img>",{src:field.image}).appendTo(loginButton);
} else if (field.label) {
var label = $('<span></span>').text(field.label);
if (field.icon) {
$('<i></i>',{class: "fa fa-2x "+field.icon, style:"vertical-align: middle"}).appendTo(loginButton);
label.css({
"verticalAlign":"middle",
"marginLeft":"8px"
});
}
label.appendTo(loginButton);
}
loginButton.button();
}
}
}
if (opts.cancelable) {
$("#node-dialog-login-cancel").button().on("click", function( event ) {
@ -320,10 +351,10 @@ RED.user = (function() {
userIcon.css({
backgroundImage: "url("+user.image+")",
})
} else if (user.anonymous) {
} else if (user.anonymous || (!user.username && !user.email)) {
$('<i class="fa fa-user"></i>').appendTo(userIcon);
} else {
$('<span>').text(user.username.substring(0,2)).appendTo(userIcon);
$('<span>').text((user.username || user.email).substring(0,2)).appendTo(userIcon);
}
if (user.profileColor !== undefined) {
userIcon.addClass('red-ui-user-profile-color-' + user.profileColor)

View File

@ -259,7 +259,7 @@ $deploy-button-background-disabled-hover: #555;
$header-background: #000;
$header-button-background-active: #121212;
$header-accent: #d41313;
$header-accent: #C02020;
$header-menu-color: #eee;
$header-menu-color-disabled: #666;
$header-menu-heading-color: #fff;

View File

@ -84,6 +84,11 @@ ul.red-ui-sidebar-node-config-list {
background: var(--red-ui-node-config-background);
color: var(--red-ui-primary-text-color);
cursor: pointer;
&.red-ui-palette-node-config-invalid.red-ui-palette-node-config-changed {
.red-ui-palette-node-annotations.red-ui-flow-node-error {
left: calc(100% - 28px);
}
}
}
ul.red-ui-sidebar-node-config-list li.red-ui-palette-node-config-type {
color: var(--red-ui-secondary-text-color);
@ -115,6 +120,15 @@ ul.red-ui-sidebar-node-config-list li.red-ui-palette-node-config-type {
.red-ui-palette-node-config-invalid {
border-color: var(--red-ui-form-input-border-error-color)
}
.red-ui-sidebar-config-tray-header.red-ui-palette-header:not(.red-ui-sidebar-config-changed) .red-ui-flow-node-changed {
display: none;
}
.red-ui-sidebar-config-tray-header.red-ui-palette-header.red-ui-sidebar-config-changed .red-ui-flow-node-changed {
display: inline-block;
position: absolute;
top: 1px;
right: 1px;
}
.red-ui-palette-node-annotations {
position: absolute;
left: calc(100% - 15px);

View File

@ -151,8 +151,9 @@
&.red-ui-tabs-add {
padding-right: 29px;
}
&.red-ui-tabs-add.red-ui-tabs-scrollable {
padding-right: 53px;
&.red-ui-tabs-add.red-ui-tabs-scrollable,
&.red-ui-tabs-menu.red-ui-tabs-scrollable {
padding-right: 53px;
}
&.red-ui-tabs-add.red-ui-tabs-menu.red-ui-tabs-scrollable,
&.red-ui-tabs-add.red-ui-tabs-search.red-ui-tabs-scrollable {
@ -310,8 +311,9 @@
}
}
.red-ui-tabs.red-ui-tabs-add .red-ui-tab-scroll-right {
right: 32px;
.red-ui-tabs.red-ui-tabs-add .red-ui-tab-scroll-right,
.red-ui-tabs.red-ui-tabs-menu .red-ui-tab-scroll-right {
right: 32px;
}
.red-ui-tabs.red-ui-tabs-add.red-ui-tabs-menu .red-ui-tab-scroll-right,

View File

@ -2,4 +2,15 @@
&.red-ui-popover-panel {
border-top: none;
}
}
.red-ui-autoComplete-completion {
font-family: var(--red-ui-monospace-font);
white-space: nowrap;
overflow: hidden;
flex-grow: 1;
text-overflow: ellipsis;
direction: rtl;
text-align: left;
}

View File

@ -148,7 +148,7 @@ module.exports = function(RED) {
var st = (typeof output === 'string') ? output : util.inspect(output);
var fill = "grey";
var shape = "dot";
if (typeof output === 'object' && hasOwnProperty.call(output, "fill") && hasOwnProperty.call(output, "shape") && hasOwnProperty.call(output, "text")) {
if (typeof output === 'object' && output?.fill && output?.shape && output?.text) {
fill = output.fill;
shape = output.shape;
st = output.text;

View File

@ -511,9 +511,10 @@ RED.debug = (function() {
typeHint: format,
hideKey: false,
path: path,
sourceId: sourceNode&&sourceNode.id,
sourceId: sourceNode && sourceNode.id,
rootPath: path,
nodeSelector: config.messageSourceClick,
enablePinning: true
});
// Do this in a separate step so the element functions aren't stripped
debugMessage.appendTo(el);

View File

@ -111,8 +111,6 @@ module.exports = function(RED) {
throw new Error(RED._("function.error.externalModuleNotAllowed"));
}
var functionText = "var results = null;"+
"results = (async function(msg,__send__,__done__){ "+
"var __msgid__ = msg._msgid;"+
@ -166,7 +164,13 @@ module.exports = function(RED) {
Buffer:Buffer,
Date: Date,
RED: {
util: RED.util
util: {
...RED.util,
getSetting: function (_node, name, _flow) {
// Ensure `node` argument is the Function node and do not allow flow to be overridden.
return RED.util.getSetting(node, name);
}
}
},
__node__: {
id: node.id,

View File

@ -352,7 +352,9 @@ module.exports = function(RED) {
if (msgs.length === 0) {
done()
} else {
drainMessageGroup(msgs,count,done);
setImmediate(() => {
drainMessageGroup(msgs,count,done);
})
}
}
})
@ -505,7 +507,9 @@ module.exports = function(RED) {
if (err) {
node.error(err,nextMsg);
}
processMessageQueue()
setImmediate(() => {
processMessageQueue()
})
});
}

View File

@ -253,7 +253,13 @@ module.exports = function(RED) {
if (node.allowrate && m.hasOwnProperty("rate") && !isNaN(parseFloat(m.rate))) {
node.rate = m.rate;
}
send(m);
if (msg.hasOwnProperty("reset")) {
if (msg.hasOwnProperty("flush")) {
node.buffer.push({msg: m, send: send, done: done});
}
}
else { send(m); }
node.reportDepth();
node.intervalID = setInterval(sendMsgFromBuffer, node.rate);
done();
@ -285,42 +291,23 @@ module.exports = function(RED) {
}
}
else if (!msg.hasOwnProperty("reset")) {
if (maxKeptMsgsCount(node) > 0) {
if (node.intervalID === -1) {
node.send(msg);
node.intervalID = setInterval(sendMsgFromBuffer, node.rate);
} else {
if (node.allowrate && msg.hasOwnProperty("rate") && !isNaN(parseFloat(msg.rate)) && node.rate !== msg.rate) {
node.rate = msg.rate;
clearInterval(node.intervalID);
node.intervalID = setInterval(sendMsgFromBuffer, node.rate);
}
if (node.buffer.length < _maxKeptMsgsCount) {
var m = RED.util.cloneMessage(msg);
node.buffer.push({msg: m, send: send, done: done});
} else {
node.trace("dropped due to buffer overflow. msg._msgid = " + msg._msgid);
node.droppedMsgs++;
}
}
} else {
if (node.allowrate && msg.hasOwnProperty("rate") && !isNaN(parseFloat(msg.rate))) {
node.rate = msg.rate;
}
var timeSinceLast;
if (node.lastSent) {
timeSinceLast = process.hrtime(node.lastSent);
}
if (!node.lastSent) { // ensuring that we always send the first message
node.lastSent = process.hrtime();
send(msg);
}
else if ( ( (timeSinceLast[0] * SECONDS_TO_NANOS) + timeSinceLast[1] ) > (node.rate * MILLIS_TO_NANOS) ) {
node.lastSent = process.hrtime();
send(msg);
} else if (node.outputs === 2) {
send([null,msg])
}
if (node.allowrate && msg.hasOwnProperty("rate") && !isNaN(parseFloat(msg.rate))) {
node.rate = msg.rate;
}
var timeSinceLast;
if (node.lastSent) {
timeSinceLast = process.hrtime(node.lastSent);
}
if (!node.lastSent) { // ensuring that we always send the first message
node.lastSent = process.hrtime();
send(msg);
}
else if ( ( (timeSinceLast[0] * SECONDS_TO_NANOS) + timeSinceLast[1] ) > (node.rate * MILLIS_TO_NANOS) ) {
node.lastSent = process.hrtime();
send(msg);
}
else if (node.outputs === 2) {
send([null,msg])
}
done();
}

View File

@ -24,6 +24,14 @@ module.exports = function(RED) {
this.op2 = n.op2 || "0";
this.op1type = n.op1type || "str";
this.op2type = n.op2type || "str";
// If the op1/2type is 'date', then we need to leave op1/2 alone so that
// evaluateNodeProperty works as expected.
if (this.op1type === 'date' && this.op1 === '1') {
this.op1 = ''
}
if (this.op2type === 'date' && this.op2 === '0') {
this.op2 = ''
}
this.second = (n.outputs == 2) ? true : false;
this.topic = n.topic || "topic";
@ -193,7 +201,7 @@ module.exports = function(RED) {
if (node.op2type !== "nul") {
var promise = Promise.resolve();
msg2 = RED.util.cloneMessage(msg);
if (node.op2type === "flow" || node.op2type === "global") {
if (node.op2type === "flow" || node.op2type === "global" || node.op2type === "date") {
promise = new Promise((resolve,reject) => {
RED.util.evaluateNodeProperty(node.op2,node.op2type,node,msg,(err,value) => {
if (err) {
@ -213,7 +221,6 @@ module.exports = function(RED) {
}
else {
msg2.payload = node.topics[topic].m2;
if (node.op2type === "date") { msg2.payload = Date.now(); }
if (node.second === true) { msgInfo.send([null,msg2]); }
else { msgInfo.send(msg2); }
}

View File

@ -104,14 +104,14 @@ module.exports = function(RED) {
if (this.credentials && this.credentials.passphrase) {
opts.passphrase = this.credentials.passphrase;
}
if (this.servername) {
opts.servername = this.servername;
}
if (this.alpnprotocol) {
opts.ALPNProtocols = [this.alpnprotocol];
}
opts.rejectUnauthorized = this.verifyservercert;
}
if (this.servername) {
opts.servername = this.servername;
}
if (this.alpnprotocol) {
opts.ALPNProtocols = [this.alpnprotocol];
}
opts.rejectUnauthorized = this.verifyservercert;
return opts;
}

View File

@ -158,9 +158,16 @@ module.exports = function(RED) {
if(!keys || !keys.length) return null;
keys.forEach(key => {
let val = srcUserProperties[key];
if(typeof val == "string") {
if(typeof val === "string") {
count++;
_clone[key] = val;
} else if (val !== undefined && val !== null) {
try {
_clone[key] = JSON.stringify(val)
count++;
} catch (err) {
// Silently drop property
}
}
});
if(count) properties.userProperties = _clone;
@ -673,6 +680,8 @@ module.exports = function(RED) {
delete node.options.protocolId; //V4+ default
delete node.options.protocolVersion; //V4 default
delete node.options.properties;//V5 only
if (node.compatmode == "true" || node.compatmode === true || node.protocolVersion == 3) {
node.options.protocolId = 'MQIsdp';//V3 compat only
node.options.protocolVersion = 3;
@ -691,6 +700,21 @@ module.exports = function(RED) {
setIntProp(node,node.options.properties,"sessionExpiryInterval");
}
}
// Ensure will payload, if set, is a string
if (node.options.will && Object.hasOwn(node.options.will, 'payload')) {
let payload = node.options.will.payload
if (payload === null || typeof payload === 'undefined') {
payload = "";
} else if (!Buffer.isBuffer(payload)) {
if (typeof payload === "object") {
payload = JSON.stringify(payload);
} else if (typeof payload !== "string") {
payload = "" + payload;
}
}
node.options.will.payload = payload
}
if (node.usetls && n.tls) {
var tlsNode = RED.nodes.getNode(n.tls);
if (tlsNode) {
@ -725,6 +749,7 @@ module.exports = function(RED) {
};
node.deregister = function(mqttNode, done, autoDisconnect) {
setStatusDisconnected(mqttNode, false);
delete node.users[mqttNode.id];
if (autoDisconnect && !node.closing && node.connected && Object.keys(node.users).length === 0) {
node.disconnect(done);

View File

@ -367,20 +367,21 @@ module.exports = function(RED) {
const sendHeadersAlways = node.hdrout === "all"
const sendHeaders = !dontSendHeaders && (sendHeadersOnce || sendHeadersAlways)
const quoteables = [node.sep, node.quo, "\n", "\r"]
const templateQuoteables = [',', '"', "\n", "\r"]
const templateQuoteables = [node.sep, node.quo, "\n", "\r"]
const templateQuoteablesStrict = [',', '"', "\n", "\r"]
let badTemplateWarnOnce = true
const columnStringToTemplateArray = function (col, sep) {
// NOTE: enforce strict column template parsing in RFC4180 mode
const parsed = csv.parse(col, { separator: sep, quote: node.quo, outputStyle: 'array', strict: true })
if (parsed.headers.length > 0) { node.goodtmpl = true } else { node.goodtmpl = false }
return parsed.headers.length ? parsed.headers : null
if (parsed.data?.length === 1) { node.goodtmpl = true } else { node.goodtmpl = false }
return node.goodtmpl ? parsed.data[0] : null
}
const templateArrayToColumnString = function (template, keepEmptyColumns) {
// NOTE: enforce strict column template parsing in RFC4180 mode
const parsed = csv.parse('', {headers: template, headersOnly:true, separator: ',', quote: node.quo, outputStyle: 'array', strict: true })
const templateArrayToColumnString = function (template, keepEmptyColumns, separator = ',', quotables = templateQuoteablesStrict) {
// NOTE: defaults to strict column template parsing (commas and double quotes)
const parsed = csv.parse('', {headers: template, headersOnly:true, separator, quote: node.quo, outputStyle: 'array', strict: true })
return keepEmptyColumns
? parsed.headers.map(e => addQuotes(e || '', { separator: ',', quoteables: templateQuoteables}))
? parsed.headers.map(e => addQuotes(e || '', { separator, quoteables: quotables })).join(separator)
: parsed.header // exclues empty columns
// TODO: resolve inconsistency between CSV->JSON and JSON->CSV
// CSV->JSON: empty columns are excluded
@ -447,7 +448,7 @@ module.exports = function(RED) {
template = Object.keys(inputData[0]) || ['']
}
}
stringBuilder.push(templateArrayToColumnString(template, true))
stringBuilder.push(templateArrayToColumnString(template, true, node.sep, templateQuoteables)) // use user set separator for output data.
if (sendHeadersOnce) { node.hdrSent = true }
}
@ -483,6 +484,7 @@ module.exports = function(RED) {
node.warn(RED._("csv.errors.obj_csv"))
badTemplateWarnOnce = false
}
template = Object.keys(row) || ['']
const rowData = []
for (let header in inputData[0]) {
if (row.hasOwnProperty(header)) {
@ -518,7 +520,7 @@ module.exports = function(RED) {
// join lines, don't forget to add the last new line
msg.payload = stringBuilder.join(node.ret) + node.ret
msg.columns = templateArrayToColumnString(template)
msg.columns = templateArrayToColumnString(template) // always strict commas + double quotes for
if (msg.payload !== '') { send(msg) }
done()
}
@ -615,16 +617,15 @@ module.exports = function(RED) {
}
if (msg.parts.index + 1 === msg.parts.count) {
msg.payload = node.store
msg.columns = csvParseResult.header
// msg._mode = 'RFC4180 mode'
// msg.columns = csvParseResult.header
msg.columns = templateArrayToColumnString(csvParseResult.headers) // always strict commas + double quotes for msg.columns
delete msg.parts
send(msg)
node.store = []
}
}
else {
msg.columns = csvParseResult.header
// msg._mode = 'RFC4180 mode'
msg.columns = templateArrayToColumnString(csvParseResult.headers) // always strict commas + double quotes for msg.columns
msg.payload = data
send(msg); // finally send the array
}
@ -633,7 +634,8 @@ module.exports = function(RED) {
const len = data.length
for (let row = 0; row < len; row++) {
const newMessage = RED.util.cloneMessage(msg)
newMessage.columns = csvParseResult.header
// newMessage.columns = csvParseResult.header
newMessage.columns = templateArrayToColumnString(csvParseResult.headers) // always strict commas + double quotes for msg.columns
newMessage.payload = data[row]
if (!has_parts) {
newMessage.parts = {

View File

@ -21,7 +21,7 @@
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-row">
<label for="node-input-property"><i class="fa fa-forward"></i> <span data-i18n="split.split"></span></label>
<label for="node-input-property"><i class="fa fa-forward"></i> <span data-i18n="split.splitThe"></span></label>
<input type="text" id="node-input-property" style="width:70%;"/>
</div>
<div class="form-row"><span data-i18n="[html]split.strBuff"></span></div>

View File

@ -36,6 +36,10 @@
<label style="margin-left: 10px; width: 175px;" for="node-input-overlap" data-i18n="batch.count.overlap"></label>
<input type="text" id="node-input-overlap" style="width: 50px;">
</div>
<div class="form-row">
<input type="checkbox" id="node-input-honourParts" style="margin-left: 10px; margin-right:10px; vertical-align:top; width:auto;">
<label for="node-input-honourParts" style="width:auto;" data-i18n="batch.honourParts"></label>
</div>
</div>
<div class="node-row-msg-interval">
@ -45,7 +49,7 @@
<span data-i18n="batch.interval.seconds"></span>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-allowEmptySequence" style="margin-left:20px; margin-right: 10px; vertical-align:top; width:auto;">
<input type="checkbox" id="node-input-allowEmptySequence" style="margin-left:20px; margin-right:10px; vertical-align:top; width:auto;">
<label for="node-input-allowEmptySequence" style="width:auto;" data-i18n="batch.interval.empty"></label>
</div>
</div>
@ -101,6 +105,7 @@
}
},
allowEmptySequence: {value:false},
honourParts: {value:false},
topics: {value:[{topic:""}]}
},
inputs:1,

View File

@ -181,6 +181,8 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
var node = this;
var mode = n.mode || "count";
var eof = false;
node.honourParts = n.honourParts || false;
node.pending_count = 0;
if (mode === "count") {
@ -201,9 +203,12 @@ module.exports = function(RED) {
return;
}
var queue = node.pending;
if (node.honourParts && msg.hasOwnProperty("parts")) {
if (msg.parts.index + 1 === msg.parts.count) { eof = true; }
}
queue.push({msg, send, done});
node.pending_count++;
if (queue.length === count) {
if (queue.length === count || eof === true) {
send_msgs(node, queue, is_overlap);
for (let i = 0; i < queue.length-overlap; i++) {
queue[i].done();
@ -211,6 +216,7 @@ module.exports = function(RED) {
node.pending =
(overlap === 0) ? [] : queue.slice(-overlap);
node.pending_count = 0;
eof = false;
}
var max_msgs = max_kept_msgs_count(node);
if ((max_msgs > 0) && (node.pending_count > max_msgs)) {

View File

@ -339,7 +339,7 @@ module.exports = function(RED) {
}
else {
msg.filename = filename;
var lines = Buffer.from([]);
const bufferArray = [];
var spare = "";
var count = 0;
var type = "buffer";
@ -397,7 +397,7 @@ module.exports = function(RED) {
}
}
else {
lines = Buffer.concat([lines,chunk]);
bufferArray.push(chunk);
}
}
})
@ -413,10 +413,11 @@ module.exports = function(RED) {
})
.on('end', function() {
if (node.chunk === false) {
const buffer = Buffer.concat(bufferArray);
if (node.format === "utf8") {
msg.payload = decode(lines, node.encoding);
msg.payload = decode(buffer, node.encoding);
}
else { msg.payload = lines; }
else { msg.payload = buffer; }
nodeSend(msg);
}
else if (node.format === "lines") {

View File

@ -1 +1 @@
[{"id":"827a48c0.912d88","type":"comment","z":"ff17dfa9.8fa6d","name":"Map property between different numeric ranges","info":"Range node can scale a number from one numeric range to another.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/map-between-different-number-ranges).","x":240,"y":60,"wires":[]},{"id":"bb23bd77.ce725","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"0","payloadType":"num","x":170,"y":120,"wires":[["42ed281c.790b38"]]},{"id":"42ed281c.790b38","type":"range","z":"ff17dfa9.8fa6d","minin":"0","maxin":"1023","minout":"0","maxout":"5","action":"clamp","round":false,"name":"","x":390,"y":160,"wires":[["56e6dd0f.436c24"]]},{"id":"54659d5c.0283e4","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"512","payloadType":"num","x":170,"y":160,"wires":[["42ed281c.790b38"]]},{"id":"85ce0127.07b06","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"1023","payloadType":"num","x":170,"y":200,"wires":[["42ed281c.790b38"]]},{"id":"56e6dd0f.436c24","type":"debug","z":"ff17dfa9.8fa6d","name":"","active":true,"console":"false","complete":"false","x":590,"y":160,"wires":[]}]
[{"id":"827a48c0.912d88","type":"comment","z":"ff17dfa9.8fa6d","name":"Map property between different numeric ranges","info":"Range node can scale a number from one numeric range to another.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/map-between-different-number-ranges).","x":240,"y":60,"wires":[]},{"id":"bb23bd77.ce725","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"0","payloadType":"num","x":170,"y":120,"wires":[["42ed281c.790b38"]]},{"id":"42ed281c.790b38","type":"range","z":"ff17dfa9.8fa6d","minin":"0","maxin":"1023","minout":"0","maxout":"5","action":"clamp","round":false,"property":"payload","name":"","x":390,"y":160,"wires":[["56e6dd0f.436c24"]]},{"id":"54659d5c.0283e4","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"512","payloadType":"num","x":170,"y":160,"wires":[["42ed281c.790b38"]]},{"id":"85ce0127.07b06","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"1023","payloadType":"num","x":170,"y":200,"wires":[["42ed281c.790b38"]]},{"id":"56e6dd0f.436c24","type":"debug","z":"ff17dfa9.8fa6d","name":"","active":true,"console":"false","complete":"false","x":590,"y":160,"wires":[]}]

View File

@ -912,6 +912,7 @@
"objectSend": "Sende eine Nachricht für jedes Schlüssel/Wert-Paar",
"strBuff": "<b>string</b> / <b>buffer</b>",
"array": "<b>array</b>",
"splitThe": "Split",
"splitUsing": "Aufteilung",
"splitLength": "feste Längen von",
"stream": "Als Nachrichtenstrom behandeln (Streaming-Modus)",

View File

@ -39,10 +39,36 @@
<dd><b>MQTTv5</b>: Ablaufzeit der Nachricht in Sekunden.</dd>
</dl>
<h3>Details</h3>
<p>Das abonnierte Topic darf MQTT-Platzhalterzeichen (wildcards) enthalten (+ für eine Ebene und # für mehrere Ebenen).</p>
<p>Dieser Node erfordert eine Verbindung zu einem MQTT-Broker, der über die Auswahlliste selektiert werden kann.
Eine neue Verbindung wird durch Klicken auf das Stiftsymbol erstellt.</p>
<p>Das abonnierte Topic darf MQTT-Platzhalterzeichen (wildcards) enthalten (+ für eine Ebene und # für mehrere Ebenen).</p>
<p>Diese Node erfordert eine Verbindung zu einem MQTT-Broker, der über die Auswahlliste selektiert werden kann. Eine neue Verbindung wird durch Klicken auf das Stiftsymbol erstellt.</p>
<p>Mehrere MQTT-Nodes (in oder out) können bei Bedarf dieselbe Broker-Verbindung nutzen.</p>
<h4>Dynamische Steuerung</h4>
Die von der Node genutzte Verbindung kann dynamisch gesteuert werden, wenn die MQTT-Node eine der folgenden Nachrichten erhält. Die Payload dieser Nachrichten werden nicht veröffentlicht.
<h4>Eingangsdaten</h4>
<p>Nur Verfügbar, wenn die Node für dynamische Abonnements konfiguriert wurde.</p>
<dl class="message-properties">
<dt>action <span class="property-type">string</span></dt>
<dd>Der Name der Aktion, die die MQTT-Node ausführen soll. Verfügbare Aktionen sind: <code>"connect"</code>, <code>"disconnect"</code>, <code>"getSubscriptions"</code>, <code>"subscribe"</code> und <code>"unsubscribe"</code>.</dd>
<dt class="optional">topic <span class="property-type">string|object|array</span></dt>
<dd>Bei den Aktionen <code>"subscribe"</code> und <code>"unsubscribe"</code> gibt diese Eigenschaft die MQTT-Topic an. Dabei kann es sich um Folgendes handeln:
<ul>
<li>eine Zeichenfolge, die den Topic-Filter enthält</li>
<li>ein Objekt mit den Eigenschaften <code>topic</code> und <code>qos</code></li>
<li>ein Array aus Zeichenfolgen oder Objekten, um mehrere Topics gleichzeitig zu verwalten</li>
</ul>
</dd>
<dt class="optional">broker <span class="property-type">broker</span> </dt>
<dd>Für die Aktion <code>"connect"</code> kann diese Eigenschaft jede der einzelnen Broker-Konfigurationseinstellungen überschreiben, einschließlich: <ul>
<li><code>broker</code></li>
<li><code>port</code></li>
<li><code>url</code> - überschreibt Broker/Port, um eine vollständige Verbindungs-URL bereitzustellen</li>
<li><code>username</code></li>
<li><code>password</code></li>
</ul>
<p>Wenn diese Eigenschaft gesetzt ist und der Broker bereits verbunden ist, wird ein Fehler protokolliert, es sei denn, die Eigenschaft <code>force</code> gesetzt - in diesem Fall wird die Verbindung zum Broker getrennt, die neuen Einstellungen angewendet und erneut verbunden.</p>
</dd>
</dl>
</script>
<script type="text/html" data-help-name="mqtt out">

View File

@ -456,7 +456,7 @@
"staticTopic": "Subscribe to single topic",
"dynamicTopic": "Dynamic subscription",
"auto-connect": "Connect automatically",
"auto-mode-depreciated": "This option is depreciated. Please use the new auto-detect mode.",
"auto-mode-depreciated": "This option is deprecated. Please use the new auto-detect mode.",
"none": "none",
"other": "other"
},
@ -1011,12 +1011,13 @@
"tip": "Tip: The filename should be an absolute path, otherwise it will be relative to the working directory of the Node-RED process."
},
"split": {
"split": "Split",
"split": "split",
"intro": "Split <code>msg.payload</code> based on type:",
"object": "<b>Object</b>",
"objectSend": "Send a message for each key/value pair",
"strBuff": "<b>String</b> / <b>Buffer</b>",
"array": "<b>Array</b>",
"splitThe": "Split the",
"splitUsing": "Split using",
"splitLength": "Fixed length of",
"stream": "Handle as a stream of messages",
@ -1113,6 +1114,7 @@
"too-many": "too many pending messages in batch node",
"unexpected": "unexpected mode",
"no-parts": "no parts property in message",
"honourParts": "Allow msg.parts to also complete batch operation.",
"error": {
"invalid-count": "Invalid count",
"invalid-overlap": "Invalid overlap",

View File

@ -48,7 +48,8 @@
<dl class="message-properties">
<dt>action <span class="property-type">string</span></dt>
<dd>the name of the action the node should perform. Available actions are: <code>"connect"</code>,
<code>"disconnect"</code>, <code>"subscribe"</code> and <code>"unsubscribe"</code>.</dd>
<code>"disconnect"</code>, <code>"getSubscriptions"</code>, <code>"subscribe"</code> and
<code>"unsubscribe"</code>.</dd>
<dt class="optional">topic <span class="property-type">string|object|array</span></dt>
<dd>For the <code>"subscribe"</code> and <code>"unsubscribe"</code> actions, this property
provides the topic. It can be set as either:<ul>

View File

@ -513,15 +513,15 @@
"method": "Método",
"url": "URL",
"doc": "Docs",
"return": "Return",
"upload": "Accept file uploads?",
"status": "Status code",
"headers": "Headers",
"return": "Devolver",
"upload": "¿Aceptar cargas de archivos?",
"status": "Código de estado",
"headers": "Encabezados",
"other": "otro",
"paytoqs": {
"ignore": "Ignore",
"query": "Append to query-string parameters",
"body": "Send as request body"
"ignore": "Ignorar",
"query": "Agregar a los parámetros de la cadena de consulta",
"body": "Enviar como cuerpo de la solicitud"
},
"utf8String": "texto UTF8",
"binaryBuffer": "buffer binario",
@ -529,45 +529,45 @@
"authType": "Tipo",
"bearerToken": "Token"
},
"setby": "- set by msg.method -",
"basicauth": "Use authentication",
"use-tls": "Enable secure (SSL/TLS) connection",
"tls-config": "TLS Configuration",
"basic": "basic authentication",
"digest": "digest authentication",
"bearer": "bearer authentication",
"use-proxy": "Use proxy",
"persist": "Enable connection keep-alive",
"proxy-config": "Proxy Configuration",
"use-proxyauth": "Use proxy authentication",
"noproxy-hosts": "Ignore hosts",
"senderr": "Only send non-2xx responses to Catch node",
"utf8": "a UTF-8 string",
"binary": "a binary buffer",
"json": "a parsed JSON object",
"setby": "- establecido por msg.method -",
"basicauth": "Usar autenticación",
"use-tls": "Habilitar conexión segura (SSL/TLS)",
"tls-config": "Configuración TLS",
"basic": "autenticación básica",
"digest": "autenticación digest",
"bearer": "autenticación bearer",
"use-proxy": "Usar proxy",
"persist": "Habilitar conexión activa (keep-alive)",
"proxy-config": "Configuración Proxy",
"use-proxyauth": "Usar autenticación de proxy",
"noproxy-hosts": "Ignorar hosts",
"senderr": "Enviar solo respuestas que no sean 2xx al nodo Catch",
"utf8": "una cadena UTF-8",
"binary": "un búfer binario",
"json": "un objeto JSON analizado",
"tip": {
"in": "The url will be relative to ",
"res": "The messages sent to this node <b>must</b> originate from an <i>http input</i> node",
"in": "La URL será relativa a ",
"res": "Los mensajes enviados a este nodo <b>deben</b> originarse desde un nodo de <i>http input</i>",
"req": "Tip: If the JSON parse fails the fetched string is returned as-is."
},
"httpreq": "http request",
"httpreq": "solicitud http",
"errors": {
"not-created": "Cannot create http-in node when httpNodeRoot set to false",
"missing-path": "missing path",
"no-response": "No response object",
"json-error": "JSON parse error",
"no-url": "No url specified",
"deprecated-call": "Deprecated call to __method__",
"invalid-transport": "non-http transport requested",
"timeout-isnan": "Timeout value is not a valid number, ignoring",
"timeout-isnegative": "Timeout value is negative, ignoring",
"invalid-payload": "Invalid payload",
"invalid-url": "Invalid url"
"not-created": "No se puede crear el nodo http-in cuando httpNodeRoot está establecido en falso",
"missing-path": "falta la ruta",
"no-response": "No hay objeto de respuesta",
"json-error": "Error de análisis en JSON",
"no-url": "No se especificó ninguna URL",
"deprecated-call": "Llamada obsoleta a __method__",
"invalid-transport": "protocolo no-http solicitado",
"timeout-isnan": "El valor de tiempo de espera no es un número válido, se ignora",
"timeout-isnegative": "El valor de tiempo de espera es negativo, se ignora",
"invalid-payload": "payload Invalido",
"invalid-url": "URL Inválida"
},
"status": {
"requesting": "requesting"
"requesting": "solicitando"
},
"insecureHTTPParser": "Disable strict HTTP parsing"
"insecureHTTPParser": "Deshabilitar el análisis estricto de HTTP"
},
"websocket": {
"label": {
@ -576,41 +576,42 @@
"url": "URL",
"subprotocol": "Subprotocolo"
},
"listenon": "Listen on",
"connectto": "Connect to",
"sendrec": "Send/Receive",
"listenon": "Escuchar",
"connectto": "Conectar a",
"sendrec": "Enviar/Recibir",
"payload": "payload",
"message": "entire message",
"sendheartbeat": "Send heartbeat",
"message": "mensaje completo",
"sendheartbeat": "Enviar latido",
"tip": {
"path1": "By default, <code>payload</code> will contain the data to be sent over, or received from a websocket. The listener can be configured to send or receive the entire message object as a JSON formatted string.",
"path2": "This path will be relative to <code>__path__</code>.",
"url1": "URL should use ws:&#47;&#47; or wss:&#47;&#47; scheme and point to an existing websocket listener.",
"url2": "By default, <code>payload</code> will contain the data to be sent over, or received from a websocket. The client can be configured to send or receive the entire message object as a JSON formatted string."
"path1": "De manera predeterminada, <code>payload</code> contendrá los datos que se enviarán o recibirán de un websocket. El receptor puede configurarse para enviar o recibir el objeto de mensaje completo como una cadena en formato JSON.",
"path2": "Esta ruta será relativa a <code>__path__</code>.",
"url1": "La URL debe usar el esquema ws:&#47;&#47; o wss:&#47;&#47; y apuntar a un receptor de websocket existente.",
"url2": "De manera predeterminada, <code>payload</code> contendrá los datos que se enviarán o recibirán de un websocket. El cliente puede configurarse para enviar o recibir el objeto de mensaje completo como una cadena en formato JSON",
"headers": "Los encabezados solo se envían durante el mecanismo de actualización del protocolo, de HTTP al protocolo WS/WSS."
},
"status": {
"connected": "connected __count__",
"connected_plural": "connected __count__"
"connected": "__count__ conectado",
"connected_plural": "__count__ conectados"
},
"errors": {
"connect-error": "An error occurred on the ws connection: ",
"send-error": "An error occurred while sending: ",
"missing-conf": "Missing server configuration",
"duplicate-path": "Cannot have two WebSocket listeners on the same path: __path__",
"missing-server": "Missing server configuration",
"missing-client": "Missing client configuration"
"connect-error": "Se produjo un error en la conexión ws:",
"send-error": "Se produjo un error al enviar: ",
"missing-conf": "Falta la configuración del servidor",
"duplicate-path": "No se pueden tener dos escuchas de WebSocket en la misma ruta: __path__",
"missing-server": "Falta la configuración del servidor",
"missing-client": "Falta la configuración del cliente"
}
},
"watch": {
"watch": "watch",
"watch": "observar",
"label": {
"files": "File(s)",
"recursive": "Watch sub-directories recursively"
"files": "Fichero(s)",
"recursive": "Observar subdirectorios recursivamente"
},
"placeholder": {
"files": "Comma-separated list of files and/or directories"
"files": "Lista de archivos y/o directorios separados por comas"
},
"tip": "On Windows you must use double back-slashes \\\\ in any directory names."
"tip": "En Windows, debes utilizar barras invertidas dobles \\\\ en cualquier nombre de directorio."
},
"tcpin": {
"label": {
@ -849,7 +850,13 @@
"newline": "Nueva línea",
"usestrings": "analizar valores numéricos",
"include_empty_strings": "incluir cadenas vacías",
"include_null_values": "incluir valores nulos"
"include_null_values": "incluir valores nulos",
"spec": "Analizador"
},
"spec": {
"rfc": "RFC4180",
"legacy": "Legado",
"legacy_warning": "El modo legado se eliminará en una versión futura."
},
"placeholder": {
"columns": "nombres de columnas separados por comas"
@ -878,6 +885,7 @@
"once": "enviar encabezados una vez, hasta msg.reset"
},
"errors": {
"bad_template": "Plantilla de columnas mal formada.",
"csv_js": "Este nodo solo maneja cadenas CSV u objetos JS.",
"obj_csv": "No se ha especificado ninguna plantilla de columnas para el objeto -> CSV.",
"bad_csv": "Datos CSV con formato incorrecto: la salida probablemente esté corrupta."
@ -887,12 +895,14 @@
"label": {
"select": "Selector",
"output": "Salida",
"in": "en"
"in": "en",
"prefix": "Nombre de la propiedad para el contenido HTML"
},
"output": {
"html": "el contenido HTML de los elementos",
"text": "sólo el contenido textual de los elementos",
"attr": "un objeto de cualquier atributo de los elementos"
"attr": "un objeto de cualquier atributo de los elementos",
"compl": "un objeto de cualquier atributo de los elementos y contenidos html"
},
"format": {
"single": "como un mensaje único que contiene una matriz",
@ -1007,6 +1017,7 @@
"objectSend": "Enviar un mensaje para cada par clave/valor",
"strBuff": "<b>Texto</b> / <b>Buffer</b>",
"array": "<b>Array</b>",
"splitThe": "Dividir el",
"splitUsing": "Dividir usando",
"splitLength": "Longitud fija de",
"stream": "Manejar como un flujo de mensajes",
@ -1036,6 +1047,7 @@
"joinedUsing": "se unió usando",
"send": "Enviar el mensaje:",
"afterCount": "Después de varias partes del mensaje",
"useparts": "Usar la propiedad msg.parts existente",
"count": "contar",
"subsequent": "y cada mensaje posterior.",
"afterTimeout": "Después de un tiempo de espera trás el primer mensaje",
@ -1102,6 +1114,7 @@
"too-many": "demasiados mensajes pendientes en el nodo de lotes",
"unexpected": "modo inesperado",
"no-parts": "ninguna propiedad 'parte' en el mensaje",
"honourParts": "Permitir que msg.parts también complete la operación por lotes.",
"error": {
"invalid-count": "Recuento no válido",
"invalid-overlap": "Solapamiento no válido",

View File

@ -24,12 +24,14 @@
<p>Solo se envía el <code>msg.payload</code>.</p>
<p>Si <code>msg.payload</code> es una cadena que contiene una codificación Base64 de datos binarios, la opción de decodificación Base64 hará que se vuelva a convertir a binario antes de enviarse.</p>
<p>Si <code>msg._session</code> no está presente, la carga se envía a <b>todos</b> los clientes conectados.</p>
<p>En el modo Responder a, configurar <code>msg.reset = true</code> restablecerá la conexión especificada por _session.id, o todas las conexiones si no se especifica _session.id.</p>
<p><b>Nota: </b>En algunos sistemas, es posible que necesites acceso raíz o de administrador para acceder a los puertos inferiores a 1024.</p>
</script>
<script type="text/html" data-help-name="tcp request">
<p>Un nodo de solicitud TCP simple: envía el <code>msg.payload</code> a un puerto tcp del servidor y espera una respuesta.</p>
<p>Se conecta, envía la "solicitud" y lee la "respuesta". Puede contar una cantidad de caracteres devueltos en un búfer fijo, hacer coincidir un carácter específico antes de regresar, esperar un tiempo de espera fijo desde la primera respuesta y luego regresar, esperar datos, o enviar y luego cerrar la conexión inmediatamente, sin esperar una respuesta.</p>
<p>Si está en modo sentado y esperando (permanecer conectado), puede enviar <code>msg.reset = true</code> o <code>msg.reset = "host:port"</code> para forzar una interrupción en la conexión y una reconexión automática.</p>
<p>La respuesta se generará en <code>msg.payload</code> como un búfer, por lo que es posible que quieras utilizar .toString().</p>
<p>Si dejas el host TCP o el puerto en blanco, debes configurarlos utilizando las propiedades <code>msg.host</code> y <code>msg.port</code> en cada mensaje enviado al nodo.</p>
</script>

View File

@ -35,7 +35,9 @@
</dd>
</dl>
<h3>Detalles</h3>
<p>La plantilla de columnas puede contener una lista ordenada de nombres de columnas. Al convertir CSV en un objeto, los nombres de las columnas se utilizarán como nombres de propiedades. Alternativamente, los nombres de las columnas se pueden tomar de la primera fila del CSV.</p>
<p>La plantilla de columnas puede contener una lista ordenada de nombres de columnas. Al convertir CSV en un objeto, los nombres de las columnas se utilizarán como nombres de propiedades. Alternativamente, los nombres de las columnas se pueden tomar de la primera fila del CSV.
<p>Cuando se selecciona el analizador RFC, la plantilla de columna debe ser compatible con RFC4180.</p>
</p>
<p>Al convertir a CSV, la plantilla de columnas se utiliza para identificar qué propiedades extraer del objeto y en qué orden.</p>
<p>Si la plantilla de columnas está en blanco, puede utilizar una lista simple de propiedades separadas por comas proporcionada en <code>msg.columns</code> para determinar qué extraer y en qué orden. Si ninguno de los dos está presente, todas las propiedades del objeto se muestran en el orden en que se encuentran en la primera fila.</p>
<p>Si la entrada es una matriz, entonces la plantilla de columnas solo se usa para generar opcionalmente una fila de títulos de columnas.</p>
@ -46,4 +48,5 @@
<p>Si genera varios mensajes, tendrán su propiedad <code>parts</code> configurada y formarán una secuencia de mensajes completa.</p>
<p>Si el nodo está configurado para enviar encabezados de columna solo una vez, si se configura <code>msg.reset</code> en cualquier valor hará que el nodo reenvíe los encabezados.</p>
<p><b>Nota:</b> la plantilla de columna debe estar separada por comas, incluso si se elige un separador diferente para los datos.</p>
<p><b>Nota:</b> en el modo RFC, se generarán errores detectables para encabezados CSV mal formados y datos de carga útil de entrada no válidos</p>
</script>

View File

@ -1017,6 +1017,7 @@
"objectSend": "Envoie un message pour chaque paire clé/valeur",
"strBuff": "<b>Chaîne</b> / <b>Tampon</b>",
"array": "<b>Tableau</b>",
"splitThe": "Diviser le",
"splitUsing": "Diviser en utilisant",
"splitLength": "Longueur fixe de",
"stream": "Gérer comme un flux de messages",
@ -1046,6 +1047,7 @@
"joinedUsing": "joint en utilisant",
"send": "Envoyer le message :",
"afterCount": "Après un nombre de parties du message",
"useparts": "Utiliser la propriété msg.parts existante",
"count": "nombre",
"subsequent": "Et tous les messages suivants.",
"afterTimeout": "Après un délai d'attente après le premier message",
@ -1112,6 +1114,7 @@
"too-many": "Trop de messages en attente dans le noeud batch",
"unexpected": "Mode inattendu",
"no-parts": "Aucune propriété de pièces dans le message",
"honourParts": "Autoriser msg.parts à compléter les opération par lots",
"error": {
"invalid-count": "Compte invalide",
"invalid-overlap": "Recouvrement invalide",

View File

@ -1017,6 +1017,7 @@
"objectSend": "各key/valueペアのメッセージを送信",
"strBuff": "<b>文字列</b> / <b>バッファ</b>",
"array": "<b>配列</b>",
"splitThe": "に基づく",
"splitUsing": "分割",
"splitLength": "固定長",
"stream": "メッセージのストリームとして処理",
@ -1046,6 +1047,7 @@
"joinedUsing": "連結文字",
"send": "メッセージ送信:",
"afterCount": "指定数のメッセージパーツを受信後",
"useparts": "既存のmsg.partsプロパティを使用",
"count": "合計値",
"subsequent": "後続のメッセージ毎",
"afterTimeout": "最初のメッセージ受信からのタイムアウト後",
@ -1112,6 +1114,7 @@
"too-many": "batchード内で保持しているメッセージが多すぎます",
"unexpected": "想定外のモード",
"no-parts": "メッセージにpartsプロパティがありません",
"honourParts": "msg.partsを用いたbatch操作を許可",
"error": {
"invalid-count": "メッセージ数が不正",
"invalid-overlap": "オーバラップが不正",

View File

@ -44,7 +44,7 @@
"global": "contexto global",
"str": "Cadeia de caracteres",
"num": "número",
"bool": "booliano",
"bool": "booliano",
"json": "objeto",
"bin": "Armazenamento temporário",
"date": "Carimbo de data/hora",
@ -352,8 +352,8 @@
}
},
"trigger": {
"send": "Enviar",
"then": "então",
"send": "Enviar",
"then": "então",
"then-send": "então enviem",
"output": {
"string": "a cadeia de caracteres",
@ -446,7 +446,7 @@
"staticTopic": "Assinar um tópico único",
"dynamicTopic": "Assinatura dinâmica",
"auto-connect": "Conectar automaticamente",
"auto-mode-depreciated": "Esta opção está deprecada. Favor utilizar o novo modo de auto-detecção."
"auto-mode-depreciated": "Esta opção está deprecada. Favor utilizar o novo modo de auto-detecção."
},
"sections-label": {
"birth-message": "Mensagem enviada na conexão (mensagem de nascimento)",
@ -466,8 +466,8 @@
"close-topic": "Deixe em branco para desativar a mensagem de fechamento"
},
"state": {
"connected": "Conectado ao negociante: _ broker _",
"disconnected": "Desconectado do negociante: _ broker _",
"connected": "Conectado ao negociante: _ broker _",
"disconnected": "Desconectado do negociante: _ broker _",
"connect-failed": "Falha na conexão com o negociante: __broker__",
"broker-disconnected": "Cliente de negociante __broker__ desconectado: __reasonCode__ __reasonString__"
},
@ -898,7 +898,7 @@
"o2j": "Objeto para opções JSON",
"pretty": "Formatar cadeia de caracteres JSON",
"action": "Ação",
"property": "Propriedade",
"property": "Propriedade",
"actions": {
"toggle": "Converter entre cadeia de caracteres JSON e Objeto",
"str": "Sempre converter em cadeia de caracteres JSON",
@ -929,7 +929,7 @@
"write": "escrever arquivo",
"read": "ler arquivo",
"filename": "Nome do arquivo",
"path": "caminho",
"path": "caminho",
"action": "Ação",
"addnewline": "Adicionar nova linha (\\n) a cada carga útil?",
"createdir": "Criar diretório se não existir?",
@ -994,6 +994,7 @@
"objectSend": "Envia uma mensagem para cada par chave/valor",
"strBuff": "<b>Cadeia de caracteres</b> / <b>Armazenamento Temporário</b>",
"array": "<b>Matriz</b>",
"splitThe": "Dividir",
"splitUsing": "Dividir usando",
"splitLength": "Comprimento fixo de",
"stream": "Tratar como uma transmissão de mensagens",
@ -1066,9 +1067,9 @@
"batch" : {
"batch": "lote",
"mode": {
"label": "Modo",
"num-msgs": "Agrupar por número de mensagens",
"interval": "Agrupar por intervalo de tempo",
"label": "Modo",
"num-msgs": "Agrupar por número de mensagens",
"interval": "Agrupar por intervalo de tempo",
"concat": "Concatenar sequências"
},
"count": {

View File

@ -874,6 +874,7 @@
"objectSend":"Отправлять сообщение для каждой пары ключ/значение",
"strBuff":"<b>Строка</b> / <b>Буфер</b>",
"array":"<b>Массив</b>",
"splitThe": "Pазделить",
"splitUsing":"С помощью",
"splitLength":"Фикс. длина",
"stream":"Обрабатывать как поток сообщений",

View File

@ -997,6 +997,7 @@
"objectSend": "每个键值对作为单个消息发送",
"strBuff": "<b>字符串</b> / <b>Buffer</b>",
"array": "<b>数组</b>",
"splitThe": "Split",
"splitUsing": "拆分使用",
"splitLength": "固定长度",
"stream": "作为消息流处理",

View File

@ -866,6 +866,7 @@
"objectSend": "每個鍵值對作為單個消息發送",
"strBuff": "<b>字串</b> / <b>Buffer</b>",
"array": "<b>陣列</b>",
"splitThe": "Split",
"splitUsing": "拆分使用",
"splitLength": "固定長度",
"stream": "作為消息流處理",

View File

@ -1,6 +1,6 @@
{
"name": "@node-red/nodes",
"version": "4.0.1",
"version": "4.0.9",
"license": "Apache-2.0",
"repository": {
"type": "git",
@ -15,20 +15,20 @@
}
],
"dependencies": {
"acorn": "8.11.3",
"acorn-walk": "8.3.2",
"ajv": "8.14.0",
"body-parser": "1.20.2",
"acorn": "8.12.1",
"acorn-walk": "8.3.4",
"ajv": "8.17.1",
"body-parser": "1.20.3",
"cheerio": "1.0.0-rc.10",
"content-type": "1.0.5",
"cookie-parser": "1.4.6",
"cookie": "0.6.0",
"cookie-parser": "1.4.7",
"cookie": "0.7.2",
"cors": "2.8.5",
"cronosjs": "1.7.1",
"denque": "2.1.0",
"form-data": "4.0.0",
"fs-extra": "11.2.0",
"got": "12.6.0",
"got": "12.6.1",
"hash-sum": "2.0.0",
"hpagent": "1.2.0",
"https-proxy-agent": "5.0.1",
@ -40,8 +40,8 @@
"mustache": "4.2.0",
"node-watch": "0.7.4",
"on-headers": "1.0.2",
"raw-body": "2.5.2",
"tough-cookie": "4.1.4",
"raw-body": "3.0.0",
"tough-cookie": "^5.0.0",
"uuid": "9.0.1",
"ws": "7.5.10",
"xml2js": "0.6.2",

View File

@ -144,7 +144,7 @@ async function installModule(module,version,url) {
if (url) {
if (pkgurlRe.test(url) || localtgzRe.test(url)) {
// Git remote url or Tarball url - check the valid package url
installName = url;
installName = localtgzRe.test(url) && slashRe.test(url) ? `"${url}"` : url;
isRegistryPackage = false;
} else {
log.warn(log._("server.install.install-failed-url",{name:module,url:url}));

View File

@ -1,6 +1,6 @@
{
"name": "@node-red/registry",
"version": "4.0.1",
"version": "4.0.9",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@ -16,11 +16,11 @@
}
],
"dependencies": {
"@node-red/util": "4.0.1",
"@node-red/util": "4.0.9",
"clone": "2.1.2",
"fs-extra": "11.2.0",
"semver": "7.5.4",
"tar": "7.2.0",
"semver": "7.6.3",
"tar": "7.4.3",
"uglify-js": "3.17.4"
}
}

View File

@ -96,7 +96,11 @@ var api = module.exports = {
} else if (scope === 'node') {
var node = runtime.nodes.getNode(id);
if (node) {
ctx = node.context();
if (/^subflow:/.test(node.type)) {
ctx = runtime.nodes.getContext(node.id);
} else {
ctx = node.context();
}
}
}
if (ctx) {
@ -104,13 +108,25 @@ var api = module.exports = {
store = store || availableStores.default;
ctx.get(key,store,function(err, v) {
if (opts.keysOnly) {
const result = {}
if (Array.isArray(v)) {
resolve({ [store]: { format: `array[${v.length}]`}})
result.format = `array[${v.length}]`
} else if (typeof v === 'object') {
resolve({ [store]: { keys: Object.keys(v), format: 'Object' } })
result.keys = Object.keys(v).map(k => {
if (Array.isArray(v[k])) {
return { key: k, format: `array[${v[k].length}]`, length: v[k].length }
} else if (typeof v[k] === 'object') {
return { key: k, format: 'object' }
} else {
return { key: k }
}
})
result.format = 'object'
} else {
resolve({ [store]: { keys: [] }})
result.keys = []
}
resolve({ [store]: result })
return
}
var encoded = util.encodeObject({msg:v});
if (store !== availableStores.default) {
@ -147,7 +163,7 @@ var api = module.exports = {
}
return
}
result[store] = { keys }
result[store] = { keys: keys.map(key => { return { key }}) }
c--;
if (c === 0) {
if (!errorReported) {

View File

@ -719,6 +719,14 @@ class Flow {
});
}
getContext(scope) {
if (scope === 'flow') {
return this.context
} else if (scope === 'global') {
return context.get('global')
}
}
dump() {
console.log("==================")
console.log(this.TYPE, this.id);

View File

@ -49,6 +49,14 @@ class Group {
}
return this.parent.getSetting(key);
}
error(msg) {
this.parent.error(msg);
}
getContext(scope) {
return this.parent.getContext(scope);
}
}
module.exports = {

View File

@ -100,7 +100,24 @@ async function evaluateEnvProperties(flow, env, credentials) {
}
} else if (type ==='jsonata') {
pendingEvaluations.push(new Promise((resolve, _) => {
redUtil.evaluateNodeProperty(value, 'jsonata', {_flow: flow}, null, (err, result) => {
redUtil.evaluateNodeProperty(value, 'jsonata',{
// Fake a node object to provide access to _flow and context
_flow: flow,
context: () => {
return {
flow: {
get: (value, store, callback) => {
return flow.getContext('flow').get(value, store, callback)
}
},
global: {
get: (value, store, callback) => {
return flow.getContext('global').get(value, store, callback)
}
}
}
}
}, null, (err, result) => {
if (!err) {
if (typeof result === 'object') {
result = { value: result, __clone__: true}
@ -113,6 +130,10 @@ async function evaluateEnvProperties(flow, env, credentials) {
resolve()
});
}))
} else if (type === "conf-type" && /^\${[^}]+}$/.test(value)) {
// Get the config node from the parent subflow
const name = value.substring(2, value.length - 1);
value = flow.getSetting(name);
} else {
try {
value = redUtil.evaluateNodeProperty(value, type, {_flow: flow}, null, null);

View File

@ -23,14 +23,16 @@ module.exports = {
if (existingSessionId) {
connections.delete(opts.session)
const session = sessions.get(existingSessionId)
session.active = false
session.idleTimeout = setTimeout(() => {
sessions.delete(existingSessionId)
}, 30000)
runtime.events.emit('comms', {
topic: "multiplayer/connection-removed",
data: { session: existingSessionId }
})
if (session) {
session.active = false
session.idleTimeout = setTimeout(() => {
sessions.delete(existingSessionId)
}, 30000)
runtime.events.emit('comms', {
topic: "multiplayer/connection-removed",
data: { session: existingSessionId }
})
}
}
})
runtime.events.on('comms:message:multiplayer/connect', (opts) => {
@ -91,29 +93,32 @@ module.exports = {
const sessionId = connections.get(opts.session)
const session = sessions.get(sessionId)
if (opts.user) {
if (session.user.anonymous !== opts.user.anonymous) {
session.user = opts.user
runtime.events.emit('comms', {
topic: 'multiplayer/connection-added',
excludeSession: opts.session,
data: session
})
if (session) {
if (opts.user) {
if (session.user.anonymous !== opts.user.anonymous) {
session.user = opts.user
runtime.events.emit('comms', {
topic: 'multiplayer/connection-added',
excludeSession: opts.session,
data: session
})
}
}
}
session.location = opts.data
session.location = opts.data
const payload = {
session: sessionId,
workspace: opts.data.workspace,
node: opts.data.node
const payload = {
session: sessionId,
workspace: opts.data.workspace,
node: opts.data.node,
cursor: opts.data.cursor
}
runtime.events.emit('comms', {
topic: 'multiplayer/location',
data: payload,
excludeSession: opts.session
})
}
runtime.events.emit('comms', {
topic: 'multiplayer/location',
data: payload,
excludeSession: opts.session
})
})
}
}

View File

@ -25,6 +25,7 @@
"removing-modules": "Eliminando módulos de la configuración",
"added-types": "Tipos de nodos añadidos:",
"removed-types": "Tipos de nodos eliminados:",
"removed-plugins": "Extensiones eliminadas:",
"install": {
"invalid": "Nombre de módulo no válido",
"installing": "Instalando módulo: __name__, versión: __version__",

View File

@ -1,6 +1,6 @@
{
"name": "@node-red/runtime",
"version": "4.0.1",
"version": "4.0.9",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@ -16,11 +16,11 @@
}
],
"dependencies": {
"@node-red/registry": "4.0.1",
"@node-red/util": "4.0.1",
"@node-red/registry": "4.0.9",
"@node-red/util": "4.0.9",
"async-mutex": "0.5.0",
"clone": "2.1.2",
"express": "4.19.2",
"express": "4.21.2",
"fs-extra": "11.2.0",
"json-stringify-safe": "5.0.1",
"rfdc": "^1.3.1"

View File

@ -75,12 +75,28 @@ LogHandler.prototype.shouldReportMessage = function(msglevel) {
msglevel <= this.logLevel;
}
// Older versions of Node-RED used the deprecated util.log function.
// With Node.js 22, use of that function causes warnings. So here we
// are replicating the same format output to ensure we don't break any
// log parsing that happens in the real world.
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const utilLog = function (msg) {
const d = new Date();
const time = [
d.getHours().toString().padStart(2, '0'),
d.getMinutes().toString().padStart(2, '0'),
d.getSeconds().toString().padStart(2, '0')
].join(':');
console.log(`${d.getDate()} ${months[d.getMonth()]} ${time} - ${msg}`)
}
var consoleLogger = function(msg) {
if (msg.level == log.METRIC || msg.level == log.AUDIT) {
util.log("["+levelNames[msg.level]+"] "+JSON.stringify(msg));
utilLog("["+levelNames[msg.level]+"] "+JSON.stringify(msg));
} else {
if (verbose && msg.msg && msg.msg.stack) {
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+msg.msg.stack);
utilLog("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+msg.msg.stack);
} else {
var message = msg.msg;
try {
@ -91,7 +107,7 @@ var consoleLogger = function(msg) {
message = 'Exception trying to log: '+util.inspect(message);
}
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+message);
utilLog("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+message);
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@node-red/util",
"version": "4.0.1",
"version": "4.0.9",
"license": "Apache-2.0",
"repository": {
"type": "git",
@ -21,6 +21,6 @@
"jsonata": "2.0.5",
"lodash.clonedeep": "^4.5.0",
"moment": "2.30.1",
"moment-timezone": "0.5.45"
"moment-timezone": "0.5.46"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "node-red",
"version": "4.0.1",
"version": "4.0.9",
"description": "Low-code programming for event-driven applications",
"homepage": "https://nodered.org",
"license": "Apache-2.0",
@ -31,18 +31,18 @@
"flow"
],
"dependencies": {
"@node-red/editor-api": "4.0.1",
"@node-red/runtime": "4.0.1",
"@node-red/util": "4.0.1",
"@node-red/nodes": "4.0.1",
"@node-red/editor-api": "4.0.9",
"@node-red/runtime": "4.0.9",
"@node-red/util": "4.0.9",
"@node-red/nodes": "4.0.9",
"basic-auth": "2.0.1",
"bcryptjs": "2.4.3",
"cors": "2.8.5",
"express": "4.19.2",
"express": "4.21.2",
"fs-extra": "11.2.0",
"node-red-admin": "^4.0.0",
"node-red-admin": "^4.0.1",
"nopt": "5.0.0",
"semver": "7.5.4"
"semver": "7.6.3"
},
"optionalDependencies": {
"@node-rs/bcrypt": "1.10.4"

View File

@ -36,10 +36,12 @@ function generateScript() {
packages.forEach(name => {
const tarName = name.replace(/@/,"").replace(/\//,"-")
lines.push(`npm publish ${tarName}-${version}.tgz ${tagArg}\n`);
if (updateNextToLatest) {
lines.push(`npm dist-tag add ${name}@${version} next\n`);
}
})
if (updateNextToLatest) {
packages.forEach(name => {
lines.push(`npm dist-tag add ${name}@${version} next\n`);
})
}
resolve(lines.join(""))
});
}

View File

@ -1009,6 +1009,29 @@ describe('delay Node', function() {
});
});
it('sending a msg with reset to empty queue doesnt send anything', function(done) {
this.timeout(2000);
var flow = [{"id":"delayNode1","type":"delay","name":"delayNode","pauseType":"rate","timeout":1,"timeoutUnits":"seconds","rate":2,"rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"wires":[["helperNode1"]]},
{id:"helperNode1", type:"helper", wires:[]}];
helper.load(delayNode, flow, function() {
var delayNode1 = helper.getNode("delayNode1");
var helperNode1 = helper.getNode("helperNode1");
var t = Date.now();
var c = 0;
helperNode1.on("input", function(msg) {
console.log("Shold not get here")
done(e);
});
setTimeout( function() {
if (c === 0) { done(); }
}, 250);
// send test messages
delayNode1.receive({payload:1,topic:"foo",reset:true}); // send something with blank topic
});
});
/* Messaging API support */
function mapiDoneTestHelper(done, pauseType, drop, msgAndTimings) {
const completeNode = require("nr-test-utils").require("@node-red/nodes/core/common/24-complete.js");

View File

@ -111,7 +111,15 @@ describe('trigger node', function() {
try {
if (rval) {
msg.should.have.property("payload");
should.deepEqual(msg.payload, rval);
if (type == "date" && val == "1") {
should.deepEqual(Math.round(msg.payload/1000000), Math.round(Date.now()/1000000));
}
else if (type == "date" && val == "iso") {
should.deepEqual(msg.payload.substr(0,11), rval.substr(0,11));
}
else {
should.deepEqual(msg.payload, rval);
}
}
else {
msg.should.have.property("payload", val);
@ -126,6 +134,7 @@ describe('trigger node', function() {
});
it('should output 2st value when triggered ('+type+')', function(done) {
if (type == "date" && val == "1") { val = "0"; }
var flow = [{"id":"n1", "type":"trigger", "name":"triggerNode", op1:"foo", op1type:"str", op2:val, op2type:type, duration:"20", wires:[["n2"]] },
{id:"n2", type:"helper"} ];
process.env[val] = rval;
@ -142,7 +151,15 @@ describe('trigger node', function() {
else {
if (rval) {
msg.should.have.property("payload");
should.deepEqual(msg.payload, rval);
if (type == "date" && val == "0") {
;(Math.round(msg.payload/1000000)).should.be.approximately(parseInt(Date.now()/1000000), 1);
}
else if (type == "date" && val == "iso") {
should.deepEqual(msg.payload.substr(0,11), rval.substr(0,11));
}
else {
should.deepEqual(msg.payload, rval);
}
}
else {
msg.should.have.property("payload", val);
@ -166,6 +183,9 @@ describe('trigger node', function() {
var val_buf = "[1,2,3,4,5]";
basicTest("bin", val_buf, Buffer.from(JSON.parse(val_buf)));
basicTest("env", "NR-TEST", "env-val");
basicTest("date", "1", Date.now());
basicTest("date", "iso", (new Date()).toISOString());
// basicTest("date", "object", Date.now());
it('should output 1 then 0 when triggered (default)', function(done) {
var flow = [{"id":"n1", "type":"trigger", "name":"triggerNode", duration:"20", wires:[["n2"]] },

View File

@ -2067,6 +2067,27 @@ describe('CSV node (RFC Mode)', function () {
n2.on("input", function (msg) {
try {
msg.should.have.property('payload', '1\tfoo\t"ba""r"\tdi,ng\n');
msg.should.have.property('columns', 'd,b,c,a'); // Strict RFC columns
done();
} catch (e) {
done(e);
}
});
const testJson = { d: 1, b: "foo", c: "ba\"r", a: "di,ng" };
n1.emit("input", { payload: testJson });
});
});
it('should convert a simple object back to a tsv with headers using a tab as a separator', function (done) {
const flow = [{ id: "n1", type: "csv", spec: "rfc", temp: "", sep: "\t", ret: '\n', hdrout: "all", wires: [["n2"]] }, // RFC-vs-Legacy difference - use line separator \n to satisfy original test
{ id: "n2", type: "helper" }];
helper.load(csvNode, flow, function () {
const n1 = helper.getNode("n1");
const n2 = helper.getNode("n2");
n2.on("input", function (msg) {
try {
msg.should.have.property('payload', 'd\tb\tc\ta\n1\tfoo\t"ba""r"\tdi,ng\n');
msg.should.have.property('columns', 'd,b,c,a'); // Strict RFC columns
done();
} catch (e) {
done(e);
@ -2086,6 +2107,7 @@ describe('CSV node (RFC Mode)', function () {
n2.on("input", function (msg) {
try {
msg.should.have.property('payload', '4,foo,true,,0\n');
msg.should.have.property('columns', 'a,b o,c p,e'); // Strict RFC columns
done();
} catch (e) {
done(e);
@ -2106,6 +2128,7 @@ describe('CSV node (RFC Mode)', function () {
try {
// 'payload', 'a"a,b\'b\nA1,B1\nA2,B2\n'); // Legacy
msg.should.have.property('payload', '"a""a",b\'b\nA1,B1\nA2,B2\n'); // RFC-vs-Legacy difference - RFC4180 Section 2.6, 2.7 quote handling
msg.should.have.property('columns', '"a""a",b\'b'); // RCF compliant column names
done();
} catch (e) {
done(e);
@ -2171,6 +2194,7 @@ describe('CSV node (RFC Mode)', function () {
n2.on("input", function (msg) {
try {
msg.should.have.property('payload', '1,3,2,4\n4,2,3,1\n');
msg.should.have.property('columns', 'd,b,c,a'); // Strict RFC columns
done();
}
catch (e) { done(e); }
@ -2189,6 +2213,7 @@ describe('CSV node (RFC Mode)', function () {
n2.on("input", function (msg) {
try {
msg.should.have.property('payload', 'd,b,c,a\n1,3,2,4\n4,"f\ng",3,1\n');
msg.should.have.property('columns', 'd,b,c,a'); // Strict RFC columns
done();
}
catch (e) { done(e); }
@ -2208,6 +2233,7 @@ describe('CSV node (RFC Mode)', function () {
try {
// 'payload', ',0,1,foo,"ba""r","di,ng","fa\nba"\n');
msg.should.have.property('payload', ',0,1,foo\n'); // RFC-vs-Legacy difference - respect that user has specified a template with 4 columns
msg.should.have.property('columns', 'a,b,c,d');
done();
}
catch (e) { done(e); }
@ -2327,6 +2353,7 @@ describe('CSV node (RFC Mode)', function () {
n2.on("input", function (msg) {
try {
msg.should.have.property('payload', '{},"text,with,commas","This ""is"" a banana","{""sub"":""object""}"\n');
msg.should.have.property('columns', 'a,b,c,d');
done();
}
catch (e) { done(e); }

View File

@ -98,7 +98,7 @@ describe('BATCH node', function() {
var n2 = helper.getNode("n2");
check_data(n1, n2, results, done);
for(var i = 0; i < 6; i++) {
n1.receive({payload: i});
n1.receive({payload: i, parts: { count:6, index:i }});
}
});
}
@ -168,6 +168,25 @@ describe('BATCH node', function() {
check_count(flow, results, done);
});
it('should create seq. with count (more sent than count)', function(done) {
var flow = [{id:"n1", type:"batch", name: "BatchNode", mode: "count", count: 4, overlap: 0, interval: 10, allowEmptySequence: false, topics: [], wires:[["n2"]]},
{id:"n2", type:"helper"}];
var results = [
[0, 1, 2, 3]
];
check_count(flow, results, done);
});
it('should create seq. with count and terminate early if parts honoured', function(done) {
var flow = [{id:"n1", type:"batch", name: "BatchNode", mode: "count", count: 4, overlap: 0, interval: 10, allowEmptySequence:false, honourParts:true, topics: [], wires:[["n2"]]},
{id:"n2", type:"helper"}];
var results = [
[0, 1, 2, 3],
[4, 5]
];
check_count(flow, results, done);
});
it('should create seq. with count and overlap', function(done) {
var flow = [{id:"n1", type:"batch", name: "BatchNode", mode: "count", count: 3, overlap: 2, interval: 10, allowEmptySequence: false, topics: [], wires:[["n2"]]},
{id:"n2", type:"helper"}];
@ -455,7 +474,7 @@ describe('BATCH node', function() {
function mapiDoneTestHelper(done, mode, count, overlap, interval, allowEmptySequence, msgAndTimings) {
const completeNode = require("nr-test-utils").require("@node-red/nodes/core/common/24-complete.js");
const catchNode = require("nr-test-utils").require("@node-red/nodes/core/common/25-catch.js");
const flow = [{id:"batchNode1", type:"batch", name: "BatchNode", mode, count, overlap, interval,
const flow = [{id:"batchNode1", type:"batch", name: "BatchNode", mode, count, overlap, interval,
allowEmptySequence, topics: [{topic: "TA"}], wires:[[]]},
{id:"completeNode1",type:"complete",scope: ["batchNode1"],uncaught:false,wires:[["helperNode1"]]},
{id:"catchNode1", type:"catch",scope: ["batchNode1"],uncaught:false,wires:[["helperNode1"]]},
@ -482,13 +501,13 @@ describe('BATCH node', function() {
}
it('should call done() when message is sent (mode: count)', function(done) {
mapiDoneTestHelper(done, "count", 2, 0, 2, false, [
mapiDoneTestHelper(done, "count", 2, 0, 2, false, [
{ msg: {payload: 0}, delay: 0, avr: 0, var: 100},
{ msg: {payload: 1}, delay: 0, avr: 0, var: 100}
]);
});
it('should call done() when reset (mode: count)', function(done) {
mapiDoneTestHelper(done, "count", 2, 0, 2, false, [
mapiDoneTestHelper(done, "count", 2, 0, 2, false, [
{ msg: {payload: 0}, delay: 0, avr: 200, var: 100},
{ msg: {payload: 1, reset:true}, delay: 200, avr: 200, var: 100}
]);

View File

@ -258,6 +258,29 @@ describe('nodes/registry/installer', function() {
}).catch(done);
});
it("succeeds when file path is valid node-red module", function(done) {
var nodeInfo = {nodes:{module:"foo",types:["a"]}};
var res = {
code: 0,
stdout:"",
stderr:""
}
var p = Promise.resolve(res);
p.catch((err)=>{});
execResponse = p;
var addModule = sinon.stub(registry,"addModule").callsFake(function(md) {
return Promise.resolve(nodeInfo);
});
installer.installModule("foo",null,"/example path/foo-0.1.1.tgz").then(function(info) {
exec.run.lastCall.args[1].should.eql([ 'install', '--no-audit', '--no-update-notifier', '--no-fund', '--save', '--save-prefix=~', '--omit=dev', '--engine-strict', '"/example path/foo-0.1.1.tgz"' ]);
info.should.eql(nodeInfo);
done();
}).catch(done);
});
it("triggers preInstall and postInstall hooks", function(done) {
let receivedPreEvent,receivedPostEvent;
hooks.add("preInstall", function(event) { event.args = ["a"]; receivedPreEvent = event; })

View File

@ -24,38 +24,38 @@ var log = NR_TEST_UTILS.require("@node-red/util").log;
describe("@node-red/util/log", function() {
beforeEach(function () {
var spy = sinon.stub(util, 'log').callsFake(function(arg){});
var spy = sinon.stub(console, 'log').callsFake(function(arg){});
var settings = {logging: { console: { level: 'metric', metrics: true } } };
log.init(settings);
});
afterEach(function() {
util.log.restore();
console.log.restore();
});
it('it can raise an error', function() {
var ret = log.error("This is an error");
sinon.assert.calledWithMatch(util.log,"[error] This is an error");
sinon.assert.calledWithMatch(console.log,"[error] This is an error");
});
it('it can raise a trace', function() {
var ret = log.trace("This is a trace");
sinon.assert.calledWithMatch(util.log,"[trace] This is a trace");
sinon.assert.calledWithMatch(console.log,"[trace] This is a trace");
});
it('it can raise a debug', function() {
var ret = log.debug("This is a debug");
sinon.assert.calledWithMatch(util.log,"[debug] This is a debug");
sinon.assert.calledWithMatch(console.log,"[debug] This is a debug");
});
it('it can raise a info', function() {
var ret = log.info("This is an info");
sinon.assert.calledWithMatch(util.log,"[info] This is an info");
sinon.assert.calledWithMatch(console.log,"[info] This is an info");
});
it('it can raise a warn', function() {
var ret = log.warn("This is a warn");
sinon.assert.calledWithMatch(util.log,"[warn] This is a warn");
sinon.assert.calledWithMatch(console.log,"[warn] This is a warn");
});
it('it can raise a metric', function() {
@ -66,9 +66,10 @@ describe("@node-red/util/log", function() {
metrics.msgid = "12345";
metrics.value = "the metric payload";
var ret = log.log(metrics);
util.log.calledOnce.should.be.true();
util.log.firstCall.args[0].indexOf("[metric] ").should.equal(0);
var body = JSON.parse(util.log.firstCall.args[0].substring(9));
console.log.calledOnce.should.be.true();
console.log.firstCall.args[0].indexOf("[metric]").should.not.equal(-1);
const parts = console.log.firstCall.args[0].split("[metric] ")
var body = JSON.parse(parts[1])
body.should.have.a.property("nodeid","testid");
body.should.have.a.property("event","node.test.testevent");
body.should.have.a.property("msgid","12345");
@ -86,13 +87,13 @@ describe("@node-red/util/log", function() {
it('it logs node type and name if provided',function() {
log.log({level:log.INFO,type:"nodeType",msg:"test",name:"nodeName",id:"nodeId"});
util.log.calledOnce.should.be.true();
util.log.firstCall.args[0].indexOf("[nodeType:nodeName]").should.not.equal(-1);
console.log.calledOnce.should.be.true();
console.log.firstCall.args[0].indexOf("[nodeType:nodeName]").should.not.equal(-1);
});
it('it logs node type and id if no name provided',function() {
log.log({level:log.INFO,type:"nodeType",msg:"test",id:"nodeId"});
util.log.calledOnce.should.be.true();
util.log.firstCall.args[0].indexOf("[nodeType:nodeId]").should.not.equal(-1);
console.log.calledOnce.should.be.true();
console.log.firstCall.args[0].indexOf("[nodeType:nodeId]").should.not.equal(-1);
});
it('ignores lower level messages and metrics', function() {
@ -104,12 +105,12 @@ describe("@node-red/util/log", function() {
log.debug("This is a debug");
log.trace("This is a trace");
log.log({level:log.METRIC,msg:"testMetric"});
sinon.assert.calledWithMatch(util.log,"[error] This is an error");
sinon.assert.calledWithMatch(util.log,"[warn] This is a warn");
sinon.assert.neverCalledWithMatch(util.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(util.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(util.log,"[trace] This is a trace");
sinon.assert.neverCalledWithMatch(util.log,"[metric] ");
sinon.assert.calledWithMatch(console.log,"[error] This is an error");
sinon.assert.calledWithMatch(console.log,"[warn] This is a warn");
sinon.assert.neverCalledWithMatch(console.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(console.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(console.log,"[trace] This is a trace");
sinon.assert.neverCalledWithMatch(console.log,"[metric] ");
});
it('ignores lower level messages but accepts metrics', function() {
var settings = {logging: { console: { level: 'log', metrics: true } } };
@ -120,12 +121,12 @@ describe("@node-red/util/log", function() {
log.debug("This is a debug");
log.trace("This is a trace");
log.log({level:log.METRIC,msg:"testMetric"});
sinon.assert.calledWithMatch(util.log,"[error] This is an error");
sinon.assert.calledWithMatch(util.log,"[warn] This is a warn");
sinon.assert.calledWithMatch(util.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(util.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(util.log,"[trace] This is a trace");
sinon.assert.calledWithMatch(util.log,"[metric] ");
sinon.assert.calledWithMatch(console.log,"[error] This is an error");
sinon.assert.calledWithMatch(console.log,"[warn] This is a warn");
sinon.assert.calledWithMatch(console.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(console.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(console.log,"[trace] This is a trace");
sinon.assert.calledWithMatch(console.log,"[metric] ");
});
it('default settings set to INFO and metrics off', function() {
@ -136,12 +137,12 @@ describe("@node-red/util/log", function() {
log.debug("This is a debug");
log.trace("This is a trace");
log.log({level:log.METRIC,msg:"testMetric"});
sinon.assert.calledWithMatch(util.log,"[error] This is an error");
sinon.assert.calledWithMatch(util.log,"[warn] This is a warn");
sinon.assert.calledWithMatch(util.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(util.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(util.log,"[trace] This is a trace");
sinon.assert.neverCalledWithMatch(util.log,"[metric] ");
sinon.assert.calledWithMatch(console.log,"[error] This is an error");
sinon.assert.calledWithMatch(console.log,"[warn] This is a warn");
sinon.assert.calledWithMatch(console.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(console.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(console.log,"[trace] This is a trace");
sinon.assert.neverCalledWithMatch(console.log,"[metric] ");
});
it('no logger used if custom logger handler does not exist', function() {
var settings = {logging: { customLogger: { level: 'trace', metrics: true } } };
@ -152,12 +153,12 @@ describe("@node-red/util/log", function() {
log.debug("This is a debug");
log.trace("This is a trace");
log.log({level:log.METRIC,msg:"testMetric"});
sinon.assert.neverCalledWithMatch(util.log,"[error] This is an error");
sinon.assert.neverCalledWithMatch(util.log,"[warn] This is a warn");
sinon.assert.neverCalledWithMatch(util.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(util.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(util.log,"[trace] This is a trace");
sinon.assert.neverCalledWithMatch(util.log,"[metric] ");
sinon.assert.neverCalledWithMatch(console.log,"[error] This is an error");
sinon.assert.neverCalledWithMatch(console.log,"[warn] This is a warn");
sinon.assert.neverCalledWithMatch(console.log,"[info] This is an info");
sinon.assert.neverCalledWithMatch(console.log,"[debug] This is a debug");
sinon.assert.neverCalledWithMatch(console.log,"[trace] This is a trace");
sinon.assert.neverCalledWithMatch(console.log,"[metric] ");
});
it('add a custom log handler directly', function() {
@ -244,7 +245,7 @@ describe("@node-red/util/log", function() {
},
};
var ret = log.info(msg.msg);
sinon.assert.calledWithMatch(util.log,"my special message");
sinon.assert.calledWithMatch(console.log,"my special message");
});