mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
300 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f91762ec8f | ||
|
7f698610df | ||
|
bee06f64f5 | ||
|
53af4231af | ||
|
2ea4b15dca | ||
|
ce09f56dcc | ||
|
6c648e4bab | ||
|
72661aa159 | ||
|
16e79d6bd2 | ||
|
726fac97d2 | ||
|
efc3882961 | ||
|
489c456271 | ||
|
970be7b5f2 | ||
|
b94fdd2f79 | ||
|
66f6bc59fa | ||
|
455f2dc800 | ||
|
aed2b8e46d | ||
|
633afbbb44 | ||
|
6c797e35cf | ||
|
30b8a95421 | ||
|
7665971b52 | ||
|
ba6dc3117f | ||
|
73fcc05a54 | ||
|
fd409b0636 | ||
|
29287149b4 | ||
|
18c0ec990a | ||
|
ee2b151b7a | ||
|
2d7a068644 | ||
|
5c5855751c | ||
|
396b3b64ff | ||
|
48e33a472b | ||
|
a7375e4e8f | ||
|
42732db2b0 | ||
|
7c830856df | ||
|
5dad33dc77 | ||
|
cbdb988d02 | ||
|
e944dfecc2 | ||
|
b2c2b9bd14 | ||
|
0ed7f6ce4e | ||
|
74e3b9e9ed | ||
|
7fd884c68f | ||
|
3f29283724 | ||
|
ea303495b0 | ||
|
9d39709038 | ||
|
facb6143c3 | ||
|
68a2786ff2 | ||
|
b2b31670f8 | ||
|
355fb724f8 | ||
|
d925f12aea | ||
|
428ed090f3 | ||
|
9946132658 | ||
|
30f08a9f17 | ||
|
83f1729d83 | ||
|
3667de18a9 | ||
|
bda8e86ea4 | ||
|
7920fa1dd4 | ||
|
cb06690553 | ||
|
4b4e5a0861 | ||
|
e5952f082e | ||
|
c7994b6393 | ||
|
39ac6b0d46 | ||
|
e22bf22b61 | ||
|
92dd80ac49 | ||
|
9442e2a993 | ||
|
6df7f50f9f | ||
|
933cad888f | ||
|
8133c5e834 | ||
|
e7f6549cb6 | ||
|
2ded07c765 | ||
|
6a799e7e2a | ||
|
1d40378f8c | ||
|
bcab1cf096 | ||
|
03484fd5cd | ||
|
1eea371124 | ||
|
02d9ad479d | ||
|
3be75fa822 | ||
|
ca204dea2d | ||
|
a2de514c05 | ||
|
ea5d25c794 | ||
|
b51eb7326f | ||
|
3a7a606f6a | ||
|
294fc6b62f | ||
|
662a44fccf | ||
|
b0a5d4fb6f | ||
|
205dbc1a25 | ||
|
f717eb7388 | ||
|
020eaef5ba | ||
|
c5efdf5ae3 | ||
|
15958cd4a3 | ||
|
cdcc8cc59a | ||
|
0014fec63f | ||
|
812efde342 | ||
|
889f0e1569 | ||
|
3a26c5cd65 | ||
|
4706e20a1d | ||
|
58e87b3ddf | ||
|
ea0abb70a2 | ||
|
e092f41074 | ||
|
79a90dc476 | ||
|
25962dbf39 | ||
|
8df53e441d | ||
|
6f89efa40b | ||
|
d6a1b4e71f | ||
|
a2c0e53f87 | ||
|
97678577fb | ||
|
226f45d8d5 | ||
|
0aa80d82d9 | ||
|
21a0b33645 | ||
|
ae76ff0aaf | ||
|
bba819ba84 | ||
|
780e41d6a6 | ||
|
6d0b55f753 | ||
|
77e2e44abc | ||
|
50718495da | ||
|
b7b604aed4 | ||
|
a1f5cabbba | ||
|
c2aae6ddf6 | ||
|
c8dc2327a3 | ||
|
f660973168 | ||
|
cf2e7744f3 | ||
|
855d799b21 | ||
|
97dd1d0f4f | ||
|
702545e0b2 | ||
|
fa2787eb5d | ||
|
0f37b326a0 | ||
|
7f9f551cfe | ||
|
ecf1847dd2 | ||
|
40a9dce869 | ||
|
a6696733fa | ||
|
d9bd736159 | ||
|
4f5f5d31a3 | ||
|
fad1325427 | ||
|
8b6678a453 | ||
|
c7f48a83c0 | ||
|
af0f02d63e | ||
|
497d63e67e | ||
|
4d048af384 | ||
|
49e69a54bd | ||
|
73ff852648 | ||
|
6d50eb5737 | ||
|
a8579fa68a | ||
|
10f77fdf1a | ||
|
84a9cf7adf | ||
|
a49927f173 | ||
|
ac97e8c613 | ||
|
95fe717ca7 | ||
|
10b18de3e0 | ||
|
cf1424976f | ||
|
fdb868516f | ||
|
97ebe33d68 | ||
|
c0612e6193 | ||
|
380a08242a | ||
|
0398ef3b90 | ||
|
25f4fbf2bb | ||
|
5f0ea85f47 | ||
|
6c7c1202ed | ||
|
669aa769c2 | ||
|
fcf2994015 | ||
|
bee21ddc9e | ||
|
263e68e677 | ||
|
2b958f5724 | ||
|
95f7177ef4 | ||
|
006324b78e | ||
|
efd8c1229d | ||
|
0f1aea3e0d | ||
|
6a41cbebc9 | ||
|
bffb91f196 | ||
|
4573b65639 | ||
|
3d8505385a | ||
|
99c053f86b | ||
|
f2dde705ef | ||
|
be11fda814 | ||
|
0261105c52 | ||
|
264047dc0c | ||
|
4d84926ed2 | ||
|
da3211fee6 | ||
|
1388b03cf2 | ||
|
b3f1401ab4 | ||
|
e5e3832809 | ||
|
2eff7da171 | ||
|
e9622bcfe8 | ||
|
dc73997be3 | ||
|
fb81121bd3 | ||
|
5293563a6a | ||
|
2e1e61dabe | ||
|
280d63fde7 | ||
|
e55cbb3e3d | ||
|
7959d18248 | ||
|
b7bae18849 | ||
|
fbde247c72 | ||
|
3a69af9034 | ||
|
5c87a6cb76 | ||
|
9c6bb434e8 | ||
|
d1bd303dfa | ||
|
3813c32454 | ||
|
3b00a692ee | ||
|
3304ebe9d3 | ||
|
513120cbfe | ||
|
b06049d5a3 | ||
|
0f50355deb | ||
|
bd6e35fea2 | ||
|
a4fd63cd44 | ||
|
fdc4219b68 | ||
|
5b428bb8e6 | ||
|
c948ff88a5 | ||
|
9b9a0d7060 | ||
|
16578e3677 | ||
|
be7f84bc67 | ||
|
033d26f2cb | ||
|
4c0826b1c4 | ||
|
c4cc204c94 | ||
|
3747db18b1 | ||
|
4173625fca | ||
|
0e7863a6fb | ||
|
207ba00ad2 | ||
|
87c89586a5 | ||
|
1cea1ced82 | ||
|
08732bac0f | ||
|
283e8d3c08 | ||
|
42a7165596 | ||
|
aa3f5001d5 | ||
|
56580c4005 | ||
|
ba304c9651 | ||
|
703c5adba7 | ||
|
8b85f6e0a6 | ||
|
c136d22382 | ||
|
42358419ad | ||
|
ab2ced5c37 | ||
|
faf31be0dc | ||
|
ff4c67d068 | ||
|
10b133db02 | ||
|
f0bf607b43 | ||
|
8948ca5323 | ||
|
9c3be51fe9 | ||
|
2da9161f29 | ||
|
983dad5b53 | ||
|
8b23d341b4 | ||
|
0ad60013aa | ||
|
289815e128 | ||
|
f7ee83f1b9 | ||
|
f67aafa8d3 | ||
|
4e5ddd57bf | ||
|
e0d4ecf835 | ||
|
81a461115b | ||
|
d679b02658 | ||
|
5effcdb024 | ||
|
5fc920087b | ||
|
085233ab9b | ||
|
6657b2629f | ||
|
58f3a76da7 | ||
|
75bcd9e8d5 | ||
|
977e7ef395 | ||
|
eb1b8b577f | ||
|
28f91685ce | ||
|
81a4fe59d9 | ||
|
51f45293b8 | ||
|
8b43b31c64 | ||
|
3abef972a7 | ||
|
30b00741b5 | ||
|
f86e743cce | ||
|
cb96fb735e | ||
|
459a52d31d | ||
|
44ef9a13d6 | ||
|
0bb3652a63 | ||
|
6a82d683a9 | ||
|
fad708e8de | ||
|
c6a38b8355 | ||
|
ee84eb666b | ||
|
af949c62c2 | ||
|
e26bae8027 | ||
|
555f155cad | ||
|
f3997128b9 | ||
|
154a4e23dd | ||
|
30f2b96c68 | ||
|
58c94b7773 | ||
|
83203d5f5d | ||
|
f77d161643 | ||
|
6580b139c0 | ||
|
2743c7c6ac | ||
|
bd77d7eec3 | ||
|
cb3fcb7bfa | ||
|
bef641609e | ||
|
24b52f09df | ||
|
c9f03f1ac5 | ||
|
02bd292b8c | ||
|
e5f1029d0c | ||
|
cae247160f | ||
|
6692b1992c | ||
|
0937837b7f | ||
|
828888490a | ||
|
2cad42870e | ||
|
43651135f3 | ||
|
6ae42eb787 | ||
|
ecaf866613 | ||
|
5ea3329b36 | ||
|
7bb7149f4c | ||
|
5856d043ca | ||
|
7cd3e49f04 | ||
|
720a163273 | ||
|
a9b12e5172 |
2894
CHANGELOG.md
2894
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -38,12 +38,9 @@ If you want to raise a pull-request with a new feature, or a refactoring
|
||||
of existing code, it may well get rejected if you haven't discussed it on
|
||||
the [forum](https://discourse.nodered.org) first.
|
||||
|
||||
All contributors need to sign the JS Foundation's Contributor License Agreement.
|
||||
It is an online process and quick to do. You can read the details of the agreement
|
||||
here: https://cla.js.foundation/node-red/node-red.
|
||||
|
||||
If you raise a pull-request without having signed the CLA, you will be prompted
|
||||
to do so automatically.
|
||||
All contributors need to sign the OpenJS Foundation's Contributor License Agreement.
|
||||
It is an online process and quick to do. If you raise a pull-request without
|
||||
having signed the CLA, you will be prompted to do so automatically.
|
||||
|
||||
|
||||
### Code Branches
|
||||
|
10
README.md
10
README.md
@@ -56,13 +56,13 @@ This project adheres to the [Contributor Covenant 1.4](http://contributor-covena
|
||||
|
||||
## Authors
|
||||
|
||||
Node-RED is a project of the [OpenJS Foundation](https://openjsf.org).
|
||||
Node-RED is a project of the [OpenJS Foundation](http://openjsf.org).
|
||||
|
||||
It was created by [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-technology/).
|
||||
|
||||
* Nick O'Leary [@knolleary](http://twitter.com/knolleary)
|
||||
* Dave Conway-Jones [@ceejay](http://twitter.com/ceejay)
|
||||
It is maintained by:
|
||||
|
||||
* Nick O'Leary [@knolleary](http://twitter.com/knolleary)
|
||||
* Dave Conway-Jones [@ceejay](http://twitter.com/ceejay)
|
||||
* And many others...
|
||||
|
||||
|
||||
## Copyright and license
|
||||
|
40
package.json
40
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red",
|
||||
"version": "2.1.6",
|
||||
"version": "2.2.3",
|
||||
"description": "Low-code programming for event-driven applications",
|
||||
"homepage": "http://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
@@ -28,7 +28,7 @@
|
||||
"dependencies": {
|
||||
"acorn": "8.7.0",
|
||||
"acorn-walk": "8.2.0",
|
||||
"ajv": "8.8.2",
|
||||
"ajv": "8.10.0",
|
||||
"async-mutex": "0.3.2",
|
||||
"basic-auth": "2.0.1",
|
||||
"bcryptjs": "2.4.3",
|
||||
@@ -36,7 +36,7 @@
|
||||
"cheerio": "1.0.0-rc.10",
|
||||
"clone": "2.1.2",
|
||||
"content-type": "1.0.4",
|
||||
"cookie": "0.4.1",
|
||||
"cookie": "0.4.2",
|
||||
"cookie-parser": "1.4.6",
|
||||
"cors": "2.8.5",
|
||||
"cronosjs": "1.7.1",
|
||||
@@ -50,42 +50,42 @@
|
||||
"hash-sum": "2.0.0",
|
||||
"hpagent": "0.1.2",
|
||||
"https-proxy-agent": "5.0.0",
|
||||
"i18next": "21.6.6",
|
||||
"i18next": "21.6.11",
|
||||
"iconv-lite": "0.6.3",
|
||||
"is-utf8": "0.2.1",
|
||||
"js-yaml": "3.14.1",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"jsonata": "1.8.5",
|
||||
"jsonata": "1.8.6",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"media-typer": "1.1.0",
|
||||
"memorystore": "1.6.6",
|
||||
"mime": "2.5.2",
|
||||
"memorystore": "1.6.7",
|
||||
"mime": "3.0.0",
|
||||
"moment-timezone": "0.5.34",
|
||||
"mqtt": "4.3.4",
|
||||
"multer": "1.4.3",
|
||||
"mqtt": "4.3.5",
|
||||
"multer": "1.4.4",
|
||||
"mustache": "4.2.0",
|
||||
"node-red-admin": "^2.2.1",
|
||||
"node-red-admin": "^2.2.3",
|
||||
"nopt": "5.0.0",
|
||||
"oauth2orize": "1.11.1",
|
||||
"on-headers": "1.0.2",
|
||||
"passport": "0.5.2",
|
||||
"passport-http-bearer": "1.0.1",
|
||||
"passport-oauth2-client-password": "0.1.2",
|
||||
"raw-body": "2.4.2",
|
||||
"raw-body": "2.4.3",
|
||||
"semver": "7.3.5",
|
||||
"tar": "6.1.11",
|
||||
"tough-cookie": "4.0.0",
|
||||
"uglify-js": "3.14.5",
|
||||
"uglify-js": "3.15.1",
|
||||
"uuid": "8.3.2",
|
||||
"ws": "7.5.1",
|
||||
"ws": "7.5.6",
|
||||
"xml2js": "0.4.23"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bcrypt": "5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dompurify": "2.3.4",
|
||||
"grunt": "1.4.1",
|
||||
"dompurify": "2.3.6",
|
||||
"grunt": "1.5.2",
|
||||
"grunt-chmod": "~1.1.1",
|
||||
"grunt-cli": "~1.4.3",
|
||||
"grunt-concurrent": "3.0.0",
|
||||
@@ -104,20 +104,20 @@
|
||||
"grunt-sass": "~3.1.0",
|
||||
"grunt-simple-mocha": "~0.4.1",
|
||||
"grunt-simple-nyc": "^3.0.1",
|
||||
"i18next-http-backend": "1.3.1",
|
||||
"i18next-http-backend": "1.3.2",
|
||||
"jquery-i18next": "1.2.1",
|
||||
"jsdoc-nr-template": "github:node-red/jsdoc-nr-template",
|
||||
"marked": "4.0.10",
|
||||
"marked": "4.0.12",
|
||||
"minami": "1.2.3",
|
||||
"mocha": "9.1.3",
|
||||
"mocha": "9.2.0",
|
||||
"node-red-node-test-helper": "^0.2.7",
|
||||
"nodemon": "2.0.15",
|
||||
"proxy": "^1.0.2",
|
||||
"sass": "1.48.0",
|
||||
"sass": "1.49.7",
|
||||
"should": "13.2.3",
|
||||
"sinon": "11.1.2",
|
||||
"stoppable": "^1.1.0",
|
||||
"supertest": "6.2.1"
|
||||
"supertest": "6.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
|
@@ -122,6 +122,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (req.body.active) {
|
||||
opts.clearContext = req.body.hasOwnProperty('clearContext')?req.body.clearContext:true
|
||||
runtimeAPI.projects.setActiveProject(opts).then(function() {
|
||||
listProjects(req,res);
|
||||
}).catch(function(err) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-api",
|
||||
"version": "2.1.6",
|
||||
"version": "2.2.3",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,23 +16,23 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "2.1.6",
|
||||
"@node-red/editor-client": "2.1.6",
|
||||
"@node-red/util": "2.2.3",
|
||||
"@node-red/editor-client": "2.2.3",
|
||||
"bcryptjs": "2.4.3",
|
||||
"body-parser": "1.19.1",
|
||||
"clone": "2.1.2",
|
||||
"cors": "2.8.5",
|
||||
"express-session": "1.17.2",
|
||||
"express": "4.17.2",
|
||||
"memorystore": "1.6.6",
|
||||
"mime": "2.5.2",
|
||||
"multer": "1.4.3",
|
||||
"memorystore": "1.6.7",
|
||||
"mime": "3.0.0",
|
||||
"multer": "1.4.4",
|
||||
"mustache": "4.2.0",
|
||||
"oauth2orize": "1.11.1",
|
||||
"passport-http-bearer": "1.0.1",
|
||||
"passport-oauth2-client-password": "0.1.2",
|
||||
"passport": "0.5.2",
|
||||
"ws": "7.5.1"
|
||||
"ws": "7.5.6"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bcrypt": "5.0.1"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
|
@@ -75,6 +75,8 @@
|
||||
"view": {
|
||||
"view": "View",
|
||||
"grid": "Grid",
|
||||
"storeZoom": "Restore zoom level on load",
|
||||
"storePosition": "Restore scroll position on load",
|
||||
"showGrid": "Show grid",
|
||||
"snapGrid": "Snap to grid",
|
||||
"gridSize": "Grid size",
|
||||
@@ -894,6 +896,8 @@
|
||||
"addTitle": "add an item"
|
||||
},
|
||||
"search": {
|
||||
"history": "Search history",
|
||||
"clear": "clear all",
|
||||
"empty": "No matches found",
|
||||
"addNode": "add a node..."
|
||||
},
|
||||
@@ -1091,7 +1095,8 @@
|
||||
"not-git": "Not a git repository",
|
||||
"no-resource": "Repository not found",
|
||||
"cant-get-ssh-key-path": "Error! Can't get selected SSH key path.",
|
||||
"unexpected_error": "unexpected_error"
|
||||
"unexpected_error": "unexpected_error",
|
||||
"clearContext": "Clear context when switching projects"
|
||||
},
|
||||
"delete": {
|
||||
"confirm": "Are you sure you want to delete this project?"
|
||||
|
@@ -75,6 +75,8 @@
|
||||
"view": {
|
||||
"view": "表示",
|
||||
"grid": "グリッド",
|
||||
"storeZoom": "読み込み時に拡大/縮小のレベルを復元",
|
||||
"storePosition": "読み込み時にスクロール位置を復元",
|
||||
"showGrid": "グリッドを表示",
|
||||
"snapGrid": "ノードの配置を補助",
|
||||
"gridSize": "グリッドの大きさ",
|
||||
@@ -843,7 +845,7 @@
|
||||
"pushFailed": "リモートに新しいコミットがあるため、プッシュに失敗しました。プルしてマージしてから、再度プッシュしてください。",
|
||||
"push": "プッシュ",
|
||||
"pull": "プル",
|
||||
"unablePull": "<p>リモートの変更のプル失敗:ステージングされていないローカルの変更を上書きされてしまいます。</p><p>変更をコミットしてから再度実行してください。</p>",
|
||||
"unablePull": "<p>リモートの変更のプル失敗:ステージングされていないローカルの変更が上書きされてしまいます。</p><p>変更をコミットしてから再度実行してください。</p>",
|
||||
"showUnstagedChanges": "ステージングされていない変更を表示",
|
||||
"connectionFailed": "リモートリポジトリに接続できません: ",
|
||||
"pullUnrelatedHistory": "<p>リモートに関連のないコミット履歴があります。</p><p>本当に変更をプルしてローカルリポジトリに反映しますか?</p>",
|
||||
@@ -894,6 +896,8 @@
|
||||
"addTitle": "要素を追加"
|
||||
},
|
||||
"search": {
|
||||
"history": "検索履歴",
|
||||
"clear": "全て削除",
|
||||
"empty": "一致したものが見つかりませんでした",
|
||||
"addNode": "ノードを追加..."
|
||||
},
|
||||
@@ -1091,7 +1095,8 @@
|
||||
"not-git": "Gitリポジトリではありません",
|
||||
"no-resource": "リポジトリが見つかりません",
|
||||
"cant-get-ssh-key-path": "エラー! 選択したSSHキーのパスを取得できません。",
|
||||
"unexpected_error": "予期しないエラー"
|
||||
"unexpected_error": "予期しないエラー",
|
||||
"clearContext": "プロジェクトを切り替る際にコンテキストを初期化"
|
||||
},
|
||||
"delete": {
|
||||
"confirm": "プロジェクトを削除しても良いですか?"
|
||||
@@ -1151,5 +1156,141 @@
|
||||
"ru": "ロシア語",
|
||||
"zh-CN": "中国語(簡体)",
|
||||
"zh-TW": "中国語(繁体)"
|
||||
},
|
||||
"action-list": {
|
||||
"toggle-show-tips": "ヒント表示切替",
|
||||
"show-about": "Node-REDの説明を表示",
|
||||
"show-welcome-tour": "ウェルカムツアー表示",
|
||||
"show-next-tab": "次のタブを表示",
|
||||
"show-previous-tab": "前のタブを表示",
|
||||
"add-flow": "フローを追加",
|
||||
"add-flow-to-right": "フローを右に追加",
|
||||
"edit-flow": "フローを編集",
|
||||
"remove-flow": "フローを削除",
|
||||
"enable-flow": "フローを有効化",
|
||||
"disable-flow": "フローを無効化",
|
||||
"hide-flow": "フローを隠す",
|
||||
"hide-other-flows": "他のフローを非表示",
|
||||
"hide-all-flows": "全てのフローを非表示",
|
||||
"show-all-flows": "全てのフローを表示",
|
||||
"show-last-hidden-flow": "最後に非表示にしたフローを表示",
|
||||
"list-hidden-flows": "非表示フローを表示",
|
||||
"list-flows": "フロー一覧",
|
||||
"list-subflows": "サブフロー一覧",
|
||||
"go-to-previous-location": "前の位置に移動",
|
||||
"go-to-next-location": "次の位置に移動",
|
||||
"copy-selection-to-internal-clipboard": "選択をクリップボードにコピー",
|
||||
"cut-selection-to-internal-clipboard": "選択をクリップボードに切り取り",
|
||||
"paste-from-internal-clipboard": "クリップボードから貼り付け",
|
||||
"detach-selected-nodes": "選択ノードを接続から外す",
|
||||
"delete-selection": "選択を削除",
|
||||
"delete-selection-and-reconnect": "選択を削除し再接続",
|
||||
"edit-selected-node": "選択したノードを編集",
|
||||
"go-to-selection": "選択に移動",
|
||||
"undo": "変更操作を戻す",
|
||||
"redo": "変更操作をやり直し",
|
||||
"select-all-nodes": "全てのノードを選択",
|
||||
"select-none": "ノードを選択",
|
||||
"enable-selected-nodes": "選択ノードを有効化",
|
||||
"disable-selected-nodes": "選択ノードを無効化",
|
||||
"toggle-show-grid": "グリッド表示切替",
|
||||
"toggle-snap-grid": "ノードの配置補助切替",
|
||||
"toggle-status": "ステータス表示切替",
|
||||
"show-selected-node-labels": "選択したノードのラベルを表示",
|
||||
"hide-selected-node-labels": "選択したノードのラベルを非表示",
|
||||
"scroll-view-up": "上スクロール",
|
||||
"scroll-view-right": "右スクロール",
|
||||
"scroll-view-down": "下スクロール",
|
||||
"scroll-view-left": "左スクロール",
|
||||
"step-view-up": "一単位上スクロール",
|
||||
"step-view-right": "一単位右スクロール",
|
||||
"step-view-down": "一単位下スクロール",
|
||||
"step-view-left": "一単位左スクロール",
|
||||
"move-selection-up": "選択を上移動",
|
||||
"move-selection-right": "選択を右移動",
|
||||
"move-selection-down": "選択を下移動",
|
||||
"move-selection-left": "選択を左移動",
|
||||
"move-selection-forwards": "選択を前面に移動",
|
||||
"move-selection-backwards": "選択を背面に移動",
|
||||
"move-selection-to-front": "選択を最前面に移動",
|
||||
"move-selection-to-back": "選択を最背面に移動",
|
||||
"step-selection-up": "選択を一単位上移動",
|
||||
"step-selection-right": "選択を一単位右移動",
|
||||
"step-selection-down": "選択を一単位下移動",
|
||||
"step-selection-left": "選択を一単位左移動",
|
||||
"select-connected-nodes": "接続されたノードを選択",
|
||||
"select-downstream-nodes": "後方に接続されたノードを選択",
|
||||
"select-upstream-nodes": "前方に接続されたノードを選択",
|
||||
"go-to-next-node": "次のノードに移動",
|
||||
"go-to-previous-node": "前のノードに移動",
|
||||
"go-to-next-sibling": "次の兄弟ノードに移動",
|
||||
"go-to-previous-sibling": "前の兄弟ノードに移動",
|
||||
"go-to-nearest-node-on-left": "最も近い左側ノードに移動",
|
||||
"go-to-nearest-node-on-right": "最も近い右側ノードに移動",
|
||||
"go-to-nearest-node-above": "最も近い上側ノードに移動",
|
||||
"go-to-nearest-node-below": "最も近い下側ノードに移動",
|
||||
"align-selection-to-grid": "選択を整列",
|
||||
"align-selection-to-left": "選択を左揃え",
|
||||
"align-selection-to-right": "選択を右揃え",
|
||||
"align-selection-to-top": "選択を上揃え",
|
||||
"align-selection-to-bottom": "選択を下揃え",
|
||||
"align-selection-to-middle": "選択を上下中央揃え",
|
||||
"align-selection-to-center": "選択を左右中央揃え",
|
||||
"distribute-selection-horizontally": "選択を左右に整列",
|
||||
"distribute-selection-vertically": "選択を上下に整列",
|
||||
"wire-series-of-nodes": "ノードを一続きに接続",
|
||||
"wire-node-to-multiple": "ノードを複数に接続",
|
||||
"show-user-settings": "ユーザ設定を表示",
|
||||
"show-help": "ヘルプを表示",
|
||||
"toggle-palette": "パレットの表示切替",
|
||||
"show-event-log": "イベントログを表示",
|
||||
"manage-palette": "パレットの管理",
|
||||
"toggle-sidebar": "サイドバーの表示切替",
|
||||
"show-info-tab": "ノード情報タブの表示",
|
||||
"show-help-tab": "ノードヘルプタブの表示",
|
||||
"show-config-tab": "設定ノードタブの表示",
|
||||
"select-all-config-nodes": "全ての設定ノードを選択",
|
||||
"delete-config-selection": "選択した設定ノードを削除",
|
||||
"show-context-tab": "コンテキストデータタブを表示",
|
||||
"create-subflow": "サブフローを作成",
|
||||
"convert-to-subflow": "選択をサブフローに変換",
|
||||
"group-selection": "選択をグループ化",
|
||||
"ungroup-selection": "選択をグループ解除",
|
||||
"merge-selection-to-group": "選択をグループにマージ",
|
||||
"remove-selection-from-group": "選択をグループから削除",
|
||||
"copy-group-style": "グループのスタイルをコピー",
|
||||
"paste-group-style": "グループのスタイルを貼り付け",
|
||||
"show-export-dialog": "書き出しダイアログを表示",
|
||||
"show-import-dialog": "読み込みダイアログを表示",
|
||||
"show-library-export-dialog": "ライブラリ書き出しダイアログを表示",
|
||||
"show-library-import-dialog": "ライブラリ読み込みダイアログを表示",
|
||||
"show-examples-import-dialog": "サンプル読み込みダイアログを表示",
|
||||
"search": "検索",
|
||||
"show-action-list": "アクション一覧を表示",
|
||||
"confirm-edit-tray": "編集を完了",
|
||||
"cancel-edit-tray": "編集をキャンセル",
|
||||
"show-remote-diff": "リモートとの変更差分を表示",
|
||||
"deploy-flows": "フローをデプロイ",
|
||||
"restart-flows": "フローを再起動",
|
||||
"set-deploy-type-to-full": "デプロイを「全て」に設定",
|
||||
"set-deploy-type-to-modified-flows": "デプロイを「変更したフロー」に設定",
|
||||
"set-deploy-type-to-modified-nodes": "デプロイを「変更したノード」に設定",
|
||||
"show-debug-tab": "デバッグタブを表示",
|
||||
"clear-debug-messages": "デバッグメッセージをクリア",
|
||||
"clear-filtered-debug-messages": "フィルタしたデバッグメッセージをクリア",
|
||||
"activate-selected-debug-nodes": "選択したデバッグノードを有効化",
|
||||
"activate-all-debug-nodes": "全てのデバッグノードを有効化",
|
||||
"activate-all-flow-debug-nodes": "フロー内の全デバッグノードを有効化",
|
||||
"deactivate-selected-debug-nodes": "選択したデバッグノードを無効化",
|
||||
"deactivate-all-debug-nodes": "全てのデバッグノードを無効化",
|
||||
"deactivate-all-flow-debug-nodes": "フロー内の全デバッグノードを無効化",
|
||||
"zoom-in": "ズームイン",
|
||||
"zoom-out": "ズームアウト",
|
||||
"zoom-reset": "ズームリセット",
|
||||
"toggle-navigator": "ナビゲータ表示切替",
|
||||
"new-project": "新しいプロジェクト",
|
||||
"open-project": "プロジェクトを開く",
|
||||
"show-project-settings": "プロジェクト設定を表示",
|
||||
"show-version-control-tab": "バージョンコントロールタブを表示"
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
"tip14": "[shift] を押しながらノードを [click] すると、接続された全てのノードを選択できます。",
|
||||
"tip15": "[ctrl] を押しながらノードを [click] すると、選択/非選択を切り替えできます。",
|
||||
"tip16": "{{core:show-previous-tab}} や {{core:show-next-tab}} で、タブの切り替えができます。",
|
||||
"tip17": "ノードのプロバティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。",
|
||||
"tip17": "ノードのプロパティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。",
|
||||
"tip18": "ノードを選択し、 {{core:edit-selected-node}} を押すとプロパティ設定画面が表示されます。"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-client",
|
||||
"version": "2.1.6",
|
||||
"version": "2.2.3",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@@ -98,7 +98,7 @@ oop.inherits(NRJavaScriptWorker, Mirror);
|
||||
if (options) {
|
||||
for (var opt in options) {
|
||||
if (options.hasOwnProperty(opt)) {
|
||||
this.options[opt] = options.opt;
|
||||
this.options[opt] = options[opt];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -684,6 +684,13 @@ RED.history = (function() {
|
||||
peek: function() {
|
||||
return undoHistory[undoHistory.length-1];
|
||||
},
|
||||
replace: function(ev) {
|
||||
if (undoHistory.length === 0) {
|
||||
RED.history.push(ev);
|
||||
} else {
|
||||
undoHistory[undoHistory.length-1] = ev;
|
||||
}
|
||||
},
|
||||
clear: function() {
|
||||
undoHistory = [];
|
||||
redoHistory = [];
|
||||
|
@@ -38,7 +38,9 @@
|
||||
},
|
||||
"red-ui-workspace": {
|
||||
"backspace": "core:delete-selection",
|
||||
"ctrl-backspace": "core:delete-selection-and-reconnect",
|
||||
"delete": "core:delete-selection",
|
||||
"ctrl-delete": "core:delete-selection-and-reconnect",
|
||||
"enter": "core:edit-selected-node",
|
||||
"ctrl-enter": "core:go-to-selection",
|
||||
"ctrl-c": "core:copy-selection-to-internal-clipboard",
|
||||
|
@@ -15,6 +15,9 @@
|
||||
**/
|
||||
RED.nodes = (function() {
|
||||
|
||||
var PORT_TYPE_INPUT = 1;
|
||||
var PORT_TYPE_OUTPUT = 0;
|
||||
|
||||
var node_defs = {};
|
||||
var linkTabMap = {};
|
||||
|
||||
@@ -597,6 +600,14 @@ RED.nodes = (function() {
|
||||
RED.events.emit('nodes:add',n);
|
||||
}
|
||||
function addLink(l) {
|
||||
if (nodeLinks[l.source.id]) {
|
||||
const isUnique = nodeLinks[l.source.id].out.every(function(link) {
|
||||
return link.sourcePort !== l.sourcePort || link.target.id !== l.target.id
|
||||
})
|
||||
if (!isUnique) {
|
||||
return
|
||||
}
|
||||
}
|
||||
links.push(l);
|
||||
if (l.source) {
|
||||
// Possible the node hasn't been added yet
|
||||
@@ -2124,7 +2135,7 @@ RED.nodes = (function() {
|
||||
n = new_nodes[i];
|
||||
if (n.wires) {
|
||||
for (var w1=0;w1<n.wires.length;w1++) {
|
||||
var wires = (n.wires[w1] instanceof Array)?n.wires[w1]:[n.wires[w1]];
|
||||
var wires = (Array.isArray(n.wires[w1]))?n.wires[w1]:[n.wires[w1]];
|
||||
for (var w2=0;w2<wires.length;w2++) {
|
||||
if (node_map.hasOwnProperty(wires[w2])) {
|
||||
if (n.z === node_map[wires[w2]].z) {
|
||||
@@ -2458,6 +2469,144 @@ RED.nodes = (function() {
|
||||
return helpContent;
|
||||
}
|
||||
|
||||
function getNodeIslands(nodes) {
|
||||
var selectedNodes = new Set(nodes);
|
||||
// Maps node => island index
|
||||
var nodeToIslandIndex = new Map();
|
||||
// Maps island index => [nodes in island]
|
||||
var islandIndexToNodes = new Map();
|
||||
var internalLinks = new Set();
|
||||
nodes.forEach((node, index) => {
|
||||
nodeToIslandIndex.set(node,index);
|
||||
islandIndexToNodes.set(index, [node]);
|
||||
var inboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_INPUT);
|
||||
var outboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_OUTPUT);
|
||||
inboundLinks.forEach(l => {
|
||||
if (selectedNodes.has(l.source)) {
|
||||
internalLinks.add(l)
|
||||
}
|
||||
})
|
||||
outboundLinks.forEach(l => {
|
||||
if (selectedNodes.has(l.target)) {
|
||||
internalLinks.add(l)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
internalLinks.forEach(l => {
|
||||
let source = l.source;
|
||||
let target = l.target;
|
||||
if (nodeToIslandIndex.get(source) !== nodeToIslandIndex.get(target)) {
|
||||
let sourceIsland = nodeToIslandIndex.get(source);
|
||||
let islandToMove = nodeToIslandIndex.get(target);
|
||||
let nodesToMove = islandIndexToNodes.get(islandToMove);
|
||||
nodesToMove.forEach(n => {
|
||||
nodeToIslandIndex.set(n,sourceIsland);
|
||||
islandIndexToNodes.get(sourceIsland).push(n);
|
||||
})
|
||||
islandIndexToNodes.delete(islandToMove);
|
||||
}
|
||||
})
|
||||
const result = [];
|
||||
islandIndexToNodes.forEach((nodes,index) => {
|
||||
result.push(nodes);
|
||||
})
|
||||
return result;
|
||||
}
|
||||
|
||||
function detachNodes(nodes) {
|
||||
let allSelectedNodes = [];
|
||||
nodes.forEach(node => {
|
||||
if (node.type === 'group') {
|
||||
let groupNodes = RED.group.getNodes(node,true,true);
|
||||
allSelectedNodes = allSelectedNodes.concat(groupNodes);
|
||||
} else {
|
||||
allSelectedNodes.push(node);
|
||||
}
|
||||
})
|
||||
if (allSelectedNodes.length > 0 ) {
|
||||
const nodeIslands = RED.nodes.getNodeIslands(allSelectedNodes);
|
||||
let removedLinks = [];
|
||||
let newLinks = [];
|
||||
let createdLinkIds = new Set();
|
||||
|
||||
nodeIslands.forEach(nodes => {
|
||||
let selectedNodes = new Set(nodes);
|
||||
let allInboundLinks = [];
|
||||
let allOutboundLinks = [];
|
||||
// Identify links that enter or exit this island of nodes
|
||||
nodes.forEach(node => {
|
||||
var inboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_INPUT);
|
||||
var outboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_OUTPUT);
|
||||
inboundLinks.forEach(l => {
|
||||
if (!selectedNodes.has(l.source)) {
|
||||
allInboundLinks.push(l)
|
||||
}
|
||||
})
|
||||
outboundLinks.forEach(l => {
|
||||
if (!selectedNodes.has(l.target)) {
|
||||
allOutboundLinks.push(l)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
// Identify the links to restore
|
||||
allInboundLinks.forEach(inLink => {
|
||||
// For Each inbound link,
|
||||
// - get source node.
|
||||
// - trace through to all outbound links
|
||||
let sourceNode = inLink.source;
|
||||
let targetNodes = new Set();
|
||||
let visited = new Set();
|
||||
let stack = [inLink.target];
|
||||
while (stack.length > 0) {
|
||||
let node = stack.pop(stack);
|
||||
visited.add(node)
|
||||
let links = RED.nodes.getNodeLinks(node, PORT_TYPE_OUTPUT);
|
||||
links.forEach(l => {
|
||||
if (visited.has(l.target)) {
|
||||
return
|
||||
}
|
||||
visited.add(l.target);
|
||||
if (selectedNodes.has(l.target)) {
|
||||
// internal link
|
||||
stack.push(l.target)
|
||||
} else {
|
||||
targetNodes.add(l.target)
|
||||
}
|
||||
})
|
||||
}
|
||||
targetNodes.forEach(target => {
|
||||
let linkId = `${sourceNode.id}[${inLink.sourcePort}] -> ${target.id}`
|
||||
if (!createdLinkIds.has(linkId)) {
|
||||
createdLinkIds.add(linkId);
|
||||
let link = {
|
||||
source: sourceNode,
|
||||
sourcePort: inLink.sourcePort,
|
||||
target: target
|
||||
}
|
||||
let existingLinks = RED.nodes.filterLinks(link)
|
||||
if (existingLinks.length === 0) {
|
||||
newLinks.push(link);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 2. delete all those links
|
||||
allInboundLinks.forEach(l => { RED.nodes.removeLink(l); removedLinks.push(l)})
|
||||
allOutboundLinks.forEach(l => { RED.nodes.removeLink(l); removedLinks.push(l)})
|
||||
})
|
||||
|
||||
newLinks.forEach(l => RED.nodes.addLink(l));
|
||||
return {
|
||||
newLinks,
|
||||
removedLinks
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
RED.events.on("registry:node-type-added",function(type) {
|
||||
@@ -2539,7 +2688,7 @@ RED.nodes = (function() {
|
||||
add: addNode,
|
||||
remove: removeNode,
|
||||
clear: clear,
|
||||
|
||||
detachNodes: detachNodes,
|
||||
moveNodesForwards: moveNodesForwards,
|
||||
moveNodesBackwards: moveNodesBackwards,
|
||||
moveNodesToFront: moveNodesToFront,
|
||||
@@ -2551,7 +2700,20 @@ RED.nodes = (function() {
|
||||
|
||||
addLink: addLink,
|
||||
removeLink: removeLink,
|
||||
|
||||
getNodeLinks: function(id, portType) {
|
||||
if (typeof id !== 'string') {
|
||||
id = id.id;
|
||||
}
|
||||
if (nodeLinks[id]) {
|
||||
if (portType === 1) {
|
||||
// Return cloned arrays so they can be safely modified by caller
|
||||
return [].concat(nodeLinks[id].in)
|
||||
} else {
|
||||
return [].concat(nodeLinks[id].out)
|
||||
}
|
||||
}
|
||||
return [];
|
||||
},
|
||||
addWorkspace: addWorkspace,
|
||||
removeWorkspace: removeWorkspace,
|
||||
getWorkspaceOrder: function() { return workspacesOrder },
|
||||
@@ -2625,6 +2787,7 @@ RED.nodes = (function() {
|
||||
getAllFlowNodes: getAllFlowNodes,
|
||||
getAllUpstreamNodes: getAllUpstreamNodes,
|
||||
getAllDownstreamNodes: getAllDownstreamNodes,
|
||||
getNodeIslands: getNodeIslands,
|
||||
createExportableNodeSet: createExportableNodeSet,
|
||||
createCompleteNodeSet: createCompleteNodeSet,
|
||||
updateConfigNodeUsers: updateConfigNodeUsers,
|
||||
|
@@ -252,8 +252,21 @@ var RED = (function() {
|
||||
if (/^#flow\/.+$/.test(currentHash)) {
|
||||
RED.workspaces.show(currentHash.substring(6),true);
|
||||
}
|
||||
if (RED.workspaces.active() === 0 && RED.workspaces.count() > 0) {
|
||||
RED.workspaces.show(RED.nodes.getWorkspaceOrder()[0])
|
||||
if (RED.workspaces.count() > 0) {
|
||||
const hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
const workspaces = RED.nodes.getWorkspaceOrder();
|
||||
if (RED.workspaces.active() === 0) {
|
||||
for (let index = 0; index < workspaces.length; index++) {
|
||||
const ws = workspaces[index];
|
||||
if (!hiddenTabs[ws]) {
|
||||
RED.workspaces.show(ws);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (RED.workspaces.active() === 0) {
|
||||
RED.workspaces.show(workspaces[0]);
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
console.warn(err);
|
||||
@@ -461,7 +474,7 @@ var RED = (function() {
|
||||
var parts = topic.split("/");
|
||||
var node = RED.nodes.node(parts[1]);
|
||||
if (node) {
|
||||
if (msg.hasOwnProperty("text") && msg.text !== null && /^[a-zA-Z]/.test(msg.text)) {
|
||||
if (msg.hasOwnProperty("text") && msg.text !== null && /^[@a-zA-Z]/.test(msg.text)) {
|
||||
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
||||
}
|
||||
node.status = msg;
|
||||
@@ -556,8 +569,7 @@ var RED = (function() {
|
||||
|
||||
$(".red-ui-header-toolbar").show();
|
||||
|
||||
|
||||
RED.sidebar.show(":first");
|
||||
RED.sidebar.show(":first", true);
|
||||
|
||||
setTimeout(function() {
|
||||
loader.end();
|
||||
|
@@ -160,18 +160,19 @@ RED.actionList = (function() {
|
||||
createDialog();
|
||||
}
|
||||
dialog.slideDown(300);
|
||||
searchInput.searchBox('value',v)
|
||||
searchInput.searchBox('value',v);
|
||||
searchResults.editableList('empty');
|
||||
results = [];
|
||||
var actions = RED.actions.list();
|
||||
actions.sort(function(A,B) {
|
||||
return A.id.localeCompare(B.id);
|
||||
var Akey = A.label;
|
||||
var Bkey = B.label;
|
||||
return Akey.localeCompare(Bkey);
|
||||
});
|
||||
actions.forEach(function(action) {
|
||||
action.label = action.id.replace(/:/,": ").replace(/-/g," ").replace(/(^| )./g,function() { return arguments[0].toUpperCase()});
|
||||
action._label = action.label.toLowerCase();
|
||||
searchResults.editableList('addItem',action)
|
||||
})
|
||||
searchResults.editableList('addItem',action);
|
||||
});
|
||||
RED.events.emit("actionList:open");
|
||||
visible = true;
|
||||
}
|
||||
|
@@ -1,33 +1,39 @@
|
||||
RED.actions = (function() {
|
||||
var actions = {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
function addAction(name,handler) {
|
||||
function addAction(name,handler,options) {
|
||||
if (typeof handler !== 'function') {
|
||||
throw new Error("Action handler not a function");
|
||||
}
|
||||
if (actions[name]) {
|
||||
throw new Error("Cannot override existing action");
|
||||
}
|
||||
actions[name] = handler;
|
||||
actions[name] = {
|
||||
handler: handler,
|
||||
options: options,
|
||||
};
|
||||
}
|
||||
function removeAction(name) {
|
||||
delete actions[name];
|
||||
}
|
||||
function getAction(name) {
|
||||
return actions[name];
|
||||
return actions[name].handler;
|
||||
}
|
||||
function invokeAction() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var name = args.shift();
|
||||
if (actions.hasOwnProperty(name)) {
|
||||
actions[name].apply(null, args);
|
||||
var handler = actions[name].handler;
|
||||
handler.apply(null, args);
|
||||
}
|
||||
}
|
||||
function listActions() {
|
||||
var result = [];
|
||||
var missing = [];
|
||||
Object.keys(actions).forEach(function(action) {
|
||||
var def = actions[action];
|
||||
var shortcut = RED.keyboard.getShortcut(action);
|
||||
var isUser = false;
|
||||
if (shortcut) {
|
||||
@@ -35,13 +41,38 @@ RED.actions = (function() {
|
||||
} else {
|
||||
isUser = !!RED.keyboard.getUserShortcut(action);
|
||||
}
|
||||
if (!def.label) {
|
||||
var name = action;
|
||||
var options = def.options;
|
||||
var key = options ? options.label : undefined;
|
||||
if (!key) {
|
||||
key = "action-list." +name.replace(/^.*:/,"");
|
||||
}
|
||||
var label = RED._(key);
|
||||
if (label === key) {
|
||||
// no translation. convert `name` to description
|
||||
label = name.replace(/(^.+:([a-z]))|(-([a-z]))/g, function() {
|
||||
if (arguments[5] === 0) {
|
||||
return arguments[2].toUpperCase();
|
||||
} else {
|
||||
return " "+arguments[4].toUpperCase();
|
||||
}
|
||||
});
|
||||
missing.push(key);
|
||||
}
|
||||
def.label = label;
|
||||
}
|
||||
//console.log("; missing:", missing);
|
||||
|
||||
result.push({
|
||||
id:action,
|
||||
scope:shortcut?shortcut.scope:undefined,
|
||||
key:shortcut?shortcut.key:undefined,
|
||||
user:isUser
|
||||
})
|
||||
})
|
||||
user:isUser,
|
||||
label: def.label,
|
||||
options: def.options,
|
||||
});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
return {
|
||||
|
@@ -350,6 +350,15 @@ RED.popover = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
target.on("remove", function (ev) {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
if (active) {
|
||||
active = false;
|
||||
setTimeout(closePopup,delay.hide);
|
||||
}
|
||||
});
|
||||
if (trigger === 'hover') {
|
||||
target.on('mouseenter',function(e) {
|
||||
clearTimeout(timer);
|
||||
|
@@ -557,23 +557,19 @@ RED.tabs = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
li.one("transitionend", function(evt) {
|
||||
li.remove();
|
||||
if (tabs[id].pinned) {
|
||||
pinnedTabsCount--;
|
||||
}
|
||||
if (options.onremove) {
|
||||
options.onremove(tabs[id]);
|
||||
}
|
||||
delete tabs[id];
|
||||
updateTabWidths();
|
||||
if (collapsibleMenu) {
|
||||
collapsibleMenu.remove();
|
||||
collapsibleMenu = null;
|
||||
}
|
||||
})
|
||||
li.addClass("hide-tab");
|
||||
li.width(0);
|
||||
li.remove();
|
||||
if (tabs[id].pinned) {
|
||||
pinnedTabsCount--;
|
||||
}
|
||||
if (options.onremove) {
|
||||
options.onremove(tabs[id]);
|
||||
}
|
||||
delete tabs[id];
|
||||
updateTabWidths();
|
||||
if (collapsibleMenu) {
|
||||
collapsibleMenu.remove();
|
||||
collapsibleMenu = null;
|
||||
}
|
||||
}
|
||||
|
||||
function findPreviousVisibleTab(li) {
|
||||
@@ -832,7 +828,7 @@ RED.tabs = (function() {
|
||||
}
|
||||
|
||||
// link.attr("title",tab.label);
|
||||
RED.popover.tooltip(link,function() { return tab.label})
|
||||
RED.popover.tooltip(link,function() { return RED.utils.sanitize(tab.label); });
|
||||
|
||||
if (options.onadd) {
|
||||
options.onadd(tab);
|
||||
|
@@ -319,192 +319,208 @@ RED.deploy = (function() {
|
||||
},delta);
|
||||
});
|
||||
}
|
||||
function save(skipValidation,force) {
|
||||
if (!$("#red-ui-header-button-deploy").hasClass("disabled")) {
|
||||
if (!RED.user.hasPermission("flows.write")) {
|
||||
RED.notify(RED._("user.errors.deploy"),"error");
|
||||
function save(skipValidation, force) {
|
||||
if ($("#red-ui-header-button-deploy").hasClass("disabled")) {
|
||||
return; //deploy is disabled
|
||||
}
|
||||
if ($("#red-ui-header-shade").is(":visible")) {
|
||||
return; //deploy is shaded
|
||||
}
|
||||
if (!RED.user.hasPermission("flows.write")) {
|
||||
RED.notify(RED._("user.errors.deploy"), "error");
|
||||
return;
|
||||
}
|
||||
let hasUnusedConfig = false;
|
||||
if (!skipValidation) {
|
||||
let hasUnknown = false;
|
||||
let hasInvalid = false;
|
||||
const unknownNodes = [];
|
||||
const invalidNodes = [];
|
||||
|
||||
RED.nodes.eachConfig(function (node) {
|
||||
if (node.valid === undefined) {
|
||||
RED.editor.validateNode(node);
|
||||
}
|
||||
if (!node.valid && !node.d) {
|
||||
invalidNodes.push(getNodeInfo(node));
|
||||
}
|
||||
if (node.type === "unknown") {
|
||||
if (unknownNodes.indexOf(node.name) == -1) {
|
||||
unknownNodes.push(node.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
RED.nodes.eachNode(function (node) {
|
||||
if (!node.valid && !node.d) {
|
||||
invalidNodes.push(getNodeInfo(node));
|
||||
}
|
||||
if (node.type === "unknown") {
|
||||
if (unknownNodes.indexOf(node.name) == -1) {
|
||||
unknownNodes.push(node.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
hasUnknown = unknownNodes.length > 0;
|
||||
hasInvalid = invalidNodes.length > 0;
|
||||
|
||||
const unusedConfigNodes = [];
|
||||
RED.nodes.eachConfig(function (node) {
|
||||
if ((node._def.hasUsers !== false) && (node.users.length === 0)) {
|
||||
unusedConfigNodes.push(getNodeInfo(node));
|
||||
hasUnusedConfig = true;
|
||||
}
|
||||
});
|
||||
|
||||
let showWarning = false;
|
||||
let notificationMessage;
|
||||
let notificationButtons = [];
|
||||
let notification;
|
||||
if (hasUnknown && !ignoreDeployWarnings.unknown) {
|
||||
showWarning = true;
|
||||
notificationMessage = "<p>" + RED._('deploy.confirm.unknown') + "</p>" +
|
||||
'<ul class="red-ui-deploy-dialog-confirm-list"><li>' + cropList(unknownNodes).map(function (n) { return sanitize(n) }).join("</li><li>") + "</li></ul><p>" +
|
||||
RED._('deploy.confirm.confirm') +
|
||||
"</p>";
|
||||
|
||||
notificationButtons = [
|
||||
{
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-deploy",
|
||||
text: RED._("deploy.confirm.button.confirm"),
|
||||
class: "primary",
|
||||
click: function () {
|
||||
save(true);
|
||||
notification.close();
|
||||
}
|
||||
}
|
||||
];
|
||||
} else if (hasInvalid && !ignoreDeployWarnings.invalid) {
|
||||
showWarning = true;
|
||||
invalidNodes.sort(sortNodeInfo);
|
||||
|
||||
notificationMessage = "<p>" + RED._('deploy.confirm.improperlyConfigured') + "</p>" +
|
||||
'<ul class="red-ui-deploy-dialog-confirm-list"><li>' + cropList(invalidNodes.map(function (A) { return sanitize((A.tab ? "[" + A.tab + "] " : "") + A.label + " (" + A.type + ")") })).join("</li><li>") + "</li></ul><p>" +
|
||||
RED._('deploy.confirm.confirm') +
|
||||
"</p>";
|
||||
notificationButtons = [
|
||||
{
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-deploy",
|
||||
text: RED._("deploy.confirm.button.confirm"),
|
||||
class: "primary",
|
||||
click: function () {
|
||||
save(true);
|
||||
notification.close();
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
if (showWarning) {
|
||||
notificationButtons.unshift(
|
||||
{
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function () {
|
||||
notification.close();
|
||||
}
|
||||
}
|
||||
);
|
||||
notification = RED.notify(notificationMessage, {
|
||||
modal: true,
|
||||
fixed: true,
|
||||
buttons: notificationButtons
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!skipValidation) {
|
||||
var hasUnknown = false;
|
||||
var hasInvalid = false;
|
||||
var hasUnusedConfig = false;
|
||||
|
||||
var unknownNodes = [];
|
||||
var invalidNodes = [];
|
||||
|
||||
RED.nodes.eachNode(function(node) {
|
||||
if (!node.valid && !node.d) {
|
||||
invalidNodes.push(getNodeInfo(node));
|
||||
}
|
||||
if (node.type === "unknown") {
|
||||
if (unknownNodes.indexOf(node.name) == -1) {
|
||||
unknownNodes.push(node.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
hasUnknown = unknownNodes.length > 0;
|
||||
hasInvalid = invalidNodes.length > 0;
|
||||
|
||||
var unusedConfigNodes = [];
|
||||
RED.nodes.eachConfig(function(node) {
|
||||
if ((node._def.hasUsers !== false) && (node.users.length === 0)) {
|
||||
unusedConfigNodes.push(getNodeInfo(node));
|
||||
hasUnusedConfig = true;
|
||||
}
|
||||
});
|
||||
|
||||
var showWarning = false;
|
||||
var notificationMessage;
|
||||
var notificationButtons = [];
|
||||
var notification;
|
||||
if (hasUnknown && !ignoreDeployWarnings.unknown) {
|
||||
showWarning = true;
|
||||
notificationMessage = "<p>"+RED._('deploy.confirm.unknown')+"</p>"+
|
||||
'<ul class="red-ui-deploy-dialog-confirm-list"><li>'+cropList(unknownNodes).map(function(n) { return sanitize(n) }).join("</li><li>")+"</li></ul><p>"+
|
||||
RED._('deploy.confirm.confirm')+
|
||||
"</p>";
|
||||
|
||||
notificationButtons= [
|
||||
{
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-deploy",
|
||||
text: RED._("deploy.confirm.button.confirm"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
save(true);
|
||||
notification.close();
|
||||
}
|
||||
}
|
||||
];
|
||||
} else if (hasInvalid && !ignoreDeployWarnings.invalid) {
|
||||
showWarning = true;
|
||||
invalidNodes.sort(sortNodeInfo);
|
||||
|
||||
notificationMessage = "<p>"+RED._('deploy.confirm.improperlyConfigured')+"</p>"+
|
||||
'<ul class="red-ui-deploy-dialog-confirm-list"><li>'+cropList(invalidNodes.map(function(A) { return sanitize( (A.tab?"["+A.tab+"] ":"")+A.label+" ("+A.type+")")})).join("</li><li>")+"</li></ul><p>"+
|
||||
RED._('deploy.confirm.confirm')+
|
||||
"</p>";
|
||||
notificationButtons= [
|
||||
{
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-deploy",
|
||||
text: RED._("deploy.confirm.button.confirm"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
save(true);
|
||||
notification.close();
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
if (showWarning) {
|
||||
notificationButtons.unshift(
|
||||
{
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
notification.close();
|
||||
}
|
||||
}
|
||||
);
|
||||
notification = RED.notify(notificationMessage,{
|
||||
modal: true,
|
||||
fixed: true,
|
||||
buttons:notificationButtons
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var nns = RED.nodes.createCompleteNodeSet();
|
||||
|
||||
var startTime = Date.now();
|
||||
$(".red-ui-deploy-button-content").css('opacity',0);
|
||||
$(".red-ui-deploy-button-spinner").show();
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
|
||||
var data = {flows:nns};
|
||||
|
||||
if (!force) {
|
||||
data.rev = RED.nodes.version();
|
||||
}
|
||||
|
||||
deployInflight = true;
|
||||
$("#red-ui-header-shade").show();
|
||||
$("#red-ui-editor-shade").show();
|
||||
$("#red-ui-palette-shade").show();
|
||||
$("#red-ui-sidebar-shade").show();
|
||||
$.ajax({
|
||||
url:"flows",
|
||||
type: "POST",
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
headers: {
|
||||
"Node-RED-Deployment-Type":deploymentType
|
||||
}
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
RED.nodes.dirty(false);
|
||||
RED.nodes.version(data.rev);
|
||||
RED.nodes.originalFlow(nns);
|
||||
if (hasUnusedConfig) {
|
||||
RED.notify(
|
||||
'<p>'+RED._("deploy.successfulDeploy")+'</p>'+
|
||||
'<p>'+RED._("deploy.unusedConfigNodes")+' <a href="#" onclick="RED.sidebar.config.show(true); return false;">'+RED._("deploy.unusedConfigNodesLink")+'</a></p>',"success",false,6000);
|
||||
} else {
|
||||
RED.notify('<p>'+RED._("deploy.successfulDeploy")+'</p>',"success");
|
||||
}
|
||||
RED.nodes.eachNode(function(node) {
|
||||
if (node.changed) {
|
||||
node.dirty = true;
|
||||
node.changed = false;
|
||||
}
|
||||
if (node.moved) {
|
||||
node.dirty = true;
|
||||
node.moved = false;
|
||||
}
|
||||
if(node.credentials) {
|
||||
delete node.credentials;
|
||||
}
|
||||
});
|
||||
RED.nodes.eachConfig(function (confNode) {
|
||||
confNode.changed = false;
|
||||
if (confNode.credentials) {
|
||||
delete confNode.credentials;
|
||||
}
|
||||
});
|
||||
RED.nodes.eachSubflow(function(subflow) {
|
||||
subflow.changed = false;
|
||||
});
|
||||
RED.nodes.eachWorkspace(function(ws) {
|
||||
ws.changed = false;
|
||||
});
|
||||
// Once deployed, cannot undo back to a clean state
|
||||
RED.history.markAllDirty();
|
||||
RED.view.redraw();
|
||||
RED.events.emit("deploy");
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
RED.nodes.dirty(true);
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||
} else if (xhr.status === 409) {
|
||||
resolveConflict(nns, true);
|
||||
} else if (xhr.responseText) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error");
|
||||
} else {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("deploy.errors.noResponse")}),"error");
|
||||
}
|
||||
}).always(function() {
|
||||
deployInflight = false;
|
||||
var delta = Math.max(0,300-(Date.now()-startTime));
|
||||
setTimeout(function() {
|
||||
$(".red-ui-deploy-button-content").css('opacity',1);
|
||||
$(".red-ui-deploy-button-spinner").hide();
|
||||
$("#red-ui-header-shade").hide();
|
||||
$("#red-ui-editor-shade").hide();
|
||||
$("#red-ui-palette-shade").hide();
|
||||
$("#red-ui-sidebar-shade").hide();
|
||||
},delta);
|
||||
});
|
||||
}
|
||||
|
||||
const nns = RED.nodes.createCompleteNodeSet();
|
||||
const startTime = Date.now();
|
||||
|
||||
$(".red-ui-deploy-button-content").css('opacity', 0);
|
||||
$(".red-ui-deploy-button-spinner").show();
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
|
||||
const data = { flows: nns };
|
||||
|
||||
if (!force) {
|
||||
data.rev = RED.nodes.version();
|
||||
}
|
||||
|
||||
deployInflight = true;
|
||||
$("#red-ui-header-shade").show();
|
||||
$("#red-ui-editor-shade").show();
|
||||
$("#red-ui-palette-shade").show();
|
||||
$("#red-ui-sidebar-shade").show();
|
||||
$.ajax({
|
||||
url: "flows",
|
||||
type: "POST",
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
headers: {
|
||||
"Node-RED-Deployment-Type": deploymentType
|
||||
}
|
||||
}).done(function (data, textStatus, xhr) {
|
||||
RED.nodes.dirty(false);
|
||||
RED.nodes.version(data.rev);
|
||||
RED.nodes.originalFlow(nns);
|
||||
if (hasUnusedConfig) {
|
||||
RED.notify(
|
||||
'<p>' + RED._("deploy.successfulDeploy") + '</p>' +
|
||||
'<p>' + RED._("deploy.unusedConfigNodes") + ' <a href="#" onclick="RED.sidebar.config.show(true); return false;">' + RED._("deploy.unusedConfigNodesLink") + '</a></p>', "success", false, 6000);
|
||||
} else {
|
||||
RED.notify('<p>' + RED._("deploy.successfulDeploy") + '</p>', "success");
|
||||
}
|
||||
RED.nodes.eachNode(function (node) {
|
||||
if (node.changed) {
|
||||
node.dirty = true;
|
||||
node.changed = false;
|
||||
}
|
||||
if (node.moved) {
|
||||
node.dirty = true;
|
||||
node.moved = false;
|
||||
}
|
||||
if (node.credentials) {
|
||||
delete node.credentials;
|
||||
}
|
||||
});
|
||||
RED.nodes.eachConfig(function (confNode) {
|
||||
confNode.changed = false;
|
||||
if (confNode.credentials) {
|
||||
delete confNode.credentials;
|
||||
}
|
||||
});
|
||||
RED.nodes.eachSubflow(function (subflow) {
|
||||
subflow.changed = false;
|
||||
});
|
||||
RED.nodes.eachWorkspace(function (ws) {
|
||||
ws.changed = false;
|
||||
});
|
||||
// Once deployed, cannot undo back to a clean state
|
||||
RED.history.markAllDirty();
|
||||
RED.view.redraw();
|
||||
RED.events.emit("deploy");
|
||||
}).fail(function (xhr, textStatus, err) {
|
||||
RED.nodes.dirty(true);
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("deploy.deployFailed", { message: RED._("user.notAuthorized") }), "error");
|
||||
} else if (xhr.status === 409) {
|
||||
resolveConflict(nns, true);
|
||||
} else if (xhr.responseText) {
|
||||
RED.notify(RED._("deploy.deployFailed", { message: xhr.responseText }), "error");
|
||||
} else {
|
||||
RED.notify(RED._("deploy.deployFailed", { message: RED._("deploy.errors.noResponse") }), "error");
|
||||
}
|
||||
}).always(function () {
|
||||
deployInflight = false;
|
||||
const delta = Math.max(0, 300 - (Date.now() - startTime));
|
||||
setTimeout(function () {
|
||||
$(".red-ui-deploy-button-content").css('opacity', 1);
|
||||
$(".red-ui-deploy-button-spinner").hide();
|
||||
$("#red-ui-header-shade").hide();
|
||||
$("#red-ui-editor-shade").hide();
|
||||
$("#red-ui-palette-shade").hide();
|
||||
$("#red-ui-sidebar-shade").hide();
|
||||
}, delta);
|
||||
});
|
||||
}
|
||||
return {
|
||||
init: init,
|
||||
|
@@ -577,7 +577,7 @@ RED.editor.codeEditor.monaco = (function() {
|
||||
createMonacoCompletionItem("set (flow context)", 'flow.set("${1:name}", ${1:value});','Set a value in flow context',range),
|
||||
createMonacoCompletionItem("get (global context)", 'global.get("${1:name}");','Get a value from global context',range),
|
||||
createMonacoCompletionItem("set (global context)", 'global.set("${1:name}", ${1:value});','Set a value in global context',range),
|
||||
createMonacoCompletionItem("get (env)", 'env.get("${1:name}");','Get env variable value',range),
|
||||
createMonacoCompletionItem("get (env)", 'env.get("${1|NR_NODE_ID,NR_NODE_NAME,NR_NODE_PATH,NR_GROUP_ID,NR_GROUP_NAME,NR_FLOW_ID,NR_FLOW_NAME|}");','Get env variable value',range),
|
||||
createMonacoCompletionItem("cloneMessage (RED.util)", 'RED.util.cloneMessage(${1:msg});',
|
||||
["```typescript",
|
||||
"RED.util.cloneMessage<T extends registry.NodeMessage>(msg: T): T",
|
||||
|
@@ -41,8 +41,12 @@ RED.editor.envVarList = (function() {
|
||||
style: "width:100%",
|
||||
class: "node-input-env-value",
|
||||
type: "text",
|
||||
}).attr("autocomplete","disable").appendTo(envRow)
|
||||
valueField.typedInput({default:'str',types:isTemplateNode?DEFAULT_ENV_TYPE_LIST:DEFAULT_ENV_TYPE_LIST_INC_CRED});
|
||||
}).attr("autocomplete","disable").appendTo(envRow);
|
||||
var types = (opt.ui && opt.ui.opts && opt.ui.opts.types);
|
||||
if (!types) {
|
||||
types = isTemplateNode ? DEFAULT_ENV_TYPE_LIST : DEFAULT_ENV_TYPE_LIST_INC_CRED;
|
||||
}
|
||||
valueField.typedInput({default:'str',types:types});
|
||||
valueField.typedInput('type', opt.type);
|
||||
if (opt.type === "cred") {
|
||||
if (opt.value) {
|
||||
@@ -94,6 +98,11 @@ RED.editor.envVarList = (function() {
|
||||
}
|
||||
opt.ui.label = opt.ui.label || {};
|
||||
opt.ui.type = opt.ui.type || "input";
|
||||
if ((opt.ui.type === "cred") &&
|
||||
opt.ui.opts &&
|
||||
opt.ui.opts.types) {
|
||||
opt.ui.type = "input";
|
||||
}
|
||||
|
||||
var uiRow = $('<div/>').appendTo(container).hide();
|
||||
// save current info for reverting on cancel
|
||||
|
@@ -168,7 +168,7 @@
|
||||
'b': { before:"**", after: "**", tooltip: RED._("markdownEditor.bold")},
|
||||
'i': { before:"_", after: "_", tooltip: RED._("markdownEditor.italic")},
|
||||
'code': { before:"`", after: "`", tooltip: RED._("markdownEditor.code")},
|
||||
'ol': { before:" * ", newline: true, tooltip: RED._("markdownEditor.ordered-list")},
|
||||
'ol': { before:" 1. ", newline: true, tooltip: RED._("markdownEditor.ordered-list")},
|
||||
'ul': { before:" - ", newline: true, tooltip: RED._("markdownEditor.unordered-list")},
|
||||
'bq': { before:"> ", newline: true, tooltip: RED._("markdownEditor.quote")},
|
||||
'link': { before:"[", after: "]()", tooltip: RED._("markdownEditor.link")},
|
||||
|
@@ -35,9 +35,9 @@
|
||||
editState.changed = true;
|
||||
}
|
||||
if (!node._def.defaults || !node._def.defaults.hasOwnProperty("icon")) {
|
||||
var icon = $("#red-ui-editor-node-icon").val()||""
|
||||
var icon = $("#red-ui-editor-node-icon").val()||"";
|
||||
if (!this.isDefaultIcon) {
|
||||
if (icon !== node.icon) {
|
||||
if ((node.icon && icon !== node.icon) || (!node.icon && icon !== "")) {
|
||||
editState.changes.icon = node.icon;
|
||||
node.icon = icon;
|
||||
editState.changed = true;
|
||||
@@ -101,14 +101,14 @@
|
||||
if (showLabel) {
|
||||
// Default to show label
|
||||
if (node.l !== false) {
|
||||
editState.changes.l = node.l
|
||||
editState.changes.l = node.l;
|
||||
editState.changed = true;
|
||||
}
|
||||
node.l = false;
|
||||
} else {
|
||||
// Node has showLabel:false (eg link nodes)
|
||||
if (node.hasOwnProperty('l') && node.l) {
|
||||
editState.changes.l = node.l
|
||||
editState.changes.l = node.l;
|
||||
editState.changed = true;
|
||||
}
|
||||
delete node.l;
|
||||
@@ -118,20 +118,20 @@
|
||||
if (showLabel) {
|
||||
// Default to show label
|
||||
if (node.hasOwnProperty('l') && !node.l) {
|
||||
editState.changes.l = node.l
|
||||
editState.changes.l = node.l;
|
||||
editState.changed = true;
|
||||
}
|
||||
delete node.l;
|
||||
} else {
|
||||
if (!node.l) {
|
||||
editState.changes.l = node.l
|
||||
editState.changes.l = node.l;
|
||||
editState.changed = true;
|
||||
}
|
||||
node.l = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
function buildAppearanceForm(container,node) {
|
||||
@@ -164,10 +164,10 @@
|
||||
var categories = RED.palette.getCategories();
|
||||
categories.sort(function(A,B) {
|
||||
return A.label.localeCompare(B.label);
|
||||
})
|
||||
});
|
||||
categories.forEach(function(cat) {
|
||||
categorySelector.append($("<option/>").val(cat.id).text(cat.label));
|
||||
})
|
||||
});
|
||||
categorySelector.append($("<option/>").attr('disabled',true).text("---"));
|
||||
categorySelector.append($("<option/>").val("_custom_").text(RED._("palette.addCategory")));
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
$("#subflow-appearance-input-category").width(250);
|
||||
$("#subflow-appearance-input-custom-category").hide();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$("#subflow-appearance-input-category").val(node.category||"subflows");
|
||||
var userCount = 0;
|
||||
@@ -204,7 +204,7 @@
|
||||
$("#node-input-show-label").toggleButton({
|
||||
enabledLabel: RED._("editor.show"),
|
||||
disabledLabel: RED._("editor.hide")
|
||||
})
|
||||
});
|
||||
|
||||
if (!node.hasOwnProperty("l")) {
|
||||
// Show label unless def.showLabel set to false
|
||||
@@ -230,7 +230,7 @@
|
||||
"#E9967A", "#F3B567", "#FDD0A2",
|
||||
"#FDF0C2", "#FFAAAA", "#FFCC66",
|
||||
"#FFF0F0", "#FFFFFF"
|
||||
]
|
||||
];
|
||||
|
||||
RED.editor.colorPicker.create({
|
||||
id: "red-ui-editor-node-color",
|
||||
@@ -245,9 +245,9 @@
|
||||
nodeDiv.css('backgroundColor',colour);
|
||||
var borderColor = RED.utils.getDarkerColor(colour);
|
||||
if (borderColor !== colour) {
|
||||
nodeDiv.css('border-color',borderColor)
|
||||
nodeDiv.css('border-color',borderColor);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
nodeDiv.css('backgroundColor',colour);
|
||||
var borderColor = RED.utils.getDarkerColor(colour);
|
||||
if (borderColor !== colour) {
|
||||
nodeDiv.css('border-color',borderColor)
|
||||
nodeDiv.css('border-color',borderColor);
|
||||
}
|
||||
|
||||
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
|
||||
@@ -292,7 +292,7 @@
|
||||
|
||||
RED.popover.tooltip(iconButton, function() {
|
||||
return $("#red-ui-editor-node-icon").val() || RED._("editor.default");
|
||||
})
|
||||
});
|
||||
$('<input type="hidden" id="red-ui-editor-node-icon">').val(node.icon).appendTo(iconRow);
|
||||
}
|
||||
|
||||
@@ -417,11 +417,11 @@
|
||||
});
|
||||
rows.sort(function(A,B) {
|
||||
return A.i-B.i;
|
||||
})
|
||||
});
|
||||
rows.forEach(function(r,i) {
|
||||
r.r.find("label").text((i+1)+".");
|
||||
r.r.appendTo(outputsDiv);
|
||||
})
|
||||
});
|
||||
if (rows.length === 0) {
|
||||
buildLabelRow("output",i,"").appendTo(outputsDiv);
|
||||
} else {
|
||||
@@ -467,7 +467,7 @@
|
||||
clear.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
input.val("");
|
||||
})
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -501,6 +501,12 @@
|
||||
}
|
||||
var v = $(this).val();
|
||||
hasNonBlankLabel = hasNonBlankLabel || v!== "";
|
||||
|
||||
// mark changed output port labels as dirty
|
||||
if (node.type === "subflow" && (!node.outputLabels || node.outputLabels[index] !== v)) {
|
||||
node.out[index].dirty = true;
|
||||
}
|
||||
|
||||
newValue[index] = v;
|
||||
});
|
||||
|
||||
@@ -509,6 +515,12 @@
|
||||
changes.outputLabels = node.outputLabels;
|
||||
node.outputLabels = newValue;
|
||||
changed = true;
|
||||
|
||||
// trigger redraw of dirty port labels
|
||||
if (node.type === "subflow") {
|
||||
RED.view.redraw();
|
||||
}
|
||||
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@
|
||||
newValue = "";
|
||||
}
|
||||
}
|
||||
if (node[d] != newValue) {
|
||||
if (!isEqual(node[d], newValue)) {
|
||||
if (node._def.defaults[d].type) {
|
||||
// Change to a related config node
|
||||
var configNode = RED.nodes.node(node[d]);
|
||||
@@ -139,6 +139,23 @@
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Compares `newValue` with `originalValue` for equality.
|
||||
* @param {*} originalValue Original value
|
||||
* @param {*} newValue New value
|
||||
* @returns {boolean} true if originalValue equals newValue, otherwise false
|
||||
*/
|
||||
function isEqual(originalValue, newValue) {
|
||||
try {
|
||||
if(originalValue == newValue) {
|
||||
return true;
|
||||
}
|
||||
return JSON.stringify(originalValue) === JSON.stringify(newValue);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the node credentials from the edit form
|
||||
* @param node - the node containing the credentials
|
||||
|
@@ -323,9 +323,6 @@ RED.group = (function() {
|
||||
groups: [ ],
|
||||
dirty: RED.nodes.dirty()
|
||||
}
|
||||
RED.history.push(historyEvent);
|
||||
|
||||
|
||||
groups.forEach(function(g) {
|
||||
newSelection = newSelection.concat(ungroup(g))
|
||||
historyEvent.groups.push(g);
|
||||
@@ -590,12 +587,14 @@ RED.group = (function() {
|
||||
markDirty(group);
|
||||
}
|
||||
|
||||
function getNodes(group,recursive) {
|
||||
function getNodes(group,recursive,excludeGroup) {
|
||||
var nodes = [];
|
||||
group.nodes.forEach(function(n) {
|
||||
nodes.push(n);
|
||||
if (n.type !== 'group' || !excludeGroup) {
|
||||
nodes.push(n);
|
||||
}
|
||||
if (recursive && n.type === 'group') {
|
||||
nodes = nodes.concat(getNodes(n,recursive))
|
||||
nodes = nodes.concat(getNodes(n,recursive,excludeGroup))
|
||||
}
|
||||
})
|
||||
return nodes;
|
||||
|
@@ -49,15 +49,15 @@ RED.keyboard = (function() {
|
||||
"]": 221,
|
||||
"{": 219,// <- QWERTY specific
|
||||
"}": 221 // <- QWERTY specific
|
||||
}
|
||||
};
|
||||
var metaKeyCodes = {
|
||||
16: true,
|
||||
17: true,
|
||||
18: true,
|
||||
91: true,
|
||||
93: true
|
||||
}
|
||||
var actionToKeyMap = {}
|
||||
};
|
||||
var actionToKeyMap = {};
|
||||
var defaultKeyMap = {};
|
||||
|
||||
// FF generates some different keycodes because reasons.
|
||||
@@ -65,7 +65,7 @@ RED.keyboard = (function() {
|
||||
59:186,
|
||||
61:187,
|
||||
173:189
|
||||
}
|
||||
};
|
||||
|
||||
function migrateOldKeymap() {
|
||||
// pre-0.18
|
||||
@@ -80,7 +80,7 @@ RED.keyboard = (function() {
|
||||
}
|
||||
|
||||
function getUserKey(action) {
|
||||
return RED.settings.get('editor.keymap',{})[action]
|
||||
return RED.settings.get('editor.keymap',{})[action];
|
||||
}
|
||||
|
||||
function mergeKeymaps(defaultKeymap, themeKeymap) {
|
||||
@@ -105,7 +105,7 @@ RED.keyboard = (function() {
|
||||
scope:scope,
|
||||
key:key,
|
||||
user:false
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,13 +115,13 @@ RED.keyboard = (function() {
|
||||
if (themeKeymap.hasOwnProperty(action)) {
|
||||
if (!themeKeymap[action].key) {
|
||||
// No key for this action - default is no keybinding
|
||||
delete mergedKeymap[action]
|
||||
delete mergedKeymap[action];
|
||||
} else {
|
||||
mergedKeymap[action] = [{
|
||||
scope: themeKeymap[action].scope || "*",
|
||||
key: themeKeymap[action].key,
|
||||
user: false
|
||||
}]
|
||||
}];
|
||||
if (mergedKeymap[action][0].scope === "workspace") {
|
||||
mergedKeymap[action][0].scope = "red-ui-workspace";
|
||||
}
|
||||
@@ -179,7 +179,7 @@ RED.keyboard = (function() {
|
||||
close: function() {
|
||||
RED.menu.refreshShortcuts();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function revertToDefault(action) {
|
||||
@@ -327,7 +327,7 @@ RED.keyboard = (function() {
|
||||
scope:scope,
|
||||
key:key,
|
||||
user:false
|
||||
}
|
||||
};
|
||||
}
|
||||
if (!ondown) {
|
||||
var userAction = getUserKey(cbdown);
|
||||
@@ -350,7 +350,7 @@ RED.keyboard = (function() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
keys.push([key,mod])
|
||||
keys.push([key,mod]);
|
||||
}
|
||||
var slot = handlers;
|
||||
for (i=0;i<keys.length;i++) {
|
||||
@@ -373,7 +373,7 @@ RED.keyboard = (function() {
|
||||
//slot[key] = {scope: scope, ondown:cbdown};
|
||||
}
|
||||
slot.handlers = slot.handlers || [];
|
||||
slot.handlers.push({scope:scope,ondown:cbdown})
|
||||
slot.handlers.push({scope:scope,ondown:cbdown});
|
||||
slot.scope = scope;
|
||||
slot.ondown = cbdown;
|
||||
}
|
||||
@@ -390,12 +390,12 @@ RED.keyboard = (function() {
|
||||
if (parsedKey) {
|
||||
keys.push(parsedKey);
|
||||
} else {
|
||||
console.log("Unrecognised key specifier:",key)
|
||||
console.log("Unrecognised key specifier:",key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
keys.push([key,mod])
|
||||
keys.push([key,mod]);
|
||||
}
|
||||
var slot = handlers;
|
||||
for (i=0;i<keys.length;i++) {
|
||||
@@ -417,7 +417,7 @@ RED.keyboard = (function() {
|
||||
}
|
||||
if (typeof slot.ondown === "string") {
|
||||
if (typeof modifiers === 'boolean' && modifiers) {
|
||||
actionToKeyMap[slot.ondown] = {user: modifiers}
|
||||
actionToKeyMap[slot.ondown] = {user: modifiers};
|
||||
} else {
|
||||
delete actionToKeyMap[slot.ondown];
|
||||
}
|
||||
@@ -433,11 +433,11 @@ RED.keyboard = (function() {
|
||||
function formatKey(key,plain) {
|
||||
var formattedKey = isMac?key.replace(/ctrl-?/,"⌘"):key;
|
||||
formattedKey = isMac?formattedKey.replace(/alt-?/,"⌥"):key;
|
||||
formattedKey = formattedKey.replace(/shift-?/,"⇧")
|
||||
formattedKey = formattedKey.replace(/left/,"←")
|
||||
formattedKey = formattedKey.replace(/up/,"↑")
|
||||
formattedKey = formattedKey.replace(/right/,"→")
|
||||
formattedKey = formattedKey.replace(/down/,"↓")
|
||||
formattedKey = formattedKey.replace(/shift-?/,"⇧");
|
||||
formattedKey = formattedKey.replace(/left/,"←");
|
||||
formattedKey = formattedKey.replace(/up/,"↑");
|
||||
formattedKey = formattedKey.replace(/right/,"→");
|
||||
formattedKey = formattedKey.replace(/down/,"↓");
|
||||
if (plain) {
|
||||
return formattedKey;
|
||||
}
|
||||
@@ -461,7 +461,6 @@ RED.keyboard = (function() {
|
||||
var container = $(this);
|
||||
var object = container.data('data');
|
||||
|
||||
|
||||
if (!container.hasClass('keyboard-shortcut-entry-expanded')) {
|
||||
endEditShortcut();
|
||||
|
||||
@@ -485,7 +484,7 @@ RED.keyboard = (function() {
|
||||
}
|
||||
$(this).toggleClass("input-error",!valid);
|
||||
okButton.attr("disabled",!valid);
|
||||
})
|
||||
});
|
||||
|
||||
var scopeSelect = $('<select><option value="*" data-i18n="keyboard.global"></option><option value="red-ui-workspace" data-i18n="keyboard.workspace"></option></select>').appendTo(scope);
|
||||
scopeSelect.i18n();
|
||||
@@ -495,7 +494,7 @@ RED.keyboard = (function() {
|
||||
scopeSelect.val(object.scope||'*');
|
||||
scopeSelect.on("change", function() {
|
||||
keyInput.trigger("change");
|
||||
})
|
||||
});
|
||||
|
||||
var div = $('<div class="keyboard-shortcut-edit button-group-vertical"></div>').appendTo(scope);
|
||||
var okButton = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-check"></i></button>').appendTo(div);
|
||||
@@ -521,10 +520,13 @@ RED.keyboard = (function() {
|
||||
id:object.id,
|
||||
scope:shortcut?shortcut.scope:undefined,
|
||||
key:shortcut?shortcut.key:undefined,
|
||||
user:shortcut?shortcut.user:undefined
|
||||
}
|
||||
user:shortcut?shortcut.user:undefined,
|
||||
|
||||
label: object.label,
|
||||
options: object.options,
|
||||
};
|
||||
buildShortcutRow(container,obj);
|
||||
})
|
||||
});
|
||||
|
||||
keyInput.trigger("focus");
|
||||
}
|
||||
@@ -559,7 +561,7 @@ RED.keyboard = (function() {
|
||||
delete object.scope;
|
||||
} else {
|
||||
keyDiv.parent().removeClass("keyboard-shortcut-entry-unassigned");
|
||||
keyDiv.append(RED.keyboard.formatKey(key))
|
||||
keyDiv.append(RED.keyboard.formatKey(key));
|
||||
$("<span>").text(scope).appendTo(scopeDiv);
|
||||
object.key = key;
|
||||
object.scope = scope;
|
||||
@@ -572,7 +574,7 @@ RED.keyboard = (function() {
|
||||
userKeymap[object.id] = {
|
||||
scope:shortcut.scope,
|
||||
key:shortcut.key
|
||||
}
|
||||
};
|
||||
RED.settings.set('editor.keymap',userKeymap);
|
||||
}
|
||||
}
|
||||
@@ -588,13 +590,7 @@ RED.keyboard = (function() {
|
||||
var item = $('<div class="keyboard-shortcut-entry">').appendTo(container);
|
||||
container.data('data',object);
|
||||
|
||||
var text = object.id.replace(/(^.+:([a-z]))|(-([a-z]))/g,function() {
|
||||
if (arguments[5] === 0) {
|
||||
return arguments[2].toUpperCase();
|
||||
} else {
|
||||
return " "+arguments[4].toUpperCase();
|
||||
}
|
||||
});
|
||||
var text = object.label;
|
||||
var label = $('<div>').addClass("keyboard-shortcut-entry-text").text(text).appendTo(item);
|
||||
|
||||
var user = $('<i class="fa fa-user"></i>').prependTo(label);
|
||||
@@ -629,14 +625,15 @@ RED.keyboard = (function() {
|
||||
pane.find("#red-ui-settings-tab-keyboard-filter").searchBox({
|
||||
delay: 100,
|
||||
change: function() {
|
||||
var filterValue = $(this).val().trim();
|
||||
var filterValue = $(this).val().trim().toLowerCase();
|
||||
if (filterValue === "") {
|
||||
shortcutList.editableList('filter', null);
|
||||
} else {
|
||||
filterValue = filterValue.replace(/\s/g,"");
|
||||
shortcutList.editableList('filter', function(data) {
|
||||
return data.id.toLowerCase().replace(/^.*:/,"").replace("-","").indexOf(filterValue) > -1;
|
||||
})
|
||||
var label = data.label.toLowerCase();
|
||||
return label.indexOf(filterValue) > -1;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -657,9 +654,9 @@ RED.keyboard = (function() {
|
||||
});
|
||||
var shortcuts = RED.actions.list();
|
||||
shortcuts.sort(function(A,B) {
|
||||
var Aid = A.id.replace(/^.*:/,"").replace(/[ -]/g,"").toLowerCase();
|
||||
var Bid = B.id.replace(/^.*:/,"").replace(/[ -]/g,"").toLowerCase();
|
||||
return Aid.localeCompare(Bid);
|
||||
var Akey = A.label;
|
||||
var Bkey = B.label;
|
||||
return Akey.localeCompare(Bkey);
|
||||
});
|
||||
knownShortcuts = new Set();
|
||||
shortcuts.forEach(function(s) {
|
||||
|
@@ -363,106 +363,112 @@ RED.library = (function() {
|
||||
options.onconfirm(item);
|
||||
}
|
||||
});
|
||||
var itemTools = $("<div>").css({position: "absolute",bottom:"6px",right:"8px"});
|
||||
var menuButton = $('<button class="red-ui-button red-ui-button-small" type="button"><i class="fa fa-ellipsis-h"></i></button>')
|
||||
.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
var elementPos = menuButton.offset();
|
||||
|
||||
var menuOptionMenu = RED.menu.init({id:"red-ui-library-browser-menu",
|
||||
options: [
|
||||
{id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() {
|
||||
var defaultFolderName = "new-folder";
|
||||
var defaultFolderNameMatches = {};
|
||||
|
||||
var selected = dirList.treeList('selected');
|
||||
if (!selected.children) {
|
||||
selected = selected.parent;
|
||||
}
|
||||
var complete = function() {
|
||||
selected.children.forEach(function(c) {
|
||||
if (/^new-folder/.test(c.label)) {
|
||||
defaultFolderNameMatches[c.label] = true
|
||||
}
|
||||
});
|
||||
var folderIndex = 2;
|
||||
while(defaultFolderNameMatches[defaultFolderName]) {
|
||||
defaultFolderName = "new-folder-"+(folderIndex++)
|
||||
}
|
||||
|
||||
selected.treeList.expand();
|
||||
var input = $('<input type="text" class="red-ui-treeList-input">').val(defaultFolderName);
|
||||
var newItem = {
|
||||
icon: "fa fa-folder-o",
|
||||
children:[],
|
||||
path: selected.path,
|
||||
element: input
|
||||
}
|
||||
var confirmAdd = function() {
|
||||
var val = input.val().trim();
|
||||
if (val === "") {
|
||||
cancelAdd();
|
||||
return;
|
||||
} else {
|
||||
for (var i=0;i<selected.children.length;i++) {
|
||||
if (selected.children[i].label === val) {
|
||||
cancelAdd();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
newItem.treeList.remove();
|
||||
var finalItem = {
|
||||
library: selected.library,
|
||||
type: selected.type,
|
||||
icon: "fa fa-folder",
|
||||
children:[],
|
||||
label: val,
|
||||
path: newItem.path+val+"/"
|
||||
}
|
||||
selected.treeList.addChild(finalItem,true);
|
||||
}
|
||||
var cancelAdd = function() {
|
||||
newItem.treeList.remove();
|
||||
}
|
||||
input.on('keydown', function(evt) {
|
||||
evt.stopPropagation();
|
||||
if (evt.keyCode === 13) {
|
||||
confirmAdd();
|
||||
} else if (evt.keyCode === 27) {
|
||||
cancelAdd();
|
||||
}
|
||||
})
|
||||
input.on("blur", function() {
|
||||
confirmAdd();
|
||||
})
|
||||
selected.treeList.addChild(newItem);
|
||||
setTimeout(function() {
|
||||
input.trigger("focus");
|
||||
input.select();
|
||||
},400);
|
||||
}
|
||||
selected.treeList.expand(complete);
|
||||
|
||||
} },
|
||||
// null,
|
||||
// {id:"red-ui-library-browser-menu-rename",label:"Rename", onselect: function() {} },
|
||||
// {id:"red-ui-library-browser-menu-delete",label:"Delete", onselect: function() {} }
|
||||
]
|
||||
}).on('mouseleave', function(){ $(this).remove(); dirList.focus() })
|
||||
.on('mouseup', function() { var self = $(this);self.hide(); dirList.focus(); setTimeout(function() { self.remove() },100)})
|
||||
.appendTo("body");
|
||||
menuOptionMenu.css({
|
||||
position: "absolute",
|
||||
top: elementPos.top+"px",
|
||||
left: (elementPos.left - menuOptionMenu.width() + 20)+"px"
|
||||
}).show();
|
||||
|
||||
}).appendTo(itemTools);
|
||||
var itemTools = null;
|
||||
if (options.folderTools) {
|
||||
dirList.on('treelistselect', function(event, item) {
|
||||
if (item.writable !== false && item.treeList) {
|
||||
if (itemTools) {
|
||||
itemTools.remove();
|
||||
}
|
||||
itemTools = $("<div>").css({position: "absolute",bottom:"6px",right:"8px"});
|
||||
var menuButton = $('<button class="red-ui-button red-ui-button-small" type="button"><i class="fa fa-ellipsis-h"></i></button>')
|
||||
.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
var elementPos = menuButton.offset();
|
||||
|
||||
var menuOptionMenu
|
||||
= RED.menu.init({id:"red-ui-library-browser-menu",
|
||||
options: [
|
||||
{id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() {
|
||||
var defaultFolderName = "new-folder";
|
||||
var defaultFolderNameMatches = {};
|
||||
|
||||
var selected = dirList.treeList('selected');
|
||||
if (!selected.children) {
|
||||
selected = selected.parent;
|
||||
}
|
||||
var complete = function() {
|
||||
selected.children.forEach(function(c) {
|
||||
if (/^new-folder/.test(c.label)) {
|
||||
defaultFolderNameMatches[c.label] = true
|
||||
}
|
||||
});
|
||||
var folderIndex = 2;
|
||||
while(defaultFolderNameMatches[defaultFolderName]) {
|
||||
defaultFolderName = "new-folder-"+(folderIndex++)
|
||||
}
|
||||
|
||||
selected.treeList.expand();
|
||||
var input = $('<input type="text" class="red-ui-treeList-input">').val(defaultFolderName);
|
||||
var newItem = {
|
||||
icon: "fa fa-folder-o",
|
||||
children:[],
|
||||
path: selected.path,
|
||||
element: input
|
||||
}
|
||||
var confirmAdd = function() {
|
||||
var val = input.val().trim();
|
||||
if (val === "") {
|
||||
cancelAdd();
|
||||
return;
|
||||
} else {
|
||||
for (var i=0;i<selected.children.length;i++) {
|
||||
if (selected.children[i].label === val) {
|
||||
cancelAdd();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
newItem.treeList.remove();
|
||||
var finalItem = {
|
||||
library: selected.library,
|
||||
type: selected.type,
|
||||
icon: "fa fa-folder",
|
||||
children:[],
|
||||
label: val,
|
||||
path: newItem.path+val+"/"
|
||||
}
|
||||
selected.treeList.addChild(finalItem,true);
|
||||
}
|
||||
var cancelAdd = function() {
|
||||
newItem.treeList.remove();
|
||||
}
|
||||
input.on('keydown', function(evt) {
|
||||
evt.stopPropagation();
|
||||
if (evt.keyCode === 13) {
|
||||
confirmAdd();
|
||||
} else if (evt.keyCode === 27) {
|
||||
cancelAdd();
|
||||
}
|
||||
})
|
||||
input.on("blur", function() {
|
||||
confirmAdd();
|
||||
})
|
||||
selected.treeList.addChild(newItem);
|
||||
setTimeout(function() {
|
||||
input.trigger("focus");
|
||||
input.select();
|
||||
},400);
|
||||
}
|
||||
selected.treeList.expand(complete);
|
||||
|
||||
} },
|
||||
// null,
|
||||
// {id:"red-ui-library-browser-menu-rename",label:"Rename", onselect: function() {} },
|
||||
// {id:"red-ui-library-browser-menu-delete",label:"Delete", onselect: function() {} }
|
||||
]
|
||||
}).on('mouseleave', function(){ $(this).remove(); dirList.focus() })
|
||||
.on('mouseup', function() { var self = $(this);self.hide(); dirList.focus(); setTimeout(function() { self.remove() },100)})
|
||||
.appendTo("body");
|
||||
menuOptionMenu.css({
|
||||
position: "absolute",
|
||||
top: elementPos.top+"px",
|
||||
left: (elementPos.left - menuOptionMenu.width() + 20)+"px"
|
||||
}).show();
|
||||
|
||||
}).appendTo(itemTools);
|
||||
|
||||
itemTools.appendTo(item.treeList.label);
|
||||
}
|
||||
});
|
||||
|
@@ -208,7 +208,7 @@ RED.palette = (function() {
|
||||
}
|
||||
|
||||
function escapeCategory(category) {
|
||||
return category.replace(/[ /.]/g,"_");
|
||||
return category.replace(/[\x00-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]/g,"_");
|
||||
}
|
||||
function addNodeType(nt,def) {
|
||||
if (getPaletteNode(nt).length) {
|
||||
|
@@ -1212,6 +1212,9 @@ RED.projects = (function() {
|
||||
}
|
||||
}).appendTo(row);
|
||||
|
||||
row = $('<div class="form-row red-ui-projects-dialog-screen-create-row red-ui-projects-dialog-screen-create-row-open"></div>').hide().appendTo(container);
|
||||
$('<span style="display: flex; align-items: center;"><input style="padding:0; margin: 0 5px 0 0" checked type="checkbox" id="red-ui-projects-dialog-screen-clear-context"> <label for="red-ui-projects-dialog-screen-clear-context" style="padding:0; margin: 0"> <span data-i18n="projects.create.clearContext"></span></label></span>').appendTo(row).i18n();
|
||||
|
||||
row = $('<div class="form-row red-ui-projects-dialog-screen-create-row red-ui-projects-dialog-screen-create-row-empty red-ui-projects-dialog-screen-create-row-clone"></div>').appendTo(container);
|
||||
$('<label for="red-ui-projects-dialog-screen-create-project-name">'+RED._("projects.create.project-name")+'</label>').appendTo(row);
|
||||
|
||||
@@ -1501,7 +1504,8 @@ RED.projects = (function() {
|
||||
};
|
||||
}
|
||||
} else if (projectType === 'open') {
|
||||
return switchProject(selectedProject.name,function(err,data) {
|
||||
var clearContext = $("#red-ui-projects-dialog-screen-clear-context").prop("checked")
|
||||
return switchProject(selectedProject.name, clearContext, function(err,data) {
|
||||
if (err) {
|
||||
if (err.code !== 'credentials_load_failed') {
|
||||
console.log(RED._("projects.create.unexpected_error"),err)
|
||||
@@ -1595,7 +1599,7 @@ RED.projects = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
function switchProject(name,done) {
|
||||
function switchProject(name,clearContext,done) {
|
||||
RED.deploy.setDeployInflight(true);
|
||||
RED.projects.settings.switchProject(name);
|
||||
sendRequest({
|
||||
@@ -1614,7 +1618,7 @@ RED.projects = (function() {
|
||||
'*': done
|
||||
},
|
||||
}
|
||||
},{active:true}).then(function() {
|
||||
},{active:true, clearContext:clearContext}).then(function() {
|
||||
dialog.dialog( "close" );
|
||||
RED.events.emit("project:change", {name:name});
|
||||
}).always(function() {
|
||||
@@ -1687,7 +1691,7 @@ RED.projects = (function() {
|
||||
dialogHeight = 590 - (750 - winHeight);
|
||||
}
|
||||
$(".red-ui-projects-dialog-box").height(dialogHeight);
|
||||
$(".red-ui-projects-dialog-project-list-inner-container").height(Math.max(500,dialogHeight) - 180);
|
||||
$(".red-ui-projects-dialog-project-list-inner-container").height(Math.max(500,dialogHeight) - 210);
|
||||
dialog.dialog('option','title',screen.title||"");
|
||||
dialog.dialog("open");
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ RED.search = (function() {
|
||||
var selected = -1;
|
||||
var visible = false;
|
||||
|
||||
var searchHistory = [];
|
||||
var index = {};
|
||||
var currentResults = [];
|
||||
var previousActiveElement;
|
||||
@@ -52,10 +53,22 @@ RED.search = (function() {
|
||||
}
|
||||
l = l||n.label||n.name||n.id||"";
|
||||
|
||||
|
||||
var properties = ['id','type','name','label','info'];
|
||||
if (n._def && n._def.defaults) {
|
||||
properties = properties.concat(Object.keys(n._def.defaults));
|
||||
const node_def = n && n._def;
|
||||
if (node_def) {
|
||||
if (node_def.defaults) {
|
||||
properties = properties.concat(Object.keys(node_def.defaults));
|
||||
}
|
||||
if (n.type !== "group" && node_def.paletteLabel && node_def.paletteLabel !== node_def.type) {
|
||||
try {
|
||||
const label = ("" + (typeof node_def.paletteLabel === "function" ? node_def.paletteLabel.call(node_def) : node_def.paletteLabel)).toLowerCase();
|
||||
if(label && label !== (""+node_def.type).toLowerCase()) {
|
||||
indexProperty(n, l, label);
|
||||
}
|
||||
} catch(err) {
|
||||
console.warn(`error indexing ${l}`, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i=0;i<properties.length;i++) {
|
||||
if (n.hasOwnProperty(properties[i])) {
|
||||
@@ -128,7 +141,7 @@ RED.search = (function() {
|
||||
var key = keys[i];
|
||||
var kpos = keys[i].indexOf(val);
|
||||
if (kpos > -1) {
|
||||
var ids = Object.keys(index[key]);
|
||||
var ids = Object.keys(index[key]||{});
|
||||
for (j=0;j<ids.length;j++) {
|
||||
var node = index[key][ids[j]];
|
||||
var isConfigNode = node.node._def.category === "config" && node.node.type !== 'group';
|
||||
@@ -205,6 +218,20 @@ RED.search = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
function populateSearchHistory() {
|
||||
if (searchHistory.length > 0) {
|
||||
searchResults.editableList('addItem',{
|
||||
historyHeader: true
|
||||
});
|
||||
searchHistory.forEach(function(entry) {
|
||||
searchResults.editableList('addItem',{
|
||||
history: true,
|
||||
value: entry
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
function createDialog() {
|
||||
dialog = $("<div>",{id:"red-ui-search",class:"red-ui-search"}).appendTo("#red-ui-main-container");
|
||||
var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(dialog);
|
||||
@@ -213,9 +240,14 @@ RED.search = (function() {
|
||||
change: function() {
|
||||
searchResults.editableList('empty');
|
||||
selected = -1;
|
||||
currentResults = search($(this).val());
|
||||
var value = $(this).val();
|
||||
if (value === "") {
|
||||
populateSearchHistory();
|
||||
return;
|
||||
}
|
||||
currentResults = search(value);
|
||||
if (currentResults.length > 0) {
|
||||
for (i=0;i<Math.min(currentResults.length,25);i++) {
|
||||
for (let i=0;i<Math.min(currentResults.length,25);i++) {
|
||||
searchResults.editableList('addItem',currentResults[i])
|
||||
}
|
||||
if (currentResults.length > 25) {
|
||||
@@ -285,7 +317,12 @@ RED.search = (function() {
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} if ($(children[selected]).hasClass("red-ui-search-history")) {
|
||||
var object = $(children[selected]).find(".red-ui-editableList-item-content").data('data');
|
||||
if (object) {
|
||||
searchInput.searchBox('value',object.value)
|
||||
}
|
||||
} else if (!$(children[selected]).hasClass("red-ui-search-historyHeader")) {
|
||||
if (currentResults.length > 0) {
|
||||
reveal(currentResults[Math.max(0,selected)].node);
|
||||
}
|
||||
@@ -301,7 +338,32 @@ RED.search = (function() {
|
||||
addItem: function(container,i,object) {
|
||||
var node = object.node;
|
||||
var div;
|
||||
if (object.more) {
|
||||
if (object.historyHeader) {
|
||||
container.parent().addClass("red-ui-search-historyHeader")
|
||||
$('<div>',{class:"red-ui-search-empty"}).text(RED._("search.history")).appendTo(container);
|
||||
$('<button type="button" class="red-ui-button red-ui-button-small"></button>').text(RED._("search.clear")).appendTo(container).on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
searchHistory = [];
|
||||
searchResults.editableList('empty');
|
||||
});
|
||||
} else if (object.history) {
|
||||
container.parent().addClass("red-ui-search-history")
|
||||
div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container);
|
||||
div.text(object.value);
|
||||
div.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
searchInput.searchBox('value',object.value)
|
||||
searchInput.focus();
|
||||
})
|
||||
$('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-remove"></i></button>').appendTo(container).on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
var index = searchHistory.indexOf(object.value);
|
||||
searchHistory.splice(index,1);
|
||||
searchResults.editableList('removeItem', object);
|
||||
});
|
||||
|
||||
|
||||
} else if (object.more) {
|
||||
container.parent().addClass("red-ui-search-more")
|
||||
div = $('<a>',{href:'#',class:"red-ui-search-result red-ui-search-empty"}).appendTo(container);
|
||||
div.text(RED._("palette.editor.more",{count:object.more.results.length-object.more.start}));
|
||||
@@ -356,6 +418,12 @@ RED.search = (function() {
|
||||
}
|
||||
|
||||
function reveal(node) {
|
||||
var searchVal = searchInput.val();
|
||||
var existingIndex = searchHistory.indexOf(searchVal);
|
||||
if (existingIndex > -1) {
|
||||
searchHistory.splice(existingIndex,1);
|
||||
}
|
||||
searchHistory.unshift(searchInput.val());
|
||||
hide();
|
||||
RED.view.reveal(node.id);
|
||||
}
|
||||
@@ -374,9 +442,14 @@ RED.search = (function() {
|
||||
|
||||
if (dialog === null) {
|
||||
createDialog();
|
||||
} else {
|
||||
searchResults.editableList('empty');
|
||||
}
|
||||
dialog.slideDown(300);
|
||||
searchInput.searchBox('value',v)
|
||||
if (!v || v === "") {
|
||||
populateSearchHistory();
|
||||
}
|
||||
RED.events.emit("search:open");
|
||||
visible = true;
|
||||
}
|
||||
|
@@ -19,6 +19,15 @@ RED.sidebar = (function() {
|
||||
var sidebar_tabs;
|
||||
var knownTabs = {};
|
||||
|
||||
// We store the current sidebar tab id in localStorage as 'last-sidebar-tab'
|
||||
// This is restored when the editor is reloaded.
|
||||
// We use sidebar_tabs.onchange to update localStorage. However that will
|
||||
// also get triggered when the first tab gets added to the tabs - typically
|
||||
// the 'info' tab. So we use the following variable to store the retrieved
|
||||
// value from localStorage before we start adding the actual tabs
|
||||
var lastSessionSelectedTab = null;
|
||||
|
||||
|
||||
function addTab(title,content,closeable,visible) {
|
||||
var options;
|
||||
if (typeof title === "string") {
|
||||
@@ -194,16 +203,16 @@ RED.sidebar = (function() {
|
||||
RED.events.emit("sidebar:resize");
|
||||
}
|
||||
|
||||
function showSidebar(id) {
|
||||
function showSidebar(id, skipShowSidebar) {
|
||||
if (id === ":first") {
|
||||
id = RED.settings.get("editor.sidebar.order",["info", "help", "version-control", "debug"])[0]
|
||||
id = lastSessionSelectedTab || RED.settings.get("editor.sidebar.order",["info", "help", "version-control", "debug"])[0]
|
||||
}
|
||||
if (id) {
|
||||
if (!containsTab(id) && knownTabs[id]) {
|
||||
sidebar_tabs.addTab(knownTabs[id]);
|
||||
}
|
||||
sidebar_tabs.activateTab(id);
|
||||
if (!RED.menu.isSelected("menu-item-sidebar")) {
|
||||
if (!skipShowSidebar && !RED.menu.isSelected("menu-item-sidebar")) {
|
||||
RED.menu.setSelected("menu-item-sidebar",true);
|
||||
}
|
||||
}
|
||||
@@ -227,6 +236,7 @@ RED.sidebar = (function() {
|
||||
if (tab.toolbar) {
|
||||
$(tab.toolbar).show();
|
||||
}
|
||||
RED.settings.setLocal("last-sidebar-tab", tab.id)
|
||||
},
|
||||
onremove: function(tab) {
|
||||
$(tab.wrapper).hide();
|
||||
@@ -255,7 +265,9 @@ RED.sidebar = (function() {
|
||||
}
|
||||
});
|
||||
RED.popover.tooltip($("#red-ui-sidebar-separator").find(".red-ui-sidebar-control-right"),RED._("keyboard.toggleSidebar"),"core:toggle-sidebar");
|
||||
showSidebar();
|
||||
|
||||
lastSessionSelectedTab = RED.settings.getLocal("last-sidebar-tab")
|
||||
|
||||
RED.sidebar.info.init();
|
||||
RED.sidebar.help.init();
|
||||
RED.sidebar.config.init();
|
||||
|
@@ -27,5 +27,7 @@ RED.state = {
|
||||
PANNING: 10,
|
||||
SELECTING_NODE: 11,
|
||||
GROUP_DRAGGING: 12,
|
||||
GROUP_RESIZE: 13
|
||||
GROUP_RESIZE: 13,
|
||||
DETACHED_DRAGGING: 14,
|
||||
SLICING: 15
|
||||
}
|
||||
|
@@ -983,6 +983,17 @@ RED.subflow = (function() {
|
||||
default: inputType
|
||||
})
|
||||
input.typedInput('value',val.value)
|
||||
if (inputType === 'cred') {
|
||||
if (node.credentials) {
|
||||
if (node.credentials[tenv.name]) {
|
||||
input.typedInput('value', node.credentials[tenv.name]);
|
||||
} else if (node.credentials['has_'+tenv.name]) {
|
||||
input.typedInput('value', "__PWRD__")
|
||||
} else {
|
||||
input.typedInput('value', "");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
input.val(val.value)
|
||||
}
|
||||
|
@@ -346,7 +346,7 @@ RED.sidebar.config = (function() {
|
||||
refreshConfigNodeList();
|
||||
}
|
||||
});
|
||||
RED.popover.tooltip($('#red-ui-sidebar-config-filter-all'), RED._("sidebar.config.showAllUnusedConfigNodes"));
|
||||
RED.popover.tooltip($('#red-ui-sidebar-config-filter-all'), RED._("sidebar.config.showAllConfigNodes"));
|
||||
RED.popover.tooltip($('#red-ui-sidebar-config-filter-unused'), RED._("sidebar.config.showAllUnusedConfigNodes"));
|
||||
|
||||
}
|
||||
|
@@ -64,15 +64,17 @@ RED.sidebar.help = (function() {
|
||||
style: "compact",
|
||||
delay: 100,
|
||||
change: function() {
|
||||
var val = $(this).val().toLowerCase();
|
||||
if (val) {
|
||||
const searchFor = $(this).val().toLowerCase();
|
||||
if (searchFor) {
|
||||
showTOC();
|
||||
var c = treeList.treeList('filter',function(item) {
|
||||
treeList.treeList('filter',function(item) {
|
||||
if (item.depth === 0) {
|
||||
return true;
|
||||
}
|
||||
return (item.nodeType && item.nodeType.indexOf(val) > -1) ||
|
||||
(item.subflowLabel && item.subflowLabel.indexOf(val) > -1)
|
||||
let found = item.nodeType && item.nodeType.toLowerCase().indexOf(searchFor) > -1;
|
||||
found = found || item.subflowLabel && item.subflowLabel.toLowerCase().indexOf(searchFor) > -1;
|
||||
found = found || item.palleteLabel && item.palleteLabel.toLowerCase().indexOf(searchFor) > -1;
|
||||
return found;
|
||||
},true)
|
||||
} else {
|
||||
treeList.treeList('filter',null);
|
||||
@@ -224,17 +226,21 @@ RED.sidebar.help = (function() {
|
||||
|
||||
|
||||
moduleNames.forEach(function(moduleName) {
|
||||
var module = modules[moduleName];
|
||||
var nodeTypes = [];
|
||||
|
||||
var setNames = Object.keys(module.sets);
|
||||
const module = modules[moduleName];
|
||||
const nodeTypes = [];
|
||||
const moduleSets = module.sets;
|
||||
const setNames = Object.keys(moduleSets);
|
||||
setNames.forEach(function(setName) {
|
||||
module.sets[setName].types.forEach(function(nodeType) {
|
||||
const moduleSet = moduleSets[setName];
|
||||
moduleSet.types.forEach(function(nodeType) {
|
||||
if ($("script[data-help-name='"+nodeType+"']").length) {
|
||||
const n = {_def:RED.nodes.getType(nodeType),type:nodeType}
|
||||
n.name = getNodePaletteLabel(n);
|
||||
nodeTypes.push({
|
||||
id: "node-type:"+nodeType,
|
||||
nodeType: nodeType,
|
||||
element:getNodeLabel({_def:RED.nodes.getType(nodeType),type:nodeType})
|
||||
palleteLabel: n.name,
|
||||
element: getNodeLabel(n)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -254,18 +260,21 @@ RED.sidebar.help = (function() {
|
||||
treeList.treeList("data",helpData);
|
||||
}
|
||||
|
||||
function getNodeLabel(n) {
|
||||
var div = $('<div>',{class:"red-ui-node-list-item"});
|
||||
var icon = RED.utils.createNodeIcon(n).appendTo(div);
|
||||
var label = n.name;
|
||||
function getNodePaletteLabel(n) {
|
||||
let label = n.name;
|
||||
if (!label && n._def && n._def.paletteLabel) {
|
||||
try {
|
||||
label = (typeof n._def.paletteLabel === "function" ? n._def.paletteLabel.call(n._def) : n._def.paletteLabel)||"";
|
||||
} catch (err) {
|
||||
}
|
||||
}
|
||||
label = label || n.type;
|
||||
$('<div>',{class:"red-ui-node-label"}).text(n.name||n.type).appendTo(icon);
|
||||
return label || n.type;
|
||||
}
|
||||
|
||||
function getNodeLabel(n) {
|
||||
const div = $('<div>',{class:"red-ui-node-list-item"});
|
||||
const icon = RED.utils.createNodeIcon(n).appendTo(div);
|
||||
$('<div>',{class:"red-ui-node-label"}).text(getNodePaletteLabel(n)).appendTo(icon);
|
||||
return div;
|
||||
}
|
||||
|
||||
|
@@ -256,6 +256,10 @@ RED.tourGuide = (function() {
|
||||
}
|
||||
$('<div>').css("text-align","left").html(getLocaleText(step.description)).appendTo(stepDescription);
|
||||
|
||||
if (step.image) {
|
||||
$(`<img src="red/tours/${step.image}" />`).appendTo(stepDescription)
|
||||
}
|
||||
|
||||
var stepToolbar = $('<div>',{class:"red-ui-tourGuide-toolbar"}).appendTo(stepContent);
|
||||
|
||||
// var breadcrumbs = $('<div>',{class:"red-ui-tourGuide-breadcrumbs"}).appendTo(stepToolbar);
|
||||
|
@@ -121,6 +121,13 @@ RED.userSettings = (function() {
|
||||
// {setting:"theme", label:"Theme",options:function(done){ done([{val:'',text:'default'}].concat(RED.settings.theme("themes"))) }},
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
title: "menu.label.view.view",
|
||||
options: [
|
||||
{setting:"view-store-zoom",label:"menu.label.view.storeZoom", default: false, toggle:true, onchange: function(val) { if (!val) { RED.settings.removeLocal("zoom-level")}}},
|
||||
{setting:"view-store-position",label:"menu.label.view.storePosition", default: false, toggle:true, onchange: function(val) { if (!val) { RED.settings.removeLocal("scroll-positions")}}},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "menu.label.view.grid",
|
||||
options: [
|
||||
|
@@ -725,6 +725,90 @@ RED.view.tools = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function wireSeriesOfNodes() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
if (selection.nodes.length > 1) {
|
||||
var i = 0;
|
||||
var newLinks = [];
|
||||
while (i < selection.nodes.length - 1) {
|
||||
var nodeA = selection.nodes[i];
|
||||
var nodeB = selection.nodes[i+1];
|
||||
if (nodeA.outputs > 0 && nodeB.inputs > 0) {
|
||||
var existingLinks = RED.nodes.filterLinks({
|
||||
source: nodeA,
|
||||
target: nodeB,
|
||||
sourcePort: 0
|
||||
})
|
||||
if (existingLinks.length === 0) {
|
||||
var newLink = {
|
||||
source: nodeA,
|
||||
target: nodeB,
|
||||
sourcePort: 0
|
||||
}
|
||||
RED.nodes.addLink(newLink);
|
||||
newLinks.push(newLink);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (newLinks.length > 0) {
|
||||
RED.history.push({
|
||||
t: 'add',
|
||||
links: newLinks,
|
||||
dirty: RED.nodes.dirty()
|
||||
})
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wireNodeToMultiple() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
if (selection.nodes.length > 1) {
|
||||
var sourceNode = selection.nodes[0];
|
||||
if (sourceNode.outputs === 0) {
|
||||
return;
|
||||
}
|
||||
var i = 1;
|
||||
var newLinks = [];
|
||||
while (i < selection.nodes.length) {
|
||||
var targetNode = selection.nodes[i];
|
||||
if (targetNode.inputs > 0) {
|
||||
var existingLinks = RED.nodes.filterLinks({
|
||||
source: sourceNode,
|
||||
target: targetNode,
|
||||
sourcePort: Math.min(sourceNode.outputs-1,i-1)
|
||||
})
|
||||
if (existingLinks.length === 0) {
|
||||
var newLink = {
|
||||
source: sourceNode,
|
||||
target: targetNode,
|
||||
sourcePort: Math.min(sourceNode.outputs-1,i-1)
|
||||
}
|
||||
RED.nodes.addLink(newLink);
|
||||
newLinks.push(newLink);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (newLinks.length > 0) {
|
||||
RED.history.push({
|
||||
t: 'add',
|
||||
links: newLinks,
|
||||
dirty: RED.nodes.dirty()
|
||||
})
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
RED.actions.add("core:show-selected-node-labels", function() { setSelectedNodeLabelState(true); })
|
||||
@@ -783,7 +867,8 @@ RED.view.tools = (function() {
|
||||
RED.actions.add("core:distribute-selection-horizontally", function() { distributeSelection('h') })
|
||||
RED.actions.add("core:distribute-selection-vertically", function() { distributeSelection('v') })
|
||||
|
||||
|
||||
RED.actions.add("core:wire-series-of-nodes", function() { wireSeriesOfNodes() })
|
||||
RED.actions.add("core:wire-node-to-multiple", function() { wireNodeToMultiple() })
|
||||
|
||||
// RED.actions.add("core:add-node", function() { addNode() })
|
||||
},
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -281,9 +281,22 @@ RED.workspaces = (function() {
|
||||
onselect: "core:show-last-hidden-flow"
|
||||
}
|
||||
]
|
||||
if (hideStack.length > 0) {
|
||||
let hiddenFlows = new Set()
|
||||
for (let i = 0; i < hideStack.length; i++) {
|
||||
let ids = hideStack[i]
|
||||
if (!Array.isArray(ids)) {
|
||||
ids = [ids]
|
||||
}
|
||||
ids.forEach(id => {
|
||||
if (RED.nodes.workspace(id)) {
|
||||
hiddenFlows.add(id)
|
||||
}
|
||||
})
|
||||
}
|
||||
const flowCount = hiddenFlows.size;
|
||||
if (flowCount > 0) {
|
||||
menuItems.unshift({
|
||||
label: RED._("workspace.hiddenFlows",{count: hideStack.length}),
|
||||
label: RED._("workspace.hiddenFlows",{count: flowCount}),
|
||||
onselect: "core:list-hidden-flows"
|
||||
})
|
||||
}
|
||||
|
@@ -150,7 +150,8 @@ $popover-button-border-color-hover: #666;
|
||||
|
||||
$diff-text-header-color: $secondary-text-color;
|
||||
$diff-text-header-background: #ffd;
|
||||
$diff-text-header-background-hover: #ffc;
|
||||
$diff-state-color: $primary-text-color;
|
||||
$diff-state-prefix-color: $secondary-text-color;
|
||||
$diff-state-added: #009900;
|
||||
$diff-state-deleted: #f80000;
|
||||
$diff-state-changed: #f89406;
|
||||
@@ -193,7 +194,6 @@ $view-lasso-stroke: #ff7f0e;
|
||||
$view-lasso-fill: rgba(20,125,255,0.1);
|
||||
|
||||
$view-background: $secondary-background;
|
||||
$view-select-mode-background: $secondary-background-selected;
|
||||
$view-grid-color: #eee;
|
||||
|
||||
$node-label-color: #333;
|
||||
@@ -212,6 +212,7 @@ $node-icon-background-color-opacity: 0.05;
|
||||
$node-icon-border-color: #000;
|
||||
$node-icon-border-color-opacity: 0.1;
|
||||
|
||||
$node-config-background: #f3f3f3;
|
||||
|
||||
$node-link-port-background: #eee;
|
||||
|
||||
|
@@ -562,7 +562,7 @@ ul.red-ui-deploy-dialog-confirm-list {
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
color: $secondary-text-color;
|
||||
color: $diff-state-prefix-color;
|
||||
}
|
||||
|
||||
&.added {
|
||||
@@ -577,9 +577,11 @@ ul.red-ui-deploy-dialog-confirm-list {
|
||||
}
|
||||
td.added {
|
||||
background: $diff-state-added-background;
|
||||
color: $diff-state-color;
|
||||
}
|
||||
td.removed {
|
||||
background: $diff-state-deleted-background;
|
||||
color: $diff-state-color;
|
||||
}
|
||||
tr.mergeHeader td {
|
||||
color: $diff-merge-header-color;
|
||||
@@ -652,7 +654,7 @@ ul.red-ui-deploy-dialog-confirm-list {
|
||||
font-family: $monospace-font;
|
||||
padding: 5px 10px;
|
||||
text-align: left;
|
||||
color: $secondary-text-color;
|
||||
color: $diff-text-header-color;
|
||||
background: $diff-text-header-background;
|
||||
height: 30px;
|
||||
vertical-align: middle;
|
||||
|
@@ -21,6 +21,13 @@
|
||||
stroke-dasharray: 10 5;
|
||||
}
|
||||
|
||||
.nr-ui-view-slice {
|
||||
stroke-width: 1px;
|
||||
stroke: $view-lasso-stroke;
|
||||
fill: none;
|
||||
stroke-dasharray: 10 5;
|
||||
}
|
||||
|
||||
.node_label_italic, // deprecated: use red-ui-flow-node-label-italic
|
||||
.red-ui-flow-node-label-italic {
|
||||
font-style: italic;
|
||||
|
@@ -26,6 +26,13 @@
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.ui-widget.ui-widget-content {
|
||||
border: 1px solid $tertiary-border-color;
|
||||
}
|
||||
.ui-widget-content {
|
||||
border: 1px solid $secondary-border-color;
|
||||
}
|
||||
|
||||
.ui-widget-header {
|
||||
color: $header-text-color;
|
||||
}
|
||||
|
@@ -254,7 +254,7 @@ button.red-ui-palette-editor-upload-button {
|
||||
padding: 2px 8px;
|
||||
}
|
||||
form {
|
||||
width: 0;
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
.red-ui-palette-editor-upload {
|
||||
|
@@ -204,6 +204,28 @@
|
||||
font-style: italic;
|
||||
color: $form-placeholder-color;
|
||||
}
|
||||
.red-ui-search-history {
|
||||
button {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 7px;
|
||||
}
|
||||
|
||||
&:hover button {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
.red-ui-search-historyHeader {
|
||||
button {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 7px;
|
||||
}
|
||||
}
|
||||
.red-ui-search-history-result {
|
||||
|
||||
}
|
||||
|
||||
.red-ui-search-result-action {
|
||||
color: $primary-text-color;
|
||||
|
@@ -54,7 +54,7 @@ ul.red-ui-sidebar-node-config-list {
|
||||
.red-ui-palette-icon-container {
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
background-color: $secondary-background-selected;
|
||||
background-color: $node-icon-background-color;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
a {
|
||||
@@ -63,10 +63,10 @@ ul.red-ui-sidebar-node-config-list {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
color: $secondary-text-color;
|
||||
color: $node-port-label-color;
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
background: $secondary-background-hover;
|
||||
background: $node-port-background-hover;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ ul.red-ui-sidebar-node-config-list {
|
||||
.red-ui-palette-node-config {
|
||||
width: 160px;
|
||||
height: 30px;
|
||||
background: $primary-background;
|
||||
background: $node-config-background;
|
||||
color: $primary-text-color;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@@ -78,6 +78,12 @@
|
||||
}
|
||||
.red-ui-tourGuide-popover-description {
|
||||
padding: 10px 20px 5px;
|
||||
|
||||
img {
|
||||
max-height: 150px;
|
||||
border: 1px solid var(--red-ui-tourGuide-border);
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
.red-ui-tourGuide-popover-full {
|
||||
.red-ui-tourGuide-popover-description {
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
.red-ui-typedInput-container {
|
||||
border: 1px solid $form-input-border-color;
|
||||
border-radius: 4px;
|
||||
border-radius: 5px;
|
||||
height: 34px;
|
||||
line-height: 14px;
|
||||
display: inline-flex;
|
||||
|
@@ -58,7 +58,6 @@
|
||||
.red-ui-workspace-select-mode {
|
||||
.red-ui-workspace-chart-background {
|
||||
opacity: 0.7;
|
||||
// fill: $view-select-mode-background;
|
||||
}
|
||||
.red-ui-workspace-chart-grid line {
|
||||
opacity: 0.8;
|
||||
|
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/delete-repair.gif
vendored
Normal file
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/delete-repair.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/detach-repair.gif
vendored
Normal file
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/detach-repair.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/slice.gif
vendored
Normal file
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/slice.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/subflow-labels.png
vendored
Normal file
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/subflow-labels.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
@@ -1,12 +1,12 @@
|
||||
export default {
|
||||
version: "2.1.0",
|
||||
version: "2.2.0",
|
||||
steps: [
|
||||
{
|
||||
titleIcon: "fa fa-map-o",
|
||||
title: {
|
||||
"en-US": "Welcome to Node-RED 2.1!",
|
||||
"ja": "Node-RED 2.1へようこそ!"
|
||||
},
|
||||
"en-US": "Welcome to Node-RED 2.2!",
|
||||
"ja": "Node-RED 2.2へようこそ!"
|
||||
},
|
||||
description: {
|
||||
"en-US": "Let's take a moment to discover the new features in this release.",
|
||||
"ja": "本リリースの新機能を見つけてみましょう。"
|
||||
@@ -14,215 +14,142 @@ export default {
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "A new Tour Guide",
|
||||
"ja": "新しいツアーガイド"
|
||||
"en-US": "Search history",
|
||||
"ja": "検索履歴"
|
||||
},
|
||||
description: {
|
||||
"en-US": "<p>First, as you've already found, we now have this tour of new features. We'll only show the tour the first time you open the editor for each new version of Node-RED.</p>" +
|
||||
"<p>You can choose not to see this tour in the future by disabling it under the View tab of User Settings.</p>",
|
||||
"ja": "<p>最初に、既に見つけている様に、新機能の本ツアーがあります。本ツアーは、新バージョンのNode-REDフローエディタを初めて開いた時のみ表示されます。</p>" +
|
||||
"<p>ユーザ設定の表示タブの中で、この機能を無効化することで、本ツアーを表示しないようにすることもできます。</p>"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "New Edit menu",
|
||||
"ja": "新しい編集メニュー"
|
||||
"en-US": "<p>The Search dialog now keeps a history of your searches, making it easier to go back to a previous search.</p>",
|
||||
"ja": "<p>検索ダイアログが検索履歴を保持するようになりました。これによって、過去の検索に戻りやすくなりました。</p>"
|
||||
},
|
||||
prepare() {
|
||||
$("#red-ui-header-button-sidemenu").trigger("click");
|
||||
$("#menu-item-edit-menu").parent().addClass("open");
|
||||
},
|
||||
complete() {
|
||||
$("#menu-item-edit-menu").parent().removeClass("open");
|
||||
},
|
||||
element: "#menu-item-edit-menu-submenu",
|
||||
interactive: false,
|
||||
direction: "left",
|
||||
description: {
|
||||
"en-US": "<p>The main menu has been updated with a new 'Edit' section. This includes all of the familar options, like cut/paste and undo/redo.</p>" +
|
||||
"<p>The menu now displays keyboard shortcuts for the options.</p>",
|
||||
"ja": "<p>メインメニューに「編集」セクションが追加されました。本セクションには、切り取り/貼り付けや、変更操作を戻す/やり直しの様な使い慣れたオプションが含まれています。</p>" +
|
||||
"<p>本メニューには、オプションのためのキーボードショートカットも表示されるようになりました。</p>"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Arranging nodes",
|
||||
"ja": "ノードの配置"
|
||||
},
|
||||
prepare() {
|
||||
$("#red-ui-header-button-sidemenu").trigger("click");
|
||||
$("#menu-item-arrange-menu").parent().addClass("open");
|
||||
},
|
||||
complete() {
|
||||
$("#menu-item-arrange-menu").parent().removeClass("open");
|
||||
},
|
||||
element: "#menu-item-arrange-menu-submenu",
|
||||
interactive: false,
|
||||
direction: "left",
|
||||
description: {
|
||||
"en-US": "<p>The new 'Arrange' section of the menu provides new options to help arrange your nodes. You can align them to a common edge, spread them out evenly or change their order.</p>",
|
||||
"ja": "<p>メニューの新しい「配置」セクションには、ノードの配置を助ける新しいオプションが提供されています。ノードの端を揃えたり、均等に配置したり、表示順序を変更したりできます。</p>"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Hiding tabs",
|
||||
"ja": "タブの非表示"
|
||||
},
|
||||
element: "#red-ui-workspace-tabs > li.active",
|
||||
description: {
|
||||
"en-US": '<p>Tabs can now be hidden by clicking their <i class="fa fa-eye-slash"></i> icon.</p><p>The Info Sidebar will still list all of your tabs, and tell you which ones are currently hidden.',
|
||||
"ja": '<p><i class="fa fa-eye-slash"></i> アイコンをクリックすることで、タブを非表示にできます。</p><p>情報サイドバーには、全てのタブが一覧表示されており、現在非表示になっているタブを確認できます。'
|
||||
},
|
||||
interactive: false,
|
||||
prepare() {
|
||||
$("#red-ui-workspace-tabs > li.active .red-ui-tab-close").css("display","block");
|
||||
},
|
||||
complete() {
|
||||
$("#red-ui-workspace-tabs > li.active .red-ui-tab-close").css("display","");
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Tab menu",
|
||||
"ja": "タブメニュー"
|
||||
},
|
||||
element: "#red-ui-workspace-tabs-menu",
|
||||
description: {
|
||||
"en-US": "<p>The new tab menu also provides lots of new options for your tabs.</p>",
|
||||
"ja": "<p>新しいタブメニューには、タブに関する沢山の新しいオプションが提供されています。</p>"
|
||||
},
|
||||
interactive: false,
|
||||
direction: "left",
|
||||
prepare() {
|
||||
$("#red-ui-workspace > .red-ui-tabs > .red-ui-tabs-menu a").trigger("click");
|
||||
},
|
||||
complete() {
|
||||
$(document).trigger("click");
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Flow and Group level environment variables",
|
||||
"ja": "フローとグループの環境変数"
|
||||
},
|
||||
element: "#red-ui-workspace-tabs > li.active",
|
||||
interactive: false,
|
||||
description: {
|
||||
"en-US": "<p>Flows and Groups can now have their own environment variables that can be referenced by nodes inside them.</p>",
|
||||
"ja": "<p>フローとグループには、内部のノードから参照できる環境変数を設定できるようになりました。</p>"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#red-ui-search .red-ui-searchBox-form",
|
||||
prepare(done) {
|
||||
RED.editor.editFlow(RED.nodes.workspace(RED.workspaces.active()),"editor-tab-envProperties");
|
||||
setTimeout(done,700);
|
||||
RED.search.show();
|
||||
setTimeout(done,400);
|
||||
},
|
||||
complete() {
|
||||
RED.search.hide();
|
||||
},
|
||||
element: "#red-ui-tab-editor-tab-envProperties-link-button",
|
||||
description: {
|
||||
"en-US": "<p>Their edit dialogs have a new Environment Variables section.</p>",
|
||||
"ja": "<p>編集ダイアログに環境変数セクションが追加されました。</p>"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: ".node-input-env-container-row",
|
||||
direction: "left",
|
||||
title: {
|
||||
"en-US": "Remembering Zoom & Position",
|
||||
"ja": "拡大/縮小のレベルや位置を記憶"
|
||||
},
|
||||
description: {
|
||||
"en-US": '<p>The environment variables are listed in this table and new ones can be added by clicking the <i class="fa fa-plus"></i> button.</p>',
|
||||
"ja": '<p>この表に環境変数が一覧表示されており、<i class="fa fa-plus"></i>ボタンをクリックすることで新しい変数を追加できます。</p>'
|
||||
"en-US": "<p>The editor has new options to restore the zoom level and scroll position when reloading the editor.</p>",
|
||||
"ja": "<p>エディタを再読み込みした時に、拡大/縮小のレベルやスクロール位置を復元するための新しいオプションを利用できます。</p>"
|
||||
},
|
||||
element: function() { return $("#user-settings-view-store-position").parent()},
|
||||
prepare(done) {
|
||||
RED.actions.invoke("core:show-user-settings")
|
||||
setTimeout(done,400);
|
||||
},
|
||||
complete(done) {
|
||||
$("#node-dialog-cancel").trigger("click");
|
||||
setTimeout(done,500);
|
||||
$("#node-dialog-ok").trigger("click");
|
||||
setTimeout(done,400);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "New wiring actions",
|
||||
"ja": "新しいワイヤー操作"
|
||||
},
|
||||
// image: "images/",
|
||||
description: {
|
||||
"en-US": `<p>A pair of new actions have been added to help with wiring nodes together:</p>
|
||||
<ul>
|
||||
<li><b><code>Wire Series Of Nodes</code></b> - adds a wire (if necessary) between each pair of nodes in the order they were selected.</li>
|
||||
<li><b><code>Wire Node To Multiple</code></b> - wires the first node selected to all of the other selected nodes.</li>
|
||||
</ul>
|
||||
<p>Actions can be accessed from the Action List in the main menu.</p>`,
|
||||
"ja": `<p>ノード接続を支援する2つの新しい操作が追加されました:</p>
|
||||
<ul>
|
||||
<li><b><code>Wire Series Of Nodes</code></b> - ノードを選択した順序で、各ノードのペアの間にワイヤーを(必要に応じて)追加します。</li>
|
||||
<li><b><code>Wire Node To Multiple</code></b> - 最初に選択したノードから、他の選択した全てのノードに対して、ワイヤーを追加します。</li>
|
||||
</ul>
|
||||
<p>メインメニュー内の動作一覧から、これらの操作を利用できます。</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Deleting nodes and reconnecting wires",
|
||||
"ja": "ノードの削除とワイヤーの再接続"
|
||||
},
|
||||
image: "images/delete-repair.gif",
|
||||
description: {
|
||||
"en-US": `<p>It is now possible to delete a selection of nodes and automatically repair the wiring behind them.</p>
|
||||
<p>This is really useful if you want to remove a node from the middle of the flow.</p>
|
||||
<p>Hold the Ctrl (or Cmd) key when you press Delete and the nodes will be gone and the wires repaired.</p>
|
||||
`,
|
||||
"ja": `<p>選択したノードを削除した後、その背後にあるワイヤーを自動的に修復できるようになりました。</p>
|
||||
<p>これは、フローの中からノードを削除する時に、とても便利に使えます。</p>
|
||||
<p>Ctrl (またはCmd)キーを押しながらDeleteキーを押すと、ノードがなくなり、ワイヤーが修復されます。</p>
|
||||
`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Link Call node added",
|
||||
"ja": "Link Callノードを追加"
|
||||
"en-US": "Detaching nodes from a flow",
|
||||
"ja": "フローからノードの切り離し"
|
||||
},
|
||||
prepare(done) {
|
||||
this.paletteWasClosed = $("#red-ui-main-container").hasClass("red-ui-palette-closed");
|
||||
RED.actions.invoke("core:toggle-palette",true)
|
||||
$('[data-palette-type="link call"]')[0].scrollIntoView({block:"center"})
|
||||
setTimeout(done,100);
|
||||
},
|
||||
element: '[data-palette-type="link call"]',
|
||||
direction: "right",
|
||||
image: "images/detach-repair.gif",
|
||||
description: {
|
||||
"en-US": "<p>The <code>Link Call</code> node lets you call another flow that begins with a <code>Link In</code> node and get the result back when the message reaches a <code>Link Out</code> node.</p>",
|
||||
"ja": "<p><code>Link Call</code>ノードを用いることで、<code>Link In</code>ノードから始まるフローを呼び出し、<code>Link Out</code>ノードに到達した時に、結果を取得できます。</p>"
|
||||
"en-US": `<p>If you want to remove a node from a flow without deleting it,
|
||||
you can use the <b><code>Detach Selected Nodes</code></b> action.</p>
|
||||
<p>The nodes will be removed from their flow, the wiring repaired behind them, and then attached to the mouse
|
||||
so you can drop them wherever you want in the workspace.</p>
|
||||
<p>There isn't a default keyboard shortcut assigned for this new action, but
|
||||
you can add your own via the Keyboard pane of the main Settings dialog.</p>`,
|
||||
"ja": `<p>ノードを削除することなく、フローからノードを除きたい場合は、<b><code>Detach Selected Nodes</code></b>操作を利用できます。</p>
|
||||
<p>フローからノードが除かれた後、背後のワイヤーが修復され、ノードはマウスポインタにつながります。そのため、ワークスペースの好きな所にノードを配置できます。</p>
|
||||
<p>この新しい操作に対して、デフォルトのキーボードショートカットは登録されていませんが、メイン設定ダイアログのキーボード設定から追加できます。</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "MQTT nodes support dynamic connections",
|
||||
"ja": "MQTTノードが動的接続をサポート"
|
||||
"en-US": "More wiring tricks",
|
||||
"ja": "その他のワイヤー操作"
|
||||
},
|
||||
prepare(done) {
|
||||
$('[data-palette-type="mqtt out"]')[0].scrollIntoView({block:"center"})
|
||||
setTimeout(done,100);
|
||||
},
|
||||
element: '[data-palette-type="mqtt out"]',
|
||||
direction: "right",
|
||||
image: "images/slice.gif",
|
||||
description: {
|
||||
"en-US": '<p>The <code>MQTT</code> nodes now support creating their connections and subscriptions dynamically.</p>',
|
||||
"ja": '<p><code>MQTT</code>ノードは、動的な接続や購読ができるようになりました。</p>'
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "File nodes renamed",
|
||||
"ja": "ファイルノードの名前変更"
|
||||
},
|
||||
prepare(done) {
|
||||
$('[data-palette-type="file"]')[0].scrollIntoView({block:"center"});
|
||||
setTimeout(done,100);
|
||||
},
|
||||
complete() {
|
||||
if (this.paletteWasClosed) {
|
||||
RED.actions.invoke("core:toggle-palette",false)
|
||||
}
|
||||
},
|
||||
element: '[data-palette-type="file"]',
|
||||
direction: "right",
|
||||
description: {
|
||||
"en-US": "<p>The file nodes have been renamed to make it clearer which node does what.</p>",
|
||||
"ja": "<p>fileノードの名前が変更され、どのノードが何を行うかが明確になりました。</p>"
|
||||
"en-US": `<p>A couple more wiring tricks to share.</p>
|
||||
<p>You can now select multiple wires by holding the Ctrl (or Cmd) key
|
||||
when clicking on a wire. This makes it easier to delete multiple wires in one go.</p>
|
||||
<p>If you hold the Ctrl (or Cmd) key, then click and drag with the right-hand mouse button,
|
||||
you can slice through wires to remove them.</p>`,
|
||||
"ja": `<p>その他のいくつかのワイヤー操作</p>
|
||||
<p>Ctrl (またはCmd)キーを押しながらワイヤーをクリックすることで、複数のワイヤーを選択できるようになりました。これによって、複数のワイヤーを一度に削除することが簡単になりました。</p>
|
||||
<p>Ctrl (またはCmd)キーを押しながら、マウスの右ボタンを用いてドラッグすると、ワイヤーを切って削除できます。</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Deep copy option on Change node",
|
||||
"ja": "Changeノードのディープコピーオプション"
|
||||
},
|
||||
prepare(done) {
|
||||
var def = RED.nodes.getType('change');
|
||||
RED.editor.edit({id:"test",type:"change",rules:[{t:"set",p:"payload",pt:"msg", tot:"msg",to:"anotherProperty"}],_def:def, _:def._});
|
||||
setTimeout(done,700);
|
||||
},
|
||||
complete(done) {
|
||||
$("#node-dialog-cancel").trigger("click");
|
||||
setTimeout(done,500);
|
||||
},
|
||||
element: function() {
|
||||
return $(".node-input-rule-property-deepCopy").next();
|
||||
"en-US": "Subflow Output Labels",
|
||||
"ja": "サブフローの出力ラベル"
|
||||
},
|
||||
image: "images/subflow-labels.png",
|
||||
description: {
|
||||
"en-US": "<p>The Set rule has a new option to create a deep copy of the value. This ensures a complete copy is made, rather than using a reference.</p>",
|
||||
"ja": "<p>値を代入に、値のディープコピーを作成するオプションが追加されました。これによって参照ではなく、完全なコピーが作成されます。</p>"
|
||||
}
|
||||
"en-US": "<p>If a subflow has labels set for its outputs, they now get shown on the ports within the subflow template view.</p>",
|
||||
"ja": "<p>サブフローの出力にラベルが設定されている場合、サブフローテンプレート画面内のポートにラベルが表示されるようになりました。</p>"
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "And that's not all...",
|
||||
"ja": "これが全てではありません..."
|
||||
"en-US": "Node Updates",
|
||||
"ja": "ノードの更新"
|
||||
},
|
||||
// image: "images/",
|
||||
description: {
|
||||
"en-US": "<p>There are many more smaller changes, including:</p><ul><li>Auto-complete suggestions in the <code>msg</code> TypedInput.</li><li>Support for <code>msg.resetTimeout</code> in the <code>Join</code> node.</li><li>Pushing messages to the front of the queue in the <code>Delay</code> node's rate limiting mode.</li><li>An optional second output on the <code>Delay</code> node for rate limited messages.</li></ul>",
|
||||
"ja": "<p>以下の様な小さな変更が沢山あります:</p><ul><li><code>msg</code> TypedInputの自動補完提案</li><li><code>Join</code>ノードで<code>msg.resetTimeout</code>のサポート</li><li><code>Delay</code>ノードの流量制御モードにおいて先頭メッセージをキューに追加</li><li><code>Delay</code>ノードで流量制限されたメッセージ向けの任意の2つ目の出力</li></ul>"
|
||||
"en-US": `<ul>
|
||||
<li>The JSON node will now handle parsing Buffer payloads</li>
|
||||
<li>The TCP Client nodes support TLS connections</li>
|
||||
<li>The WebSocket node allows you to specify a sub-protocol when connecting</li>
|
||||
</ul>`,
|
||||
"ja": `<ul>
|
||||
<li>JSONノードが、バッファ形式のペイロードを解析できるようになりました。</li>
|
||||
<li>TCPクライアントノードが、TLS接続をサポートしました。</li>
|
||||
<li>WebSocketノードで、接続時にサブプロトコルを指定できるようになりました。</li>
|
||||
</ul>`
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@@ -31,12 +31,12 @@ interface NodeStatus {
|
||||
}
|
||||
|
||||
declare class node {
|
||||
/**
|
||||
* Send 1 or more messages asynchronously
|
||||
* @param {object | object[]} msg The msg object
|
||||
* @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true`
|
||||
* @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)
|
||||
*/
|
||||
/**
|
||||
* Send 1 or more messages asynchronously
|
||||
* @param {object | object[]} msg The msg object
|
||||
* @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true`
|
||||
* @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)
|
||||
*/
|
||||
static send(msg:object|object[], clone?:Boolean): void;
|
||||
/** Inform runtime this instance has completed its operation */
|
||||
static done();
|
||||
@@ -57,11 +57,13 @@ declare class node {
|
||||
*/
|
||||
static status(status:string|boolean|number);
|
||||
/** the id of this node */
|
||||
public readonly id:string;
|
||||
public static readonly id:string;
|
||||
/** the name of this node */
|
||||
public readonly name:string;
|
||||
public static readonly name:string;
|
||||
/** the path identifier for this node */
|
||||
public static readonly path:string;
|
||||
/** the number of outputs of this node */
|
||||
public readonly outputCount:number;
|
||||
public static readonly outputCount:number;
|
||||
}
|
||||
declare class context {
|
||||
/**
|
||||
@@ -93,27 +95,27 @@ declare class context {
|
||||
/**
|
||||
* Set one or multiple values in context (synchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[]);
|
||||
/**
|
||||
* Set one or multiple values in context (asynchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param callback - (optional) Callback function (`(err) => {}`)
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[], callback?: Function);
|
||||
/**
|
||||
* Set one or multiple values in context (synchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param store - (optional) Name of context store
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[], store?: string);
|
||||
/**
|
||||
* Set one or multiple values in context (asynchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param store - (optional) Name of context store
|
||||
* @param callback - (optional) Callback function (`(err) => {}`)
|
||||
*/
|
||||
@@ -158,27 +160,27 @@ declare class flow {
|
||||
/**
|
||||
* Set one or multiple values in context (synchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[]);
|
||||
/**
|
||||
* Set one or multiple values in context (asynchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param callback - (optional) Callback function (`(err) => {}`)
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[], callback?: Function);
|
||||
/**
|
||||
* Set one or multiple values in context (synchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param store - (optional) Name of context store
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[], store?: string);
|
||||
/**
|
||||
* Set one or multiple values in context (asynchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param store - (optional) Name of context store
|
||||
* @param callback - (optional) Callback function (`(err) => {}`)
|
||||
*/
|
||||
@@ -225,32 +227,32 @@ declare class global {
|
||||
/**
|
||||
* Set one or multiple values in context (synchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[]);
|
||||
/**
|
||||
* Set one or multiple values in context (asynchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param callback - (optional) Callback function (`(err) => {}`)
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[], callback?: Function);
|
||||
/**
|
||||
* Set one or multiple values in context (synchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param store - (optional) Name of context store
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[], store?: string);
|
||||
/**
|
||||
* Set one or multiple values in context (asynchronous).
|
||||
* @param name - Name (or array of names) to set in context
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed.
|
||||
* @param store - (optional) Name of context store
|
||||
* @param callback - (optional) Callback function (`(err) => {}`)
|
||||
*/
|
||||
static set(name: string | string[], value?: any | any[], store?: string, callback?: Function);
|
||||
|
||||
|
||||
/** Get an array of the keys in the context store */
|
||||
static keys(): Array<string>;
|
||||
/** Get an array of the keys in the context store */
|
||||
@@ -261,6 +263,20 @@ declare class global {
|
||||
static keys(store: string, callback: Function);
|
||||
}
|
||||
declare class env {
|
||||
/** Get an environment variable value */
|
||||
static get(name:string);
|
||||
/**
|
||||
* Get an environment variable value
|
||||
*
|
||||
* Predefined node-red variables...
|
||||
* * `NR_NODE_ID` - the ID of the node
|
||||
* * `NR_NODE_NAME` - the Name of the node
|
||||
* * `NR_NODE_PATH` - the Path of the node
|
||||
* * `NR_GROUP_ID` - the ID of the containing group
|
||||
* * `NR_GROUP_NAME` - the Name of the containing group
|
||||
* * `NR_FLOW_ID` - the ID of the flow the node is on
|
||||
* * `NR_FLOW_NAME` - the Name of the flow the node is on
|
||||
* @param name Name of the environment variable to get
|
||||
* @example
|
||||
* ```const flowName = env.get("NR_FLOW_NAME");```
|
||||
*/
|
||||
static get(name:string) :string;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
|
@@ -75,16 +75,12 @@ module.exports = function(RED) {
|
||||
node.repeaterSetup = function () {
|
||||
if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
|
||||
this.repeat = this.repeat * 1000;
|
||||
if (RED.settings.verbose) {
|
||||
this.log(RED._("inject.repeat", this));
|
||||
}
|
||||
this.debug(RED._("inject.repeat", this));
|
||||
this.interval_id = setInterval(function() {
|
||||
node.emit("input", {});
|
||||
}, this.repeat);
|
||||
} else if (this.crontab) {
|
||||
if (RED.settings.verbose) {
|
||||
this.log(RED._("inject.crontab", this));
|
||||
}
|
||||
this.debug(RED._("inject.crontab", this));
|
||||
this.cronjob = scheduleTask(this.crontab,() => { node.emit("input", {})});
|
||||
}
|
||||
};
|
||||
@@ -113,9 +109,10 @@ module.exports = function(RED) {
|
||||
if (!property) return;
|
||||
|
||||
if (valueType === "jsonata") {
|
||||
if (p.exp) {
|
||||
if (p.v) {
|
||||
try {
|
||||
var val = RED.util.evaluateJSONataExpression(p.exp, msg);
|
||||
var exp = RED.util.prepareJSONataExpression(p.v, node);
|
||||
var val = RED.util.evaluateJSONataExpression(exp, msg);
|
||||
RED.util.setMessageProperty(msg, property, val, true);
|
||||
}
|
||||
catch (err) {
|
||||
@@ -148,10 +145,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
if (this.interval_id != null) {
|
||||
clearInterval(this.interval_id);
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
|
||||
} else if (this.cronjob != null) {
|
||||
this.cronjob.stop();
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
|
||||
delete this.cronjob;
|
||||
}
|
||||
};
|
||||
|
@@ -7,6 +7,7 @@ module.exports = function(RED) {
|
||||
var debuglength = RED.settings.debugMaxLength || 1000;
|
||||
var useColors = RED.settings.debugUseColors || false;
|
||||
util.inspect.styles.boolean = "red";
|
||||
const { hasOwnProperty } = Object.prototype;
|
||||
|
||||
function DebugNode(n) {
|
||||
var hasEditExpression = (n.targetType === "jsonata");
|
||||
@@ -107,7 +108,9 @@ module.exports = function(RED) {
|
||||
}
|
||||
})
|
||||
this.on("input", function(msg, send, done) {
|
||||
if (msg.hasOwnProperty("status") && msg.status.hasOwnProperty("source") && msg.status.source.hasOwnProperty("id") && (msg.status.source.id === node.id)) {
|
||||
if (hasOwnProperty.call(msg, "status") && msg.status &&
|
||||
hasOwnProperty.call(msg.status, "source") && msg.status.source &&
|
||||
hasOwnProperty.call(msg.status.source, "id") && (msg.status.source.id === node.id)) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
@@ -118,17 +121,18 @@ module.exports = function(RED) {
|
||||
var st = (typeof output === 'string') ? output : util.inspect(output);
|
||||
var fill = "grey";
|
||||
var shape = "dot";
|
||||
if (typeof output === 'object' && output.hasOwnProperty("fill") && output.hasOwnProperty("shape") && output.hasOwnProperty("text")) {
|
||||
if (typeof output === 'object' && hasOwnProperty.call(output, "fill") && hasOwnProperty.call(output, "shape") && hasOwnProperty.call(output, "text")) {
|
||||
fill = output.fill;
|
||||
shape = output.shape;
|
||||
st = output.text;
|
||||
}
|
||||
if (node.statusType === "auto") {
|
||||
if (msg.hasOwnProperty("error")) {
|
||||
if (hasOwnProperty.call(msg, "error")) {
|
||||
fill = "red";
|
||||
st = msg.error.message;
|
||||
}
|
||||
if (msg.hasOwnProperty("status")) {
|
||||
if (hasOwnProperty.call(msg, "status") &&
|
||||
msg.status) {
|
||||
fill = msg.status.fill || "grey";
|
||||
shape = msg.status.shape || "ring";
|
||||
st = msg.status.text || "";
|
||||
@@ -194,7 +198,7 @@ module.exports = function(RED) {
|
||||
|
||||
function sendDebug(msg) {
|
||||
// don't put blank errors in sidebar (but do add to logs)
|
||||
//if ((msg.msg === "") && (msg.hasOwnProperty("level")) && (msg.level === 20)) { return; }
|
||||
//if ((msg.msg === "") && (hasOwnProperty.call(msg, "level")) && (msg.level === 20)) { return; }
|
||||
msg = RED.util.encodeObject(msg,{maxLength:debuglength});
|
||||
RED.comms.publish("debug",msg);
|
||||
}
|
||||
|
@@ -399,7 +399,7 @@
|
||||
$("#func-tabs-content").children().hide();
|
||||
$("#" + tab.id).show();
|
||||
let editor = $("#" + tab.id).find('.monaco-editor').first();
|
||||
if(editor.length) {
|
||||
if(editor.length) {
|
||||
if(that.editor.nodered && that.editor.type == "monaco") {
|
||||
that.editor.nodered.refreshModuleLibs(getLibsList());
|
||||
}
|
||||
|
@@ -112,6 +112,7 @@ module.exports = function(RED) {
|
||||
"var node = {"+
|
||||
"id:__node__.id,"+
|
||||
"name:__node__.name,"+
|
||||
"path:__node__.path,"+
|
||||
"outputCount:__node__.outputCount,"+
|
||||
"log:__node__.log,"+
|
||||
"error:__node__.error,"+
|
||||
@@ -163,6 +164,7 @@ module.exports = function(RED) {
|
||||
__node__: {
|
||||
id: node.id,
|
||||
name: node.name,
|
||||
path: node._path,
|
||||
outputCount: node.outputs,
|
||||
log: function() {
|
||||
node.log.apply(node, arguments);
|
||||
@@ -344,6 +346,7 @@ module.exports = function(RED) {
|
||||
var node = {
|
||||
id:__node__.id,
|
||||
name:__node__.name,
|
||||
path:__node__.path,
|
||||
outputCount:__node__.outputCount,
|
||||
log:__node__.log,
|
||||
error:__node__.error,
|
||||
@@ -366,6 +369,7 @@ module.exports = function(RED) {
|
||||
var node = {
|
||||
id:__node__.id,
|
||||
name:__node__.name,
|
||||
path:__node__.path,
|
||||
outputCount:__node__.outputCount,
|
||||
log:__node__.log,
|
||||
error:__node__.error,
|
||||
|
@@ -168,9 +168,9 @@ module.exports = function(RED) {
|
||||
return getFromValueType(RED.util.getMessageProperty(msg,rule.from),done);
|
||||
} else if (rule.fromt === 'flow' || rule.fromt === 'global') {
|
||||
var contextKey = RED.util.parseContextStore(rule.from);
|
||||
if (/\[msg\./.test(context.key)) {
|
||||
if (/\[msg\./.test(contextKey.key)) {
|
||||
// The key has a nest msg. reference to evaluate first
|
||||
context.key = RED.util.normalisePropertyExpression(contextKey.key,msg,true);
|
||||
contextKey.key = RED.util.normalisePropertyExpression(contextKey.key,msg,true);
|
||||
}
|
||||
node.context()[rule.fromt].get(contextKey.key, contextKey.store, (err,fromValue) => {
|
||||
if (err) {
|
||||
|
@@ -115,7 +115,7 @@
|
||||
timeoutUnits: {value:"seconds"},
|
||||
rate: {value:"1", required:true, validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
|
||||
nbRateUnits: {value:"1", required:false,
|
||||
validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
|
||||
validate:function(v) { return v === undefined || (RED.validators.number(v) && (v >= 0)); }},
|
||||
rateUnits: {value: "second"},
|
||||
randomFirst: {value:"1", required:true, validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
|
||||
randomLast: {value:"5", required:true, validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
|
||||
|
@@ -275,18 +275,22 @@ module.exports = function(RED) {
|
||||
if (msg.hasOwnProperty("flush")) {
|
||||
var len = node.buffer.length;
|
||||
if (typeof(msg.flush) == 'number') { len = Math.min(Math.floor(msg.flush),len); }
|
||||
while (len > 0) {
|
||||
const msgInfo = node.buffer.shift();
|
||||
if (Object.keys(msgInfo.msg).length > 1) {
|
||||
node.send(msgInfo.msg);
|
||||
msgInfo.done();
|
||||
}
|
||||
len = len - 1;
|
||||
}
|
||||
if (node.buffer.length === 0) {
|
||||
if (len === 0) {
|
||||
clearInterval(node.intervalID);
|
||||
node.intervalID = -1;
|
||||
}
|
||||
else {
|
||||
while (len > 0) {
|
||||
const msgInfo = node.buffer.shift();
|
||||
if (Object.keys(msgInfo.msg).length > 1) {
|
||||
node.send(msgInfo.msg);
|
||||
msgInfo.done();
|
||||
}
|
||||
len = len - 1;
|
||||
}
|
||||
clearInterval(node.intervalID);
|
||||
node.intervalID = setInterval(sendMsgFromBuffer, node.rate);
|
||||
}
|
||||
node.status({fill:"blue",shape:"dot",text:node.buffer.length});
|
||||
done();
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
var cmd = arg.shift();
|
||||
/* istanbul ignore else */
|
||||
if (RED.settings.verbose) { node.log(cmd+" ["+arg+"]"); }
|
||||
node.debug(cmd+" ["+arg+"]");
|
||||
child = spawn(cmd,arg,node.spawnOpt);
|
||||
node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid});
|
||||
var unknownCommand = (child.pid === undefined);
|
||||
@@ -136,7 +136,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
else {
|
||||
/* istanbul ignore else */
|
||||
if (RED.settings.verbose) { node.log(arg); }
|
||||
node.debug(arg);
|
||||
child = exec(arg, node.execOpt, function (error, stdout, stderr) {
|
||||
var msg2, msg3;
|
||||
delete msg.payload;
|
||||
@@ -155,7 +155,7 @@ module.exports = function(RED) {
|
||||
if (error.signal) { msg3.payload.signal = error.signal; }
|
||||
if (error.code === null) { node.status({fill:"red",shape:"dot",text:"killed"}); }
|
||||
else { node.status({fill:"red",shape:"dot",text:"error:"+error.code}); }
|
||||
if (RED.settings.verbose) { node.log('error:' + error); }
|
||||
node.debug('error:' + error);
|
||||
}
|
||||
else if (node.oldrc === "false") {
|
||||
msg3 = RED.util.cloneMessage(msg);
|
||||
|
@@ -442,7 +442,17 @@
|
||||
}
|
||||
return defaultContentType || 'none'
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a topic string is valid for publishing
|
||||
* @param {string} topic
|
||||
* @returns `true` if it is a valid topic
|
||||
*/
|
||||
function validateMQTTPublishTopic(topic, opts) {
|
||||
if(!topic || topic == "" || !/[\+#\b\f\n\r\t\v\0]/.test(topic)) {
|
||||
return true;
|
||||
}
|
||||
return RED._("node-red:mqtt.errors.invalid-topic");
|
||||
}
|
||||
RED.nodes.registerType('mqtt-broker',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
@@ -480,6 +490,7 @@
|
||||
willRetain: {value:false},
|
||||
willPayload: {value:""},
|
||||
willMsg: { value: {}},
|
||||
userProps: { value: ""},
|
||||
sessionExpiry: {value:0}
|
||||
},
|
||||
credentials: {
|
||||
@@ -609,6 +620,7 @@
|
||||
default: !this.userProps ? 'none':'json',
|
||||
types: [typedInputNoneOpt, 'json']
|
||||
});
|
||||
$("#node-config-input-userProps").typedInput('value',this.userProps);
|
||||
if (typeof this.keepalive === 'undefined') {
|
||||
this.keepalive = 15;
|
||||
$("#node-config-input-keepalive").val(this.keepalive);
|
||||
@@ -718,6 +730,14 @@
|
||||
}
|
||||
|
||||
if (v5) {
|
||||
this.userProps = "";
|
||||
const userPropsType = $("#node-config-input-userProps").typedInput("type");
|
||||
if(userPropsType == "json") {
|
||||
const userProps = $("#node-config-input-userProps").val();
|
||||
if (userProps && typeof userProps === "string") {
|
||||
this.userProps = userProps.trim();
|
||||
}
|
||||
}
|
||||
this.birthMsg = saveV5Message("birth");
|
||||
this.closeMsg = saveV5Message("close");
|
||||
this.willMsg = saveV5Message("will");
|
||||
|
@@ -68,12 +68,21 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a topic string is valid
|
||||
* Test a topic string is valid for subscription
|
||||
* @param {string} topic
|
||||
* @returns `true` if it is a valid topic
|
||||
*/
|
||||
function isValidSubscriptionTopic(topic) {
|
||||
return /^(#$|(\+|[^+#]*)(\/(\+|[^+#]*))*(\/(\+|#|[^+#]*))?$)/.test(topic)
|
||||
return /^(#$|(\+|[^+#]*)(\/(\+|[^+#]*))*(\/(\+|#|[^+#]*))?$)/.test(topic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a topic string is valid for publishing
|
||||
* @param {string} topic
|
||||
* @returns `true` if it is a valid topic
|
||||
*/
|
||||
function isValidPublishTopic(topic) {
|
||||
return !/[\+#\b\f\n\r\t\v\0]/.test(topic);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +112,7 @@ module.exports = function(RED) {
|
||||
if(src[propName] === "true" || src[propName] === true) {
|
||||
dst[propName] = true;
|
||||
} else if(src[propName] === "false" || src[propName] === false) {
|
||||
dst[propName] = true;
|
||||
dst[propName] = false;
|
||||
}
|
||||
} else {
|
||||
if(def != undefined) dst[propName] = def;
|
||||
@@ -288,7 +297,7 @@ module.exports = function(RED) {
|
||||
//TODO: delete msg.responseTopic - to prevent it being resent?
|
||||
}
|
||||
}
|
||||
topicOK = topicOK && !/[\+#]/.test(msg.topic);
|
||||
topicOK = topicOK && isValidPublishTopic(msg.topic);
|
||||
|
||||
if (topicOK) {
|
||||
node.brokerConn.publish(msg, done); // send the message
|
||||
@@ -391,6 +400,7 @@ module.exports = function(RED) {
|
||||
node.options = {};
|
||||
node.queue = [];
|
||||
node.subscriptions = {};
|
||||
node.clientListeners = []
|
||||
/** @type {mqtt.MqttClient}*/ this.client;
|
||||
node.setOptions = function(opts, init) {
|
||||
if(!opts || typeof opts !== "object") {
|
||||
@@ -415,8 +425,12 @@ module.exports = function(RED) {
|
||||
setIfHasProperty(opts, node, "topicAliasMaximum", init);
|
||||
setIfHasProperty(opts, node, "maximumPacketSize", init);
|
||||
setIfHasProperty(opts, node, "receiveMaximum", init);
|
||||
setIfHasProperty(opts, node, "userProperties", init);//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
||||
setIfHasProperty(opts, node, "userPropertiesType", init);
|
||||
//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
||||
if (hasProperty(opts, "userProperties")) {
|
||||
node.userProperties = opts.userProperties;
|
||||
} else if (hasProperty(opts, "userProps")) {
|
||||
node.userProperties = opts.userProps;
|
||||
}
|
||||
|
||||
function createLWT(topic, payload, qos, retain, v5opts, v5SubPropName) {
|
||||
let message = undefined;
|
||||
@@ -465,7 +479,7 @@ module.exports = function(RED) {
|
||||
};
|
||||
if(hasProperty(opts, "willTopic")) {
|
||||
//will v5 properties must be set in the "properties" sub object
|
||||
node.options.will = createLWT(opts.willTopic, opts.willPayload, opts.willQos, opts.willRetain, opts.willMsg, "properies");
|
||||
node.options.will = createLWT(opts.willTopic, opts.willPayload, opts.willQos, opts.willRetain, opts.willMsg, "properties");
|
||||
};
|
||||
} else {
|
||||
//update options
|
||||
@@ -525,7 +539,7 @@ module.exports = function(RED) {
|
||||
// Only for ws or wss, check if proxy env var for additional configuration
|
||||
if (node.brokerurl.indexOf("wss://") > -1 || node.brokerurl.indexOf("ws://") > -1) {
|
||||
// check if proxy is set in env
|
||||
let prox, noprox;
|
||||
let prox, noprox, noproxy;
|
||||
if (process.env.http_proxy) { prox = process.env.http_proxy; }
|
||||
if (process.env.HTTP_PROXY) { prox = process.env.HTTP_PROXY; }
|
||||
if (process.env.no_proxy) { noprox = process.env.no_proxy.split(","); }
|
||||
@@ -637,24 +651,8 @@ module.exports = function(RED) {
|
||||
|
||||
node.deregister = function(mqttNode,done) {
|
||||
delete node.users[mqttNode.id];
|
||||
if (node.closing) {
|
||||
return done();
|
||||
}
|
||||
if (Object.keys(node.users).length === 0) {
|
||||
if (node.client && node.client.connected) {
|
||||
// Send close message
|
||||
if (node.closeMessage) {
|
||||
node.publish(node.closeMessage,function(err) {
|
||||
node.client.end(done);
|
||||
});
|
||||
} else {
|
||||
node.client.end(done);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (node.client) { node.client.end(); }
|
||||
return done();
|
||||
}
|
||||
if (!node.closing && node.connected && Object.keys(node.users).length === 0) {
|
||||
node.disconnect();
|
||||
}
|
||||
done();
|
||||
};
|
||||
@@ -663,15 +661,22 @@ module.exports = function(RED) {
|
||||
}
|
||||
node.connect = function (callback) {
|
||||
if (node.canConnect()) {
|
||||
node.closing = false;
|
||||
node.connecting = true;
|
||||
setStatusConnecting(node, true);
|
||||
try {
|
||||
node.serverProperties = {};
|
||||
if(node.client) {
|
||||
//belt and braces to avoid left over clients
|
||||
node.client.end(true);
|
||||
node._clientRemoveListeners();
|
||||
}
|
||||
node.client = mqtt.connect(node.brokerurl, node.options);
|
||||
node.client.setMaxListeners(0);
|
||||
let callbackDone = false; //prevent re-connects causing node.client.on('connect' firing callback multiple times
|
||||
let callbackDone = false; //prevent re-connects causing node._clientOn('connect' firing callback multiple times
|
||||
// Register successful connect or reconnect handler
|
||||
node.client.on('connect', function (connack) {
|
||||
node._clientOn('connect', function (connack) {
|
||||
node.closing = false;
|
||||
node.connecting = false;
|
||||
node.connected = true;
|
||||
if(!callbackDone && typeof callback == "function") {
|
||||
@@ -702,7 +707,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
setStatusConnected(node, true);
|
||||
// Remove any existing listeners before resubscribing to avoid duplicates in the event of a re-connection
|
||||
node.client.removeAllListeners('message');
|
||||
node._clientRemoveListeners('message');
|
||||
|
||||
// Re-subscribe to stored topics
|
||||
for (var s in node.subscriptions) {
|
||||
@@ -714,7 +719,7 @@ module.exports = function(RED) {
|
||||
if (node.subscriptions[s].hasOwnProperty(r)) {
|
||||
qos = Math.max(qos,node.subscriptions[s][r].qos);
|
||||
_options = node.subscriptions[s][r].options;
|
||||
node.client.on('message',node.subscriptions[s][r].handler);
|
||||
node._clientOn('message',node.subscriptions[s][r].handler);
|
||||
}
|
||||
}
|
||||
_options.qos = _options.qos || qos;
|
||||
@@ -727,18 +732,25 @@ module.exports = function(RED) {
|
||||
node.publish(node.birthMessage);
|
||||
}
|
||||
});
|
||||
node.client.on("reconnect", function() {
|
||||
node._clientOn("reconnect", function() {
|
||||
setStatusConnecting(node, true);
|
||||
});
|
||||
//TODO: what to do with this event? Anything? Necessary?
|
||||
node.client.on("disconnect", function(packet) {
|
||||
//Broker Disconnect - V5 event
|
||||
node._clientOn("disconnect", function(packet) {
|
||||
//Emitted after receiving disconnect packet from broker. MQTT 5.0 feature.
|
||||
var rc = packet && packet.properties && packet.properties.reasonString;
|
||||
var rc = packet && packet.properties && packet.reasonCode;
|
||||
//TODO: If keeping this event, do we use these? log these?
|
||||
const rc = (packet && packet.properties && packet.reasonCode) || packet.reasonCode;
|
||||
const rs = packet && packet.properties && packet.properties.reasonString || "";
|
||||
const details = {
|
||||
broker: (node.clientid?node.clientid+"@":"")+node.brokerurl,
|
||||
reasonCode: rc,
|
||||
reasonString: rs
|
||||
}
|
||||
node.connected = false;
|
||||
node.log(RED._("mqtt.state.broker-disconnected", details));
|
||||
setStatusDisconnected(node, true);
|
||||
});
|
||||
// Register disconnect handlers
|
||||
node.client.on('close', function () {
|
||||
node._clientOn('close', function () {
|
||||
if (node.connected) {
|
||||
node.connected = false;
|
||||
node.log(RED._("mqtt.state.disconnected",{broker:(node.clientid?node.clientid+"@":"")+node.brokerurl}));
|
||||
@@ -750,33 +762,59 @@ module.exports = function(RED) {
|
||||
|
||||
// Register connect error handler
|
||||
// The client's own reconnect logic will take care of errors
|
||||
node.client.on('error', function (error) {
|
||||
node._clientOn('error', function (error) {
|
||||
});
|
||||
}catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
node.disconnect = function (callback) {
|
||||
const _callback = function () {
|
||||
setStatusDisconnected(node, true);
|
||||
if(node.connected || node.connecting) {
|
||||
setStatusDisconnected(node, true);
|
||||
}
|
||||
if(node.client) { node._clientRemoveListeners(); }
|
||||
node.connecting = false;
|
||||
node.connected = false;
|
||||
callback && typeof callback == "function" && callback();
|
||||
};
|
||||
if(!node.client) { return _callback(); }
|
||||
if(node.closing) { return _callback(); }
|
||||
|
||||
if(node.client) {
|
||||
if(node.client.connected && node.closeMessage) {
|
||||
node.publish(node.closeMessage, function (err) {
|
||||
node.client.end(_callback);
|
||||
});
|
||||
} else if(node.client.connected || node.client.reconnecting) {
|
||||
node.client.end(_callback);
|
||||
} else if(node.client.disconnecting || node.client.connected === false) {
|
||||
_callback();
|
||||
}
|
||||
let waitEnd = (client, ms) => {
|
||||
return new Promise( (resolve, reject) => {
|
||||
node.closing = true;
|
||||
if(!client) {
|
||||
resolve();
|
||||
} else {
|
||||
const t = setTimeout(() => {
|
||||
//clean end() has exceeded WAIT_END, lets force end!
|
||||
client && client.end(true);
|
||||
reject();
|
||||
}, ms);
|
||||
client.end(() => {
|
||||
clearTimeout(t);
|
||||
resolve()
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
if(node.connected && node.closeMessage) {
|
||||
node.publish(node.closeMessage, function (err) {
|
||||
waitEnd(node.client, 2000).then(() => {
|
||||
_callback();
|
||||
}).catch((e) => {
|
||||
_callback();
|
||||
})
|
||||
});
|
||||
} else {
|
||||
_callback();
|
||||
waitEnd(node.client, 2000).then(() => {
|
||||
_callback();
|
||||
}).catch((e) => {
|
||||
_callback();
|
||||
})
|
||||
}
|
||||
}
|
||||
node.subscriptionIds = {};
|
||||
@@ -813,7 +851,7 @@ module.exports = function(RED) {
|
||||
};
|
||||
node.subscriptions[topic][ref] = sub;
|
||||
if (node.connected) {
|
||||
node.client.on('message',sub.handler);
|
||||
node._clientOn('message',sub.handler);
|
||||
node.client.subscribe(topic, options);
|
||||
}
|
||||
};
|
||||
@@ -824,7 +862,7 @@ module.exports = function(RED) {
|
||||
if (sub) {
|
||||
if (sub[ref]) {
|
||||
if(node.client) {
|
||||
node.client.removeListener('message',sub[ref].handler);
|
||||
node._clientRemoveListeners('message',sub[ref].handler);
|
||||
}
|
||||
delete sub[ref];
|
||||
}
|
||||
@@ -858,8 +896,18 @@ module.exports = function(RED) {
|
||||
qos: msg.qos || 0,
|
||||
retain: msg.retain || false
|
||||
};
|
||||
let topicOK = hasProperty(msg, "topic") && (typeof msg.topic === "string") && (isValidPublishTopic(msg.topic));
|
||||
//https://github.com/mqttjs/MQTT.js/blob/master/README.md#mqttclientpublishtopic-message-options-callback
|
||||
if(node.options.protocolVersion == 5) {
|
||||
const bsp = node.serverProperties || {};
|
||||
if (msg.userProperties && typeof msg.userProperties !== "object") {
|
||||
delete msg.userProperties;
|
||||
}
|
||||
if (hasProperty(msg, "topicAlias") && !isNaN(Number(msg.topicAlias))) {
|
||||
msg.topicAlias = parseInt(msg.topicAlias);
|
||||
} else {
|
||||
delete msg.topicAlias;
|
||||
}
|
||||
options.properties = options.properties || {};
|
||||
setStrProp(msg, options.properties, "responseTopic");
|
||||
setBufferProp(msg, options.properties, "correlationData");
|
||||
@@ -869,31 +917,75 @@ module.exports = function(RED) {
|
||||
setIntProp(msg, options.properties, "topicAlias", 1, node.serverProperties.topicAliasMaximum || 0);
|
||||
setBoolProp(msg, options.properties, "payloadFormatIndicator");
|
||||
//FUTURE setIntProp(msg, options.properties, "subscriptionIdentifier", 1, 268435455);
|
||||
if (options.properties.topicAlias) {
|
||||
if (!node.topicAliases.hasOwnProperty(options.properties.topicAlias) && msg.topic == "") {
|
||||
|
||||
//check & sanitise topic
|
||||
if (topicOK && options.properties.topicAlias) {
|
||||
let aliasValid = (bsp.topicAliasMaximum && bsp.topicAliasMaximum >= options.properties.topicAlias);
|
||||
if (!aliasValid) {
|
||||
done("Invalid topicAlias");
|
||||
return
|
||||
}
|
||||
if (node.topicAliases[options.properties.topicAlias] === msg.topic) {
|
||||
msg.topic = ""
|
||||
msg.topic = "";
|
||||
} else {
|
||||
node.topicAliases[options.properties.topicAlias] = msg.topic
|
||||
node.topicAliases[options.properties.topicAlias] = msg.topic;
|
||||
}
|
||||
} else if (!msg.topic && options.properties.responseTopic) {
|
||||
msg.topic = msg.responseTopic;
|
||||
topicOK = isValidPublishTopic(msg.topic);
|
||||
delete msg.responseTopic; //prevent responseTopic being resent?
|
||||
}
|
||||
}
|
||||
|
||||
node.client.publish(msg.topic, msg.payload, options, function(err) {
|
||||
done && done(err);
|
||||
return
|
||||
});
|
||||
if (topicOK) {
|
||||
node.client.publish(msg.topic, msg.payload, options, function(err) {
|
||||
done && done(err);
|
||||
return
|
||||
});
|
||||
} else {
|
||||
const error = new Error(RED._("mqtt.errors.invalid-topic"));
|
||||
error.warn = true;
|
||||
done(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
node.on('close', function(done) {
|
||||
node.closing = true;
|
||||
node.disconnect(done);
|
||||
node.disconnect(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Add event handlers to the MQTT.js client and track them so that
|
||||
* we do not remove any handlers that the MQTT client uses internally.
|
||||
* Use {@link node._clientRemoveListeners `node._clientRemoveListeners`} to remove handlers
|
||||
* @param {string} event The name of the event
|
||||
* @param {function} handler The handler for this event
|
||||
*/
|
||||
node._clientOn = function(event, handler) {
|
||||
node.clientListeners.push({event, handler})
|
||||
node.client.on(event, handler)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove event handlers from the MQTT.js client & only the events
|
||||
* that we attached in {@link node._clientOn `node._clientOn`}.
|
||||
* * If `event` is omitted, then all events matching `handler` are removed
|
||||
* * If `handler` is omitted, then all events named `event` are removed
|
||||
* * If both parameters are omitted, then all events are removed
|
||||
* @param {string} [event] The name of the event (optional)
|
||||
* @param {function} [handler] The handler for this event (optional)
|
||||
*/
|
||||
node._clientRemoveListeners = function(event, handler) {
|
||||
node.clientListeners = node.clientListeners.filter((l) => {
|
||||
if (event && event !== l.event) { return true; }
|
||||
if (handler && handler !== l.handler) { return true; }
|
||||
node.client.removeListener(l.event, l.handler)
|
||||
return false; //found and removed, filter out this one
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RED.nodes.registerType("mqtt-broker",MQTTBrokerNode,{
|
||||
@@ -1068,6 +1160,9 @@ module.exports = function(RED) {
|
||||
node.brokerConn.unsubscribe(node.topic,node.id, removed);
|
||||
}
|
||||
node.brokerConn.deregister(node, done);
|
||||
node.brokerConn = null;
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -1128,7 +1223,12 @@ module.exports = function(RED) {
|
||||
}
|
||||
node.brokerConn.register(node);
|
||||
node.on('close', function(done) {
|
||||
node.brokerConn.deregister(node,done);
|
||||
if (node.brokerConn) {
|
||||
node.brokerConn.deregister(node,done);
|
||||
node.brokerConn = null;
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
node.error(RED._("mqtt.errors.missing-config"));
|
||||
|
@@ -91,6 +91,11 @@
|
||||
<label for="node-input-senderr" style="width: auto" data-i18n="httpin.senderr"></label>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<input type="checkbox" id="node-input-insecureHTTPParser" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
<label for="node-input-insecureHTTPParser", style="width: auto;" data-i18n="httpin.insecureHTTPParser"></label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-ret"><i class="fa fa-arrow-left"></i> <span data-i18n="httpin.label.return"></span></label>
|
||||
@@ -120,6 +125,7 @@
|
||||
tls: {type:"tls-config",required: false},
|
||||
persist: {value:false},
|
||||
proxy: {type:"http proxy",required: false},
|
||||
insecureHTTPParser: {value: false},
|
||||
authType: {value: ""},
|
||||
senderr: {value: false}
|
||||
},
|
||||
@@ -224,6 +230,12 @@
|
||||
} else {
|
||||
$("#node-input-useProxy").prop("checked", false);
|
||||
}
|
||||
|
||||
if (node.insecureHTTPParser) {
|
||||
$("node-intput-insecureHTTPParser").prop("checked", true)
|
||||
} else {
|
||||
$("node-intput-insecureHTTPParser").prop("checked", false)
|
||||
}
|
||||
updateProxyOptions();
|
||||
$("#node-input-useProxy").on("click", function() {
|
||||
updateProxyOptions();
|
||||
|
@@ -214,6 +214,10 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
delete options.headers[h];
|
||||
}
|
||||
})
|
||||
|
||||
if (node.insecureHTTPParser) {
|
||||
options.insecureHTTPParser = true
|
||||
}
|
||||
}
|
||||
],
|
||||
beforeRedirect: [
|
||||
@@ -264,7 +268,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
if (opts.headers.hasOwnProperty('cookie')) {
|
||||
var cookies = cookie.parse(opts.headers.cookie, {decode:String});
|
||||
for (var name in cookies) {
|
||||
opts.cookieJar.setCookie(cookie.serialize(name, cookies[name], {encode:String}), url, {ignoreError: true});
|
||||
opts.cookieJar.setCookieSync(cookie.serialize(name, cookies[name], {encode:String}), url, {ignoreError: true});
|
||||
}
|
||||
delete opts.headers.cookie;
|
||||
}
|
||||
@@ -277,13 +281,13 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
} else if (typeof msg.cookies[name] === 'object') {
|
||||
if(msg.cookies[name].encode === false){
|
||||
// If the encode option is false, the value is not encoded.
|
||||
opts.cookieJar.setCookie(cookie.serialize(name, msg.cookies[name].value, {encode: String}), url, {ignoreError: true});
|
||||
opts.cookieJar.setCookieSync(cookie.serialize(name, msg.cookies[name].value, {encode: String}), url, {ignoreError: true});
|
||||
} else {
|
||||
// The value is encoded by encodeURIComponent().
|
||||
opts.cookieJar.setCookie(cookie.serialize(name, msg.cookies[name].value), url, {ignoreError: true});
|
||||
opts.cookieJar.setCookieSync(cookie.serialize(name, msg.cookies[name].value), url, {ignoreError: true});
|
||||
}
|
||||
} else {
|
||||
opts.cookieJar.setCookie(cookie.serialize(name, msg.cookies[name]), url, {ignoreError: true});
|
||||
opts.cookieJar.setCookieSync(cookie.serialize(name, msg.cookies[name]), url, {ignoreError: true});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -177,7 +177,8 @@
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/)},
|
||||
tls: {type:"tls-config",required: false},
|
||||
wholemsg: {value:"false"},
|
||||
hb: {value: "", validate: RED.validators.number(/*blank allowed*/true) }
|
||||
hb: {value: "", validate: RED.validators.number(/*blank allowed*/true) },
|
||||
subprotocol: {value:"",required: false}
|
||||
},
|
||||
inputs:0,
|
||||
outputs:0,
|
||||
@@ -265,7 +266,10 @@
|
||||
<label for="node-config-input-tls" data-i18n="httpin.tls-config"></label>
|
||||
<input type="text" id="node-config-input-tls">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-subprotocol"><i class="fa fa-tag"></i> <span data-i18n="websocket.label.subprotocol"></span></label>
|
||||
<input type="text" id="node-config-input-subprotocol">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-wholemsg" data-i18n="websocket.sendrec"></label>
|
||||
<select type="text" id="node-config-input-wholemsg" style="width: 70%;">
|
||||
|
@@ -35,8 +35,6 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
var listenerNodes = {};
|
||||
var activeListenerNodes = 0;
|
||||
|
||||
|
||||
// A node red node that sets up a local websocket server
|
||||
function WebSocketListenerNode(n) {
|
||||
@@ -46,6 +44,12 @@ module.exports = function(RED) {
|
||||
|
||||
// Store local copies of the node configuration (as defined in the .html)
|
||||
node.path = n.path;
|
||||
if (typeof n.subprotocol === "string") {
|
||||
// Split the string on comma and trim each result
|
||||
node.subprotocol = n.subprotocol.split(",").map(v => v.trim())
|
||||
} else {
|
||||
node.subprotocol = [];
|
||||
}
|
||||
node.wholemsg = (n.wholemsg === "true");
|
||||
|
||||
node._inputNodes = []; // collection of nodes that want to receive events
|
||||
@@ -92,7 +96,7 @@ module.exports = function(RED) {
|
||||
tlsNode.addTLSOptions(options);
|
||||
}
|
||||
}
|
||||
var socket = new ws(node.path,options);
|
||||
var socket = new ws(node.path,node.subprotocol,options);
|
||||
socket.setMaxListeners(0);
|
||||
node.server = socket; // keep for closing
|
||||
handleConnection(socket);
|
||||
@@ -160,7 +164,6 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
if (node.isServer) {
|
||||
activeListenerNodes++;
|
||||
if (!serverUpgradeAdded) {
|
||||
RED.server.on('upgrade', handleServerUpgrade);
|
||||
serverUpgradeAdded = true
|
||||
@@ -204,7 +207,7 @@ module.exports = function(RED) {
|
||||
startconn(); // start outbound connection
|
||||
}
|
||||
|
||||
node.on("close", function() {
|
||||
node.on("close", function(done) {
|
||||
if (node.heartbeatInterval) {
|
||||
clearInterval(node.heartbeatInterval);
|
||||
}
|
||||
@@ -212,19 +215,25 @@ module.exports = function(RED) {
|
||||
delete listenerNodes[node.fullPath];
|
||||
node.server.close();
|
||||
node._inputNodes = [];
|
||||
activeListenerNodes--;
|
||||
// if (activeListenerNodes === 0 && serverUpgradeAdded) {
|
||||
// RED.server.removeListener('upgrade', handleServerUpgrade);
|
||||
// serverUpgradeAdded = false;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
node.closing = true;
|
||||
node.server.close();
|
||||
if (node.tout) {
|
||||
clearTimeout(node.tout);
|
||||
node.tout = null;
|
||||
}
|
||||
//wait 20*50 (1000ms max) for ws to close.
|
||||
//call done when readyState === ws.CLOSED (or 1000ms, whichever comes fist)
|
||||
const closeMonitorInterval = 20;
|
||||
let closeMonitorCount = 50;
|
||||
let si = setInterval(() => {
|
||||
if(node.server.readyState === ws.CLOSED || closeMonitorCount <= 0) {
|
||||
if (node.tout) {
|
||||
clearTimeout(node.tout);
|
||||
node.tout = null;
|
||||
}
|
||||
clearInterval(si);
|
||||
return done();
|
||||
}
|
||||
closeMonitorCount--;
|
||||
}, closeMonitorInterval);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -23,9 +23,17 @@
|
||||
</select>
|
||||
<span data-i18n="tcpin.label.port"></span> <input type="text" id="node-input-port" style="width:65px">
|
||||
</div>
|
||||
<div class="form-row hidden" id="node-input-host-row" style="padding-left: 110px;">
|
||||
<div class="form-row hidden" id="node-input-host-row" style="padding-left:110px;">
|
||||
<span data-i18n="tcpin.label.host"></span> <input type="text" id="node-input-host" placeholder="localhost" style="width: 60%;">
|
||||
</div>
|
||||
<div class="form-row" id="node-input-tls-enable">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-usetls" style="display: inline-block; width:auto; vertical-align:top;">
|
||||
<label for="node-input-usetls" style="width:auto" data-i18n="httpin.use-tls"></label>
|
||||
<div id="node-row-tls" class="hide">
|
||||
<label style="width:auto; margin-left:20px; margin-right:10px;" for="node-input-tls"><span data-i18n="httpin.tls-config"></span></label><input type="text" style="width: 300px" id="node-input-tls">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.output"></span></label>
|
||||
@@ -42,7 +50,7 @@
|
||||
</div>
|
||||
|
||||
<div id="node-row-newline" class="form-row hidden" style="padding-left:110px;">
|
||||
<span data-i18n="tcpin.label.delimited"></span> <input type="text" id="node-input-newline" style="width:110px;">
|
||||
<span data-i18n="tcpin.label.delimited"></span> <input type="text" id="node-input-newline" style="width:110px;" data-i18n="[placeholder]tcpin.label.optional">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
@@ -58,17 +66,18 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('tcp in',{
|
||||
category: 'network',
|
||||
color:"Silver",
|
||||
color: "Silver",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
server: {value:"server",required:true},
|
||||
host: {value:"",validate:function(v) { return (this.server == "server")||v.length > 0;} },
|
||||
port: {value:"",required:true,validate:RED.validators.number()},
|
||||
server: {value:"server", required:true},
|
||||
host: {value:"", validate:function(v) { return (this.server == "server")||v.length > 0;} },
|
||||
port: {value:"", required:true, validate:RED.validators.number()},
|
||||
datamode:{value:"stream"},
|
||||
datatype:{value:"buffer"},
|
||||
newline:{value:""},
|
||||
topic: {value:""},
|
||||
base64: {/*deprecated*/ value:false,required:true}
|
||||
base64: {/*deprecated*/ value:false, required:true},
|
||||
tls: {type:"tls-config", value:'', required:false}
|
||||
},
|
||||
inputs:0,
|
||||
outputs:1,
|
||||
@@ -77,7 +86,7 @@
|
||||
return this.name || "tcp:"+(this.host?this.host+":":"")+this.port;
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
return this.name ? "node_label_italic" : "";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
var updateOptions = function() {
|
||||
@@ -103,6 +112,27 @@
|
||||
$("#node-input-server").change(updateOptions);
|
||||
$("#node-input-datatype").change(updateOptions);
|
||||
$("#node-input-datamode").change(updateOptions);
|
||||
function updateTLSOptions() {
|
||||
if ($("#node-input-usetls").is(':checked')) {
|
||||
$("#node-row-tls").show();
|
||||
} else {
|
||||
$("#node-row-tls").hide();
|
||||
}
|
||||
}
|
||||
if (this.tls) {
|
||||
$('#node-input-usetls').prop('checked', true);
|
||||
} else {
|
||||
$('#node-input-usetls').prop('checked', false);
|
||||
}
|
||||
updateTLSOptions();
|
||||
$("#node-input-usetls").on("click",function() {
|
||||
updateTLSOptions();
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
if (!$("#node-input-usetls").is(':checked')) {
|
||||
$("#node-input-tls").val("_ADD_");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -123,6 +153,15 @@
|
||||
<span data-i18n="tcpin.label.host"></span> <input type="text" id="node-input-host" style="width: 60%;">
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="node-input-tls-enable">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-usetls" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
<label for="node-input-usetls" style="width: auto" data-i18n="httpin.use-tls"></label>
|
||||
<div id="node-row-tls" class="hide">
|
||||
<label style="width: auto; margin-left: 20px; margin-right: 10px;" for="node-input-tls"><span data-i18n="httpin.tls-config"></span></label><input type="text" style="width: 300px" id="node-input-tls">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row hidden" id="node-input-end-row">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-end" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
@@ -144,14 +183,15 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('tcp out',{
|
||||
category: 'network',
|
||||
color:"Silver",
|
||||
color: "Silver",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
host: {value:"",validate:function(v) { return (this.beserver != "client")||v.length > 0;} },
|
||||
port: {value:"",validate:function(v) { return (this.beserver == "reply")||RED.validators.number()(v); } },
|
||||
beserver: {value:"client",required:true},
|
||||
base64: {value:false,required:true},
|
||||
end: {value:false,required:true},
|
||||
name: {value:""}
|
||||
beserver: {value:"client", required:true},
|
||||
base64: {value:false, required:true},
|
||||
end: {value:false, required:true},
|
||||
tls: {type:"tls-config", value:'', required:false}
|
||||
},
|
||||
inputs:1,
|
||||
outputs:0,
|
||||
@@ -170,18 +210,42 @@
|
||||
$("#node-input-port-row").hide();
|
||||
$("#node-input-host-row").hide();
|
||||
$("#node-input-end-row").hide();
|
||||
$("#node-input-tls-enable").hide();
|
||||
} else if (sockettype == "client"){
|
||||
$("#node-input-port-row").show();
|
||||
$("#node-input-host-row").show();
|
||||
$("#node-input-end-row").show();
|
||||
$("#node-input-tls-enable").show();
|
||||
} else {
|
||||
$("#node-input-port-row").show();
|
||||
$("#node-input-host-row").hide();
|
||||
$("#node-input-end-row").show();
|
||||
$("#node-input-tls-enable").show();
|
||||
}
|
||||
};
|
||||
updateOptions();
|
||||
$("#node-input-beserver").change(updateOptions);
|
||||
function updateTLSOptions() {
|
||||
if ($("#node-input-usetls").is(':checked')) {
|
||||
$("#node-row-tls").show();
|
||||
} else {
|
||||
$("#node-row-tls").hide();
|
||||
}
|
||||
}
|
||||
if (this.tls) {
|
||||
$('#node-input-usetls').prop('checked', true);
|
||||
} else {
|
||||
$('#node-input-usetls').prop('checked', false);
|
||||
}
|
||||
updateTLSOptions();
|
||||
$("#node-input-usetls").on("click",function() {
|
||||
updateTLSOptions();
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
if (!$("#node-input-usetls").is(':checked')) {
|
||||
$("#node-input-tls").val("_ADD_");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -194,15 +258,23 @@
|
||||
<span data-i18n="tcpin.label.port"></span>
|
||||
<input type="text" id="node-input-port" style="width:60px">
|
||||
</div>
|
||||
<div class="form-row" id="node-input-tls-enable">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-usetls" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
<label for="node-input-usetls" style="width: auto" data-i18n="httpin.use-tls"></label>
|
||||
<div id="node-row-tls" class="hide">
|
||||
<label style="width: auto; margin-left: 20px; margin-right: 10px;" for="node-input-tls"><span data-i18n="httpin.tls-config"></span></label><input type="text" style="width: 300px" id="node-input-tls">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-out"><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.return"></span></label>
|
||||
<label for="node-input-ret"><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.return"></span></label>
|
||||
<select type="text" id="node-input-ret" style="width:54%;">
|
||||
<option value="buffer" data-i18n="tcpin.output.buffer"></option>
|
||||
<option value="string" data-i18n="tcpin.output.string"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-out"> </label>
|
||||
<label for="node-input-out"><i class="fa fa-sign-out fa-rotate-90"></i> <span data-i18n="tcpin.label.close"></span></label>
|
||||
<select type="text" id="node-input-out" style="width:54%;">
|
||||
<option value="time" data-i18n="tcpin.return.timeout"></option>
|
||||
<option value="char" data-i18n="tcpin.return.character"></option>
|
||||
@@ -213,6 +285,9 @@
|
||||
<input type="text" id="node-input-splitc" style="width:50px;">
|
||||
<span id="node-units"></span>
|
||||
</div>
|
||||
<div id="node-row-newline" class="form-row hidden" style="padding-left:162px;">
|
||||
<span data-i18n="tcpin.label.delimited"></span> <input type="text" id="node-input-newline" style="width:110px;" data-i18n="[placeholder]tcpin.label.optional">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
@@ -222,14 +297,16 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('tcp request',{
|
||||
category: 'network',
|
||||
color:"Silver",
|
||||
color: "Silver",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
server: {value:""},
|
||||
port: {value:"",validate:RED.validators.regex(/^(\d*|)$/)},
|
||||
out: {value:"time",required:true},
|
||||
port: {value:"", validate:RED.validators.regex(/^(\d*|)$/)},
|
||||
out: {value:"time", required:true},
|
||||
ret: {value:"buffer"},
|
||||
splitc: {value:"0",required:true},
|
||||
name: {value:""}
|
||||
splitc: {value:"0", required:true},
|
||||
newline: {value:""},
|
||||
tls: {type:"tls-config", value:'', required:false}
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
@@ -246,6 +323,14 @@
|
||||
$("#node-input-ret").val("buffer");
|
||||
this.ret = "buffer";
|
||||
}
|
||||
$("#node-input-ret").on("change", function() {
|
||||
if ($("#node-input-ret").val() === "string" && $("#node-input-out").val() === "sit") { $("#node-row-newline").show(); }
|
||||
else { $("#node-row-newline").hide(); }
|
||||
});
|
||||
$("#node-input-out").on("change", function() {
|
||||
if ($("#node-input-ret").val() === "string" && $("#node-input-out").val() === "sit") { $("#node-row-newline").show(); }
|
||||
else { $("#node-row-newline").hide(); }
|
||||
});
|
||||
$("#node-input-out").on('focus', function () { previous = this.value; }).on("change", function() {
|
||||
$("#node-input-splitc").show();
|
||||
if (previous === null) { previous = $("#node-input-out").val(); }
|
||||
@@ -272,6 +357,27 @@
|
||||
$("#node-input-splitc").hide();
|
||||
}
|
||||
});
|
||||
function updateTLSOptions() {
|
||||
if ($("#node-input-usetls").is(':checked')) {
|
||||
$("#node-row-tls").show();
|
||||
} else {
|
||||
$("#node-row-tls").hide();
|
||||
}
|
||||
}
|
||||
if (this.tls) {
|
||||
$('#node-input-usetls').prop('checked', true);
|
||||
} else {
|
||||
$('#node-input-usetls').prop('checked', false);
|
||||
}
|
||||
updateTLSOptions();
|
||||
$("#node-input-usetls").on("click",function() {
|
||||
updateTLSOptions();
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
if (!$("#node-input-usetls").is(':checked')) {
|
||||
$("#node-input-tls").val("_ADD_");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@@ -16,13 +16,46 @@
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
var reconnectTime = RED.settings.socketReconnectTime||10000;
|
||||
var socketTimeout = RED.settings.socketTimeout||null;
|
||||
let reconnectTime = RED.settings.socketReconnectTime || 10000;
|
||||
let socketTimeout = RED.settings.socketTimeout || null;
|
||||
const msgQueueSize = RED.settings.tcpMsgQueueSize || 1000;
|
||||
const Denque = require('denque');
|
||||
var net = require('net');
|
||||
const net = require('net');
|
||||
const tls = require('tls');
|
||||
|
||||
var connectionPool = {};
|
||||
let connectionPool = {};
|
||||
|
||||
function normalizeConnectArgs(listArgs) {
|
||||
const args = net._normalizeArgs(listArgs);
|
||||
const options = args[0];
|
||||
const cb = args[1];
|
||||
|
||||
// If args[0] was options, then normalize dealt with it.
|
||||
// If args[0] is port, or args[0], args[1] is host, port, we need to
|
||||
// find the options and merge them in, normalize's options has only
|
||||
// the host/port/path args that it knows about, not the tls options.
|
||||
// This means that options.host overrides a host arg.
|
||||
if (listArgs[1] !== null && typeof listArgs[1] === 'object') {
|
||||
ObjectAssign(options, listArgs[1]);
|
||||
} else if (listArgs[2] !== null && typeof listArgs[2] === 'object') {
|
||||
ObjectAssign(options, listArgs[2]);
|
||||
}
|
||||
|
||||
return cb ? [options, cb] : [options];
|
||||
}
|
||||
|
||||
function getAllowUnauthorized() {
|
||||
const allowUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0';
|
||||
|
||||
if (allowUnauthorized) {
|
||||
process.emitWarning(
|
||||
'Setting the NODE_TLS_REJECT_UNAUTHORIZED ' +
|
||||
'environment variable to \'0\' makes TLS connections ' +
|
||||
'and HTTPS requests insecure by disabling ' +
|
||||
'certificate verification.');
|
||||
}
|
||||
return allowUnauthorized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue `item` in `queue`
|
||||
@@ -53,13 +86,14 @@ module.exports = function(RED) {
|
||||
this.topic = n.topic;
|
||||
this.stream = (!n.datamode||n.datamode=='stream'); /* stream,single*/
|
||||
this.datatype = n.datatype||'buffer'; /* buffer,utf8,base64 */
|
||||
this.newline = (n.newline||"").replace("\\n","\n").replace("\\r","\r");
|
||||
this.newline = (n.newline||"").replace("\\n","\n").replace("\\r","\r").replace("\\t","\t");
|
||||
this.base64 = n.base64;
|
||||
this.server = (typeof n.server == 'boolean')?n.server:(n.server == "server");
|
||||
this.closing = false;
|
||||
this.connected = false;
|
||||
var node = this;
|
||||
var count = 0;
|
||||
if (n.tls) { var tlsNode = RED.nodes.getNode(n.tls); }
|
||||
|
||||
if (!node.server) {
|
||||
var buffer = null;
|
||||
@@ -70,13 +104,25 @@ module.exports = function(RED) {
|
||||
node.log(RED._("tcpin.status.connecting",{host:node.host,port:node.port}));
|
||||
node.status({fill:"grey",shape:"dot",text:"common.status.connecting"});
|
||||
var id = RED.util.generateId();
|
||||
client = net.connect(node.port, node.host, function() {
|
||||
buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : "";
|
||||
node.connected = true;
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected",_session:{type:"tcp",id:id}});
|
||||
});
|
||||
client.setKeepAlive(true,120000);
|
||||
var connOpts = {host: node.host};
|
||||
if (n.tls) {
|
||||
var connOpts = tlsNode.addTLSOptions({host: node.host});
|
||||
client = tls.connect(node.port, connOpts, function() {
|
||||
buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : "";
|
||||
node.connected = true;
|
||||
node.log(RED._("status.connected", {host: node.host, port: node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected",_session:{type:"tcp",id:id}});
|
||||
});
|
||||
}
|
||||
else {
|
||||
client = net.connect(node.port, node.host, function() {
|
||||
buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : "";
|
||||
node.connected = true;
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected",_session:{type:"tcp",id:id}});
|
||||
});
|
||||
}
|
||||
client.setKeepAlive(true, 120000);
|
||||
connectionPool[id] = client;
|
||||
|
||||
client.on('data', function (data) {
|
||||
@@ -150,7 +196,13 @@ module.exports = function(RED) {
|
||||
});
|
||||
}
|
||||
else {
|
||||
var server = net.createServer(function (socket) {
|
||||
let srv = net;
|
||||
let connOpts;
|
||||
if (n.tls) {
|
||||
srv = tls;
|
||||
connOpts = tlsNode.addTLSOptions({});
|
||||
}
|
||||
var server = srv.createServer(connOpts, function (socket) {
|
||||
socket.setKeepAlive(true,120000);
|
||||
if (socketTimeout !== null) { socket.setTimeout(socketTimeout); }
|
||||
var id = RED.util.generateId();
|
||||
@@ -269,8 +321,9 @@ module.exports = function(RED) {
|
||||
this.closing = false;
|
||||
this.connected = false;
|
||||
var node = this;
|
||||
if (n.tls) { var tlsNode = RED.nodes.getNode(n.tls); }
|
||||
|
||||
if (!node.beserver||node.beserver=="client") {
|
||||
if (!node.beserver || node.beserver == "client") {
|
||||
var reconnectTimeout;
|
||||
var client = null;
|
||||
var end = false;
|
||||
@@ -278,11 +331,24 @@ module.exports = function(RED) {
|
||||
var setupTcpClient = function() {
|
||||
node.log(RED._("tcpin.status.connecting",{host:node.host,port:node.port}));
|
||||
node.status({fill:"grey",shape:"dot",text:"common.status.connecting"});
|
||||
client = net.connect(node.port, node.host, function() {
|
||||
node.connected = true;
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
});
|
||||
if (n.tls) {
|
||||
// connOpts = tlsNode.addTLSOptions(connOpts);
|
||||
// client = tls.connect(connOpts, function() {
|
||||
var connOpts = tlsNode.addTLSOptions({host: node.host});
|
||||
client = tls.connect(node.port, connOpts, function() {
|
||||
// buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : "";
|
||||
node.connected = true;
|
||||
node.log(RED._("status.connected", {host: node.host, port: node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
});
|
||||
}
|
||||
else {
|
||||
client = net.connect(node.port, node.host, function() {
|
||||
node.connected = true;
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
});
|
||||
}
|
||||
client.setKeepAlive(true,120000);
|
||||
client.on('error', function (err) {
|
||||
node.log(RED._("tcpin.errors.error",{error:err.toString()}));
|
||||
@@ -366,9 +432,15 @@ module.exports = function(RED) {
|
||||
});
|
||||
}
|
||||
else {
|
||||
var connectedSockets = [];
|
||||
const connectedSockets = new Set();
|
||||
node.status({text:RED._("tcpin.status.connections",{count:0})});
|
||||
var server = net.createServer(function (socket) {
|
||||
let srv = net;
|
||||
let connOpts;
|
||||
if (n.tls) {
|
||||
srv = tls;
|
||||
connOpts = tlsNode.addTLSOptions({});
|
||||
}
|
||||
var server = srv.createServer(connOpts, function (socket) {
|
||||
socket.setKeepAlive(true,120000);
|
||||
if (socketTimeout !== null) { socket.setTimeout(socketTimeout); }
|
||||
node.log(RED._("tcpin.status.connection-from",{host:socket.remoteAddress, port:socket.remotePort}));
|
||||
@@ -381,16 +453,16 @@ module.exports = function(RED) {
|
||||
});
|
||||
socket.on('close',function() {
|
||||
node.log(RED._("tcpin.status.connection-closed",{host:socket.remoteAddress, port:socket.remotePort}));
|
||||
connectedSockets.splice(connectedSockets.indexOf(socket),1);
|
||||
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.length})});
|
||||
connectedSockets.delete(socket);
|
||||
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.size})});
|
||||
});
|
||||
socket.on('error',function() {
|
||||
node.log(RED._("tcpin.errors.socket-error",{host:socket.remoteAddress, port:socket.remotePort}));
|
||||
connectedSockets.splice(connectedSockets.indexOf(socket),1);
|
||||
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.length})});
|
||||
connectedSockets.delete(socket);
|
||||
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.size})});
|
||||
});
|
||||
connectedSockets.push(socket);
|
||||
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.length})});
|
||||
connectedSockets.add(socket);
|
||||
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.size})});
|
||||
});
|
||||
|
||||
node.on("input", function(msg, nodeSend, nodeDone) {
|
||||
@@ -403,10 +475,10 @@ module.exports = function(RED) {
|
||||
} else {
|
||||
buffer = Buffer.from(""+msg.payload);
|
||||
}
|
||||
for (var i = 0; i < connectedSockets.length; i += 1) {
|
||||
if (node.doend === true) { connectedSockets[i].end(buffer); }
|
||||
else { connectedSockets[i].write(buffer); }
|
||||
}
|
||||
connectedSockets.forEach(soc => {
|
||||
if (node.doend === true) { soc.end(buffer); }
|
||||
else { soc.write(buffer); }
|
||||
})
|
||||
}
|
||||
nodeDone();
|
||||
});
|
||||
@@ -423,12 +495,10 @@ module.exports = function(RED) {
|
||||
} else {
|
||||
node.log(RED._("tcpin.status.listening-port",{port:node.port}));
|
||||
node.on('close', function() {
|
||||
for (var c in connectedSockets) {
|
||||
if (connectedSockets.hasOwnProperty(c)) {
|
||||
connectedSockets[c].end();
|
||||
connectedSockets[c].unref();
|
||||
}
|
||||
}
|
||||
connectedSockets.forEach(soc => {
|
||||
soc.end();
|
||||
soc.unref();
|
||||
})
|
||||
server.close();
|
||||
node.log(RED._("tcpin.status.stopped-listening",{port:node.port}));
|
||||
});
|
||||
@@ -445,7 +515,11 @@ module.exports = function(RED) {
|
||||
this.port = Number(n.port);
|
||||
this.out = n.out;
|
||||
this.ret = n.ret || "buffer";
|
||||
this.newline = (n.newline||"").replace("\\n","\n").replace("\\r","\r").replace("\\t","\t");
|
||||
this.splitc = n.splitc;
|
||||
if (n.tls) {
|
||||
var tlsNode = RED.nodes.getNode(n.tls);
|
||||
}
|
||||
|
||||
if (this.out === "immed") { this.splitc = -1; this.out = "time"; }
|
||||
if (this.out !== "char") { this.splitc = Number(this.splitc); }
|
||||
@@ -500,12 +574,48 @@ module.exports = function(RED) {
|
||||
}
|
||||
else { buf = Buffer.alloc(65536); } // set it to 64k... hopefully big enough for most TCP packets.... but only hopefully
|
||||
|
||||
clients[connection_id].client = net.Socket();
|
||||
var connOpts = {host:host, port:port};
|
||||
if (n.tls) {
|
||||
connOpts = tlsNode.addTLSOptions(connOpts);
|
||||
const allowUnauthorized = getAllowUnauthorized();
|
||||
|
||||
let options = {
|
||||
rejectUnauthorized: !allowUnauthorized,
|
||||
ciphers: tls.DEFAULT_CIPHERS,
|
||||
checkServerIdentity: tls.checkServerIdentity,
|
||||
minDHSize: 1024,
|
||||
...connOpts
|
||||
};
|
||||
|
||||
if (!options.keepAlive) { options.singleUse = true; }
|
||||
|
||||
const context = options.secureContext || tls.createSecureContext(options);
|
||||
|
||||
clients[connection_id].client = new tls.TLSSocket(options.socket, {
|
||||
allowHalfOpen: options.allowHalfOpen,
|
||||
pipe: !!options.path,
|
||||
secureContext: context,
|
||||
isServer: false,
|
||||
requestCert: false, // true,
|
||||
rejectUnauthorized: false, // options.rejectUnauthorized !== false,
|
||||
session: options.session,
|
||||
ALPNProtocols: options.ALPNProtocols,
|
||||
requestOCSP: options.requestOCSP,
|
||||
enableTrace: options.enableTrace,
|
||||
pskCallback: options.pskCallback,
|
||||
highWaterMark: options.highWaterMark,
|
||||
onread: options.onread,
|
||||
signal: options.signal,
|
||||
});
|
||||
}
|
||||
else {
|
||||
clients[connection_id].client = net.Socket();
|
||||
}
|
||||
if (socketTimeout !== null) { clients[connection_id].client.setTimeout(socketTimeout);}
|
||||
|
||||
if (host && port) {
|
||||
clients[connection_id].connecting = true;
|
||||
clients[connection_id].client.connect(port, host, function() {
|
||||
clients[connection_id].client.connect(connOpts, function() {
|
||||
//node.log(RED._("tcpin.errors.client-connected"));
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
if (clients[connection_id] && clients[connection_id].client) {
|
||||
@@ -528,17 +638,32 @@ module.exports = function(RED) {
|
||||
else {
|
||||
node.warn(RED._("tcpin.errors.no-host"));
|
||||
}
|
||||
|
||||
var chunk = "";
|
||||
clients[connection_id].client.on('data', function(data) {
|
||||
if (node.out === "sit") { // if we are staying connected just send the buffer
|
||||
if (clients[connection_id]) {
|
||||
const msg = clients[connection_id].lastMsg || {};
|
||||
msg.payload = RED.util.cloneMessage(data);
|
||||
if (node.ret === "string") {
|
||||
try { msg.payload = msg.payload.toString(); }
|
||||
catch(e) { node.error("Failed to create string", msg); }
|
||||
try {
|
||||
if (node.newline && node.newline !== "" ) {
|
||||
chunk += msg.payload.toString();
|
||||
let parts = chunk.split(node.newline);
|
||||
for (var p=0; p<parts.length-1; p+=1) {
|
||||
let m = RED.util.cloneMessage(msg);
|
||||
m.payload = parts[p] + node.newline.trimEnd();
|
||||
nodeSend(m);
|
||||
}
|
||||
chunk = parts[parts.length-1];
|
||||
}
|
||||
else {
|
||||
msg.payload = msg.payload.toString();
|
||||
nodeSend(msg);
|
||||
}
|
||||
}
|
||||
catch(e) { node.error(RED._("tcpin.errors.bad-string"), msg); }
|
||||
}
|
||||
nodeSend(msg);
|
||||
else { nodeSend(msg); }
|
||||
}
|
||||
}
|
||||
// else if (node.splitc === 0) {
|
||||
@@ -675,7 +800,13 @@ module.exports = function(RED) {
|
||||
//node.warn(RED._("tcpin.errors.connect-timeout"));
|
||||
if (clients[connection_id].client) {
|
||||
clients[connection_id].connecting = true;
|
||||
clients[connection_id].client.connect(port, host, function() {
|
||||
|
||||
var connOpts = {host:host, port:port};
|
||||
if (n.tls) {
|
||||
connOpts = tlsNode.addTLSOptions(connOpts);
|
||||
}
|
||||
|
||||
clients[connection_id].client.connect(connOpts, function() {
|
||||
clients[connection_id].connected = true;
|
||||
clients[connection_id].connecting = false;
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
|
@@ -89,6 +89,9 @@ module.exports = function(RED) {
|
||||
else if (msg.payload[s][t].toString().indexOf(node.sep) !== -1) { // add quotes if any "commas"
|
||||
msg.payload[s][t] = node.quo + msg.payload[s][t].toString() + node.quo;
|
||||
}
|
||||
else if (msg.payload[s][t].toString().indexOf("\n") !== -1) { // add quotes if any "\n"
|
||||
msg.payload[s][t] = node.quo + msg.payload[s][t].toString() + node.quo;
|
||||
}
|
||||
}
|
||||
ou += msg.payload[s].join(node.sep) + node.ret;
|
||||
}
|
||||
@@ -112,7 +115,7 @@ module.exports = function(RED) {
|
||||
q = q.replace(/"/g, '""');
|
||||
ou += node.quo + q + node.quo + node.sep;
|
||||
}
|
||||
else if (q.indexOf(node.sep) !== -1) { // add quotes if any "commas"
|
||||
else if (q.indexOf(node.sep) !== -1 || p.indexOf("\n") !== -1) { // add quotes if any "commas" or "\n"
|
||||
ou += node.quo + q + node.quo + node.sep;
|
||||
}
|
||||
else { ou += q + node.sep; } // otherwise just add
|
||||
@@ -134,7 +137,7 @@ module.exports = function(RED) {
|
||||
p = p.replace(/"/g, '""');
|
||||
ou += node.quo + p + node.quo + node.sep;
|
||||
}
|
||||
else if (p.indexOf(node.sep) !== -1) { // add quotes if any "commas"
|
||||
else if (p.indexOf(node.sep) !== -1 || p.indexOf("\n") !== -1) { // add quotes if any "commas" or "\n"
|
||||
ou += node.quo + p + node.quo + node.sep;
|
||||
}
|
||||
else { ou += p + node.sep; } // otherwise just add
|
||||
|
@@ -21,7 +21,7 @@
|
||||
<label style="width:100%;"><span data-i18n="json.label.o2j"></span></label>
|
||||
</div>
|
||||
<div class="form-row node-json-to-json-options" style="padding-left: 20px;">
|
||||
<input style="width:20px; vertical-align:top; margin-right: 5px;" type="checkbox" id="node-input-pretty"><label style="width: auto;" for="node-input-pretty" data-i18n="json.label.pretty"></span>
|
||||
<input style="width:20px; vertical-align:top; margin-right: 5px;" type="checkbox" id="node-input-pretty"><label style="width: auto;" for="node-input-pretty" data-i18n="json.label.pretty"></label>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
@@ -49,7 +49,11 @@ module.exports = function(RED) {
|
||||
}
|
||||
var value = RED.util.getMessageProperty(msg,node.property);
|
||||
if (value !== undefined) {
|
||||
if (typeof value === "string") {
|
||||
if (typeof value === "string" || Buffer.isBuffer(value)) {
|
||||
// if (Buffer.isBuffer(value) && node.action !== "obj") {
|
||||
// node.warn(RED._("json.errors.dropped")); done();
|
||||
// }
|
||||
// else
|
||||
if (node.action === "" || node.action === "obj") {
|
||||
try {
|
||||
RED.util.setMessageProperty(msg,node.property,JSON.parse(value));
|
||||
|
@@ -314,11 +314,13 @@ module.exports = function(RED) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
msgInfo.send({payload: result});
|
||||
msgInfo.msg.payload = result;
|
||||
msgInfo.send(msgInfo.msg);
|
||||
done();
|
||||
});
|
||||
} else {
|
||||
msgInfo.send({payload: result});
|
||||
msgInfo.msg.payload = result;
|
||||
msgInfo.send(msgInfo.msg);
|
||||
done();
|
||||
}
|
||||
} else {
|
||||
|
@@ -47,7 +47,7 @@
|
||||
<div class="form-row">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="node-row-msg-concat">
|
||||
|
@@ -71,9 +71,7 @@ module.exports = function(RED) {
|
||||
node.error(RED._("file.errors.deletefail",{error:err.toString()}),msg);
|
||||
}
|
||||
else {
|
||||
if (RED.settings.verbose) {
|
||||
node.log(RED._("file.status.deletedfile",{file:filename}));
|
||||
}
|
||||
node.debug(RED._("file.status.deletedfile",{file:filename}));
|
||||
nodeSend(msg);
|
||||
}
|
||||
done();
|
||||
|
149
packages/node_modules/@node-red/nodes/examples/function/delay/06 - Simple Queue with release
vendored
Normal file
149
packages/node_modules/@node-red/nodes/examples/function/delay/06 - Simple Queue with release
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
[
|
||||
{
|
||||
"id": "48d660b3a4109400",
|
||||
"type": "inject",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "inject",
|
||||
"props": [
|
||||
{
|
||||
"p": "payload"
|
||||
}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 185,
|
||||
"y": 795,
|
||||
"wires": [
|
||||
[
|
||||
"e0f9e206681f3504"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e0f9e206681f3504",
|
||||
"type": "delay",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "",
|
||||
"pauseType": "rate",
|
||||
"timeout": "5",
|
||||
"timeoutUnits": "seconds",
|
||||
"rate": "1",
|
||||
"nbRateUnits": "30",
|
||||
"rateUnits": "second",
|
||||
"randomFirst": "1",
|
||||
"randomLast": "5",
|
||||
"randomUnits": "seconds",
|
||||
"drop": false,
|
||||
"allowrate": false,
|
||||
"outputs": 1,
|
||||
"x": 430,
|
||||
"y": 795,
|
||||
"wires": [
|
||||
[
|
||||
"e470f1d794e1bef9",
|
||||
"af7cea1dfb797a75"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "943543cf7a1958e4",
|
||||
"type": "change",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "set flush to 1",
|
||||
"rules": [
|
||||
{
|
||||
"t": "set",
|
||||
"p": "flush",
|
||||
"pt": "msg",
|
||||
"to": "1",
|
||||
"tot": "num"
|
||||
},
|
||||
{
|
||||
"t": "delete",
|
||||
"p": "payload",
|
||||
"pt": "msg"
|
||||
}
|
||||
],
|
||||
"action": "",
|
||||
"property": "",
|
||||
"from": "",
|
||||
"to": "",
|
||||
"reg": false,
|
||||
"x": 510,
|
||||
"y": 915,
|
||||
"wires": [
|
||||
[
|
||||
"e0f9e206681f3504"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e470f1d794e1bef9",
|
||||
"type": "function",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "Do something that takes a few seconds",
|
||||
"func": "\n//send on the message between 3 and 6 seconds later\nsetTimeout(\n function() { \n node.send(msg) \n }, \n Math.random() * 3000 + 3000\n);\nreturn null;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 760,
|
||||
"y": 795,
|
||||
"wires": [
|
||||
[
|
||||
"943543cf7a1958e4",
|
||||
"859258551b8389b7"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "af7cea1dfb797a75",
|
||||
"type": "debug",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "IN",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 710,
|
||||
"y": 735,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "859258551b8389b7",
|
||||
"type": "debug",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "OUT",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 895,
|
||||
"y": 735,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "ecaaf26326da10ee",
|
||||
"type": "comment",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "Simple Queue with release",
|
||||
"info": "This example shows how to use a delay node set to rate limit mode as a simple queue to feed a\nprocess that may take some time to complete. Once that process completes the feedback is then\nset to flush out the next message - thus running the \"loop\" as fast as possible with no overlaps.\n\n**Note**: only the `msg.flush` property msut be set - otherwise the other properties that are fed \nback will be added as another new message to the queue.",
|
||||
"x": 235,
|
||||
"y": 915,
|
||||
"wires": []
|
||||
}
|
||||
]
|
@@ -499,7 +499,8 @@
|
||||
"label": {
|
||||
"type": "Typ",
|
||||
"path": "Pfad",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "Subprotokoll"
|
||||
},
|
||||
"listenon": "Lauschen (listen on)",
|
||||
"connectto": "Verbinden mit",
|
||||
|
@@ -442,7 +442,8 @@
|
||||
"state": {
|
||||
"connected": "Connected to broker: __broker__",
|
||||
"disconnected": "Disconnected from broker: __broker__",
|
||||
"connect-failed": "Connection failed to broker: __broker__"
|
||||
"connect-failed": "Connection failed to broker: __broker__",
|
||||
"broker-disconnected": "Broker __broker__ disconnected client: __reasonCode__ __reasonString__"
|
||||
},
|
||||
"retain": "Retain",
|
||||
"output": {
|
||||
@@ -524,13 +525,15 @@
|
||||
},
|
||||
"status": {
|
||||
"requesting": "requesting"
|
||||
}
|
||||
},
|
||||
"insecureHTTPParser": "Disable strict HTTP parsing"
|
||||
},
|
||||
"websocket": {
|
||||
"label": {
|
||||
"type": "Type",
|
||||
"path": "Path",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "Subprotocol"
|
||||
},
|
||||
"listenon": "Listen on",
|
||||
"connectto": "Connect to",
|
||||
@@ -579,7 +582,9 @@
|
||||
"server": "Server",
|
||||
"return": "Return",
|
||||
"ms": "ms",
|
||||
"chars": "chars"
|
||||
"chars": "chars",
|
||||
"close": "Close",
|
||||
"optional": "(optional)"
|
||||
},
|
||||
"type": {
|
||||
"listen": "Listen on",
|
||||
@@ -596,7 +601,7 @@
|
||||
"return": {
|
||||
"timeout": "after a fixed timeout of",
|
||||
"character": "when character received is",
|
||||
"number": "a fixed number of chars",
|
||||
"number": "after a fixed number of characters",
|
||||
"never": "never - keep connection open",
|
||||
"immed": "immediately - don't wait for reply"
|
||||
},
|
||||
@@ -616,11 +621,11 @@
|
||||
"timeout": "timeout closed socket port __port__",
|
||||
"cannot-listen": "unable to listen on port __port__, error: __error__",
|
||||
"error": "error: __error__",
|
||||
|
||||
"socket-error": "socket error from __host__:__port__",
|
||||
"no-host": "Host and/or port not set",
|
||||
"connect-timeout": "connect timeout",
|
||||
"connect-fail": "connect failed"
|
||||
"connect-fail": "connect failed",
|
||||
"bad-string": "failed to convert to string"
|
||||
}
|
||||
},
|
||||
"udp": {
|
||||
|
@@ -28,7 +28,7 @@
|
||||
<p>返却/sendの対象は次のとおりです:</p>
|
||||
<ul>
|
||||
<li>単一メッセージオブジェクト - 最初の出力に接続されたノードに渡されます</li>
|
||||
<li>メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます</li>
|
||||
<li>メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます</li>
|
||||
</ul>
|
||||
<p>注: 初期化処理の実行はノードの初期化中に行われます。そのため、初期化処理タブにsendを記述した場合に後続ノードでメッセージを受け取れないことがあります。</p>
|
||||
<p>配列要素が配列の場合には、複数のメッセージを対応する出力に送出します。</p>
|
||||
|
@@ -291,8 +291,8 @@
|
||||
"hour": "時間",
|
||||
"days": "日",
|
||||
"day": "日",
|
||||
"between": "頻度",
|
||||
"and": "回/",
|
||||
"between": "範囲",
|
||||
"and": "〜",
|
||||
"rate": "流量",
|
||||
"msgper": "メッセージ/",
|
||||
"queuemsg": "中間メッセージをキューに追加",
|
||||
@@ -442,7 +442,8 @@
|
||||
"state": {
|
||||
"connected": "ブローカへ接続しました: __broker__",
|
||||
"disconnected": "ブローカから切断されました: __broker__",
|
||||
"connect-failed": "ブローカへの接続に失敗しました: __broker__"
|
||||
"connect-failed": "ブローカへの接続に失敗しました: __broker__",
|
||||
"broker-disconnected": "ブローカ __broker__ がクライアントを切断しました: __reasonCode__ __reasonString__"
|
||||
},
|
||||
"retain": "保持",
|
||||
"output": {
|
||||
@@ -530,7 +531,8 @@
|
||||
"label": {
|
||||
"type": "種類",
|
||||
"path": "パス",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "サブプロトコル"
|
||||
},
|
||||
"listenon": "待ち受け",
|
||||
"connectto": "接続",
|
||||
@@ -579,7 +581,9 @@
|
||||
"server": "サーバ",
|
||||
"return": "戻り値",
|
||||
"ms": "ミリ秒",
|
||||
"chars": "文字"
|
||||
"chars": "文字",
|
||||
"close": "終了",
|
||||
"optional": "(任意)"
|
||||
},
|
||||
"type": {
|
||||
"listen": "待ち受け",
|
||||
@@ -618,7 +622,8 @@
|
||||
"socket-error": "__host__:__port__ にてソケットのエラーが生じました",
|
||||
"no-host": "ホスト名またはポートが設定されていません",
|
||||
"connect-timeout": "接続がタイムアウトしました",
|
||||
"connect-fail": "接続に失敗しました"
|
||||
"connect-fail": "接続に失敗しました",
|
||||
"bad-string": "文字列への変換に失敗しました"
|
||||
}
|
||||
},
|
||||
"udp": {
|
||||
|
@@ -89,7 +89,7 @@
|
||||
<dt class="optional">userProperties <span class="property-type">オブジェクト</span></dt>
|
||||
<dd><b>MQTTv5</b>: メッセージのユーザプロパティ</dd>
|
||||
<dt class="optional">messageExpiryInterval <span class="property-type">数値</span></dt>
|
||||
<dd><b>MQTTv5</b>: 秒単位のメッセージの有効期限</dd>
|
||||
<dd><b>MQTTv5</b>: 秒単位のメッセージの有効期限</dd>
|
||||
<dt class="optional">topicAlias <span class="property-type">数値</span></dt>
|
||||
<dd><b>MQTTv5</b>: 使用するMQTTトピックエイリアス</dd>
|
||||
</dl>
|
||||
|
@@ -433,7 +433,8 @@
|
||||
"label": {
|
||||
"type": "종류",
|
||||
"path": "패스",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "서브 프로토콜"
|
||||
},
|
||||
"listenon": "대기",
|
||||
"connectto": "접속",
|
||||
|
@@ -461,7 +461,8 @@
|
||||
"label": {
|
||||
"type": "Тип",
|
||||
"path": "Путь",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "Подпротокол"
|
||||
},
|
||||
"listenon": "Слушать на ...",
|
||||
"connectto": "Присоединиться к ...",
|
||||
|
@@ -454,7 +454,8 @@
|
||||
"label": {
|
||||
"type": "类型",
|
||||
"path": "路径",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "子协议"
|
||||
},
|
||||
"listenon": "监听",
|
||||
"connectto": "连接",
|
||||
|
@@ -458,7 +458,8 @@
|
||||
"label": {
|
||||
"type": "類型",
|
||||
"path": "路徑",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "子协议"
|
||||
},
|
||||
"listenon": "監聽",
|
||||
"connectto": "連接",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/nodes",
|
||||
"version": "2.1.6",
|
||||
"version": "2.2.3",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -17,12 +17,12 @@
|
||||
"dependencies": {
|
||||
"acorn": "8.7.0",
|
||||
"acorn-walk": "8.2.0",
|
||||
"ajv": "8.8.2",
|
||||
"ajv": "8.10.0",
|
||||
"body-parser": "1.19.1",
|
||||
"cheerio": "1.0.0-rc.10",
|
||||
"content-type": "1.0.4",
|
||||
"cookie-parser": "1.4.6",
|
||||
"cookie": "0.4.1",
|
||||
"cookie": "0.4.2",
|
||||
"cors": "2.8.5",
|
||||
"cronosjs": "1.7.1",
|
||||
"denque": "2.0.1",
|
||||
@@ -36,14 +36,14 @@
|
||||
"is-utf8": "0.2.1",
|
||||
"js-yaml": "3.14.1",
|
||||
"media-typer": "1.1.0",
|
||||
"mqtt": "4.3.4",
|
||||
"multer": "1.4.3",
|
||||
"mqtt": "4.3.5",
|
||||
"multer": "1.4.4",
|
||||
"mustache": "4.2.0",
|
||||
"on-headers": "1.0.2",
|
||||
"raw-body": "2.4.2",
|
||||
"raw-body": "2.4.3",
|
||||
"tough-cookie": "4.0.0",
|
||||
"uuid": "8.3.2",
|
||||
"ws": "7.5.1",
|
||||
"ws": "7.5.6",
|
||||
"xml2js": "0.4.23",
|
||||
"iconv-lite": "0.6.3"
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
|
@@ -11,6 +11,7 @@ const exec = require("@node-red/util").exec;
|
||||
const log = require("@node-red/util").log;
|
||||
const hooks = require("@node-red/util").hooks;
|
||||
const url = require("url");
|
||||
const { createRequire } = require("module");
|
||||
|
||||
const BUILTIN_MODULES = require('module').builtinModules;
|
||||
|
||||
@@ -139,10 +140,15 @@ function importModule(module) {
|
||||
}
|
||||
const externalModuleDir = getInstallDir();
|
||||
const moduleDir = path.join(externalModuleDir,"node_modules",module);
|
||||
// To handle both CJS and ESM we need to resolve the module to the
|
||||
// specific file that is loaded when the module is required/imported
|
||||
// As this won't be on the natural module search path, we use createRequire
|
||||
// to access the module
|
||||
const modulePath = createRequire(moduleDir).resolve(module)
|
||||
// Import needs the full path to the module's main .js file
|
||||
// It also needs to be a file:// url for Windows
|
||||
const moduleFile = url.pathToFileURL(require.resolve(moduleDir));
|
||||
return import(moduleFile);
|
||||
const moduleUrl = url.pathToFileURL(modulePath);
|
||||
return import(moduleUrl);
|
||||
}
|
||||
|
||||
function parseModuleName(module) {
|
||||
|
@@ -353,7 +353,6 @@ async function loadPluginConfig(fileInfo) {
|
||||
*/
|
||||
function loadNodeSet(node) {
|
||||
if (!node.enabled) {
|
||||
console.log("BAIL ON",node.id)
|
||||
return Promise.resolve(node);
|
||||
} else {
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/registry",
|
||||
"version": "2.1.6",
|
||||
"version": "2.2.3",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,11 +16,11 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "2.1.6",
|
||||
"@node-red/util": "2.2.3",
|
||||
"clone": "2.1.2",
|
||||
"fs-extra": "10.0.0",
|
||||
"semver": "7.3.5",
|
||||
"tar": "6.1.11",
|
||||
"uglify-js": "3.14.5"
|
||||
"uglify-js": "3.15.1"
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
|
@@ -99,6 +99,7 @@ var api = module.exports = {
|
||||
* @param {Object} opts
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {String} opts.id - the id of the project to activate
|
||||
* @param {boolean} opts.clearContext - whether to clear context
|
||||
* @param {Object} opts.req - the request to log (optional)
|
||||
* @return {Promise<Object>} - resolves when complete
|
||||
* @memberof @node-red/runtime_projects
|
||||
@@ -107,7 +108,7 @@ var api = module.exports = {
|
||||
var currentProject = runtime.storage.projects.getActiveProject(opts.user);
|
||||
runtime.log.audit({event: "projects.set",id:opts.id}, opts.req);
|
||||
if (!currentProject || opts.id !== currentProject.name) {
|
||||
return runtime.storage.projects.setActiveProject(opts.user, opts.id);
|
||||
return runtime.storage.projects.setActiveProject(opts.user, opts.id, opts.clearContext);
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -424,6 +424,17 @@ class Flow {
|
||||
*/
|
||||
getGroupEnvSetting(node, group, name) {
|
||||
if (group) {
|
||||
if (name === "NR_GROUP_NAME") {
|
||||
return [{
|
||||
val: group.name
|
||||
}, null];
|
||||
}
|
||||
if (name === "NR_GROUP_ID") {
|
||||
return [{
|
||||
val: group.id
|
||||
}, null];
|
||||
}
|
||||
|
||||
if (group.credentials === undefined) {
|
||||
group.credentials = credentials.get(group.id) || {};
|
||||
}
|
||||
@@ -498,7 +509,13 @@ class Flow {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
getSetting(key) {
|
||||
const flow = this.flow;
|
||||
const flow = this.flow;
|
||||
if (key === "NR_FLOW_NAME") {
|
||||
return flow.label;
|
||||
}
|
||||
if (key === "NR_FLOW_ID") {
|
||||
return flow.id;
|
||||
}
|
||||
if (flow.credentials === undefined) {
|
||||
flow.credentials = credentials.get(flow.id) || {};
|
||||
}
|
||||
@@ -565,7 +582,7 @@ class Flow {
|
||||
reportingNode = node;
|
||||
}
|
||||
if (!muteStatusEvent) {
|
||||
if (statusMessage.hasOwnProperty("text") && typeof(statusMessage.text !== "string")) {
|
||||
if (statusMessage.hasOwnProperty("text") && typeof statusMessage.text !== "string") {
|
||||
try {
|
||||
statusMessage.text = statusMessage.text.toString();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user