Compare commits
1482 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c685a31056 | ||
|
|
c32ce3bb7b | ||
|
|
4f87ebdf0a | ||
|
|
19b6cba398 | ||
|
|
5cf9c07b73 | ||
|
|
211eeea05d | ||
|
|
51a3521834 | ||
|
|
6a9575e9f4 | ||
|
|
62088259ae | ||
|
|
925ebcc06e | ||
|
|
673a6bbe2c | ||
|
|
cf32a33984 | ||
|
|
98c1bc276d | ||
|
|
629536b562 | ||
|
|
1441042458 | ||
|
|
58c8311d56 | ||
|
|
e03a0fffa9 | ||
|
|
8e2c12f8d9 | ||
|
|
7cec7ae608 | ||
|
|
c49f722e4f | ||
|
|
d4d95a43b6 | ||
|
|
a345089c8b | ||
|
|
67c268e13d | ||
|
|
ce85c8d986 | ||
|
|
cb35604ef5 | ||
|
|
61681bb1d6 | ||
|
|
1a226c4dc6 | ||
|
|
08fccc4e77 | ||
|
|
c1d50e82e1 | ||
|
|
9777af7cb5 | ||
|
|
fd86035865 | ||
|
|
a8ec032553 | ||
|
|
66ee27c5fa | ||
|
|
17a737ca88 | ||
|
|
75e7c0e50d | ||
|
|
fc0cf1ff51 | ||
|
|
0f4d46671f | ||
|
|
048f9c0294 | ||
|
|
ca77842b5b | ||
|
|
6fa8b7f5f1 | ||
|
|
a2d03c14ae | ||
|
|
c667a0e74c | ||
|
|
8123828113 | ||
|
|
72b8dbb45b | ||
|
|
7703875740 | ||
|
|
6442bb8a13 | ||
|
|
f29d7c9252 | ||
|
|
2f7f53ed96 | ||
|
|
94031a52a5 | ||
|
|
d67f91e7ed | ||
|
|
f37697c4fb | ||
|
|
69448c7329 | ||
|
|
8e9815fb91 | ||
|
|
4cdd7978cf | ||
|
|
40d81358f4 | ||
|
|
c7b62aed91 | ||
|
|
c0e7d6d826 | ||
|
|
f809377de8 | ||
|
|
9767bd9697 | ||
|
|
3a55528552 | ||
|
|
56197ffe3a | ||
|
|
0f0d0c046c | ||
|
|
ecc4973645 | ||
|
|
3169f93cc2 | ||
|
|
c1a1a73599 | ||
|
|
db1b0ccb79 | ||
|
|
df161ce672 | ||
|
|
72fe30892e | ||
|
|
d373105b32 | ||
|
|
28b311b7ed | ||
|
|
dcda513901 | ||
|
|
72c400794c | ||
|
|
042409f870 | ||
|
|
5b8f4f4069 | ||
|
|
d132d63c1d | ||
|
|
4374506981 | ||
|
|
ef8b936069 | ||
|
|
36e3bfffb4 | ||
|
|
91a38bdb60 | ||
|
|
f169a68319 | ||
|
|
ee886f98dd | ||
|
|
a3826cc6a7 | ||
|
|
ba33b832ba | ||
|
|
f6c017176b | ||
|
|
7a01b115bb | ||
|
|
1dc021e871 | ||
|
|
c9f916ebab | ||
|
|
ff627fd128 | ||
|
|
695873d35a | ||
|
|
15da19dcea | ||
|
|
d5bdc1600b | ||
|
|
dfa077fd5f | ||
|
|
5155770213 | ||
|
|
f1d5bbb036 | ||
|
|
69ed0aebc3 | ||
|
|
549e56e220 | ||
|
|
450f4d9a5a | ||
|
|
6533a9793c | ||
|
|
2000cadb17 | ||
|
|
083c321efa | ||
|
|
f64c4a981f | ||
|
|
3ac8ce03bf | ||
|
|
66fca8710e | ||
|
|
1e245ece46 | ||
|
|
81efce03ba | ||
|
|
4e549dd426 | ||
|
|
52f74ff7e0 | ||
|
|
3c71b815f5 | ||
|
|
9efd48fe51 | ||
|
|
4609ee75b6 | ||
|
|
963ea4177e | ||
|
|
17e6940a42 | ||
|
|
315a9ceba3 | ||
|
|
a2bdeedb09 | ||
|
|
da5700d2d7 | ||
|
|
90e7f30247 | ||
|
|
3ccf6ba892 | ||
|
|
e50cd5b745 | ||
|
|
db77be5d72 | ||
|
|
c36870c23e | ||
|
|
e9be007040 | ||
|
|
9e400d9aa6 | ||
|
|
490c8dae75 | ||
|
|
3bcffe375d | ||
|
|
9f81a591e1 | ||
|
|
3db5306c70 | ||
|
|
45029dd084 | ||
|
|
b01cd30339 | ||
|
|
09329e1104 | ||
|
|
ab0fc2ecfa | ||
|
|
bf5d36d6bd | ||
|
|
a29527ec96 | ||
|
|
45e7ad8049 | ||
|
|
4d54663efd | ||
|
|
29d386cc51 | ||
|
|
ba1a67969b | ||
|
|
390ea5419e | ||
|
|
0fdeec7cc4 | ||
|
|
e34d883e50 | ||
|
|
507871687b | ||
|
|
ed58f62cd1 | ||
|
|
94bc4e7125 | ||
|
|
5832f7930d | ||
|
|
0066a20c22 | ||
|
|
774e4bfced | ||
|
|
054c7a76a4 | ||
|
|
c7f3b77aac | ||
|
|
a6a4620374 | ||
|
|
5148c62d1c | ||
|
|
6fc863a91e | ||
|
|
e066a154a1 | ||
|
|
d432edaed2 | ||
|
|
8f34f4e80b | ||
|
|
39b751acf5 | ||
|
|
bd5e8ba961 | ||
|
|
ed20327c41 | ||
|
|
991c68c394 | ||
|
|
2acc31a4e7 | ||
|
|
b9733e3dfa | ||
|
|
bb106bfce7 | ||
|
|
daf1388a6a | ||
|
|
8226f1fa75 | ||
|
|
e675512fa3 | ||
|
|
65e67b6c3e | ||
|
|
7612481570 | ||
|
|
f6c7cb5804 | ||
|
|
2201c9062f | ||
|
|
ca3da262da | ||
|
|
5847f92bef | ||
|
|
31ee1be81e | ||
|
|
6bccdd015f | ||
|
|
cecea318da | ||
|
|
8663ec6880 | ||
|
|
9b03f128aa | ||
|
|
8a51f97616 | ||
|
|
ee74ed9ce9 | ||
|
|
0f947c756e | ||
|
|
cae7949a48 | ||
|
|
be58b614e1 | ||
|
|
b0a01fa4b2 | ||
|
|
9734228001 | ||
|
|
9df1d44bc4 | ||
|
|
13d887028a | ||
|
|
83a8979309 | ||
|
|
75c29f1cb7 | ||
|
|
d9d15e41c7 | ||
|
|
d3598d5854 | ||
|
|
3a8aaee5d7 | ||
|
|
4fcf57d42c | ||
|
|
adb0891335 | ||
|
|
d21e719cc1 | ||
|
|
5807ab82c1 | ||
|
|
65cb04da63 | ||
|
|
312e3611b1 | ||
|
|
46acc62279 | ||
|
|
529b358c9b | ||
|
|
7fca04404e | ||
|
|
3a1cc6a2be | ||
|
|
5b76c91004 | ||
|
|
cf87837f7d | ||
|
|
5a0a7b907b | ||
|
|
6a2b1669b3 | ||
|
|
ca8264b3f4 | ||
|
|
b44ecd8819 | ||
|
|
987942959e | ||
|
|
91992b48c1 | ||
|
|
c9a335a6f9 | ||
|
|
b7ed159b50 | ||
|
|
c72961a52a | ||
|
|
afe6afca36 | ||
|
|
050acd239c | ||
|
|
24505ee4f5 | ||
|
|
63a249aba3 | ||
|
|
7bd94df2a0 | ||
|
|
761161a8e5 | ||
|
|
513579a7ee | ||
|
|
7165483d83 | ||
|
|
f8bcf219cb | ||
|
|
590506e306 | ||
|
|
9a5439c580 | ||
|
|
6b2f5fbb19 | ||
|
|
051c147b41 | ||
|
|
9111adf15f | ||
|
|
ba18b27371 | ||
|
|
2a287b2ae6 | ||
|
|
fc9040f715 | ||
|
|
0029022ef6 | ||
|
|
94f728d3fd | ||
|
|
d53ced7830 | ||
|
|
053d8c44c2 | ||
|
|
9f5767ea16 | ||
|
|
e8d76b0555 | ||
|
|
c2675600f6 | ||
|
|
6f087b4ec1 | ||
|
|
e94708606d | ||
|
|
c248f1a762 | ||
|
|
28402b0894 | ||
|
|
7dd98e99f9 | ||
|
|
dba195b396 | ||
|
|
88b153bc12 | ||
|
|
d4a47dc974 | ||
|
|
fe3ea6edfd | ||
|
|
6c8fc4846b | ||
|
|
54d9656f09 | ||
|
|
49da324c5d | ||
|
|
9bf87697fd | ||
|
|
f368f5a9c4 | ||
|
|
eea85485e6 | ||
|
|
1a544b3b82 | ||
|
|
8b38fe9fe0 | ||
|
|
1bf4addf63 | ||
|
|
407e16e900 | ||
|
|
6e9fe3248a | ||
|
|
d8cf86fd6f | ||
|
|
f8aa4a9588 | ||
|
|
c249907846 | ||
|
|
57c1524a9a | ||
|
|
d8d82e2ba3 | ||
|
|
807b512ef7 | ||
|
|
b2f06b6777 | ||
|
|
d7adff9a65 | ||
|
|
b0d7e11d48 | ||
|
|
fc9cdb61f2 | ||
|
|
9c00492dc2 | ||
|
|
1a6babd199 | ||
|
|
1b693eed37 | ||
|
|
afb566b6b4 | ||
|
|
f870e9ed3e | ||
|
|
4bcf13cb58 | ||
|
|
946a6d6041 | ||
|
|
372c213c2c | ||
|
|
a5a79d3ab7 | ||
|
|
e6c5cfb703 | ||
|
|
7843eccae8 | ||
|
|
7ca153abd0 | ||
|
|
33b4774c49 | ||
|
|
c243481432 | ||
|
|
80873e4ea9 | ||
|
|
4e4a1f11e6 | ||
|
|
9bbe405cd0 | ||
|
|
c440a4c730 | ||
|
|
a1251371d7 | ||
|
|
7d702e8332 | ||
|
|
43d7c8d48c | ||
|
|
7423583508 | ||
|
|
08b0838f9a | ||
|
|
038d821a7c | ||
|
|
6a218814d3 | ||
|
|
905f89b0f5 | ||
|
|
14882bda78 | ||
|
|
781fa4634b | ||
|
|
cdb173fd6e | ||
|
|
466cb4be89 | ||
|
|
c39e2ffd56 | ||
|
|
17bf09e276 | ||
|
|
bc01f9f8fd | ||
|
|
c0870c5694 | ||
|
|
3b5174a2ea | ||
|
|
af6885f3e8 | ||
|
|
e01996095f | ||
|
|
5d86f7b6ba | ||
|
|
8d6ac6406d | ||
|
|
40ff54f67e | ||
|
|
cce7ac09d0 | ||
|
|
73a18891c5 | ||
|
|
fe22cedc1d | ||
|
|
fa09c7c8b2 | ||
|
|
15e28e3cc0 | ||
|
|
2cb4f6b1fc | ||
|
|
b17a483b85 | ||
|
|
7c3e5443ab | ||
|
|
f95a2851c8 | ||
|
|
2b2eee352f | ||
|
|
11569d8056 | ||
|
|
bdf87452b6 | ||
|
|
0c6bf81c24 | ||
|
|
f2fa26fb07 | ||
|
|
f5e212ff1e | ||
|
|
461e6562ca | ||
|
|
fd67d08402 | ||
|
|
e6411d11b1 | ||
|
|
dd81d947fc | ||
|
|
23b887c30e | ||
|
|
c4eae3f130 | ||
|
|
41a04a2849 | ||
|
|
ed1d34e678 | ||
|
|
f44487338d | ||
|
|
7aced85a31 | ||
|
|
fbe0e2d6eb | ||
|
|
6e34f0697c | ||
|
|
a835f9f0cb | ||
|
|
16715673c3 | ||
|
|
c48c74f173 | ||
|
|
f262348497 | ||
|
|
7185bcd51f | ||
|
|
28d05e2449 | ||
|
|
7fafa21a1b | ||
|
|
84f598e143 | ||
|
|
e30f8628db | ||
|
|
0be9c88106 | ||
|
|
e046fc1ac5 | ||
|
|
3a476ac493 | ||
|
|
e33ec0cf50 | ||
|
|
b4b70a988e | ||
|
|
e66b381070 | ||
|
|
771b598c09 | ||
|
|
cd44f13171 | ||
|
|
aa6b72ac87 | ||
|
|
a467fe5ed7 | ||
|
|
467411c6c3 | ||
|
|
2648b7ca54 | ||
|
|
de35c7024a | ||
|
|
9d219c163d | ||
|
|
f7434b5ec8 | ||
|
|
5ed3360c0b | ||
|
|
6f5974f875 | ||
|
|
56db1da3cf | ||
|
|
fef71f29c4 | ||
|
|
d46b66878a | ||
|
|
6cad80c4ad | ||
|
|
68779caa2e | ||
|
|
2a122ed283 | ||
|
|
17c5fdf0d5 | ||
|
|
f6274445a2 | ||
|
|
3b0300b834 | ||
|
|
4fbf1fe780 | ||
|
|
dcf44fed58 | ||
|
|
7136dc1c72 | ||
|
|
0e4cedbc5e | ||
|
|
dc139bcc30 | ||
|
|
b204b183de | ||
|
|
ab788bc1e3 | ||
|
|
95b4c8d515 | ||
|
|
b025644525 | ||
|
|
9e87a60597 | ||
|
|
5a70bea67a | ||
|
|
2a95af3928 | ||
|
|
0a0ca380d3 | ||
|
|
4cfbf7f71c | ||
|
|
de43148341 | ||
|
|
0a2aab7d68 | ||
|
|
745821c420 | ||
|
|
57c4c754d0 | ||
|
|
4b5c437533 | ||
|
|
8d63b6a1ed | ||
|
|
245a8adbf9 | ||
|
|
4f7d98aace | ||
|
|
b0c693cc3a | ||
|
|
b2cca10e8b | ||
|
|
a84b2ab5bb | ||
|
|
4565342b05 | ||
|
|
0ad54cc2d1 | ||
|
|
865853da19 | ||
|
|
392ed706fd | ||
|
|
0ff0f25aaf | ||
|
|
c157960846 | ||
|
|
a5c00b5c81 | ||
|
|
472bbdb59f | ||
|
|
7877093713 | ||
|
|
8cb2e51407 | ||
|
|
d5cee81fb6 | ||
|
|
bca020bc4d | ||
|
|
5069f2844c | ||
|
|
252df81f59 | ||
|
|
7f89a4a26f | ||
|
|
40f4167894 | ||
|
|
0ef16989cd | ||
|
|
3df3d6f516 | ||
|
|
10395ef254 | ||
|
|
83854c28db | ||
|
|
fcbea2629c | ||
|
|
26bc142cc2 | ||
|
|
a4eb8e11c3 | ||
|
|
9fd5d1db56 | ||
|
|
1d05b4c981 | ||
|
|
61f6535be8 | ||
|
|
7dd329b5ee | ||
|
|
b761904424 | ||
|
|
36105412b1 | ||
|
|
184b1b018c | ||
|
|
f3e1b85d82 | ||
|
|
626d012775 | ||
|
|
9ad9c0ec6a | ||
|
|
e13fed9fc6 | ||
|
|
eb6d093e56 | ||
|
|
af1ea610ea | ||
|
|
d4d9190919 | ||
|
|
4d3d1a02a8 | ||
|
|
30c2aa96d6 | ||
|
|
4edb1f80b0 | ||
|
|
0a82459233 | ||
|
|
db87b0dfa5 | ||
|
|
cd42cf7583 | ||
|
|
2d5980ff2a | ||
|
|
d49c7a3adb | ||
|
|
4fdd09a262 | ||
|
|
d6878512c4 | ||
|
|
8b1b8250ff | ||
|
|
9dccbf747e | ||
|
|
08727e1938 | ||
|
|
7584820987 | ||
|
|
d572356642 | ||
|
|
3b5a2815a9 | ||
|
|
f3cf01df25 | ||
|
|
63e6e64ad3 | ||
|
|
e8d7b48bff | ||
|
|
12944d1ebd | ||
|
|
fa1ff6e393 | ||
|
|
98546b6e6a | ||
|
|
2fef6fd1fa | ||
|
|
20cf91f1dc | ||
|
|
2efa78d590 | ||
|
|
880af0671a | ||
|
|
62471e4531 | ||
|
|
b15f8535f8 | ||
|
|
7a3a4493da | ||
|
|
11078235c4 | ||
|
|
f3e05cd08a | ||
|
|
0ca3cabbe8 | ||
|
|
44a75c1291 | ||
|
|
4a4513a746 | ||
|
|
60ff8660de | ||
|
|
6fa0d671c0 | ||
|
|
f478d7c9f0 | ||
|
|
53e3e08d70 | ||
|
|
c4d1ccb6f5 | ||
|
|
e3520309fc | ||
|
|
27bf72372e | ||
|
|
ae4b1b17a9 | ||
|
|
94cb03f4b5 | ||
|
|
e691351976 | ||
|
|
3190de873e | ||
|
|
e8a637498d | ||
|
|
e1195ac00a | ||
|
|
6cd9ccc37c | ||
|
|
25345302e8 | ||
|
|
eccd5e9801 | ||
|
|
ff355af9f2 | ||
|
|
5967f4b0d4 | ||
|
|
ff18618032 | ||
|
|
20f03c356c | ||
|
|
27fdc9e56e | ||
|
|
52d9578a19 | ||
|
|
f4c2938b41 | ||
|
|
9f703de5ec | ||
|
|
a327fd85e2 | ||
|
|
9d22a86ec8 | ||
|
|
29e0b194dd | ||
|
|
ae9cf13fc2 | ||
|
|
64ae67586a | ||
|
|
838c7a5e89 | ||
|
|
89bfc90f40 | ||
|
|
acad9f57f9 | ||
|
|
0d08dc410e | ||
|
|
ebb3fb96cd | ||
|
|
f31f23ff07 | ||
|
|
d2aa3d1868 | ||
|
|
c9e2fce94d | ||
|
|
8b0e76dd55 | ||
|
|
884618adfe | ||
|
|
6e2e36e7a0 | ||
|
|
9994df9601 | ||
|
|
98f7271ac8 | ||
|
|
087cd121b8 | ||
|
|
2d52527fb4 | ||
|
|
fe289e62b5 | ||
|
|
2845475e3f | ||
|
|
b307492487 | ||
|
|
d48284f7ea | ||
|
|
7e416797e9 | ||
|
|
5d54ca7477 | ||
|
|
b979b4e61a | ||
|
|
2527f7984a | ||
|
|
d9350b2362 | ||
|
|
bd0b903f1a | ||
|
|
f243c0df19 | ||
|
|
7482978953 | ||
|
|
77966689d4 | ||
|
|
cf43939d65 | ||
|
|
391ac4b351 | ||
|
|
e1e48aadd9 | ||
|
|
0681f206c4 | ||
|
|
d257c6f3d3 | ||
|
|
fa45c82cdc | ||
|
|
e805b58da6 | ||
|
|
943976d207 | ||
|
|
3a2e5a6ccd | ||
|
|
35ef036246 | ||
|
|
e09c3bbdd3 | ||
|
|
3b12076d4b | ||
|
|
cfcf78ae28 | ||
|
|
341ff9bf5c | ||
|
|
10d8ca30b0 | ||
|
|
4ebb5d099e | ||
|
|
1e82b66bf0 | ||
|
|
06a5e4273b | ||
|
|
e123e7b0b0 | ||
|
|
aeadc40c65 | ||
|
|
7ef418ec52 | ||
|
|
2ed52820b6 | ||
|
|
e8fd7484b6 | ||
|
|
ce5242cfe8 | ||
|
|
af947879d8 | ||
|
|
3ed112cde6 | ||
|
|
99c6a9eccd | ||
|
|
2029f6ea0a | ||
|
|
e984e1f30f | ||
|
|
f21260370f | ||
|
|
fdae75c99b | ||
|
|
a0489f2a0d | ||
|
|
0123eacbdb | ||
|
|
53401b6aa7 | ||
|
|
9a5139f452 | ||
|
|
2ee0c8c228 | ||
|
|
c53562cc9c | ||
|
|
ec5d7c2e5c | ||
|
|
d6fc258485 | ||
|
|
f953612695 | ||
|
|
2ab93acca8 | ||
|
|
326c6c496e | ||
|
|
9f7f50664c | ||
|
|
f6f1436123 | ||
|
|
c3c519419d | ||
|
|
e569a80b72 | ||
|
|
284f437c1a | ||
|
|
1fd44a9958 | ||
|
|
cad34742f6 | ||
|
|
323359b3c8 | ||
|
|
35db8b45f0 | ||
|
|
50ae815ceb | ||
|
|
1a4389c90d | ||
|
|
fdaa5ce1da | ||
|
|
09d9936aed | ||
|
|
b3f6109b1c | ||
|
|
5fb3ffc240 | ||
|
|
360db252bb | ||
|
|
0b6e290271 | ||
|
|
7f0174e6db | ||
|
|
a25dad6c2e | ||
|
|
6191a49ed3 | ||
|
|
6252b075bc | ||
|
|
7face138fd | ||
|
|
382b83b093 | ||
|
|
691687d1bc | ||
|
|
5814b80a72 | ||
|
|
e147fbb1fa | ||
|
|
b9e256adfa | ||
|
|
3b7bf04e22 | ||
|
|
43408a724c | ||
|
|
5fbd5bf9e2 | ||
|
|
5e87828b29 | ||
|
|
9066cedc29 | ||
|
|
aa1cf0b228 | ||
|
|
06a6a4408f | ||
|
|
d5619d2b9d | ||
|
|
2f6ac42efe | ||
|
|
0bba3dd83d | ||
|
|
abe60b62e6 | ||
|
|
555b7df986 | ||
|
|
b3786700e6 | ||
|
|
ce9643d21b | ||
|
|
4a5cb7f2f5 | ||
|
|
42a7e902e6 | ||
|
|
aebe080e85 | ||
|
|
c316284924 | ||
|
|
8d98b228ab | ||
|
|
5b4c42ff05 | ||
|
|
a596a4551a | ||
|
|
0968f96982 | ||
|
|
5931e13b9c | ||
|
|
415c768ae4 | ||
|
|
b4c8bf21d5 | ||
|
|
5fe5db603d | ||
|
|
9f7dd7f5d4 | ||
|
|
e6d32aab7b | ||
|
|
08bd6d963c | ||
|
|
ff05fb14a6 | ||
|
|
22d942b705 | ||
|
|
0526372f28 | ||
|
|
f99051906a | ||
|
|
d1f7fd8bfd | ||
|
|
fc1436a96d | ||
|
|
d21568497b | ||
|
|
df4beef060 | ||
|
|
a52f195d41 | ||
|
|
419019a656 | ||
|
|
42b5635485 | ||
|
|
a8fc5b01f3 | ||
|
|
ead841d844 | ||
|
|
67d7930aef | ||
|
|
6f69995f4e | ||
|
|
05252fa239 | ||
|
|
1377439bb0 | ||
|
|
407123a280 | ||
|
|
750dd590c8 | ||
|
|
44112a9d18 | ||
|
|
b220bf0d99 | ||
|
|
d0d93d7070 | ||
|
|
4117961236 | ||
|
|
68a3d71ee6 | ||
|
|
bf5d741f0d | ||
|
|
55a33bc408 | ||
|
|
3ec35ed119 | ||
|
|
3d8d6953ec | ||
|
|
528db67c34 | ||
|
|
b847e962aa | ||
|
|
bbb9a3c63b | ||
|
|
322cebc48c | ||
|
|
1cceb3d880 | ||
|
|
effc64db9a | ||
|
|
7e5bd5f2c1 | ||
|
|
e32cc4d1af | ||
|
|
09a3cd850e | ||
|
|
b0c876019a | ||
|
|
6725f870d2 | ||
|
|
0e5adc1f0a | ||
|
|
57ebb93dc0 | ||
|
|
05dc0bfa1d | ||
|
|
2d0264116c | ||
|
|
3938550ea8 | ||
|
|
9f0c567794 | ||
|
|
8672fcd2bb | ||
|
|
3f2a92e801 | ||
|
|
771e43583a | ||
|
|
9353d5c1c4 | ||
|
|
5e462f0f02 | ||
|
|
a25f6fec9f | ||
|
|
519edce0ed | ||
|
|
0bc7702d95 | ||
|
|
18be0d6d26 | ||
|
|
1d4a435f20 | ||
|
|
34e46fc6d3 | ||
|
|
50956c51f7 | ||
|
|
dd7bb28b6a | ||
|
|
8516f41ba8 | ||
|
|
15c3cc60f6 | ||
|
|
716bca211b | ||
|
|
8179813fe1 | ||
|
|
d355de509b | ||
|
|
b04a2d4c08 | ||
|
|
6d3232a4f0 | ||
|
|
2753075180 | ||
|
|
d0166b25e4 | ||
|
|
73ee657d74 | ||
|
|
45913e5ee8 | ||
|
|
e6369820a9 | ||
|
|
22a5b339f7 | ||
|
|
2cea3b6435 | ||
|
|
5d2d06fb3e | ||
|
|
0dd7bc7fb9 | ||
|
|
0b0005337c | ||
|
|
d26fb02bb9 | ||
|
|
af683835d9 | ||
|
|
c43647ca86 | ||
|
|
6d02e70025 | ||
|
|
5498c6f87d | ||
|
|
11f59bc3ac | ||
|
|
94cb7de79f | ||
|
|
838f45775b | ||
|
|
1c1422e4b5 | ||
|
|
cd8ca6fc62 | ||
|
|
b7a0a9d7c2 | ||
|
|
7822ab113a | ||
|
|
e250a91f09 | ||
|
|
92a65dcda5 | ||
|
|
4b129d94e4 | ||
|
|
e7960d1d44 | ||
|
|
95589307cd | ||
|
|
20a0e4f3e0 | ||
|
|
6a9213da64 | ||
|
|
7a89e3cf33 | ||
|
|
64607df929 | ||
|
|
a62a1012fa | ||
|
|
14efd0b2f9 | ||
|
|
7ad2192df8 | ||
|
|
3cb5cbd8d5 | ||
|
|
cc9011cd68 | ||
|
|
dc3d89008d | ||
|
|
1893642187 | ||
|
|
a9ece5772d | ||
|
|
cf34716a57 | ||
|
|
1337831061 | ||
|
|
757e72100d | ||
|
|
a75b819858 | ||
|
|
da4a0f09ed | ||
|
|
87d847a074 | ||
|
|
84711beec0 | ||
|
|
f3cf58c8ff | ||
|
|
cf40497e6e | ||
|
|
dfebc4b78d | ||
|
|
15f41a2e7c | ||
|
|
ad6e55ca17 | ||
|
|
6b466d217a | ||
|
|
00dcb304c7 | ||
|
|
c6fb3d6f41 | ||
|
|
ac3143811f | ||
|
|
7e27dd7678 | ||
|
|
c2508296a5 | ||
|
|
a9b50ce6fc | ||
|
|
eac98a6d4d | ||
|
|
7e2b2a9a02 | ||
|
|
353de471eb | ||
|
|
85fc20b52d | ||
|
|
cc25a781f8 | ||
|
|
fc3012ba72 | ||
|
|
d93a92c1c8 | ||
|
|
f7f795f58a | ||
|
|
2700f8cdd2 | ||
|
|
6310de0d20 | ||
|
|
218794be77 | ||
|
|
af71ae649b | ||
|
|
9bc72c1a06 | ||
|
|
8d7c157751 | ||
|
|
558a66fbe5 | ||
|
|
f95b414d22 | ||
|
|
e793a1e1aa | ||
|
|
b76010cb5a | ||
|
|
52475df783 | ||
|
|
1f3f32d377 | ||
|
|
3f5ba10354 | ||
|
|
25f4a018d9 | ||
|
|
a11a279c00 | ||
|
|
fd4fdb31b5 | ||
|
|
1921796d6d | ||
|
|
543a2b9dc7 | ||
|
|
dd23e03342 | ||
|
|
5307c74f85 | ||
|
|
d701c406e2 | ||
|
|
3ba56a0a65 | ||
|
|
4adafb6d1e | ||
|
|
4453a51211 | ||
|
|
14429d2943 | ||
|
|
1a62a7831b | ||
|
|
242e35c212 | ||
|
|
ea763fdfd5 | ||
|
|
e762b7ff48 | ||
|
|
298068b2b9 | ||
|
|
cb4120ec4b | ||
|
|
5cfbb87bee | ||
|
|
9e472ed83c | ||
|
|
ebca753fc4 | ||
|
|
548f45cd56 | ||
|
|
8ffabf1813 | ||
|
|
1f40d4f941 | ||
|
|
41582045d0 | ||
|
|
fd9e3fc03a | ||
|
|
8c42b2bdb4 | ||
|
|
7b1787fdbb | ||
|
|
71fee0025d | ||
|
|
1204cf1ba0 | ||
|
|
7bd8d8c3ae | ||
|
|
2c4d5fa38d | ||
|
|
bedb2d943e | ||
|
|
a3640bd9bf | ||
|
|
7c0b9ffe06 | ||
|
|
161c7d30ca | ||
|
|
4ff6e792cd | ||
|
|
af5df890a5 | ||
|
|
9ba011003a | ||
|
|
bb168d35a8 | ||
|
|
3306d30094 | ||
|
|
6516e0dfd2 | ||
|
|
00a396014b | ||
|
|
13356047dc | ||
|
|
8a6488b067 | ||
|
|
1c2ea56f42 | ||
|
|
1d7ae300e2 | ||
|
|
6013e186ed | ||
|
|
207d3d3340 | ||
|
|
5a6cde1446 | ||
|
|
63f7d826bc | ||
|
|
ff8773f6bd | ||
|
|
a868cb97d9 | ||
|
|
915d73e6f2 | ||
|
|
5f4f6e37b5 | ||
|
|
9c350311e8 | ||
|
|
3c6ba72a2a | ||
|
|
816442f5f0 | ||
|
|
3b51d18ce7 | ||
|
|
6696b6661a | ||
|
|
8c87478636 | ||
|
|
d870b072d7 | ||
|
|
2ea2af7d2a | ||
|
|
f737ea96f3 | ||
|
|
05f90394db | ||
|
|
c24b0c6bb4 | ||
|
|
e07a4dc7ba | ||
|
|
fc6748a46b | ||
|
|
7697c46652 | ||
|
|
ed52e5afd1 | ||
|
|
33a5b84181 | ||
|
|
c09a407f4c | ||
|
|
d35784ec61 | ||
|
|
53e012f296 | ||
|
|
2a9d0a5e7d | ||
|
|
474f4572f2 | ||
|
|
bf57cb209f | ||
|
|
9bc41c1709 | ||
|
|
fe10b8650f | ||
|
|
3a311c9584 | ||
|
|
d1106f53e0 | ||
|
|
a3a1bba5ef | ||
|
|
028d66befc | ||
|
|
bb59cd5742 | ||
|
|
604e3068b2 | ||
|
|
27f1d3b704 | ||
|
|
d007623347 | ||
|
|
6a5cf7a1fa | ||
|
|
3adfe249b0 | ||
|
|
923893e160 | ||
|
|
256e5360d4 | ||
|
|
304c597a2f | ||
|
|
f86d3a69d2 | ||
|
|
d7c8adfd82 | ||
|
|
55cd069043 | ||
|
|
3ca0e9c420 | ||
|
|
1dd4323613 | ||
|
|
d78916f85f | ||
|
|
1840d15397 | ||
|
|
b98d1216b1 | ||
|
|
27db727321 | ||
|
|
3f6b1f6ccb | ||
|
|
6d633b372a | ||
|
|
91352e855a | ||
|
|
8bb9b594cf | ||
|
|
6d2fd2e641 | ||
|
|
422fbcb0b7 | ||
|
|
afce106186 | ||
|
|
f21c8154ed | ||
|
|
3988a648d6 | ||
|
|
1b632894d3 | ||
|
|
5e128f89f6 | ||
|
|
fff0b15ae5 | ||
|
|
a7e14f1093 | ||
|
|
94eeaeb8d3 | ||
|
|
64191e8303 | ||
|
|
21cfb71617 | ||
|
|
806457063f | ||
|
|
b9213b73bd | ||
|
|
d7f0102aa2 | ||
|
|
f09e61a59a | ||
|
|
d426aaa88a | ||
|
|
19e45389e1 | ||
|
|
6d2389945b | ||
|
|
14c48253f6 | ||
|
|
e5ff25b92d | ||
|
|
5c88888e02 | ||
|
|
10057de9b3 | ||
|
|
cc88ebd2b9 | ||
|
|
6baedf909d | ||
|
|
f39d9d6f1b | ||
|
|
ab61a95f83 | ||
|
|
10ceed30c6 | ||
|
|
2b9aa94f3a | ||
|
|
848fb975ed | ||
|
|
d7f59dac84 | ||
|
|
dd47e615ee | ||
|
|
8f2f7ea1a5 | ||
|
|
80a8efd8ce | ||
|
|
d9dce77ef4 | ||
|
|
ce7053a1fe | ||
|
|
0db1530171 | ||
|
|
3745504107 | ||
|
|
57533fd831 | ||
|
|
f57a0d4d6b | ||
|
|
22772ca33e | ||
|
|
dba6ff1d51 | ||
|
|
40146dedaf | ||
|
|
387b822f53 | ||
|
|
b9a3563e5b | ||
|
|
3d6468326a | ||
|
|
298e37ec53 | ||
|
|
5b137c457b | ||
|
|
5218a3fbac | ||
|
|
4569cb432d | ||
|
|
611e598756 | ||
|
|
937d79d28f | ||
|
|
23c2a771d3 | ||
|
|
58a890e836 | ||
|
|
6a869e120c | ||
|
|
ae7c298b1a | ||
|
|
53bfe12ac1 | ||
|
|
140ea683a6 | ||
|
|
0634a97598 | ||
|
|
3479c794de | ||
|
|
89cad116f7 | ||
|
|
19c84eb694 | ||
|
|
eae390acf5 | ||
|
|
10567afbb9 | ||
|
|
51bad3bf3c | ||
|
|
9134d8841d | ||
|
|
e9a026c131 | ||
|
|
9a2fd0e2b2 | ||
|
|
522f7e6844 | ||
|
|
cb4f46decc | ||
|
|
81256279a8 | ||
|
|
039bd1ddc0 | ||
|
|
0791d4797f | ||
|
|
6a06142e1e | ||
|
|
ef53dca062 | ||
|
|
6ce761edda | ||
|
|
d8fd218409 | ||
|
|
edc2310599 | ||
|
|
b1cd13d629 | ||
|
|
b81940351f | ||
|
|
a42e99c4aa | ||
|
|
ff40b521b7 | ||
|
|
85392496e7 | ||
|
|
29cae9975e | ||
|
|
170d6b28f8 | ||
|
|
9a8b404054 | ||
|
|
41af5187aa | ||
|
|
a844ca161f | ||
|
|
e09efba313 | ||
|
|
96a0dbea2d | ||
|
|
5b3b5271ad | ||
|
|
d7d13c12fe | ||
|
|
54220d0e71 | ||
|
|
4a2e3586f1 | ||
|
|
f808e85da9 | ||
|
|
1671d1f580 | ||
|
|
7de1bf9d95 | ||
|
|
7368b0cefb | ||
|
|
4af43d676a | ||
|
|
67dc848b2d | ||
|
|
7ec8f0d26b | ||
|
|
eaf08a9971 | ||
|
|
5bdb9e972e | ||
|
|
d4d87054c4 | ||
|
|
0f93929544 | ||
|
|
1c0e794f87 | ||
|
|
f9bce5a5f9 | ||
|
|
797ae096c8 | ||
|
|
6d76918424 | ||
|
|
2aced893c6 | ||
|
|
f0373cd789 | ||
|
|
2f88dc64fc | ||
|
|
781ca77794 | ||
|
|
c6e453fb00 | ||
|
|
a40b3dd377 | ||
|
|
096b3534d8 | ||
|
|
5324244c55 | ||
|
|
993f1dc853 | ||
|
|
d8a4e9e1ab | ||
|
|
b3ffd33507 | ||
|
|
c93870316c | ||
|
|
fc9906624e | ||
|
|
ba6209ba54 | ||
|
|
f9769a73fe | ||
|
|
3a2f56cb95 | ||
|
|
a4d33879dc | ||
|
|
e2a91d1ea9 | ||
|
|
f30f80d117 | ||
|
|
266274135e | ||
|
|
a10439b67c | ||
|
|
0fd8d0e2bf | ||
|
|
47e2707fd3 | ||
|
|
f7bb4a7d60 | ||
|
|
6102a31a31 | ||
|
|
1692c3b102 | ||
|
|
ac60725d2a | ||
|
|
1542f73fa5 | ||
|
|
70a22187f7 | ||
|
|
347e598715 | ||
|
|
a737810c50 | ||
|
|
92654a71fb | ||
|
|
18615640e0 | ||
|
|
b8c80a2310 | ||
|
|
c34c98386e | ||
|
|
d8a3d2793f | ||
|
|
360b0d9997 | ||
|
|
356f46aaf4 | ||
|
|
87ac0507d9 | ||
|
|
63657c18e2 | ||
|
|
817f92a50e | ||
|
|
304be96dd6 | ||
|
|
9639081e7e | ||
|
|
dca553048a | ||
|
|
6201ed4d55 | ||
|
|
6db2c04585 | ||
|
|
f3840512ba | ||
|
|
9a6cf58565 | ||
|
|
78076122ba | ||
|
|
7429f66d6b | ||
|
|
e59eff83b9 | ||
|
|
2083d85afa | ||
|
|
4c9f1369c8 | ||
|
|
adca1d7855 | ||
|
|
dfc4e99560 | ||
|
|
344076c943 | ||
|
|
710f1e2ca0 | ||
|
|
74ea85d19c | ||
|
|
dded98e30c | ||
|
|
160c27c15a | ||
|
|
a6a9025bab | ||
|
|
a780d4463c | ||
|
|
23539ee907 | ||
|
|
b515df611d | ||
|
|
0d896fef0b | ||
|
|
283d5c64cb | ||
|
|
3134bc432b | ||
|
|
fd93fef73e | ||
|
|
8939a9c786 | ||
|
|
52c0d360b2 | ||
|
|
d99432bff1 | ||
|
|
4dd2d3ac7d | ||
|
|
aa7fe3668c | ||
|
|
83ebcf1dae | ||
|
|
c9317659c5 | ||
|
|
6562c558de | ||
|
|
303f67c036 | ||
|
|
2482d122b8 | ||
|
|
1733c38b5c | ||
|
|
7a1e4e9e99 | ||
|
|
e590313297 | ||
|
|
b63d243e33 | ||
|
|
e9c1216d5c | ||
|
|
df9e50445e | ||
|
|
61339face6 | ||
|
|
9cd751e977 | ||
|
|
7aa08ff885 | ||
|
|
a824caf712 | ||
|
|
395210e4f0 | ||
|
|
e23354b2bb | ||
|
|
bc472eb0b3 | ||
|
|
256f8e7226 | ||
|
|
f41959537b | ||
|
|
c9e05cf9f6 | ||
|
|
82d9a02d92 | ||
|
|
dc9fa81346 | ||
|
|
b91c178200 | ||
|
|
adebdf36a5 | ||
|
|
4f34980c9f | ||
|
|
e70766a535 | ||
|
|
55110dfbac | ||
|
|
56405ac903 | ||
|
|
2b2136c468 | ||
|
|
f12031ee9e | ||
|
|
c26852da77 | ||
|
|
d9dc171c28 | ||
|
|
d407f31ae5 | ||
|
|
f688b8d299 | ||
|
|
d8e6a7b687 | ||
|
|
7c42b04eff | ||
|
|
f527841c29 | ||
|
|
48a8dc0989 | ||
|
|
7e35c9c754 | ||
|
|
7502a2b1ff | ||
|
|
6c2de40dba | ||
|
|
ef90f19eaa | ||
|
|
90ab34591a | ||
|
|
21d3a3dd1e | ||
|
|
b44e70115b | ||
|
|
ac31957707 | ||
|
|
65e27a268d | ||
|
|
6bd59b10c7 | ||
|
|
6a6a692891 | ||
|
|
479b18354d | ||
|
|
9c6452544b | ||
|
|
0a6ff900da | ||
|
|
f54f863611 | ||
|
|
9cc04da7b2 | ||
|
|
d7f5b0c9d7 | ||
|
|
9bd4598c6a | ||
|
|
e3b052bc38 | ||
|
|
f215970649 | ||
|
|
dfe1cd4f90 | ||
|
|
3d2e6aea7b | ||
|
|
749b0d7019 | ||
|
|
7978f85f7a | ||
|
|
bd14acb68a | ||
|
|
1e9ce550db | ||
|
|
6278dfa77e | ||
|
|
2a3e355437 | ||
|
|
f6b0459d27 | ||
|
|
790d6912fd | ||
|
|
e69e5b4f50 | ||
|
|
483306e73c | ||
|
|
1148a0b637 | ||
|
|
524021f0fa | ||
|
|
5b5f9aa01d | ||
|
|
f97f92c297 | ||
|
|
9d4139085b | ||
|
|
0ee7ffb5e5 | ||
|
|
8a7bb1be9f | ||
|
|
d4135e80a6 | ||
|
|
a5ade39d7c | ||
|
|
f39b4e7d22 | ||
|
|
080469cdf5 | ||
|
|
835ad29417 | ||
|
|
c09bea4710 | ||
|
|
879c0f4114 | ||
|
|
5feb07583b | ||
|
|
5388002f54 | ||
|
|
c80fa9914b | ||
|
|
b43d566968 | ||
|
|
6b4e15dd0f | ||
|
|
d9ef32d7e8 | ||
|
|
49389d6f06 | ||
|
|
c75dc3cc36 | ||
|
|
c0eabf0438 | ||
|
|
7730d0a4f8 | ||
|
|
e79da408a8 | ||
|
|
7381784d0f | ||
|
|
085fb283e5 | ||
|
|
61e0e50e7b | ||
|
|
00460d856b | ||
|
|
48958f392f | ||
|
|
a84efeb5d5 | ||
|
|
1c8c05ae04 | ||
|
|
401d386812 | ||
|
|
6b07f58e8e | ||
|
|
6e8c978d12 | ||
|
|
5b2296b056 | ||
|
|
dbf0486acb | ||
|
|
b030e935ce | ||
|
|
29bd43413a | ||
|
|
2249b9449c | ||
|
|
30920b1b78 | ||
|
|
8f92a3e875 | ||
|
|
ed1a55d9cd | ||
|
|
93ef84f495 | ||
|
|
ccfcbe8526 | ||
|
|
5938143002 | ||
|
|
8135da71bd | ||
|
|
a3c73a04c2 | ||
|
|
7f90d31846 | ||
|
|
45fbd22e28 | ||
|
|
4689d56955 | ||
|
|
aa1b2808e7 | ||
|
|
40ad4bdbd8 | ||
|
|
b6510d66e0 | ||
|
|
4ea33ea482 | ||
|
|
e13d410b4a | ||
|
|
72da7e6c54 | ||
|
|
fb05960d79 | ||
|
|
7bd0943412 | ||
|
|
bb2649d063 | ||
|
|
d743bdbf5a | ||
|
|
61890f19bc | ||
|
|
b756a8edef | ||
|
|
adcb2f1aa8 | ||
|
|
e574f4516f | ||
|
|
2ac9c11ec9 | ||
|
|
1c470ab9e3 | ||
|
|
08b8a8e3af | ||
|
|
11ee1a7dcb | ||
|
|
a281b8c74e | ||
|
|
5cb37148c6 | ||
|
|
05878d3176 | ||
|
|
d1c42262d6 | ||
|
|
8dcc114873 | ||
|
|
c54cf26848 | ||
|
|
bfb548636e | ||
|
|
36e1b2ba08 | ||
|
|
301ac279ff | ||
|
|
08d21ccba7 | ||
|
|
62876ca377 | ||
|
|
10f94148af | ||
|
|
31502c2ebc | ||
|
|
62b29ecb65 | ||
|
|
67337e013a | ||
|
|
f987fa13ea | ||
|
|
73dfe631ce | ||
|
|
83ca8147ca | ||
|
|
1c11e7f97b | ||
|
|
aefae79186 | ||
|
|
4b05a9bb6f | ||
|
|
2453719a87 | ||
|
|
ea929b00e3 | ||
|
|
ede940a398 | ||
|
|
67da853146 | ||
|
|
624befd704 | ||
|
|
203539841d | ||
|
|
262db23f7d | ||
|
|
28ea22f0e1 | ||
|
|
3f349c3531 | ||
|
|
9928e8562a | ||
|
|
b1e3fc5761 | ||
|
|
b2390f1caf | ||
|
|
8cc9aeba4a | ||
|
|
ba0823c38c | ||
|
|
b9379f2ddf | ||
|
|
38a950a6dc | ||
|
|
fb24dca019 | ||
|
|
07d131c945 | ||
|
|
0c1c710afe | ||
|
|
15cd93c30f | ||
|
|
a5d9e17a8c | ||
|
|
a82926dd0d | ||
|
|
12435b997a | ||
|
|
5945be95cf | ||
|
|
5c2e7ce407 | ||
|
|
834e894b1d | ||
|
|
d25dac69d2 | ||
|
|
3cc4173399 | ||
|
|
36ab16c1ed | ||
|
|
5356373681 | ||
|
|
f45a2643f2 | ||
|
|
e55933706d | ||
|
|
3b3d696e45 | ||
|
|
281351e6b3 | ||
|
|
34089aec70 | ||
|
|
3658d0e039 | ||
|
|
7a10636128 | ||
|
|
604ba7f4bc | ||
|
|
27b7fb54e8 | ||
|
|
d351aa842c | ||
|
|
59da705b8f | ||
|
|
99b8f16d88 | ||
|
|
06ffe722d4 | ||
|
|
6264104642 | ||
|
|
c97812c340 | ||
|
|
bd4c578230 | ||
|
|
6ec2949b6f | ||
|
|
1ff23ebfd9 | ||
|
|
7698990e37 | ||
|
|
17e092afb3 | ||
|
|
2db65b9d1f | ||
|
|
c6436f47eb | ||
|
|
e88b4a4412 | ||
|
|
01a177adfb | ||
|
|
052b5e0ea8 | ||
|
|
68cd447109 | ||
|
|
4a8a5ed8d4 | ||
|
|
84077505b0 | ||
|
|
c4554b71d3 | ||
|
|
63ce743571 | ||
|
|
6cf53c611b | ||
|
|
d8720ee325 | ||
|
|
73501f3ad3 | ||
|
|
54ee655472 | ||
|
|
571b9fb8e0 | ||
|
|
cdd6b243ff | ||
|
|
fca77a868f | ||
|
|
424e854778 | ||
|
|
0979d565bb | ||
|
|
f5e6ca3e10 | ||
|
|
2bde07561f | ||
|
|
16c92cc739 | ||
|
|
8b31a918a4 | ||
|
|
ee0bd49918 | ||
|
|
a625eeeac8 | ||
|
|
bfcd795687 | ||
|
|
e2a9be9cec | ||
|
|
37dd075309 | ||
|
|
89769fb0e5 | ||
|
|
b24fac3dd8 | ||
|
|
4794fe495c | ||
|
|
869fdbcc6a | ||
|
|
702e6d3b51 | ||
|
|
2913e13a30 | ||
|
|
5f1e37b7fa | ||
|
|
ec0209b175 | ||
|
|
a17dcbde0f | ||
|
|
fbd159a23a | ||
|
|
599a6bf050 | ||
|
|
185b16a858 | ||
|
|
e7e3ed4923 | ||
|
|
47df5476ba | ||
|
|
d7c516ab00 | ||
|
|
50838970ec | ||
|
|
1d15ee7034 | ||
|
|
7029541b4f | ||
|
|
ada8e447cc | ||
|
|
1841fc18fa | ||
|
|
94ee465682 | ||
|
|
3e021b3a75 | ||
|
|
0643f149b7 | ||
|
|
939768eec0 | ||
|
|
f2235dacdc | ||
|
|
50017c28da | ||
|
|
85b2a03a42 | ||
|
|
829087550d | ||
|
|
dd6f71fe85 | ||
|
|
92a928680c | ||
|
|
d008b1970c | ||
|
|
4affbb8c6b | ||
|
|
ddb2ea4b5f | ||
|
|
a69683183f | ||
|
|
8d34f87667 | ||
|
|
128c4fe222 | ||
|
|
b10141d71f | ||
|
|
68e0b35364 | ||
|
|
1324f5e59c | ||
|
|
7759aacb35 | ||
|
|
fd6f7cd881 | ||
|
|
3fdeb38bb7 | ||
|
|
e27f5d0460 | ||
|
|
0720128bd4 | ||
|
|
540472a093 | ||
|
|
daca78b6cd | ||
|
|
4195840b2c | ||
|
|
57c529758e | ||
|
|
5ba9a0eb3f | ||
|
|
b8888a5d46 | ||
|
|
0857f979ff | ||
|
|
11f4ae019c | ||
|
|
0ffeb0c5af | ||
|
|
d6f6b41145 | ||
|
|
64daaeb310 | ||
|
|
0646b0060e | ||
|
|
c794ca85fd | ||
|
|
5b4019dd3d | ||
|
|
a03ccd7b59 | ||
|
|
4b64aad5ce | ||
|
|
d146ff8794 | ||
|
|
5349bf7628 | ||
|
|
a79e4d1bb3 | ||
|
|
f462435dc2 | ||
|
|
48ad614441 | ||
|
|
f699516fdb | ||
|
|
ca5cbb640a | ||
|
|
0a96259ddf | ||
|
|
d99b9c04e4 | ||
|
|
64d261e053 | ||
|
|
eb027d98aa | ||
|
|
a95727b654 | ||
|
|
4e636d7eec | ||
|
|
3cd53f617a | ||
|
|
b1684e82d8 | ||
|
|
a55027b838 | ||
|
|
28678acf74 | ||
|
|
ce6594c8cc | ||
|
|
75855d5450 | ||
|
|
f248699a30 | ||
|
|
29594726ca | ||
|
|
0a41b07297 | ||
|
|
e45cb7fac1 | ||
|
|
489dbfc72a | ||
|
|
a89ae7d77a | ||
|
|
a1eeff4034 | ||
|
|
0e1013a570 | ||
|
|
4562b06a60 | ||
|
|
3c96218338 | ||
|
|
f0a4ea099c | ||
|
|
c8d6693fba | ||
|
|
81bbdfe413 | ||
|
|
0e362943bf | ||
|
|
1e37fed90b | ||
|
|
aafcfef387 | ||
|
|
4b83d8160f | ||
|
|
73a41707e5 | ||
|
|
c989c533e8 | ||
|
|
707dc8c65c | ||
|
|
4c6157a06e | ||
|
|
f973396821 | ||
|
|
e73216d4c1 | ||
|
|
e6de26736b | ||
|
|
d131addd63 | ||
|
|
0c7705beff | ||
|
|
08b11addec | ||
|
|
555f96cfaf | ||
|
|
59ffacb3df | ||
|
|
83acb66f00 | ||
|
|
1f9ae45875 | ||
|
|
ffa628be2d | ||
|
|
215c8fd261 | ||
|
|
061cc908a7 | ||
|
|
18a519f9ed | ||
|
|
7970c9dbe5 | ||
|
|
5ca0c066e2 | ||
|
|
563728c7b8 | ||
|
|
31a72b6562 | ||
|
|
d3dfbc3034 | ||
|
|
f143a6ba08 | ||
|
|
28a65923b6 | ||
|
|
4ca3df77b3 | ||
|
|
4cbe264869 | ||
|
|
b6b65b6bf7 | ||
|
|
e7cc42a927 | ||
|
|
bba3ca8cc0 | ||
|
|
8423e2d245 | ||
|
|
fc263718a1 | ||
|
|
f6820ec615 | ||
|
|
226ad3fe22 | ||
|
|
a9b17e930c | ||
|
|
932ea7ba8f | ||
|
|
c720d78c39 | ||
|
|
8d21e441a0 | ||
|
|
16ecb1a9cb | ||
|
|
f68acca427 | ||
|
|
671d7e2beb | ||
|
|
52fc497412 | ||
|
|
f2797a4153 | ||
|
|
659c326f89 | ||
|
|
534b07d120 | ||
|
|
de64fc8b8d | ||
|
|
1e234fcb73 | ||
|
|
fa9a7e725b | ||
|
|
95b2675f03 | ||
|
|
eaa4b76ede | ||
|
|
1fd87bf664 | ||
|
|
eeaff6b553 | ||
|
|
be18cc9f2d | ||
|
|
8caee09ea4 | ||
|
|
26f5305593 | ||
|
|
d33029027f | ||
|
|
db2425c473 | ||
|
|
bf90509526 | ||
|
|
d63996eea1 | ||
|
|
9bbc8eda9d | ||
|
|
b1ab26e3ad | ||
|
|
89a05c580f | ||
|
|
b85e562980 | ||
|
|
a0e6628757 | ||
|
|
60a41524f0 | ||
|
|
6042395b81 | ||
|
|
8a5db8ce4b | ||
|
|
196d6e79e2 | ||
|
|
91f16215e5 | ||
|
|
9c675a7847 | ||
|
|
f9e09e87d6 | ||
|
|
73574d6293 | ||
|
|
de225205bd | ||
|
|
8a47d36480 | ||
|
|
d5f3ba8d8a | ||
|
|
782a06ce84 | ||
|
|
5cdafc50fb | ||
|
|
0ca3cdb9ae | ||
|
|
a1d6cbd5fd | ||
|
|
6c36778cac | ||
|
|
1c3a97a71a | ||
|
|
3489fe0cf4 | ||
|
|
74b6d9dff9 | ||
|
|
06ee9aa05c | ||
|
|
f0f40a8606 | ||
|
|
1f2c9879bd | ||
|
|
d1eb82bdf6 | ||
|
|
8167f623e3 | ||
|
|
9555e296a2 | ||
|
|
f460283fa1 | ||
|
|
79da8e5a37 | ||
|
|
a35ce22218 | ||
|
|
1c905da8c2 | ||
|
|
2b558768f1 | ||
|
|
7607c4c882 | ||
|
|
c9f4813ce1 | ||
|
|
0428e27039 | ||
|
|
e30da2168d | ||
|
|
0cd20768f4 | ||
|
|
ab31f34862 |
34
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<!--
|
||||||
|
## Before you hit that Submit button....
|
||||||
|
|
||||||
|
This issue tracker is for problems with the Node-RED runtime, the editor or the core nodes.
|
||||||
|
|
||||||
|
If your issue is:
|
||||||
|
- a general 'how-to' type question,
|
||||||
|
- a feature request or suggestion for a change,
|
||||||
|
- or problems with 3rd party (`node-red-contrib-`) nodes
|
||||||
|
|
||||||
|
please use the [Node-RED Forum](https://discourse.nodered.org) or [slack team](https://nodered.org/slack).
|
||||||
|
|
||||||
|
You could also consider asking a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/node-red) and tag it `node-red`.
|
||||||
|
|
||||||
|
That way the whole Node-RED user community can help, rather than rely on the core development team.
|
||||||
|
|
||||||
|
## So you have a real issue to raise...
|
||||||
|
|
||||||
|
To help us understand the issue, please fill-in as much of the following information as you can:
|
||||||
|
-->
|
||||||
|
|
||||||
|
### What are the steps to reproduce?
|
||||||
|
|
||||||
|
### What happens?
|
||||||
|
|
||||||
|
### What do you expect to happen?
|
||||||
|
|
||||||
|
### Please tell us about your environment:
|
||||||
|
|
||||||
|
- [ ] Node-RED version:
|
||||||
|
- [ ] node.js version:
|
||||||
|
- [ ] npm version:
|
||||||
|
- [ ] Platform/OS:
|
||||||
|
- [ ] Browser:
|
||||||
34
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<!--
|
||||||
|
## Before you hit that Submit button....
|
||||||
|
|
||||||
|
Please read our [contribution guidelines](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md)
|
||||||
|
before submitting a pull-request.
|
||||||
|
|
||||||
|
## Types of changes
|
||||||
|
|
||||||
|
What types of changes does your code introduce?
|
||||||
|
Put an `x` in the boxes that apply
|
||||||
|
-->
|
||||||
|
|
||||||
|
- [ ] Bugfix (non-breaking change which fixes an issue)
|
||||||
|
- [ ] New feature (non-breaking change which adds functionality)
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If you want to raise a pull-request with a new feature, or a refactoring
|
||||||
|
of existing code, it **may well get rejected** if it hasn't been discussed on
|
||||||
|
the [forum](https://discourse.nodered.org) or
|
||||||
|
[slack team](https://nodered.org/slack) first.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Proposed changes
|
||||||
|
|
||||||
|
<!-- Describe the nature of this change. What problem does it address? -->
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
<!-- Put an `x` in the boxes that apply -->
|
||||||
|
|
||||||
|
- [ ] I have read the [contribution guidelines](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md)
|
||||||
|
- [ ] For non-bugfix PRs, I have discussed this change on the mailing list/slack team.
|
||||||
|
- [ ] I have run `grunt` to verify the unit tests pass
|
||||||
|
- [ ] I have added suitable unit tests to cover the new/changed functionality
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
"asi": true, // allow missing semicolons
|
"asi": true, // allow missing semicolons
|
||||||
"curly": true, // require braces
|
"curly": true, // require braces
|
||||||
"eqnull": true, // ignore ==null
|
"eqnull": true, // ignore ==null
|
||||||
|
//"eqeqeq": true, // enforce ===
|
||||||
|
"freeze": true, // don't allow override
|
||||||
|
"indent": 4, // default indent of 4
|
||||||
"forin": true, // require property filtering in "for in" loops
|
"forin": true, // require property filtering in "for in" loops
|
||||||
"immed": true, // require immediate functions to be wrapped in ( )
|
"immed": true, // require immediate functions to be wrapped in ( )
|
||||||
"nonbsp": true, // warn on unexpected whitespace breaking chars
|
"nonbsp": true, // warn on unexpected whitespace breaking chars
|
||||||
@@ -9,6 +12,8 @@
|
|||||||
//"unused": true, // Check for unused functions and variables
|
//"unused": true, // Check for unused functions and variables
|
||||||
"loopfunc": true, // allow functions to be defined in loops
|
"loopfunc": true, // allow functions to be defined in loops
|
||||||
//"expr": true, // allow ternery operator syntax...
|
//"expr": true, // allow ternery operator syntax...
|
||||||
|
"shadow": true, // allow variable shadowing (re-use of names...)
|
||||||
"sub": true, // don't warn that foo['bar'] should be written as foo.bar
|
"sub": true, // don't warn that foo['bar'] should be written as foo.bar
|
||||||
"proto": true // allow setting of __proto__ in node < v0.12
|
"proto": true, // allow setting of __proto__ in node < v0.12,
|
||||||
|
"esversion": 6 // allow es6
|
||||||
}
|
}
|
||||||
|
|||||||
30
.travis.yml
@@ -1,24 +1,12 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
language: node_js
|
language: node_js
|
||||||
env:
|
|
||||||
- CXX="g++-4.8"
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.8
|
|
||||||
- gcc-4.8
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
include:
|
||||||
- node_js: "7"
|
- node_js: "10"
|
||||||
node_js:
|
script:
|
||||||
- "7"
|
- ./node_modules/.bin/grunt && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage
|
||||||
- "6"
|
before_script:
|
||||||
- "4"
|
- npm install -g istanbul coveralls
|
||||||
- "0.10"
|
- node_js: "8"
|
||||||
script:
|
- node_js: "6"
|
||||||
- istanbul cover ./node_modules/.bin/grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true ) && rm -rf coverage
|
- node_js: "4"
|
||||||
before_script:
|
|
||||||
- npm install -g istanbul
|
|
||||||
- npm install coveralls
|
|
||||||
|
|||||||
846
CHANGELOG.md
@@ -1,3 +1,813 @@
|
|||||||
|
#### 0.19.5: Maintenance Release
|
||||||
|
|
||||||
|
- Recognize pip installs of RPi.GPIO (#1934)
|
||||||
|
- Merge pull request #1941 from node-red-hitachi/master-batch
|
||||||
|
- Merge pull request #1931 from node-red-hitachi/master-typedinput
|
||||||
|
- Set min value of properties and spinners for batch
|
||||||
|
- Fix that unnecessary optionMenu remains
|
||||||
|
- Merge pull request #1894 from node-red-hitachi/fix-overlapping-file-node-execution
|
||||||
|
- Merge pull request #1924 from imZack/patch-1
|
||||||
|
- Add missing comma
|
||||||
|
- Do not disable context sidebar during node edit Fixes #1921
|
||||||
|
- Don't allow virtual links to be spliced Fixes #1920
|
||||||
|
- Merge project package changes to avoid overwritten changes
|
||||||
|
- Handle manually added project deps that are unused Fixes #1908
|
||||||
|
- update close & input handling of File node
|
||||||
|
- make close handler argument only one
|
||||||
|
- Merge pull request #1907 from amilajack/patch-2
|
||||||
|
- Change repo badge to point to master branch
|
||||||
|
- invoke callbacks if async handler is specified
|
||||||
|
- Merge pull request #1891 from camlow325/resolve-example-path-for-windows-support
|
||||||
|
- Merge pull request #1900 from kazuhitoyokoi/master-addtestcases4settings.js
|
||||||
|
- wait closing while pending messages exist
|
||||||
|
- Add test cases for red/api/editor/settings.js
|
||||||
|
- Ensure all palette categories are opened properly Closes #1893
|
||||||
|
- Resolve path when sending example file for Windows support
|
||||||
|
- fix multiple input message processing of file node
|
||||||
|
|
||||||
|
#### 0.19.4: Maintenance Release
|
||||||
|
|
||||||
|
- Fix race condition in non-cache lfs context Fixes #1888
|
||||||
|
- LocalFileSystem Context: Remove extra flush code
|
||||||
|
- Prevent race condition in caching mode of lfs context (#1889)
|
||||||
|
- Allow context store name to be provided in the key
|
||||||
|
- Switch node: only use promises when absolutely necessary
|
||||||
|
- Fix dbl-click handling on webkit-based browsers
|
||||||
|
- Ensure context.flow/global cannot be deleted or enumerated
|
||||||
|
- Handle context.get with multiple levels of unknown key Fixes #1883
|
||||||
|
- Fix global.get("foo.bar") for functionGlobalContext set values
|
||||||
|
- Fix node color bug (#1877)
|
||||||
|
- Merge pull request #1857 from cclauss/patch-1
|
||||||
|
- Define raw_input() in Python 3 & fix time.sleep()
|
||||||
|
|
||||||
|
#### 0.19.3: Maintenance Release
|
||||||
|
|
||||||
|
- Split node - fix complete to send msg for k/v object
|
||||||
|
- Remove unused Join node merged object key typed input
|
||||||
|
- Set the JavaScript editor to full-screen
|
||||||
|
- Filter global modules installed locally
|
||||||
|
- Add svg to permitted icon extension list
|
||||||
|
- Debug node - indicate status all the time if selected to do so
|
||||||
|
- pi nodes - increase test coverage slightly
|
||||||
|
- TCP-request node - only write payload
|
||||||
|
- JSON schema: perform validation when obj -> obj or str -> str
|
||||||
|
- JSON schema: add draft-06 support (via $schema keyword)
|
||||||
|
- Mqtt proxy configuration for websocket connection, #1651.
|
||||||
|
- Allows MQTT Shared Subscriptions for MQTT-In core node
|
||||||
|
- Fix use of HTML tag or CSS class specification as icon of typedInput
|
||||||
|
|
||||||
|
#### 0.19.2: Maintenance Release
|
||||||
|
|
||||||
|
- Ensure node default colour is used if palette.theme has no match
|
||||||
|
- fix lost messages / properties in TCPRequest Node; closes #1863 (#1864)
|
||||||
|
- Fix typo in template.html
|
||||||
|
- Improve error reporting from context plugin loading
|
||||||
|
- Prevent no-op edit of node marking as changed due to icon
|
||||||
|
- Change node must handle empty rule set
|
||||||
|
|
||||||
|
#### 0.19.1: Maintenance Release
|
||||||
|
|
||||||
|
- Pull in latest twitter node
|
||||||
|
- Handle windows paths for context storage
|
||||||
|
- Handle persisting objects with circular refs in context
|
||||||
|
- Ensure js editor can expand to fill available space
|
||||||
|
- Add example localfilesystem contextStorage to settings
|
||||||
|
- Fix template node handling of nested context tags
|
||||||
|
|
||||||
|
#### 0.19: Milestone Release
|
||||||
|
|
||||||
|
Editor
|
||||||
|
|
||||||
|
- Add editorTheme.palette.theme to allow overriding colours
|
||||||
|
- Index all node properties when searching Fixes #1446
|
||||||
|
- Handle NaN and Infinity properly in debug sidebar Fixes #1778 #1779
|
||||||
|
- Prevent horizontal scroll when palette name cannot wrap
|
||||||
|
- Ignore middle-click on node/ports to enable panning
|
||||||
|
- Better wire layout when looping back
|
||||||
|
- fix appearence of retry button of remote branch management dialog
|
||||||
|
- Handle releasing ctrl when using quick-add node dialog
|
||||||
|
- Add $env function to JSONata expressions
|
||||||
|
- Widen support for env var to use ${} or $() syntax
|
||||||
|
- Add env-var support to TypedInput
|
||||||
|
- Show unknown node properties in info tab
|
||||||
|
- Add node icon picker widget
|
||||||
|
- Only edit nodes on dbl click on primary button with no modifiers
|
||||||
|
- Allow subflows to be put in any palette category
|
||||||
|
- Add flow navigator widget
|
||||||
|
- Cache flow library result to improve response time Fixes #1753
|
||||||
|
- Add middle-button-drag to pan the workspace
|
||||||
|
- allow multi-line category name in editor
|
||||||
|
- Redesign sidebar tabs
|
||||||
|
- Do not disable the export-clipboard menu option with empty selection
|
||||||
|
|
||||||
|
Nodes
|
||||||
|
|
||||||
|
- Change: Ensure runtime errors in Change node can be caught Fixes #1769
|
||||||
|
- File: Add output to File Out node
|
||||||
|
- Function: add expandable JavaScript editor pane
|
||||||
|
- Function: allow id and name reference in function node code (#1731)
|
||||||
|
- HTTP Request: Move to request module
|
||||||
|
- HTTP: Ensure apiMaxLength applies to HTTP Nodes Fixes #1278
|
||||||
|
- Join: accumulate top level properties
|
||||||
|
- Join: allow environment variable as reduce init value
|
||||||
|
- JSON: add JSON schema validation via msg.schema
|
||||||
|
- Pi: Let nrgpio code work with python 3
|
||||||
|
- Pi: let Pi nodes be visible/editable on all platforms
|
||||||
|
- Switch: add isEmpty rule
|
||||||
|
- TCP: queue messages while connecting; closes #1414
|
||||||
|
- TLS: Add servername option to TLS config node for SNI Fixes #1805
|
||||||
|
- UDP: Don't accidentally re-use udp port when set to not do so
|
||||||
|
|
||||||
|
Persistent Context
|
||||||
|
|
||||||
|
- Add Context data sidebar
|
||||||
|
- Add persistable context option
|
||||||
|
- Add default memory store
|
||||||
|
- Add file-based context store
|
||||||
|
- Add async mode to evaluateJSONataExpression
|
||||||
|
- Update RED.util.evaluateNodeProperty to support context stores
|
||||||
|
|
||||||
|
Runtime
|
||||||
|
|
||||||
|
- Support flow.disabled and .info in /flow API
|
||||||
|
- Node errors should be Strings not Errors Fixes #1781
|
||||||
|
- Add detection of connection timeout in git communication Fixes #1770
|
||||||
|
- Handle loading empty nodesDir
|
||||||
|
- Add 'private' property to userDir generated package.json
|
||||||
|
- Add RED.require to allow nodes to access other modules
|
||||||
|
- Ensure add/remove modules are run sequentially
|
||||||
|
|
||||||
|
#### 0.18.7: Maintenance Release
|
||||||
|
|
||||||
|
Editor Fixes
|
||||||
|
|
||||||
|
- Do not trim wires if node declares outputs in defaults but misses value Fixes #1737
|
||||||
|
|
||||||
|
Node Fixes
|
||||||
|
|
||||||
|
- Relax twitter node version ready for major version bump
|
||||||
|
- Pass Date into the Function node sandbox to fix instanceof tests
|
||||||
|
- let TCP in node report remote ip and port when in single packet mode
|
||||||
|
- typo fix in node help (#1735)
|
||||||
|
|
||||||
|
Other Fixes
|
||||||
|
- Tidy up default grunt task and fixup test break due to reorder Fixes #1738
|
||||||
|
- Bump jsonata version
|
||||||
|
|
||||||
|
#### 0.18.6: Maintenance Release
|
||||||
|
|
||||||
|
Editor Fixes
|
||||||
|
|
||||||
|
- Handle a node having wires in the editor on ports it no longer has Fixes #1724
|
||||||
|
- Add missing ACE snippet files
|
||||||
|
- Fix wireClippedNodes is not defined Fixes #1726
|
||||||
|
- Split node html to isolate bad nodes when loading
|
||||||
|
- Avoid unnecessary use of .html() where .text() will do
|
||||||
|
|
||||||
|
- Add editorTheme.projects.enabled to default settings.js"
|
||||||
|
|
||||||
|
#### 0.18.5: Maintenance Release
|
||||||
|
|
||||||
|
Projects
|
||||||
|
|
||||||
|
- Add clone project to welcome screen
|
||||||
|
- Handle cloning a project without package.json
|
||||||
|
- Keep remote branch state in sync between editor and runtime
|
||||||
|
|
||||||
|
New Features
|
||||||
|
|
||||||
|
- Add type checks to switch node options (#1714)
|
||||||
|
- add output property select to HTML parse node (#1701)
|
||||||
|
- Add Prevent Following Redirect to HTTP Request node (#615) (#1684)
|
||||||
|
- Add debug and trace functions to function node (#1654)
|
||||||
|
- Enable user defined icon for subflow
|
||||||
|
- Add MQTT disconnect message and rework broker node UI (#1719)
|
||||||
|
- Japanese message catalogue updates (#1723)
|
||||||
|
- Show node load errors in the Palette Manager view
|
||||||
|
|
||||||
|
Editor Fixes
|
||||||
|
|
||||||
|
- Highlight subflow node when log msg comes from inside Fixes #1698
|
||||||
|
- Ensure node wires array is not longer than outputs value Fixes #1678
|
||||||
|
- Allow importing an unknown config node to be undone Fixes #1681
|
||||||
|
- Ensure keyboard shortcuts get saved in runtime settings Fixes #1696
|
||||||
|
- Don't mark a subflow changed when actually modified nothing (#1665)
|
||||||
|
|
||||||
|
Node Fixes
|
||||||
|
|
||||||
|
- bind to correct port when doing udp broadcast/multicast (#1686)
|
||||||
|
- Provide full error stack in Function node log message (#1700)
|
||||||
|
- Fix http request doc type Fixes #1690
|
||||||
|
- Make debug slightly larger to pass WCAG AA rating
|
||||||
|
- Make core nodes labels more consistent, to close #1673
|
||||||
|
- Allow template node to be updated more than once Fixes #1671
|
||||||
|
- Fix the problem that output labels of switch node sometimes disappear (#1664)
|
||||||
|
- Chinese translations for core nodes (#1607)
|
||||||
|
|
||||||
|
Runtime Fixes
|
||||||
|
|
||||||
|
- Handle and display for invalid flow credentials when project is disabled #1689 (#1694)
|
||||||
|
- node-red-pi: fix behavior with old bash version (#1713)
|
||||||
|
- Fix ENOENT error on first start when no user dir (#1711)
|
||||||
|
- Handle null error object in Flow.handleError Fixes #1721
|
||||||
|
- update settings comments to describe how to setup for ipv6 (#1675)
|
||||||
|
- Remove credential props after diffing flow to prevent future false positives Fixes #1359
|
||||||
|
- Log error if settings unavailable when saving user settings Fixes #1645
|
||||||
|
- Keep backup of .config.json
|
||||||
|
- Add warning if using \_credentialSecret from .config.json
|
||||||
|
- Filter req.user in /settings to prevent potentially leaking info
|
||||||
|
|
||||||
|
#### 0.18.4: Maintenance Release
|
||||||
|
|
||||||
|
Projects
|
||||||
|
|
||||||
|
- Ensure sshkey file path is properly escaped on Windows
|
||||||
|
- Normalize ssh key paths for Windows file names
|
||||||
|
- Ensure userDir is an absolute path when used with sshkeygen
|
||||||
|
- Detect if there are no existing flows to migrate into a project
|
||||||
|
- Use relative urls when retriving flow history
|
||||||
|
- Add credentialSecret to clone pane
|
||||||
|
- Delay clearing inflight when changing credentials key
|
||||||
|
- Mark deploy inflight when reverting a file change
|
||||||
|
- Handle missing_flow_file error on clone properly
|
||||||
|
- Remote project from cached list on delete so it can be reused
|
||||||
|
- Fix tests for existing file flag in settings
|
||||||
|
|
||||||
|
Editor Fixes
|
||||||
|
|
||||||
|
- Fix merging a remote diff
|
||||||
|
- Fixed the problems when using a node without defaults
|
||||||
|
- Disable user defined icon for subflow
|
||||||
|
- getDefaultNodeIcon should handle subflow instance nodes Fixes #1635
|
||||||
|
- Add Japanese info text for core nodes
|
||||||
|
- Fix message lookup for core nodes in case of i18 locales directory exists
|
||||||
|
- Prevent the last tab from being deleted
|
||||||
|
|
||||||
|
Node Fixes
|
||||||
|
|
||||||
|
- Ensure trigger gets reset when 2nd output is null
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.18.3: Maintenance Release
|
||||||
|
|
||||||
|
Projects
|
||||||
|
|
||||||
|
- Fix permissions on git/ssh scripts
|
||||||
|
- Add support for GIT_SSH on older levels of git
|
||||||
|
- Handle host key verification as auth error
|
||||||
|
- Ensure commit list has a refs object even if empty
|
||||||
|
- Make git error detection case-insensitive
|
||||||
|
- Fix up merge conflict handling
|
||||||
|
- Use flow-diff when looking at flow file changes
|
||||||
|
|
||||||
|
Node Fixes
|
||||||
|
|
||||||
|
- Ensure debug tools show for 'complete msg object'
|
||||||
|
- Fix msg.parts handling in concat mode of Batch node
|
||||||
|
|
||||||
|
Editor Fixes
|
||||||
|
|
||||||
|
- Fix offset calculation when dragging node from palette
|
||||||
|
- Allow a library entry to use non-default node-input- prefixes
|
||||||
|
- Change remote-diff shortcut and add it to keymap Fixes #1628
|
||||||
|
|
||||||
|
#### 0.18.2: Maintenance Release
|
||||||
|
|
||||||
|
Projects
|
||||||
|
|
||||||
|
- Filter out %D from git log command for older git versions
|
||||||
|
- Ensure projects are created as logged in user
|
||||||
|
- Better error handling/reporting in project creation
|
||||||
|
- Add Project Settings menu option
|
||||||
|
- Refresh vc sidebar on remote add/remove
|
||||||
|
- Fix auth prompt for ssh repos
|
||||||
|
- Prevent http git urls from including username/pword
|
||||||
|
- Fix fetch auth handling on non-default remote
|
||||||
|
- Avoid exception if git not installed
|
||||||
|
- Check version of git client on startup
|
||||||
|
- Fix pull/push when no tracked branch
|
||||||
|
- Add git_pull_unrelated_history handling
|
||||||
|
- Handle delete of last remote in project settings
|
||||||
|
|
||||||
|
Node Fixes
|
||||||
|
|
||||||
|
- Fix and Add some Chinese translations
|
||||||
|
- Update sort/batch docs
|
||||||
|
- Don't assume node has defaults when exporting icon property
|
||||||
|
- Ensure send is last thing trigger does
|
||||||
|
- Ensure trigger doesn't set two simultaneous timeouts
|
||||||
|
- Add missing property select var to HTML node
|
||||||
|
- Add a default keepalive to tcp client mode
|
||||||
|
- Move node.send in exec and httprequest nodes
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.18.1: Maintenance Release
|
||||||
|
|
||||||
|
Projects
|
||||||
|
|
||||||
|
- Handle more repo clone error cases
|
||||||
|
- Relax validation of git urls
|
||||||
|
- Revalidate project name on return to project-details view
|
||||||
|
- Avoid unnecessary project refresh on branch-switch Fixes #1597
|
||||||
|
- Add support for file:// git urls
|
||||||
|
- Handle project first-run without existing flow file
|
||||||
|
- Handle delete of last remote in project settings
|
||||||
|
- Add git_pull_unrelated_history handling
|
||||||
|
- Fix pull/push when no tracked branch
|
||||||
|
- Remember to disable projects in editor when git not found
|
||||||
|
|
||||||
|
Node Fixes
|
||||||
|
|
||||||
|
- Trigger node migration - ensure bytopic not blank
|
||||||
|
- Add HEAD to list of methods with no body in http req node #1598
|
||||||
|
- Do not include payload in GET requests Fixes #1598
|
||||||
|
- Update sort/batch docs Fixes #1601
|
||||||
|
- Don't assume node has defaults when exporting icon property
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.18: Milestone Release
|
||||||
|
|
||||||
|
Runtime
|
||||||
|
|
||||||
|
- Beta: Projects - must be enabled in settings file
|
||||||
|
- Allow port zero for Express (#1363)
|
||||||
|
- Better error reporting when module provides duplicate type
|
||||||
|
- Update jsonata to 1.5.0
|
||||||
|
- add express-session memorystore without leaks (#1435)
|
||||||
|
- Allow adminAuth.user to be a Function Fixes #1461
|
||||||
|
- Ensure RED.server is set even if admin api disabled
|
||||||
|
- Ensure strategy login button uses relative URL Fixes #1481
|
||||||
|
- ignore `_msgid` when merging full objects
|
||||||
|
- Move node install to spawn to allow for big stdout Fixes #1488
|
||||||
|
- SIGINT handler should wait for stop to complete before exit
|
||||||
|
|
||||||
|
Editor
|
||||||
|
|
||||||
|
- allow a node's icon to be set dynamically (#1490)
|
||||||
|
- Batch messages sent over comms to increase throughput
|
||||||
|
- Migrate deploy confirmations to notifications
|
||||||
|
- `oneditdelete` should be available to all node types Closes #1346
|
||||||
|
- Sort typeSearch results based on position of match
|
||||||
|
- Update ACE to test and add python highlighter (#1373)
|
||||||
|
- Clear mouse state when typeSearch cancelled Fixes #1517
|
||||||
|
- Handle scoped modules via palette editor
|
||||||
|
- TypedInput: handle user defined value/labels options Fixes #1549
|
||||||
|
|
||||||
|
Nodes
|
||||||
|
|
||||||
|
- add msg. select to range and yaml nodes
|
||||||
|
- add property choice to xml, sentiment nodes
|
||||||
|
- mqtt: Add 'name' to mqtt-broker node, and label it by this if it is set. (#1364)
|
||||||
|
- Add option to JSON node to ensure particular encoding
|
||||||
|
- add parts support for HTML node (#1495)
|
||||||
|
- Add passphrase to TLS node
|
||||||
|
- Add rc property to exec node outputs 1 and 2 (#1401)
|
||||||
|
- Add skip first n lines capability to csv node (#1535)
|
||||||
|
- Add support for rejectUnauthorized msg property
|
||||||
|
- Add TLS options to WebSocket client
|
||||||
|
- Added parsed YAML support for template node (#1443)
|
||||||
|
- Allow delay node in rate-limit mode to be reset Fixes #1360
|
||||||
|
- Allow setTimeout in Function node to be promisified in node 8
|
||||||
|
- Debug to status option (#1499)
|
||||||
|
- enable template config via msg.template for stored or generated templates (#1503)
|
||||||
|
- HTTP REQUEST: Adding PROPPATCH and PROPFIND http methods (#1531)
|
||||||
|
- Initial support of merge & reduce mode for JOIN node (#1546)
|
||||||
|
- Initial support of new BATCH node (#1548)
|
||||||
|
- Initial support of sequence rules for SWITCH node (#1545)
|
||||||
|
- initial support of SORT node (#1500)
|
||||||
|
- Inject node - let once delay be editable (#1541)
|
||||||
|
- Introduce `nodeMaxMessageBufferLength` setting for msg sequence nodes
|
||||||
|
- Let CSV correct parts if we remove header row.
|
||||||
|
- let default apply if msg.delay not set in override mode. (#1397)
|
||||||
|
- let trigger node be reset by boolean message (#1554)
|
||||||
|
- Let trigger node support per topic mode (#1398)
|
||||||
|
- let HTML node return empty array for no matching input (#1582)
|
||||||
|
- MQTT node - if Server/URL config contains '//' use it as a complete url; enabled ws:// and wss://
|
||||||
|
- clone messages before delayed send (#1474)
|
||||||
|
- Decrement connected client count rather than show disconnected
|
||||||
|
- Don't end mqtt client on first error Fixes #1566
|
||||||
|
- File out - create dirs synchronously to ensure they exist Fixes #1489
|
||||||
|
- Fix debug message format for Buffer (#1444)
|
||||||
|
- Fix global.keys() bug in function node (#1417)
|
||||||
|
- Handle escape characters in template node which uses Mustache format and JSON output mode (#1377)
|
||||||
|
- Move all node.send to end of timer functions in trigger node (issue #1527) (#1539)
|
||||||
|
- Publish null/undefined to mqtt as blank not toString Fixes #1521
|
||||||
|
- remove inject node at specific time spinner
|
||||||
|
- restrict inject interval to less that 2^31 millisecs
|
||||||
|
- tag UDP ports in use properly so they get closed correctly (#1508)
|
||||||
|
|
||||||
|
#### 0.17.5: Maintenance Release
|
||||||
|
|
||||||
|
- Add express-session missing dependency for oauth
|
||||||
|
- Fix improper type tests is core test cases
|
||||||
|
- File node: recreate write stream when file deleted Fixes #1351
|
||||||
|
- Add flow stopping trace messages
|
||||||
|
- Fix userDir test case when .config.json exists (#1350)
|
||||||
|
- Do not try to send msg after http request error handled Fixes #1344
|
||||||
|
- Fix boundary problem in range node (#1338)
|
||||||
|
- Modify messages in node properties to refer messages.json (#1339)
|
||||||
|
- Fix settings.js replacing webSocketVerifyClient by webSocketNodeVerifyClient (#1343)
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.17.4: Maintenance Release
|
||||||
|
|
||||||
|
- Add request node test case for POSTing 0
|
||||||
|
- Allow false and 0 in payload for httprequest (#1334)
|
||||||
|
- Add file extension into flow name of library automatically (#1331)
|
||||||
|
- Fix accessing global context from jsonata expressions Fixes #1335
|
||||||
|
- Disable editor whilst a deploy is inflight Fixes #1332
|
||||||
|
- Replace Unknown nodes with their real versions when node loaded
|
||||||
|
- Retry auto-install of modules that fail
|
||||||
|
- Fix column name in link nodes to refer language file (#1330)
|
||||||
|
- Use namespaces with link node title attributes i18n name Fixes #1329
|
||||||
|
- Tidy up GPIO pin table presentation Fixes #1328
|
||||||
|
- Join: count of 0 should not send on every msg
|
||||||
|
- Handle importing only one end of a link node pair
|
||||||
|
- Make sending to Debug synchronous again Fixes #1323
|
||||||
|
- Make send-error behaviour optional in file node
|
||||||
|
- Restore File In node behaviour of sending msg on error
|
||||||
|
- Expose context.keys within Function node
|
||||||
|
- JSON parser default should be not formatting output
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.17.3: Maintenance Release
|
||||||
|
|
||||||
|
- Fix flow library in menu to support period characters as flow name (#1320)
|
||||||
|
- editorTheme not setting custom css/scripts properly
|
||||||
|
- Fix missing icons for some nodes (#1321)
|
||||||
|
- Add reformat button to JSONata test data editor
|
||||||
|
- Update delay node status without spawning unnecessary intervals
|
||||||
|
- Avoid stringify ServerResponse and Socket in Debug node Fixes #1311
|
||||||
|
- Fix creating userDir other than system drive on Windows (#1317)
|
||||||
|
- Trigger node not handling a duration of 0 as block mode Fixes #1316
|
||||||
|
- Unable to config GPIO Pin 13 Fixes #1314
|
||||||
|
|
||||||
|
#### 0.17.2: Maintenance Release
|
||||||
|
|
||||||
|
- Fix GPIO node labels
|
||||||
|
|
||||||
|
#### 0.17.1: Maintenance Release
|
||||||
|
|
||||||
|
- Fix PI gpio to use BCM
|
||||||
|
- Prevent event thread contention when sending to Debug node Closes #1311
|
||||||
|
- Fix Bug: Can not display node icon when npm package has scope (#1305) (#1309)
|
||||||
|
- Clear moved flag when nodes are deployed
|
||||||
|
|
||||||
|
#### 0.17: Milestone Release
|
||||||
|
|
||||||
|
Runtime
|
||||||
|
|
||||||
|
- Return flow rev on reload api when api v2 enabled Closes #1273
|
||||||
|
- Provide single endpoint to load all node message catalogs
|
||||||
|
- Add .trace and .debug to Node prototype
|
||||||
|
- Rename oauth auth scheme to strategy as it works for openid
|
||||||
|
- Allow oauth schemes provide a custom verify function
|
||||||
|
- Add support for oauth adminAuth configs
|
||||||
|
- Cache auth details to save needlessly recalculating hashes
|
||||||
|
- Add context.keys function to list top-level keys
|
||||||
|
- Strip BOM character from JSON files if present Fixes #1239
|
||||||
|
- Version check no meta (#1243)
|
||||||
|
- Ensure all nodes have access to global context Fixes #1230
|
||||||
|
- Don't process subscription for unauthenticated comms link Fixes #851
|
||||||
|
- Clone credentials when passing to node Fixes #1198
|
||||||
|
- Resolve dir argument of getLocalNodeFiles function (#1216)
|
||||||
|
- Add wait for writing a library entry into a file. (#1186)
|
||||||
|
- Use correct Buffer.from method rather than constructor
|
||||||
|
- update core nodes to use newer Buffer syntax
|
||||||
|
- Treat missing msg properties as undefined rather than throw error Fixes #1167
|
||||||
|
- Allows flows to be enabled/disabled in the runtime
|
||||||
|
- add off option to logging settings comment
|
||||||
|
- Log error stack traces if verbose flag is set
|
||||||
|
- Extract line number if available from node load errors
|
||||||
|
- Add node 8 to travis (with allow failure)
|
||||||
|
- Shuffle promises for creating default package.json
|
||||||
|
- Create a package.json file in userDir if one doesn't exist
|
||||||
|
- autoInstallModules option must honour version/pending_version
|
||||||
|
- Refuse to update a non-local node module
|
||||||
|
- Finalise nodeSettings and update tlsConfigDisableLocalFiles
|
||||||
|
- Allow a node to declare what settings should be made available to the editor. (#1185)
|
||||||
|
- Add node whitelist function (#1184)
|
||||||
|
- Allow a node to declare settings that should be exported
|
||||||
|
- Add test coverage for deleting a flow
|
||||||
|
- Update tests for oauth -> strategy rename
|
||||||
|
- Fix the test cases which sometimes fails due to timing. (#1228)
|
||||||
|
- Extend timeout for the test case of installing non-existant path. (#1191)
|
||||||
|
- Fix loader test to expect line numbers in load errors
|
||||||
|
- Update ui_spec for icon module path
|
||||||
|
- let node installer try to save with ~ version prefix to allow minor updates
|
||||||
|
- Log error when non-msg-object is returned from a Function
|
||||||
|
- Timeout a node that fails to close - default 15s timeout
|
||||||
|
- Pass a 'removed' parameter to node close handler
|
||||||
|
- Remove event passing for icons/examples from the api layer
|
||||||
|
- Update general dependencies
|
||||||
|
|
||||||
|
Nodes
|
||||||
|
|
||||||
|
- Do not log node errors if handled by a Catch node
|
||||||
|
- Fix wrong number of double quotes in CSV parsing
|
||||||
|
- let csv node handle ip addresses without trying to parse
|
||||||
|
- Update debug node to register the settings it uses
|
||||||
|
- Handle IncomingMessage/ServerResponse object types in debug Fixes #1202
|
||||||
|
- Toggling debug node enabled/disabled state should set state dirty Fixes #1203
|
||||||
|
- redo delay node status messages to be interval based
|
||||||
|
- Update delay node ui
|
||||||
|
- Add new msg.delay option to delay node
|
||||||
|
- stop delay node spamming web socket (when in fast rate limit mode)
|
||||||
|
- Delay/Range node help tidy up
|
||||||
|
- Bug fix in exec node. White spaces in arguments now works (#1285)
|
||||||
|
- Make exec node explicitly call SIGTERM for default
|
||||||
|
- Fix exec node error tests on Windows (#1234)
|
||||||
|
- update messages for updated exec node
|
||||||
|
- Make exec node spawn and exec outputs more consistent
|
||||||
|
- Exec node for windows environment (#1200)
|
||||||
|
- remove requirement for cmd in exec node config + new style info
|
||||||
|
- retry exec node tests
|
||||||
|
- let exec node take msg.kill SIG... param and pid param
|
||||||
|
- Third output from Exec node must be consistent for success/failure conditions
|
||||||
|
- exec node returns 0 on the third output if command ended without error. (#1160)
|
||||||
|
- exec node can be killed on demand
|
||||||
|
- add "split/stream" ability to file in node
|
||||||
|
- add port label to file node and update info
|
||||||
|
- Allow nodes to have translations not in core (#1183)
|
||||||
|
- fix tcp node new Buffer alloc size 0
|
||||||
|
- change pin selection table for pi gpis nodes
|
||||||
|
- stop using sudo for Pi gpio access
|
||||||
|
- adding frequency configuration to pwm output (#1206)
|
||||||
|
- Fix Pi GPIO debounce
|
||||||
|
- let Hypriot on Pi detect gpio correctly
|
||||||
|
- More core node info help tidy up
|
||||||
|
- Tidy up more core node help text
|
||||||
|
- Tidy up parser node edit dialogs and help text
|
||||||
|
- yet more core node info updates
|
||||||
|
- more core node info updates to newer style
|
||||||
|
- Update some core nodes info
|
||||||
|
- First pass of new node-info style
|
||||||
|
- MQTT new style info
|
||||||
|
- Fix empty extra node help content issue
|
||||||
|
- Handle HTTP In url that is missing its leading / Fixes #1218
|
||||||
|
- Add file upload support to HTTP In node
|
||||||
|
- HTTP Request node: add info on how to do form encoding
|
||||||
|
- Prevent unmodified msg.headers from breaking HTTP Request flows Closed #1015
|
||||||
|
- Add cookie handling to HTTP Request node
|
||||||
|
- Add guard against the http-request buffer fix being reverted
|
||||||
|
- Multipart streaming
|
||||||
|
- Add http-request node unit tests
|
||||||
|
- http request node add transport validity check and warn.
|
||||||
|
- Update follow_redirects to fix http_proxy handling Fixes #1172
|
||||||
|
- Allow statusCode/headers to be set directly within HTTP Response node
|
||||||
|
- let inject "between time" also fire at start - Plus new info
|
||||||
|
- remove repeat symbol from inject if repeat is 0
|
||||||
|
- Add port labels to inject node (to show types)
|
||||||
|
- Add buffer joiner mode to Join node
|
||||||
|
- Let join node auto re-assemble buffers
|
||||||
|
- let join also accumulate strings (and not fail)
|
||||||
|
- Add Pretty print option to JSON node and
|
||||||
|
- Fix selection of link nodes
|
||||||
|
- Add link label value as portLabels
|
||||||
|
- Add sentence about clearing retained topic on mqtt
|
||||||
|
- make sure MQTT client closes if redeploy during reconnect
|
||||||
|
- make sure MQTT client closes if redeploy during reconnect
|
||||||
|
- slight filed size adjust for mqtt broker port field - allow 5 digits
|
||||||
|
- Add help info for split node
|
||||||
|
- split node - in object mode allow msg.complete on its own
|
||||||
|
- let split of objects use key to set another property (e.g. topic)
|
||||||
|
- adding streaming modes into split node
|
||||||
|
- let split node reassemble based on a final packet. (as well as the first)
|
||||||
|
- Add buffer support to split node
|
||||||
|
- updated split/join node (split still needs work before release)
|
||||||
|
- Added a name icon and a description label on edit subflow window.
|
||||||
|
- Don't display port labels for subflow pseudo-port nodes
|
||||||
|
- Added a name icon and a description label on edit subflow window.
|
||||||
|
- tcp request - remove confusing timeout wording from info
|
||||||
|
- Final TCP node nits - let 0 do it's thing as per every other timeout
|
||||||
|
- fix tcp port not waiting as per info/previous behaviour
|
||||||
|
- TCP In: Fix error in timout callback (#1249)
|
||||||
|
- Make tcp send msg more consistent
|
||||||
|
- Update 31-tcpin.js (#1235)
|
||||||
|
- really close tcp node connection right away (if told to)
|
||||||
|
- clone message before send in stay connected mode
|
||||||
|
- Better template node help example
|
||||||
|
- Add option to parse Template result as JSON before sending
|
||||||
|
- nail trigger test for windows AND linux
|
||||||
|
- give up on SIGQUIT for widows test
|
||||||
|
- better tests for windows nodes
|
||||||
|
- comment out 2nd exec node kill tests
|
||||||
|
- fixes for grunt files tests on Windows
|
||||||
|
- Add events to test helper
|
||||||
|
- Change default value of tlsConfigDisableLocalFiles to false
|
||||||
|
- Add the node setting tlsConfigDisableLocalFiles for tls node. (#1190)
|
||||||
|
- UI to upload certificates and keys for TLS node
|
||||||
|
- Update trigger help
|
||||||
|
- let trigger node set repeated outputs
|
||||||
|
- Move udp sock error listener to only be instantiated once.
|
||||||
|
- Let watch node recurse into subdirectories
|
||||||
|
- Misconfigured WebSocket nodes should not register msg handlers
|
||||||
|
- Add websocketVerifyClient option to enable custom websocket auth Fixes #1127
|
||||||
|
|
||||||
|
Editor
|
||||||
|
|
||||||
|
- Bump ACE editor to v1.2.7
|
||||||
|
- Add RED.utils.getNodeLabel utility function
|
||||||
|
- Include module name in requests for node icons
|
||||||
|
- Change debug message menu icon
|
||||||
|
- Handle empty array/objects in debug view
|
||||||
|
- Add per-node filter option to Debug pane
|
||||||
|
- Ensure debug node marked changed when button pressed
|
||||||
|
- Fix pop-out debug window for all the recent updates
|
||||||
|
- Add debug message menu
|
||||||
|
- Don't include msg. in debug message copied paths
|
||||||
|
- Format Buffer numbers as hex by default
|
||||||
|
- Remember formatting choices for dbg msg elements
|
||||||
|
- Allow debug msg elements to be pinned
|
||||||
|
- Only show debug tools under the debug tab
|
||||||
|
- Fix test for valid js identifiers in debug path construction
|
||||||
|
- Remove unused modified flag on debug messages
|
||||||
|
- Add copy path/value buttons to debug messages
|
||||||
|
- dont match only part of the node type (#1242)
|
||||||
|
- Add editorTheme.logout.redirect to allow redirect on logout Closes #1213
|
||||||
|
- Handle logging out and already logged-out editor Fixes #1288
|
||||||
|
- Fix bug: Export Subflows (#1282)
|
||||||
|
- destroy editor to ensure fully removed on close (function, template, comment)
|
||||||
|
- Don't try to nls status text starting with '.' Fixes #1258
|
||||||
|
- Add note of removed flows in diffConfig (#1253)
|
||||||
|
- Add description to flow same as subflow
|
||||||
|
- Allow tabs to be enabled/disabled in the editor
|
||||||
|
- Make H3 sections in node help collapsible
|
||||||
|
- Add JSON Expression editor
|
||||||
|
- Expression editor - clear legacy flag for blank expressions
|
||||||
|
- Ensure node labels are reordered properly to match outputs
|
||||||
|
- Add 'none' placeholder for empty port label form
|
||||||
|
- Don't mark a node changed when going from none to blank labels
|
||||||
|
- Leave a node to nls its own port labels
|
||||||
|
- Allow a node to override default labels
|
||||||
|
- Add placeholder text on label inputs and clear buttons
|
||||||
|
- Add port labels to Subflow nodes
|
||||||
|
- Keep port label form in sync with output reordering
|
||||||
|
- Basic node label editor
|
||||||
|
- Port label editor starting point
|
||||||
|
- Allow port labels be i18n identifiers
|
||||||
|
- Add inputLabels and outputLabels to node defn + Update Change node
|
||||||
|
- Resize port labels based on content
|
||||||
|
- Initial port label behaviour
|
||||||
|
- Allow a node to decide for itself if its button should be enabled or not
|
||||||
|
- Provide feedback when enable/disable node fails
|
||||||
|
- Add node module update api and expose in palette editor
|
||||||
|
- Reset palette-manager tabs when settings dialog reopened
|
||||||
|
- Move palette editor to settings panel
|
||||||
|
- Move palette editor to userSettings dialog
|
||||||
|
- Move view and keyboard into user settings dialog
|
||||||
|
- Add basic user settings panel
|
||||||
|
- Node status should be on by default
|
||||||
|
- Make theme able to load custom javascript (#1211)
|
||||||
|
- Allow tips to be hidden and cycled through
|
||||||
|
- Add info tips back to the sidebar
|
||||||
|
- Add buffer mode to typedInput
|
||||||
|
- Add typedInput binary mode icon
|
||||||
|
- Ensure all ace editors are destroyed in the expression editors
|
||||||
|
- Refresh sidebar info when tab is changed
|
||||||
|
- better spacing for library widget
|
||||||
|
- Fix gridSize for node width calculation to avoid odd resizing
|
||||||
|
- Redraw grid properly if gridSize changes
|
||||||
|
- Scroll sidebar info tab to top when changing content
|
||||||
|
- Ensure info tab sections are collapsible when set from palette
|
||||||
|
- Only show tab info if there is an active tab
|
||||||
|
- Only check for reordered outputs if outputMap defiend
|
||||||
|
- Avoid circular references when stingifying node objects
|
||||||
|
- Fix padding of config node edit dialog
|
||||||
|
- Add force-deploy option when conflict detected
|
||||||
|
- Hide tip box on startup if disabled
|
||||||
|
- Track node moves separately to node config changes
|
||||||
|
- Ensure ace editor instances are freed if edit cancelled
|
||||||
|
- Clip overly long notification messages
|
||||||
|
- Use queryCommandSupported not queryCommandEnabled to check for copy support
|
||||||
|
- Add tip to tab description editor
|
||||||
|
- Make tab info edit box resizable
|
||||||
|
- Shrink config node appearance in info table
|
||||||
|
- Display config nodes in Info sidebar table
|
||||||
|
- Ensure flow info box updates after editing flow
|
||||||
|
- Hide Node info section when displaying changelog
|
||||||
|
- Restructure info tab
|
||||||
|
- Provide notification when new flows deployed in the background
|
||||||
|
- Stop some ui elements from clearing url anchor when clicked
|
||||||
|
- clipboard export text stay highlighted even when button deselected
|
||||||
|
- ensure export clipboard keeps text selected and formatted
|
||||||
|
- Defer resizing tray components until they have finished building
|
||||||
|
- Use pre-calculated values for connection path
|
||||||
|
- Use textContent to avoid manual escaping
|
||||||
|
- Add RED.stack as a common ui component
|
||||||
|
- Numeric validator that accepts blank should accept undefined
|
||||||
|
- Add visual cue as to whether the workspace is focused
|
||||||
|
- Allow RED.validators.number to allow blank values as valid
|
||||||
|
- Support dropping json files into the editor
|
||||||
|
- NLS Expression/JSON editor and fix their height calculation
|
||||||
|
- Update JSONata to 1.2.4 Closes #1275
|
||||||
|
- Remember test expression data on a per-node basis
|
||||||
|
- NLS jsonata test messages
|
||||||
|
- Add JSONata expr tester and improved feedback
|
||||||
|
- Add $context/$flow/$global functions to jsonata
|
||||||
|
- Update jsonata
|
||||||
|
|
||||||
|
Other
|
||||||
|
|
||||||
|
- add allow es6 to .jshintrc
|
||||||
|
- travis - don't allow node 8 fails, (and re-add 7)
|
||||||
|
- ask istanbul for more reports as default
|
||||||
|
- Add istanbul to Gruntfile.js (#1189)
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.16.2: Maintenance Release
|
||||||
|
|
||||||
|
- Ensure custom mustache context parent set in Template node fixes #1126
|
||||||
|
- Display debug node name in debug panel if its known
|
||||||
|
- Ensure auth-tokens are removed when no user is specified in settings
|
||||||
|
- Ensure all a tags have blank target in info sidebar
|
||||||
|
- Ensure links do not span tabs in the editor
|
||||||
|
- Avoid creating multiple reconnect timers in websocket node
|
||||||
|
- Fix inner reference in install fail message catalog entry Fixes #1120
|
||||||
|
- Display buffer data properly for truncated buffers under Object property
|
||||||
|
|
||||||
|
#### 0.16.1: Maintenance Release
|
||||||
|
|
||||||
|
- Add colour swatches to debug when hex colour matched
|
||||||
|
- Nodes with hasUsers set to false should not appear unused
|
||||||
|
- Change hard error to verbose warning if using old node.js level
|
||||||
|
- Don't filter debug properties starting with _ Fixes #1117
|
||||||
|
- Node logged errors not displayed properly in debug pane Fixes #1116
|
||||||
|
- Do not look for existing nodes when checking for wires on paste Fixes #1114
|
||||||
|
- -v option not enabling verbose mode properly
|
||||||
|
- Add node.js version check on startup
|
||||||
|
|
||||||
|
#### 0.16.0: Milestone Release
|
||||||
|
|
||||||
|
Runtime
|
||||||
|
|
||||||
|
- Drop support for node 0.10 and 0.12
|
||||||
|
|
||||||
|
Nodes
|
||||||
|
|
||||||
|
- Add option to colourise debug console output Closes #1103
|
||||||
|
- Add property validation to nodes using typedInput
|
||||||
|
- Add common validator for typedInput fields Closes #1104
|
||||||
|
- Update debug node console logging indicator icon Closes #1094
|
||||||
|
- Let exec node (spawn) handle commands with spaces in path
|
||||||
|
- Add symbol to debug node to indicate debugging also to console.log
|
||||||
|
- Change file node to use node 4 syntax (drops support for 0.8)
|
||||||
|
- add info for httprequest responseUrl property
|
||||||
|
- Add res.responseUrl to httprequest node response
|
||||||
|
- Add support for flow and global context in Template node (#1048)
|
||||||
|
- Added YAML parser node (#1034)
|
||||||
|
- node-red-node-serialport removed as a default node
|
||||||
|
|
||||||
|
Editor
|
||||||
|
|
||||||
|
- Add install/remove dialog to increase friction Closes #1109
|
||||||
|
- Report node catalogue load errors Closes #1009
|
||||||
|
- Properly report module remove errors in palette editor Fixes #1043
|
||||||
|
- Update rather than hide install button after success install
|
||||||
|
- Tweak search box styling
|
||||||
|
- Display info tips slightly longer
|
||||||
|
- Allow tips to be enabled/disabled via menu option
|
||||||
|
- Info-tips update
|
||||||
|
- Make typedInput keyboard navigable
|
||||||
|
- update Font Awesome to 4.7.0
|
||||||
|
- Add expression editor for jsonata
|
||||||
|
- Overhaul keyboard handling and introduce editor actions
|
||||||
|
- Add Japanese translation file(editor.json) (#1084)
|
||||||
|
- Add quick-add node mode with cmd/ctrl-click
|
||||||
|
- Add cmd/ctrl-click to quick add wires
|
||||||
|
- Use json-stringify-safe to detect circular references in debug msgs
|
||||||
|
- debug - format if time if correct length/range
|
||||||
|
- Make Debug object explorable
|
||||||
|
- Initial debug pop-out window
|
||||||
|
- Add proper three-way diff view
|
||||||
|
- Focus tray body when edit dialog opened
|
||||||
|
- Hit enter to edit first node in selection
|
||||||
|
- Add node delete button to edit dialog
|
||||||
|
- Add notification when runtime stopped due to missing types Part of #832
|
||||||
|
|
||||||
|
Fixes
|
||||||
|
|
||||||
|
- Do not tie debug src loading to needsPermission Fixes #1111
|
||||||
|
- Initialise nodeApp regardless of httpAdmin setting Closes #1096 #1095
|
||||||
|
- Speed up reveal of search dialogs
|
||||||
|
- Ensure flows exist before delegating status/error events Fixes #1069
|
||||||
|
- Update package dependencies
|
||||||
|
- Update MQTT to latest 2.2.1
|
||||||
|
- Node status not being refreshed properly in the editor
|
||||||
|
- Try to prevent auto-fill of password fields in node edit tray Fixes #1081
|
||||||
|
- Fix whitespace in localfilesystem
|
||||||
|
- fix bug where savesettings did not honor local settings variables (#1073)
|
||||||
|
- Tidy up unused/duplicate editor messages Closes #922
|
||||||
|
- Property expressions must not be blank
|
||||||
|
- Tidy up merge commit of validatePropertyExpression
|
||||||
|
- add port if wires array > number of ports declared.
|
||||||
|
- Allow quoted property expressions Fixes #1101
|
||||||
|
- Index all node properties for node search
|
||||||
|
- Remove node 0.10 from travis config
|
||||||
|
- update welcome message to use logger so it can be turned off/on if required (#1083)
|
||||||
|
- Fix dynamically loading multiple node-sets from palette editor
|
||||||
|
- Allow a node to reorder its outputs and maintain links Fixes #1031
|
||||||
|
|
||||||
#### 0.15.3: Maintenance Release
|
#### 0.15.3: Maintenance Release
|
||||||
|
|
||||||
- Tcpgetfix: Another small check (#1070)
|
- Tcpgetfix: Another small check (#1070)
|
||||||
@@ -477,7 +1287,7 @@ Fixes
|
|||||||
#### 0.10.10: Maintenance Release
|
#### 0.10.10: Maintenance Release
|
||||||
|
|
||||||
- Fix permissions issue with packaged nrgpio script
|
- Fix permissions issue with packaged nrgpio script
|
||||||
- Add better help message if deprecated node missing
|
- Add better help message if deprecated node missing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -489,16 +1299,16 @@ Fix packaging of bin scripts
|
|||||||
|
|
||||||
#### 0.10.8: Maintenance Release
|
#### 0.10.8: Maintenance Release
|
||||||
|
|
||||||
- Nodes moved out of core
|
- Nodes moved out of core
|
||||||
- still included as a dependency: twitter, serial, email, feedparser
|
- still included as a dependency: twitter, serial, email, feedparser
|
||||||
- no longer included: mongo, arduino, irc, redis
|
- no longer included: mongo, arduino, irc, redis
|
||||||
- node icon defn can be a function
|
- node icon defn can be a function
|
||||||
- http_proxy support
|
- http_proxy support
|
||||||
- httpNodeMiddleware setting
|
- httpNodeMiddleware setting
|
||||||
- Trigger node ui refresh
|
- Trigger node ui refresh
|
||||||
- editorTheme setting
|
- editorTheme setting
|
||||||
- Warn on deploy of unused config nodes
|
- Warn on deploy of unused config nodes
|
||||||
- catch node prevents error loops
|
- catch node prevents error loops
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -521,14 +1331,14 @@ Changes:
|
|||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|
||||||
- http request node passes on request url as msg.url
|
- http request node passes on request url as msg.url
|
||||||
- handle config nodes appearing out of order in flow file - don't assume they are always at the start
|
- handle config nodes appearing out of order in flow file - don't assume they are always at the start
|
||||||
- move subflow palette category to the top, to make it more obvious
|
- move subflow palette category to the top, to make it more obvious
|
||||||
- fix labelling of Raspberry Pi pins
|
- fix labelling of Raspberry Pi pins
|
||||||
- allow email node to mark mail as read
|
- allow email node to mark mail as read
|
||||||
- fix saving library content
|
- fix saving library content
|
||||||
- add node-red and node-red-pi start scripts
|
- add node-red and node-red-pi start scripts
|
||||||
- use $HOME/.node-red for user data unless specified otherwise (or existing data is found in install dir)
|
- use $HOME/.node-red for user data unless specified otherwise (or existing data is found in install dir)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ We welcome contributions, but request you follow these guidelines.
|
|||||||
|
|
||||||
This project adheres to the [Contributor Covenant 1.4](http://contributor-covenant.org/version/1/4/).
|
This project adheres to the [Contributor Covenant 1.4](http://contributor-covenant.org/version/1/4/).
|
||||||
By participating, you are expected to uphold this code. Please report unacceptable
|
By participating, you are expected to uphold this code. Please report unacceptable
|
||||||
behavior to any of the [project's core team](https://github.com/orgs/node-red/teams/core).
|
behavior to the project's core team at team@nodered.org.
|
||||||
|
|
||||||
## Raising issues
|
## Raising issues
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ At a minimum, please include:
|
|||||||
|
|
||||||
## Feature requests
|
## Feature requests
|
||||||
|
|
||||||
For feature requests, please raise them on the [mailing list](https://groups.google.com/forum/#!forum/node-red).
|
For feature requests, please raise them on the [forum](https://discourse.nodered.org).
|
||||||
|
|
||||||
## Pull-Requests
|
## Pull-Requests
|
||||||
|
|
||||||
If you want to raise a pull-request with a new feature, or a refactoring
|
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
|
of existing code, it may well get rejected if you haven't discussed it on
|
||||||
the [mailing list](https://groups.google.com/forum/#!forum/node-red) first.
|
the [forum](https://discourse.nodered.org) first.
|
||||||
|
|
||||||
All contributors need to sign the JS Foundation's Contributor License Agreement.
|
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
|
It is an online process and quick to do. You can read the details of the agreement
|
||||||
|
|||||||
172
Gruntfile.js
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -24,6 +24,10 @@ module.exports = function(grunt) {
|
|||||||
nodemonArgs.push(flowFile);
|
nodemonArgs.push(flowFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var nonHeadless = grunt.option('non-headless');
|
||||||
|
if (nonHeadless) {
|
||||||
|
process.env.NODE_RED_NON_HEADLESS = 'true';
|
||||||
|
}
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
paths: {
|
paths: {
|
||||||
@@ -41,6 +45,24 @@ module.exports = function(grunt) {
|
|||||||
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
||||||
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
||||||
},
|
},
|
||||||
|
webdriver: {
|
||||||
|
all: {
|
||||||
|
configFile: 'test/editor/wdio.conf.js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mocha_istanbul: {
|
||||||
|
options: {
|
||||||
|
globals: ['expect'],
|
||||||
|
timeout: 3000,
|
||||||
|
ignoreLeaks: false,
|
||||||
|
ui: 'bdd',
|
||||||
|
reportFormats: ['lcov','html'],
|
||||||
|
print: 'both'
|
||||||
|
},
|
||||||
|
all: { src: ["test/_spec.js","test/red/**/*_spec.js","test/nodes/**/*_spec.js"] },
|
||||||
|
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
||||||
|
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
||||||
|
},
|
||||||
jshint: {
|
jshint: {
|
||||||
options: {
|
options: {
|
||||||
jshintrc:true
|
jshintrc:true
|
||||||
@@ -98,7 +120,7 @@ module.exports = function(grunt) {
|
|||||||
src: [
|
src: [
|
||||||
// Ensure editor source files are concatenated in
|
// Ensure editor source files are concatenated in
|
||||||
// the right order
|
// the right order
|
||||||
"editor/js/main.js",
|
"editor/js/red.js",
|
||||||
"editor/js/events.js",
|
"editor/js/events.js",
|
||||||
"editor/js/i18n.js",
|
"editor/js/i18n.js",
|
||||||
"editor/js/settings.js",
|
"editor/js/settings.js",
|
||||||
@@ -110,28 +132,43 @@ module.exports = function(grunt) {
|
|||||||
"editor/js/nodes.js",
|
"editor/js/nodes.js",
|
||||||
"editor/js/history.js",
|
"editor/js/history.js",
|
||||||
"editor/js/validators.js",
|
"editor/js/validators.js",
|
||||||
|
"editor/js/ui/utils.js",
|
||||||
"editor/js/ui/common/editableList.js",
|
"editor/js/ui/common/editableList.js",
|
||||||
|
"editor/js/ui/common/checkboxSet.js",
|
||||||
"editor/js/ui/common/menu.js",
|
"editor/js/ui/common/menu.js",
|
||||||
|
"editor/js/ui/common/panels.js",
|
||||||
"editor/js/ui/common/popover.js",
|
"editor/js/ui/common/popover.js",
|
||||||
"editor/js/ui/common/searchBox.js",
|
"editor/js/ui/common/searchBox.js",
|
||||||
"editor/js/ui/common/tabs.js",
|
"editor/js/ui/common/tabs.js",
|
||||||
|
"editor/js/ui/common/stack.js",
|
||||||
"editor/js/ui/common/typedInput.js",
|
"editor/js/ui/common/typedInput.js",
|
||||||
|
"editor/js/ui/actions.js",
|
||||||
"editor/js/ui/deploy.js",
|
"editor/js/ui/deploy.js",
|
||||||
|
"editor/js/ui/diff.js",
|
||||||
"editor/js/ui/keyboard.js",
|
"editor/js/ui/keyboard.js",
|
||||||
"editor/js/ui/workspaces.js",
|
"editor/js/ui/workspaces.js",
|
||||||
"editor/js/ui/view.js",
|
"editor/js/ui/view.js",
|
||||||
|
"editor/js/ui/view-navigator.js",
|
||||||
"editor/js/ui/sidebar.js",
|
"editor/js/ui/sidebar.js",
|
||||||
"editor/js/ui/palette.js",
|
"editor/js/ui/palette.js",
|
||||||
"editor/js/ui/tab-info.js",
|
"editor/js/ui/tab-info.js",
|
||||||
"editor/js/ui/tab-config.js",
|
"editor/js/ui/tab-config.js",
|
||||||
|
"editor/js/ui/tab-context.js",
|
||||||
"editor/js/ui/palette-editor.js",
|
"editor/js/ui/palette-editor.js",
|
||||||
"editor/js/ui/editor.js",
|
"editor/js/ui/editor.js",
|
||||||
|
"editor/js/ui/editors/*.js",
|
||||||
"editor/js/ui/tray.js",
|
"editor/js/ui/tray.js",
|
||||||
"editor/js/ui/clipboard.js",
|
"editor/js/ui/clipboard.js",
|
||||||
"editor/js/ui/library.js",
|
"editor/js/ui/library.js",
|
||||||
"editor/js/ui/notifications.js",
|
"editor/js/ui/notifications.js",
|
||||||
"editor/js/ui/search.js",
|
"editor/js/ui/search.js",
|
||||||
|
"editor/js/ui/typeSearch.js",
|
||||||
"editor/js/ui/subflow.js",
|
"editor/js/ui/subflow.js",
|
||||||
|
"editor/js/ui/userSettings.js",
|
||||||
|
"editor/js/ui/projects/projects.js",
|
||||||
|
"editor/js/ui/projects/projectSettings.js",
|
||||||
|
"editor/js/ui/projects/projectUserSettings.js",
|
||||||
|
"editor/js/ui/projects/tab-versionControl.js",
|
||||||
"editor/js/ui/touch/radialMenu.js"
|
"editor/js/ui/touch/radialMenu.js"
|
||||||
],
|
],
|
||||||
dest: "public/red/red.js"
|
dest: "public/red/red.js"
|
||||||
@@ -150,6 +187,14 @@ module.exports = function(grunt) {
|
|||||||
"public/vendor/vendor.css": [
|
"public/vendor/vendor.css": [
|
||||||
// TODO: resolve relative resource paths in
|
// TODO: resolve relative resource paths in
|
||||||
// bootstrap/FA/jquery
|
// bootstrap/FA/jquery
|
||||||
|
],
|
||||||
|
"public/vendor/jsonata/jsonata.min.js": [
|
||||||
|
"node_modules/jsonata/jsonata-es5.min.js",
|
||||||
|
"editor/vendor/jsonata/formatter.js"
|
||||||
|
],
|
||||||
|
"public/vendor/ace/worker-jsonata.js": [
|
||||||
|
"node_modules/jsonata/jsonata-es5.min.js",
|
||||||
|
"editor/vendor/jsonata/worker-jsonata.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +202,10 @@ module.exports = function(grunt) {
|
|||||||
uglify: {
|
uglify: {
|
||||||
build: {
|
build: {
|
||||||
files: {
|
files: {
|
||||||
'public/red/red.min.js': 'public/red/red.js'
|
'public/red/red.min.js': 'public/red/red.js',
|
||||||
|
'public/red/main.min.js': 'public/red/main.js',
|
||||||
|
'public/vendor/ace/mode-jsonata.js': 'editor/vendor/jsonata/mode-jsonata.js',
|
||||||
|
'public/vendor/ace/snippets/jsonata.js': 'editor/vendor/jsonata/snippets-jsonata.js'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -183,12 +231,18 @@ module.exports = function(grunt) {
|
|||||||
'red/api/locales/en-US/editor.json',
|
'red/api/locales/en-US/editor.json',
|
||||||
'red/runtime/locales/en-US/runtime.json'
|
'red/runtime/locales/en-US/runtime.json'
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
keymaps: {
|
||||||
|
src: [
|
||||||
|
'editor/js/keymap.json'
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
attachCopyright: {
|
attachCopyright: {
|
||||||
js: {
|
js: {
|
||||||
src: [
|
src: [
|
||||||
'public/red/red.min.js'
|
'public/red/red.min.js',
|
||||||
|
'public/red/main.min.js'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
@@ -218,7 +272,7 @@ module.exports = function(grunt) {
|
|||||||
files: [
|
files: [
|
||||||
'editor/js/**/*.js'
|
'editor/js/**/*.js'
|
||||||
],
|
],
|
||||||
tasks: ['concat','uglify','attachCopyright:js']
|
tasks: ['copy:build','concat','uglify','attachCopyright:js']
|
||||||
},
|
},
|
||||||
sass: {
|
sass: {
|
||||||
files: [
|
files: [
|
||||||
@@ -234,6 +288,12 @@ module.exports = function(grunt) {
|
|||||||
],
|
],
|
||||||
tasks: ['jsonlint:messages']
|
tasks: ['jsonlint:messages']
|
||||||
},
|
},
|
||||||
|
keymaps: {
|
||||||
|
files: [
|
||||||
|
'editor/js/keymap.json'
|
||||||
|
],
|
||||||
|
tasks: ['jsonlint:keymaps','copy:build']
|
||||||
|
},
|
||||||
misc: {
|
misc: {
|
||||||
files: [
|
files: [
|
||||||
'CHANGELOG.md'
|
'CHANGELOG.md'
|
||||||
@@ -267,40 +327,49 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
copy: {
|
copy: {
|
||||||
build: {
|
build: {
|
||||||
files:[{
|
files:[
|
||||||
cwd: 'editor/images',
|
{
|
||||||
src: '**',
|
src: 'editor/js/main.js',
|
||||||
expand: true,
|
dest: 'public/red/main.js'
|
||||||
dest: 'public/red/images/'
|
},
|
||||||
},
|
{
|
||||||
{
|
src: 'editor/js/keymap.json',
|
||||||
cwd: 'editor/vendor',
|
dest: 'public/red/keymap.json'
|
||||||
src: [
|
},
|
||||||
'ace/**',
|
{
|
||||||
//'bootstrap/css/**',
|
cwd: 'editor/images',
|
||||||
'bootstrap/img/**',
|
src: '**',
|
||||||
'jquery/css/**',
|
expand: true,
|
||||||
'font-awesome/**'
|
dest: 'public/red/images/'
|
||||||
],
|
},
|
||||||
expand: true,
|
{
|
||||||
dest: 'public/vendor/'
|
cwd: 'editor/vendor',
|
||||||
},
|
src: [
|
||||||
{
|
'ace/**',
|
||||||
cwd: 'editor/icons',
|
//'bootstrap/css/**',
|
||||||
src: '**',
|
'bootstrap/img/**',
|
||||||
expand: true,
|
'jquery/css/**',
|
||||||
dest: 'public/icons/'
|
'font-awesome/**'
|
||||||
},
|
],
|
||||||
{
|
expand: true,
|
||||||
expand: true,
|
dest: 'public/vendor/'
|
||||||
src: ['editor/index.html','editor/favicon.ico'],
|
},
|
||||||
dest: 'public/',
|
{
|
||||||
flatten: true
|
cwd: 'editor/icons',
|
||||||
},
|
src: '**',
|
||||||
{
|
expand: true,
|
||||||
src: 'CHANGELOG.md',
|
dest: 'public/icons/'
|
||||||
dest: 'public/red/about'
|
},
|
||||||
}
|
{
|
||||||
|
expand: true,
|
||||||
|
src: ['editor/index.html','editor/favicon.ico'],
|
||||||
|
dest: 'public/',
|
||||||
|
flatten: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: 'CHANGELOG.md',
|
||||||
|
dest: 'public/red/about'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
release: {
|
release: {
|
||||||
@@ -330,9 +399,9 @@ module.exports = function(grunt) {
|
|||||||
mode: '755'
|
mode: '755'
|
||||||
},
|
},
|
||||||
release: {
|
release: {
|
||||||
// Target-specific file/dir lists and/or options go here.
|
|
||||||
src: [
|
src: [
|
||||||
path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/nodes/core/hardware/nrgpio*')
|
path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/nodes/core/hardware/nrgpio*'),
|
||||||
|
path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/red/runtime/storage/localfilesystem/projects/git/node-red-*sh')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -361,11 +430,13 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||||
grunt.loadNpmTasks('grunt-chmod');
|
grunt.loadNpmTasks('grunt-chmod');
|
||||||
grunt.loadNpmTasks('grunt-jsonlint');
|
grunt.loadNpmTasks('grunt-jsonlint');
|
||||||
|
grunt.loadNpmTasks('grunt-mocha-istanbul');
|
||||||
|
grunt.loadNpmTasks('grunt-webdriver');
|
||||||
|
|
||||||
grunt.registerMultiTask('attachCopyright', function() {
|
grunt.registerMultiTask('attachCopyright', function() {
|
||||||
var files = this.data.src;
|
var files = this.data.src;
|
||||||
var copyright = "/**\n"+
|
var copyright = "/**\n"+
|
||||||
" * Copyright 2013, 2015 IBM Corp.\n"+
|
" * Copyright JS Foundation and other contributors, http://js.foundation\n"+
|
||||||
" *\n"+
|
" *\n"+
|
||||||
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
|
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
|
||||||
" * you may not use this file except in compliance with the License.\n"+
|
" * you may not use this file except in compliance with the License.\n"+
|
||||||
@@ -381,7 +452,7 @@ module.exports = function(grunt) {
|
|||||||
" **/\n";
|
" **/\n";
|
||||||
|
|
||||||
if (files) {
|
if (files) {
|
||||||
for (var i=0;i<files.length;i++) {
|
for (var i=0; i<files.length; i++) {
|
||||||
var file = files[i];
|
var file = files[i];
|
||||||
if (!grunt.file.exists(file)) {
|
if (!grunt.file.exists(file)) {
|
||||||
grunt.log.warn('File '+ file + ' not found');
|
grunt.log.warn('File '+ file + ' not found');
|
||||||
@@ -410,23 +481,27 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
grunt.registerTask('default',
|
grunt.registerTask('default',
|
||||||
'Builds editor content then runs code style checks and unit tests on all components',
|
'Builds editor content then runs code style checks and unit tests on all components',
|
||||||
['build','test-core','test-editor','test-nodes']);
|
['build','jshint:editor','mocha_istanbul:all']);
|
||||||
|
|
||||||
grunt.registerTask('test-core',
|
grunt.registerTask('test-core',
|
||||||
'Runs code style check and unit tests on core runtime code',
|
'Runs code style check and unit tests on core runtime code',
|
||||||
['jshint:core','simplemocha:core']);
|
['build','mocha_istanbul:core']);
|
||||||
|
|
||||||
grunt.registerTask('test-editor',
|
grunt.registerTask('test-editor',
|
||||||
'Runs code style check on editor code',
|
'Runs code style check on editor code',
|
||||||
['jshint:editor']);
|
['jshint:editor']);
|
||||||
|
|
||||||
|
grunt.registerTask('test-ui',
|
||||||
|
'Builds editor content then runs unit tests on editor ui',
|
||||||
|
['build','jshint:editor','webdriver:all']);
|
||||||
|
|
||||||
grunt.registerTask('test-nodes',
|
grunt.registerTask('test-nodes',
|
||||||
'Runs unit tests on core nodes',
|
'Runs unit tests on core nodes',
|
||||||
['simplemocha:nodes']);
|
['build','mocha_istanbul:nodes']);
|
||||||
|
|
||||||
grunt.registerTask('build',
|
grunt.registerTask('build',
|
||||||
'Builds editor content',
|
'Builds editor content',
|
||||||
['clean:build','concat:build','concat:vendor','uglify:build','sass:build','jsonlint:messages','copy:build','attachCopyright']);
|
['clean:build','jsonlint','concat:build','concat:vendor','copy:build','uglify:build','sass:build','attachCopyright']);
|
||||||
|
|
||||||
grunt.registerTask('dev',
|
grunt.registerTask('dev',
|
||||||
'Developer mode: run node-red, watch for source changes and build/restart',
|
'Developer mode: run node-red, watch for source changes and build/restart',
|
||||||
@@ -436,4 +511,7 @@ module.exports = function(grunt) {
|
|||||||
'Create distribution zip file',
|
'Create distribution zip file',
|
||||||
['build','clean:release','copy:release','chmod:release','compress:release']);
|
['build','clean:release','copy:release','chmod:release','compress:release']);
|
||||||
|
|
||||||
|
grunt.registerTask('coverage',
|
||||||
|
'Run Istanbul code test coverage task',
|
||||||
|
['build','mocha_istanbul:all']);
|
||||||
};
|
};
|
||||||
|
|||||||
1
LICENSE
@@ -1,3 +1,4 @@
|
|||||||
|
Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
|
|||||||
17
README.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
http://nodered.org
|
http://nodered.org
|
||||||
|
|
||||||
[](https://travis-ci.org/node-red/node-red)
|
[](https://travis-ci.org/node-red/node-red)
|
||||||
[](https://coveralls.io/r/node-red/node-red?branch=master)
|
[](https://coveralls.io/r/node-red/node-red?branch=master)
|
||||||
|
|
||||||
A visual tool for wiring the Internet of Things.
|
A visual tool for wiring the Internet of Things.
|
||||||
@@ -14,7 +14,7 @@ A visual tool for wiring the Internet of Things.
|
|||||||
Check out http://nodered.org/docs/getting-started/ for full instructions on getting
|
Check out http://nodered.org/docs/getting-started/ for full instructions on getting
|
||||||
started.
|
started.
|
||||||
|
|
||||||
1. `sudo npm install -g node-red`
|
1. `sudo npm install -g --unsafe-perm node-red`
|
||||||
2. `node-red`
|
2. `node-red`
|
||||||
3. Open <http://localhost:1880>
|
3. Open <http://localhost:1880>
|
||||||
|
|
||||||
@@ -22,8 +22,7 @@ started.
|
|||||||
|
|
||||||
More documentation can be found [here](http://nodered.org/docs).
|
More documentation can be found [here](http://nodered.org/docs).
|
||||||
|
|
||||||
For further help, or general discussion, please use the
|
For further help, or general discussion, please use the [Node-RED Forum](https://discourse.nodered.org) or [slack team](https://nodered.org/slack).
|
||||||
[mailing list](https://groups.google.com/forum/#!forum/node-red).
|
|
||||||
|
|
||||||
## Developers
|
## Developers
|
||||||
|
|
||||||
@@ -56,17 +55,19 @@ Before raising a pull-request, please read our
|
|||||||
|
|
||||||
This project adheres to the [Contributor Covenant 1.4](http://contributor-covenant.org/version/1/4/).
|
This project adheres to the [Contributor Covenant 1.4](http://contributor-covenant.org/version/1/4/).
|
||||||
By participating, you are expected to uphold this code. Please report unacceptable
|
By participating, you are expected to uphold this code. Please report unacceptable
|
||||||
behavior to any of the [project's core team](https://github.com/orgs/node-red/teams/core).
|
behavior to any of the project's core team at team@nodered.org.
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
|
|
||||||
Node-RED is a creation of [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-technology/).
|
Node-RED is a project of the [JS Foundation](http://js.foundation).
|
||||||
|
|
||||||
|
It was created by [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-technology/).
|
||||||
|
|
||||||
* Nick O'Leary [@knolleary](http://twitter.com/knolleary)
|
* Nick O'Leary [@knolleary](http://twitter.com/knolleary)
|
||||||
* Dave Conway-Jones [@ceejay](http://twitter.com/ceejay)
|
* Dave Conway-Jones [@ceejay](http://twitter.com/ceejay)
|
||||||
|
|
||||||
For more open-source projects from IBM, head over [here](http://ibm.github.io).
|
|
||||||
|
|
||||||
## Copyright and license
|
## Copyright and license
|
||||||
|
|
||||||
Copyright 2013, 2016 IBM Corp. under [the Apache 2.0 license](LICENSE).
|
Copyright JS Foundation and other contributors, http://js.foundation under [the Apache 2.0 license](LICENSE).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright 2015 IBM Corp.
|
# Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -31,7 +31,7 @@ done
|
|||||||
# Find the real location of this script
|
# Find the real location of this script
|
||||||
CURRENT_PATH=`pwd`
|
CURRENT_PATH=`pwd`
|
||||||
SCRIPT_PATH="${BASH_SOURCE[0]}";
|
SCRIPT_PATH="${BASH_SOURCE[0]}";
|
||||||
while([ -h "${SCRIPT_PATH}" ]); do
|
while [ -h "${SCRIPT_PATH}" ]; do
|
||||||
cd "`dirname "${SCRIPT_PATH}"`"
|
cd "`dirname "${SCRIPT_PATH}"`"
|
||||||
SCRIPT_PATH="$(readlink "`basename "${SCRIPT_PATH}"`")";
|
SCRIPT_PATH="$(readlink "`basename "${SCRIPT_PATH}"`")";
|
||||||
done
|
done
|
||||||
|
|||||||
BIN
editor/icons/batch.png
Normal file
|
After Width: | Height: | Size: 712 B |
BIN
editor/icons/file-in.png
Normal file
|
After Width: | Height: | Size: 542 B |
BIN
editor/icons/file-out.png
Normal file
|
After Width: | Height: | Size: 503 B |
BIN
editor/icons/parser-yaml.png
Normal file
|
After Width: | Height: | Size: 423 B |
BIN
editor/icons/sort.png
Normal file
|
After Width: | Height: | Size: 793 B |
BIN
editor/images/typedInput/bin.png
Normal file
|
After Width: | Height: | Size: 638 B |
BIN
editor/images/typedInput/env.png
Normal file
|
After Width: | Height: | Size: 809 B |
BIN
editor/images/typedInput/expr.png
Normal file
|
After Width: | Height: | Size: 563 B |
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2014, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -64,27 +64,31 @@ RED.comms = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ws.onmessage = function(event) {
|
ws.onmessage = function(event) {
|
||||||
var msg = JSON.parse(event.data);
|
var message = JSON.parse(event.data);
|
||||||
if (pendingAuth && msg.auth) {
|
for (var m = 0; m < message.length; m++) {
|
||||||
if (msg.auth === "ok") {
|
var msg = message[m];
|
||||||
pendingAuth = false;
|
if (pendingAuth && msg.auth) {
|
||||||
completeConnection();
|
if (msg.auth === "ok") {
|
||||||
} else if (msg.auth === "fail") {
|
pendingAuth = false;
|
||||||
// anything else is an error...
|
completeConnection();
|
||||||
active = false;
|
} else if (msg.auth === "fail") {
|
||||||
RED.user.login({updateMenu:true},function() {
|
// anything else is an error...
|
||||||
connectWS();
|
active = false;
|
||||||
})
|
RED.user.login({updateMenu:true},function() {
|
||||||
|
connectWS();
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (msg.topic) {
|
else if (msg.topic) {
|
||||||
for (var t in subscriptions) {
|
for (var t in subscriptions) {
|
||||||
if (subscriptions.hasOwnProperty(t)) {
|
if (subscriptions.hasOwnProperty(t)) {
|
||||||
var re = new RegExp("^"+t.replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g,"\\$1").replace(/\+/g,"[^/]+").replace(/\/#$/,"(\/.*)?")+"$");
|
var re = new RegExp("^"+t.replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g,"\\$1").replace(/\+/g,"[^/]+").replace(/\/#$/,"(\/.*)?")+"$");
|
||||||
if (re.test(msg.topic)) {
|
if (re.test(msg.topic)) {
|
||||||
var subscribers = subscriptions[t];
|
var subscribers = subscriptions[t];
|
||||||
if (subscribers) {
|
if (subscribers) {
|
||||||
for (var i=0;i<subscribers.length;i++) {
|
for (var i=0;i<subscribers.length;i++) {
|
||||||
subscribers[i](msg.topic,msg.data);
|
subscribers[i](msg.topic,msg.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,6 +16,291 @@
|
|||||||
RED.history = (function() {
|
RED.history = (function() {
|
||||||
var undo_history = [];
|
var undo_history = [];
|
||||||
|
|
||||||
|
function undoEvent(ev) {
|
||||||
|
var i;
|
||||||
|
var len;
|
||||||
|
var node;
|
||||||
|
var subflow;
|
||||||
|
var modifiedTabs = {};
|
||||||
|
if (ev) {
|
||||||
|
if (ev.t == 'multi') {
|
||||||
|
len = ev.events.length;
|
||||||
|
for (i=len-1;i>=0;i--) {
|
||||||
|
undoEvent(ev.events[i]);
|
||||||
|
}
|
||||||
|
} else if (ev.t == 'replace') {
|
||||||
|
RED.nodes.clear();
|
||||||
|
var imported = RED.nodes.import(ev.config);
|
||||||
|
imported[0].forEach(function(n) {
|
||||||
|
if (ev.changed[n.id]) {
|
||||||
|
n.changed = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
RED.nodes.version(ev.rev);
|
||||||
|
} else if (ev.t == 'add') {
|
||||||
|
if (ev.nodes) {
|
||||||
|
for (i=0;i<ev.nodes.length;i++) {
|
||||||
|
node = RED.nodes.node(ev.nodes[i]);
|
||||||
|
if (node.z) {
|
||||||
|
modifiedTabs[node.z] = true;
|
||||||
|
}
|
||||||
|
RED.nodes.remove(ev.nodes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.links) {
|
||||||
|
for (i=0;i<ev.links.length;i++) {
|
||||||
|
RED.nodes.removeLink(ev.links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.workspaces) {
|
||||||
|
for (i=0;i<ev.workspaces.length;i++) {
|
||||||
|
RED.nodes.removeWorkspace(ev.workspaces[i].id);
|
||||||
|
RED.workspaces.remove(ev.workspaces[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.subflows) {
|
||||||
|
for (i=0;i<ev.subflows.length;i++) {
|
||||||
|
RED.nodes.removeSubflow(ev.subflows[i]);
|
||||||
|
RED.workspaces.remove(ev.subflows[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.subflow) {
|
||||||
|
if (ev.subflow.instances) {
|
||||||
|
ev.subflow.instances.forEach(function(n) {
|
||||||
|
var node = RED.nodes.node(n.id);
|
||||||
|
if (node) {
|
||||||
|
node.changed = n.changed;
|
||||||
|
node.dirty = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (ev.subflow.hasOwnProperty('changed')) {
|
||||||
|
subflow = RED.nodes.subflow(ev.subflow.id);
|
||||||
|
if (subflow) {
|
||||||
|
subflow.changed = ev.subflow.changed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.removedLinks) {
|
||||||
|
for (i=0;i<ev.removedLinks.length;i++) {
|
||||||
|
RED.nodes.addLink(ev.removedLinks[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ev.t == "delete") {
|
||||||
|
if (ev.workspaces) {
|
||||||
|
for (i=0;i<ev.workspaces.length;i++) {
|
||||||
|
RED.nodes.addWorkspace(ev.workspaces[i]);
|
||||||
|
RED.workspaces.add(ev.workspaces[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.subflow && ev.subflow.subflow) {
|
||||||
|
RED.nodes.addSubflow(ev.subflow.subflow);
|
||||||
|
}
|
||||||
|
if (ev.subflowInputs && ev.subflowInputs.length > 0) {
|
||||||
|
subflow = RED.nodes.subflow(ev.subflowInputs[0].z);
|
||||||
|
subflow.in.push(ev.subflowInputs[0]);
|
||||||
|
subflow.in[0].dirty = true;
|
||||||
|
}
|
||||||
|
if (ev.subflowOutputs && ev.subflowOutputs.length > 0) {
|
||||||
|
subflow = RED.nodes.subflow(ev.subflowOutputs[0].z);
|
||||||
|
ev.subflowOutputs.sort(function(a,b) { return a.i-b.i});
|
||||||
|
for (i=0;i<ev.subflowOutputs.length;i++) {
|
||||||
|
var output = ev.subflowOutputs[i];
|
||||||
|
subflow.out.splice(output.i,0,output);
|
||||||
|
for (var j=output.i+1;j<subflow.out.length;j++) {
|
||||||
|
subflow.out[j].i++;
|
||||||
|
subflow.out[j].dirty = true;
|
||||||
|
}
|
||||||
|
RED.nodes.eachLink(function(l) {
|
||||||
|
if (l.source.type == "subflow:"+subflow.id) {
|
||||||
|
if (l.sourcePort >= output.i) {
|
||||||
|
l.sourcePort++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.subflow && ev.subflow.hasOwnProperty('instances')) {
|
||||||
|
ev.subflow.instances.forEach(function(n) {
|
||||||
|
var node = RED.nodes.node(n.id);
|
||||||
|
if (node) {
|
||||||
|
node.changed = n.changed;
|
||||||
|
node.dirty = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (subflow) {
|
||||||
|
RED.nodes.filterNodes({type:"subflow:"+subflow.id}).forEach(function(n) {
|
||||||
|
n.inputs = subflow.in.length;
|
||||||
|
n.outputs = subflow.out.length;
|
||||||
|
while (n.outputs > n.ports.length) {
|
||||||
|
n.ports.push(n.ports.length);
|
||||||
|
}
|
||||||
|
n.resize = true;
|
||||||
|
n.dirty = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (ev.nodes) {
|
||||||
|
for (i=0;i<ev.nodes.length;i++) {
|
||||||
|
RED.nodes.add(ev.nodes[i]);
|
||||||
|
modifiedTabs[ev.nodes[i].z] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.links) {
|
||||||
|
for (i=0;i<ev.links.length;i++) {
|
||||||
|
RED.nodes.addLink(ev.links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.changes) {
|
||||||
|
for (i in ev.changes) {
|
||||||
|
if (ev.changes.hasOwnProperty(i)) {
|
||||||
|
node = RED.nodes.node(i);
|
||||||
|
if (node) {
|
||||||
|
for (var d in ev.changes[i]) {
|
||||||
|
if (ev.changes[i].hasOwnProperty(d)) {
|
||||||
|
node[d] = ev.changes[i][d];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node.dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (ev.t == "move") {
|
||||||
|
for (i=0;i<ev.nodes.length;i++) {
|
||||||
|
var n = ev.nodes[i];
|
||||||
|
n.n.x = n.ox;
|
||||||
|
n.n.y = n.oy;
|
||||||
|
n.n.dirty = true;
|
||||||
|
n.n.moved = n.moved;
|
||||||
|
}
|
||||||
|
// A move could have caused a link splice
|
||||||
|
if (ev.links) {
|
||||||
|
for (i=0;i<ev.links.length;i++) {
|
||||||
|
RED.nodes.removeLink(ev.links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.removedLinks) {
|
||||||
|
for (i=0;i<ev.removedLinks.length;i++) {
|
||||||
|
RED.nodes.addLink(ev.removedLinks[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (ev.t == "edit") {
|
||||||
|
for (i in ev.changes) {
|
||||||
|
if (ev.changes.hasOwnProperty(i)) {
|
||||||
|
if (ev.node._def.defaults && ev.node._def.defaults[i] && ev.node._def.defaults[i].type) {
|
||||||
|
// This is a config node property
|
||||||
|
var currentConfigNode = RED.nodes.node(ev.node[i]);
|
||||||
|
if (currentConfigNode) {
|
||||||
|
currentConfigNode.users.splice(currentConfigNode.users.indexOf(ev.node),1);
|
||||||
|
}
|
||||||
|
var newConfigNode = RED.nodes.node(ev.changes[i]);
|
||||||
|
if (newConfigNode) {
|
||||||
|
newConfigNode.users.push(ev.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ev.node[i] = ev.changes[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.subflow) {
|
||||||
|
if (ev.subflow.hasOwnProperty('inputCount')) {
|
||||||
|
if (ev.node.in.length > ev.subflow.inputCount) {
|
||||||
|
ev.node.in.splice(ev.subflow.inputCount);
|
||||||
|
} else if (ev.subflow.inputs.length > 0) {
|
||||||
|
ev.node.in = ev.node.in.concat(ev.subflow.inputs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.subflow.hasOwnProperty('outputCount')) {
|
||||||
|
if (ev.node.out.length > ev.subflow.outputCount) {
|
||||||
|
ev.node.out.splice(ev.subflow.outputCount);
|
||||||
|
} else if (ev.subflow.outputs.length > 0) {
|
||||||
|
ev.node.out = ev.node.out.concat(ev.subflow.outputs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.subflow.hasOwnProperty('instances')) {
|
||||||
|
ev.subflow.instances.forEach(function(n) {
|
||||||
|
var node = RED.nodes.node(n.id);
|
||||||
|
if (node) {
|
||||||
|
node.changed = n.changed;
|
||||||
|
node.dirty = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
RED.editor.validateNode(ev.node);
|
||||||
|
RED.nodes.filterNodes({type:"subflow:"+ev.node.id}).forEach(function(n) {
|
||||||
|
n.inputs = ev.node.in.length;
|
||||||
|
n.outputs = ev.node.out.length;
|
||||||
|
RED.editor.updateNodeProperties(n);
|
||||||
|
RED.editor.validateNode(n);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var outputMap;
|
||||||
|
if (ev.outputMap) {
|
||||||
|
outputMap = {};
|
||||||
|
for (var port in ev.outputMap) {
|
||||||
|
if (ev.outputMap.hasOwnProperty(port) && ev.outputMap[port] !== "-1") {
|
||||||
|
outputMap[ev.outputMap[port]] = port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RED.editor.updateNodeProperties(ev.node,outputMap);
|
||||||
|
RED.editor.validateNode(ev.node);
|
||||||
|
}
|
||||||
|
if (ev.links) {
|
||||||
|
for (i=0;i<ev.links.length;i++) {
|
||||||
|
RED.nodes.addLink(ev.links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ev.node.dirty = true;
|
||||||
|
ev.node.changed = ev.changed;
|
||||||
|
} else if (ev.t == "createSubflow") {
|
||||||
|
if (ev.nodes) {
|
||||||
|
RED.nodes.filterNodes({z:ev.subflow.subflow.id}).forEach(function(n) {
|
||||||
|
n.z = ev.activeWorkspace;
|
||||||
|
n.dirty = true;
|
||||||
|
});
|
||||||
|
for (i=0;i<ev.nodes.length;i++) {
|
||||||
|
RED.nodes.remove(ev.nodes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.links) {
|
||||||
|
for (i=0;i<ev.links.length;i++) {
|
||||||
|
RED.nodes.removeLink(ev.links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RED.nodes.removeSubflow(ev.subflow.subflow);
|
||||||
|
RED.workspaces.remove(ev.subflow.subflow);
|
||||||
|
|
||||||
|
if (ev.removedLinks) {
|
||||||
|
for (i=0;i<ev.removedLinks.length;i++) {
|
||||||
|
RED.nodes.addLink(ev.removedLinks[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (ev.t == "reorder") {
|
||||||
|
if (ev.order) {
|
||||||
|
RED.workspaces.order(ev.order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object.keys(modifiedTabs).forEach(function(id) {
|
||||||
|
var subflow = RED.nodes.subflow(id);
|
||||||
|
if (subflow) {
|
||||||
|
RED.editor.validateNode(subflow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
RED.nodes.dirty(ev.dirty);
|
||||||
|
RED.view.redraw(true);
|
||||||
|
RED.palette.refresh();
|
||||||
|
RED.workspaces.refresh();
|
||||||
|
RED.sidebar.config.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
//TODO: this function is a placeholder until there is a 'save' event that can be listened to
|
//TODO: this function is a placeholder until there is a 'save' event that can be listened to
|
||||||
markAllDirty: function() {
|
markAllDirty: function() {
|
||||||
@@ -34,263 +319,13 @@ RED.history = (function() {
|
|||||||
},
|
},
|
||||||
pop: function() {
|
pop: function() {
|
||||||
var ev = undo_history.pop();
|
var ev = undo_history.pop();
|
||||||
var i;
|
undoEvent(ev);
|
||||||
var node;
|
|
||||||
var subflow;
|
|
||||||
var modifiedTabs = {};
|
|
||||||
if (ev) {
|
|
||||||
if (ev.t == 'add') {
|
|
||||||
if (ev.nodes) {
|
|
||||||
for (i=0;i<ev.nodes.length;i++) {
|
|
||||||
node = RED.nodes.node(ev.nodes[i]);
|
|
||||||
if (node.z) {
|
|
||||||
modifiedTabs[node.z] = true;
|
|
||||||
}
|
|
||||||
RED.nodes.remove(ev.nodes[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.links) {
|
|
||||||
for (i=0;i<ev.links.length;i++) {
|
|
||||||
RED.nodes.removeLink(ev.links[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.workspaces) {
|
|
||||||
for (i=0;i<ev.workspaces.length;i++) {
|
|
||||||
RED.nodes.removeWorkspace(ev.workspaces[i].id);
|
|
||||||
RED.workspaces.remove(ev.workspaces[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.subflows) {
|
|
||||||
for (i=0;i<ev.subflows.length;i++) {
|
|
||||||
RED.nodes.removeSubflow(ev.subflows[i]);
|
|
||||||
RED.workspaces.remove(ev.subflows[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.subflow) {
|
|
||||||
if (ev.subflow.instances) {
|
|
||||||
ev.subflow.instances.forEach(function(n) {
|
|
||||||
var node = RED.nodes.node(n.id);
|
|
||||||
if (node) {
|
|
||||||
node.changed = n.changed;
|
|
||||||
node.dirty = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (ev.subflow.hasOwnProperty('changed')) {
|
|
||||||
subflow = RED.nodes.subflow(ev.subflow.id);
|
|
||||||
if (subflow) {
|
|
||||||
subflow.changed = ev.subflow.changed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.removedLinks) {
|
|
||||||
for (i=0;i<ev.removedLinks.length;i++) {
|
|
||||||
RED.nodes.addLink(ev.removedLinks[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (ev.t == "delete") {
|
|
||||||
if (ev.workspaces) {
|
|
||||||
for (i=0;i<ev.workspaces.length;i++) {
|
|
||||||
RED.nodes.addWorkspace(ev.workspaces[i]);
|
|
||||||
RED.workspaces.add(ev.workspaces[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.subflow && ev.subflow.subflow) {
|
|
||||||
RED.nodes.addSubflow(ev.subflow.subflow);
|
|
||||||
}
|
|
||||||
if (ev.subflowInputs && ev.subflowInputs.length > 0) {
|
|
||||||
subflow = RED.nodes.subflow(ev.subflowInputs[0].z);
|
|
||||||
subflow.in.push(ev.subflowInputs[0]);
|
|
||||||
subflow.in[0].dirty = true;
|
|
||||||
}
|
|
||||||
if (ev.subflowOutputs && ev.subflowOutputs.length > 0) {
|
|
||||||
subflow = RED.nodes.subflow(ev.subflowOutputs[0].z);
|
|
||||||
ev.subflowOutputs.sort(function(a,b) { return a.i-b.i});
|
|
||||||
for (i=0;i<ev.subflowOutputs.length;i++) {
|
|
||||||
var output = ev.subflowOutputs[i];
|
|
||||||
subflow.out.splice(output.i,0,output);
|
|
||||||
for (var j=output.i+1;j<subflow.out.length;j++) {
|
|
||||||
subflow.out[j].i++;
|
|
||||||
subflow.out[j].dirty = true;
|
|
||||||
}
|
|
||||||
RED.nodes.eachLink(function(l) {
|
|
||||||
if (l.source.type == "subflow:"+subflow.id) {
|
|
||||||
if (l.sourcePort >= output.i) {
|
|
||||||
l.sourcePort++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.subflow && ev.subflow.hasOwnProperty('instances')) {
|
|
||||||
ev.subflow.instances.forEach(function(n) {
|
|
||||||
var node = RED.nodes.node(n.id);
|
|
||||||
if (node) {
|
|
||||||
node.changed = n.changed;
|
|
||||||
node.dirty = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (subflow) {
|
|
||||||
RED.nodes.filterNodes({type:"subflow:"+subflow.id}).forEach(function(n) {
|
|
||||||
n.inputs = subflow.in.length;
|
|
||||||
n.outputs = subflow.out.length;
|
|
||||||
while (n.outputs > n.ports.length) {
|
|
||||||
n.ports.push(n.ports.length);
|
|
||||||
}
|
|
||||||
n.resize = true;
|
|
||||||
n.dirty = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (ev.nodes) {
|
|
||||||
for (i=0;i<ev.nodes.length;i++) {
|
|
||||||
RED.nodes.add(ev.nodes[i]);
|
|
||||||
modifiedTabs[ev.nodes[i].z] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.links) {
|
|
||||||
for (i=0;i<ev.links.length;i++) {
|
|
||||||
RED.nodes.addLink(ev.links[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.changes) {
|
|
||||||
for (i in ev.changes) {
|
|
||||||
if (ev.changes.hasOwnProperty(i)) {
|
|
||||||
node = RED.nodes.node(i);
|
|
||||||
if (node) {
|
|
||||||
for (var d in ev.changes[i]) {
|
|
||||||
if (ev.changes[i].hasOwnProperty(d)) {
|
|
||||||
node[d] = ev.changes[i][d];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
node.dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (ev.t == "move") {
|
|
||||||
for (i=0;i<ev.nodes.length;i++) {
|
|
||||||
var n = ev.nodes[i];
|
|
||||||
n.n.x = n.ox;
|
|
||||||
n.n.y = n.oy;
|
|
||||||
n.n.dirty = true;
|
|
||||||
n.n.changed = n.changed;
|
|
||||||
}
|
|
||||||
// A move could have caused a link splice
|
|
||||||
if (ev.links) {
|
|
||||||
for (i=0;i<ev.links.length;i++) {
|
|
||||||
RED.nodes.removeLink(ev.links[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.removedLinks) {
|
|
||||||
for (i=0;i<ev.removedLinks.length;i++) {
|
|
||||||
RED.nodes.addLink(ev.removedLinks[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (ev.t == "edit") {
|
|
||||||
for (i in ev.changes) {
|
|
||||||
if (ev.changes.hasOwnProperty(i)) {
|
|
||||||
if (ev.node._def.defaults[i].type) {
|
|
||||||
// This is a config node property
|
|
||||||
var currentConfigNode = RED.nodes.node(ev.node[i]);
|
|
||||||
if (currentConfigNode) {
|
|
||||||
currentConfigNode.users.splice(currentConfigNode.users.indexOf(ev.node),1);
|
|
||||||
}
|
|
||||||
var newConfigNode = RED.nodes.node(ev.changes[i]);
|
|
||||||
if (newConfigNode) {
|
|
||||||
newConfigNode.users.push(ev.node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ev.node[i] = ev.changes[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.subflow) {
|
|
||||||
if (ev.subflow.hasOwnProperty('inputCount')) {
|
|
||||||
if (ev.node.in.length > ev.subflow.inputCount) {
|
|
||||||
ev.node.in.splice(ev.subflow.inputCount);
|
|
||||||
} else if (ev.subflow.inputs.length > 0) {
|
|
||||||
ev.node.in = ev.node.in.concat(ev.subflow.inputs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.subflow.hasOwnProperty('outputCount')) {
|
|
||||||
if (ev.node.out.length > ev.subflow.outputCount) {
|
|
||||||
ev.node.out.splice(ev.subflow.outputCount);
|
|
||||||
} else if (ev.subflow.outputs.length > 0) {
|
|
||||||
ev.node.out = ev.node.out.concat(ev.subflow.outputs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.subflow.hasOwnProperty('instances')) {
|
|
||||||
ev.subflow.instances.forEach(function(n) {
|
|
||||||
var node = RED.nodes.node(n.id);
|
|
||||||
if (node) {
|
|
||||||
node.changed = n.changed;
|
|
||||||
node.dirty = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
RED.nodes.filterNodes({type:"subflow:"+ev.node.id}).forEach(function(n) {
|
|
||||||
n.inputs = ev.node.in.length;
|
|
||||||
n.outputs = ev.node.out.length;
|
|
||||||
RED.editor.updateNodeProperties(n);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
RED.editor.updateNodeProperties(ev.node);
|
|
||||||
RED.editor.validateNode(ev.node);
|
|
||||||
}
|
|
||||||
if (ev.links) {
|
|
||||||
for (i=0;i<ev.links.length;i++) {
|
|
||||||
RED.nodes.addLink(ev.links[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ev.node.dirty = true;
|
|
||||||
ev.node.changed = ev.changed;
|
|
||||||
} else if (ev.t == "createSubflow") {
|
|
||||||
if (ev.nodes) {
|
|
||||||
RED.nodes.filterNodes({z:ev.subflow.subflow.id}).forEach(function(n) {
|
|
||||||
n.z = ev.activeWorkspace;
|
|
||||||
n.dirty = true;
|
|
||||||
});
|
|
||||||
for (i=0;i<ev.nodes.length;i++) {
|
|
||||||
RED.nodes.remove(ev.nodes[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ev.links) {
|
|
||||||
for (i=0;i<ev.links.length;i++) {
|
|
||||||
RED.nodes.removeLink(ev.links[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RED.nodes.removeSubflow(ev.subflow.subflow);
|
|
||||||
RED.workspaces.remove(ev.subflow.subflow);
|
|
||||||
|
|
||||||
if (ev.removedLinks) {
|
|
||||||
for (i=0;i<ev.removedLinks.length;i++) {
|
|
||||||
RED.nodes.addLink(ev.removedLinks[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (ev.t == "reorder") {
|
|
||||||
if (ev.order) {
|
|
||||||
RED.workspaces.order(ev.order);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Object.keys(modifiedTabs).forEach(function(id) {
|
|
||||||
var subflow = RED.nodes.subflow(id);
|
|
||||||
if (subflow) {
|
|
||||||
RED.editor.validateNode(subflow);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
RED.nodes.dirty(ev.dirty);
|
|
||||||
RED.view.redraw(true);
|
|
||||||
RED.palette.refresh();
|
|
||||||
RED.workspaces.refresh();
|
|
||||||
RED.sidebar.config.refresh();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
peek: function() {
|
peek: function() {
|
||||||
return undo_history[undo_history.length-1];
|
return undo_history[undo_history.length-1];
|
||||||
|
},
|
||||||
|
clear: function() {
|
||||||
|
undo_history = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -19,11 +19,11 @@ RED.i18n = (function() {
|
|||||||
return {
|
return {
|
||||||
init: function(done) {
|
init: function(done) {
|
||||||
i18n.init({
|
i18n.init({
|
||||||
resGetPath: 'locales/__ns__',
|
resGetPath: 'locales/__ns__?lng=__lng__',
|
||||||
dynamicLoad: false,
|
dynamicLoad: false,
|
||||||
load:'current',
|
load:'current',
|
||||||
ns: {
|
ns: {
|
||||||
namespaces: ["editor","node-red"],
|
namespaces: ["editor","node-red","jsonata","infotips"],
|
||||||
defaultNs: "editor"
|
defaultNs: "editor"
|
||||||
},
|
},
|
||||||
fallbackLng: ['en-US'],
|
fallbackLng: ['en-US'],
|
||||||
@@ -37,7 +37,50 @@ RED.i18n = (function() {
|
|||||||
|
|
||||||
},
|
},
|
||||||
loadCatalog: function(namespace,done) {
|
loadCatalog: function(namespace,done) {
|
||||||
i18n.loadNamespace(namespace,done);
|
var languageList = i18n.functions.toLanguages(i18n.detectLanguage());
|
||||||
|
var toLoad = languageList.length;
|
||||||
|
languageList.forEach(function(lang) {
|
||||||
|
$.ajax({
|
||||||
|
headers: {
|
||||||
|
"Accept":"application/json"
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
url: 'locales/'+namespace+'?lng='+lang,
|
||||||
|
success: function(data) {
|
||||||
|
i18n.addResourceBundle(lang,namespace,data);
|
||||||
|
toLoad--;
|
||||||
|
if (toLoad === 0) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
loadNodeCatalogs: function(done) {
|
||||||
|
var languageList = i18n.functions.toLanguages(i18n.detectLanguage());
|
||||||
|
var toLoad = languageList.length;
|
||||||
|
|
||||||
|
languageList.forEach(function(lang) {
|
||||||
|
$.ajax({
|
||||||
|
headers: {
|
||||||
|
"Accept":"application/json"
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
url: 'locales/nodes?lng='+lang,
|
||||||
|
success: function(data) {
|
||||||
|
var namespaces = Object.keys(data);
|
||||||
|
namespaces.forEach(function(ns) {
|
||||||
|
i18n.addResourceBundle(lang,ns,data[ns]);
|
||||||
|
});
|
||||||
|
toLoad--;
|
||||||
|
if (toLoad === 0) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
44
editor/js/keymap.json
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"*": {
|
||||||
|
"ctrl-shift-p":"core:manage-palette",
|
||||||
|
"ctrl-f": "core:search",
|
||||||
|
"ctrl-=": "core:zoom-in",
|
||||||
|
"ctrl--": "core:zoom-out",
|
||||||
|
"ctrl-0": "core:zoom-reset",
|
||||||
|
"ctrl-enter": "core:confirm-edit-tray",
|
||||||
|
"ctrl-escape": "core:cancel-edit-tray",
|
||||||
|
"ctrl-g i": "core:show-info-tab",
|
||||||
|
"ctrl-g d": "core:show-debug-tab",
|
||||||
|
"ctrl-g c": "core:show-config-tab",
|
||||||
|
"ctrl-g x": "core:show-context-tab",
|
||||||
|
"ctrl-e": "core:show-export-dialog",
|
||||||
|
"ctrl-i": "core:show-import-dialog",
|
||||||
|
"ctrl-space": "core:toggle-sidebar",
|
||||||
|
"ctrl-,": "core:show-user-settings",
|
||||||
|
"ctrl-alt-r": "core:show-remote-diff",
|
||||||
|
"ctrl-alt-n": "core:new-project",
|
||||||
|
"ctrl-alt-o": "core:open-project",
|
||||||
|
"ctrl-g v": "core:show-version-control-tab"
|
||||||
|
},
|
||||||
|
"workspace": {
|
||||||
|
"backspace": "core:delete-selection",
|
||||||
|
"delete": "core:delete-selection",
|
||||||
|
"enter": "core:edit-selected-node",
|
||||||
|
"ctrl-c": "core:copy-selection-to-internal-clipboard",
|
||||||
|
"ctrl-x": "core:cut-selection-to-internal-clipboard",
|
||||||
|
"ctrl-v": "core:paste-from-internal-clipboard",
|
||||||
|
"ctrl-z": "core:undo",
|
||||||
|
"ctrl-a": "core:select-all-nodes",
|
||||||
|
"shift-?": "core:show-help",
|
||||||
|
"up": "core:move-selection-up",
|
||||||
|
"right": "core:move-selection-right",
|
||||||
|
"down": "core:move-selection-down",
|
||||||
|
"left": "core:move-selection-left",
|
||||||
|
"shift-up": "core:step-selection-up",
|
||||||
|
"shift-right": "core:step-selection-right",
|
||||||
|
"shift-down": "core:step-selection-down",
|
||||||
|
"shift-left": "core:step-selection-left",
|
||||||
|
"ctrl-shift-j": "core:show-previous-tab",
|
||||||
|
"ctrl-shift-k": "core:show-next-tab"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -13,8 +13,26 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
var RED = (function() {
|
(function() {
|
||||||
|
|
||||||
|
function appendNodeConfig(nodeConfig) {
|
||||||
|
var m = /<!-- --- \[red-module:(\S+)\] --- -->/.exec(nodeConfig.trim());
|
||||||
|
var moduleId;
|
||||||
|
if (m) {
|
||||||
|
moduleId = m[1];
|
||||||
|
} else {
|
||||||
|
moduleId = "unknown";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$("body").append(nodeConfig);
|
||||||
|
} catch(err) {
|
||||||
|
RED.notify(RED._("notification.errors.failedToAppendNode",{module:moduleId, error:err.toString()}),{
|
||||||
|
type: "error",
|
||||||
|
timeout: 10000
|
||||||
|
});
|
||||||
|
console.log("["+moduleId+"] "+err.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function loadNodeList() {
|
function loadNodeList() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -25,22 +43,24 @@ var RED = (function() {
|
|||||||
url: 'nodes',
|
url: 'nodes',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
RED.nodes.setNodeList(data);
|
RED.nodes.setNodeList(data);
|
||||||
|
RED.i18n.loadNodeCatalogs(function() {
|
||||||
|
loadIconList(loadNodes);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var nsCount = 0;
|
function loadIconList(done) {
|
||||||
for (var i=0;i<data.length;i++) {
|
$.ajax({
|
||||||
var ns = data[i];
|
headers: {
|
||||||
if (ns.module != "node-red") {
|
"Accept":"application/json"
|
||||||
nsCount++;
|
},
|
||||||
RED.i18n.loadCatalog(ns.id, function() {
|
cache: false,
|
||||||
nsCount--;
|
url: 'icons',
|
||||||
if (nsCount === 0) {
|
success: function(data) {
|
||||||
loadNodes();
|
RED.nodes.setIconSets(data);
|
||||||
}
|
if (done) {
|
||||||
});
|
done();
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nsCount === 0) {
|
|
||||||
loadNodes();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -54,17 +74,42 @@ var RED = (function() {
|
|||||||
cache: false,
|
cache: false,
|
||||||
url: 'nodes',
|
url: 'nodes',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("body").append(data);
|
var configs = data.trim().split(/(?=<!-- --- \[red-module:\S+\] --- -->)/);
|
||||||
|
configs.forEach(function(data) {
|
||||||
|
appendNodeConfig(data);
|
||||||
|
});
|
||||||
|
|
||||||
$("body").i18n();
|
$("body").i18n();
|
||||||
$("#palette > .palette-spinner").hide();
|
$("#palette > .palette-spinner").hide();
|
||||||
$(".palette-scroll").removeClass("hide");
|
$(".palette-scroll").removeClass("hide");
|
||||||
$("#palette-search").removeClass("hide");
|
$("#palette-search").removeClass("hide");
|
||||||
loadFlows();
|
loadFlows(function() {
|
||||||
|
if (RED.settings.theme("projects.enabled",false)) {
|
||||||
|
RED.projects.refresh(function(activeProject) {
|
||||||
|
RED.sidebar.info.refresh()
|
||||||
|
if (!activeProject) {
|
||||||
|
// Projects enabled but no active project
|
||||||
|
RED.menu.setDisabled('menu-item-projects-open',true);
|
||||||
|
RED.menu.setDisabled('menu-item-projects-settings',true);
|
||||||
|
if (activeProject === false) {
|
||||||
|
// User previously decline the migration to projects.
|
||||||
|
} else { // null/undefined
|
||||||
|
RED.projects.showStartup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
completeLoad();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Projects disabled by the user
|
||||||
|
RED.sidebar.info.refresh()
|
||||||
|
completeLoad();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadFlows() {
|
function loadFlows(done) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
headers: {
|
headers: {
|
||||||
"Accept":"application/json",
|
"Accept":"application/json",
|
||||||
@@ -72,88 +117,257 @@ var RED = (function() {
|
|||||||
cache: false,
|
cache: false,
|
||||||
url: 'flows',
|
url: 'flows',
|
||||||
success: function(nodes) {
|
success: function(nodes) {
|
||||||
var currentHash = window.location.hash;
|
if (nodes) {
|
||||||
RED.nodes.version(nodes.rev);
|
var currentHash = window.location.hash;
|
||||||
RED.nodes.import(nodes.flows);
|
RED.nodes.version(nodes.rev);
|
||||||
RED.nodes.dirty(false);
|
RED.nodes.import(nodes.flows);
|
||||||
RED.view.redraw(true);
|
RED.nodes.dirty(false);
|
||||||
if (/^#flow\/.+$/.test(currentHash)) {
|
RED.view.redraw(true);
|
||||||
RED.workspaces.show(currentHash.substring(6));
|
if (/^#flow\/.+$/.test(currentHash)) {
|
||||||
|
RED.workspaces.show(currentHash.substring(6));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RED.comms.subscribe("status/#",function(topic,msg) {
|
done();
|
||||||
var parts = topic.split("/");
|
|
||||||
var node = RED.nodes.node(parts[1]);
|
|
||||||
if (node) {
|
|
||||||
if (msg.hasOwnProperty("text")) {
|
|
||||||
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
|
||||||
}
|
|
||||||
node.status = msg;
|
|
||||||
if (statusEnabled) {
|
|
||||||
node.dirty = true;
|
|
||||||
RED.view.redraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
RED.comms.subscribe("node/#",function(topic,msg) {
|
|
||||||
var i,m;
|
|
||||||
var typeList;
|
|
||||||
var info;
|
|
||||||
|
|
||||||
if (topic == "node/added") {
|
|
||||||
var addedTypes = [];
|
|
||||||
for (i=0;i<msg.length;i++) {
|
|
||||||
m = msg[i];
|
|
||||||
var id = m.id;
|
|
||||||
RED.nodes.addNodeSet(m);
|
|
||||||
addedTypes = addedTypes.concat(m.types);
|
|
||||||
RED.i18n.loadCatalog(id, function() {
|
|
||||||
$.get('nodes/'+id, function(data) {
|
|
||||||
$("body").append(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (addedTypes.length) {
|
|
||||||
typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>";
|
|
||||||
RED.notify(RED._("palette.event.nodeAdded", {count:addedTypes.length})+typeList,"success");
|
|
||||||
}
|
|
||||||
} else if (topic == "node/removed") {
|
|
||||||
for (i=0;i<msg.length;i++) {
|
|
||||||
m = msg[i];
|
|
||||||
info = RED.nodes.removeNodeSet(m.id);
|
|
||||||
if (info.added) {
|
|
||||||
typeList = "<ul><li>"+m.types.join("</li><li>")+"</li></ul>";
|
|
||||||
RED.notify(RED._("palette.event.nodeRemoved", {count:m.types.length})+typeList,"success");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (topic == "node/enabled") {
|
|
||||||
if (msg.types) {
|
|
||||||
info = RED.nodes.getNodeSet(msg.id);
|
|
||||||
if (info.added) {
|
|
||||||
RED.nodes.enableNodeSet(msg.id);
|
|
||||||
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
|
||||||
RED.notify(RED._("palette.event.nodeEnabled", {count:msg.types.length})+typeList,"success");
|
|
||||||
} else {
|
|
||||||
$.get('nodes/'+msg.id, function(data) {
|
|
||||||
$("body").append(data);
|
|
||||||
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
|
||||||
RED.notify(RED._("palette.event.nodeAdded", {count:msg.types.length})+typeList,"success");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (topic == "node/disabled") {
|
|
||||||
if (msg.types) {
|
|
||||||
RED.nodes.disableNodeSet(msg.id);
|
|
||||||
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
|
||||||
RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Refresh flow library to ensure any examples are updated
|
|
||||||
RED.library.loadFlowLibrary();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function completeLoad() {
|
||||||
|
var persistentNotifications = {};
|
||||||
|
RED.comms.subscribe("notification/#",function(topic,msg) {
|
||||||
|
var parts = topic.split("/");
|
||||||
|
var notificationId = parts[1];
|
||||||
|
if (notificationId === "runtime-deploy") {
|
||||||
|
// handled in ui/deploy.js
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (notificationId === "node") {
|
||||||
|
// handled below
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (notificationId === "project-update") {
|
||||||
|
RED.nodes.clear();
|
||||||
|
RED.history.clear();
|
||||||
|
RED.view.redraw(true);
|
||||||
|
RED.projects.refresh(function() {
|
||||||
|
loadFlows(function() {
|
||||||
|
var project = RED.projects.getActiveProject();
|
||||||
|
var message = {
|
||||||
|
"change-branch": RED._("notification.project.change-branch", {project: project.git.branches.local}),
|
||||||
|
"merge-abort": RED._("notification.project.merge-abort"),
|
||||||
|
"loaded": RED._("notification.project.loaded", {project: msg.project}),
|
||||||
|
"updated": RED._("notification.project.updated", {project: msg.project}),
|
||||||
|
"pull": RED._("notification.project.pull", {project: msg.project}),
|
||||||
|
"revert": RED._("notification.project.revert", {project: msg.project}),
|
||||||
|
"merge-complete": RED._("notification.project.merge-complete")
|
||||||
|
}[msg.action];
|
||||||
|
RED.notify("<p>"+message+"</p>");
|
||||||
|
RED.sidebar.info.refresh()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.text) {
|
||||||
|
msg.default = msg.text;
|
||||||
|
var text = RED._(msg.text,msg);
|
||||||
|
var options = {
|
||||||
|
type: msg.type,
|
||||||
|
fixed: msg.timeout === undefined,
|
||||||
|
timeout: msg.timeout,
|
||||||
|
id: notificationId
|
||||||
|
}
|
||||||
|
if (notificationId === "runtime-state") {
|
||||||
|
if (msg.error === "missing-types") {
|
||||||
|
text+="<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
||||||
|
if (!!RED.projects.getActiveProject()) {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("notification.label.manage-project-dep"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
RED.projects.settings.show('deps');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
// } else if (RED.settings.theme('palette.editable') !== false) {
|
||||||
|
} else {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("common.label.close"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else if (msg.error === "credentials_load_failed") {
|
||||||
|
if (RED.settings.theme("projects.enabled",false)) {
|
||||||
|
// projects enabled
|
||||||
|
if (RED.user.hasPermission("projects.write")) {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("notification.label.setup-cred"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
RED.projects.showCredentialsPrompt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("common.label.close"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else if (msg.error === "missing_flow_file") {
|
||||||
|
if (RED.user.hasPermission("projects.write")) {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("notification.label.setup-project"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
RED.projects.showFilesPrompt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else if (msg.error === "missing_package_file") {
|
||||||
|
if (RED.user.hasPermission("projects.write")) {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("notification.label.create-default-package"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
RED.projects.createDefaultPackageFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else if (msg.error === "project_empty") {
|
||||||
|
if (RED.user.hasPermission("projects.write")) {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("notification.label.no-thanks"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: RED._("notification.label.create-default-project"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
RED.projects.createDefaultFileSet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else if (msg.error === "git_merge_conflict") {
|
||||||
|
RED.nodes.clear();
|
||||||
|
RED.sidebar.versionControl.refresh(true);
|
||||||
|
if (RED.user.hasPermission("projects.write")) {
|
||||||
|
options.buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("notification.label.show-merge-conflicts"),
|
||||||
|
click: function() {
|
||||||
|
persistentNotifications[notificationId].hideNotification();
|
||||||
|
RED.sidebar.versionControl.showLocalChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!persistentNotifications.hasOwnProperty(notificationId)) {
|
||||||
|
persistentNotifications[notificationId] = RED.notify(text,options);
|
||||||
|
} else {
|
||||||
|
persistentNotifications[notificationId].update(text,options);
|
||||||
|
}
|
||||||
|
} else if (persistentNotifications.hasOwnProperty(notificationId)) {
|
||||||
|
persistentNotifications[notificationId].close();
|
||||||
|
delete persistentNotifications[notificationId];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.comms.subscribe("status/#",function(topic,msg) {
|
||||||
|
var parts = topic.split("/");
|
||||||
|
var node = RED.nodes.node(parts[1]);
|
||||||
|
if (node) {
|
||||||
|
if (msg.hasOwnProperty("text")) {
|
||||||
|
if (msg.text[0] !== ".") {
|
||||||
|
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node.status = msg;
|
||||||
|
node.dirty = true;
|
||||||
|
RED.view.redraw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.comms.subscribe("notification/node/#",function(topic,msg) {
|
||||||
|
var i,m;
|
||||||
|
var typeList;
|
||||||
|
var info;
|
||||||
|
if (topic == "notification/node/added") {
|
||||||
|
var addedTypes = [];
|
||||||
|
msg.forEach(function(m) {
|
||||||
|
var id = m.id;
|
||||||
|
RED.nodes.addNodeSet(m);
|
||||||
|
addedTypes = addedTypes.concat(m.types);
|
||||||
|
RED.i18n.loadCatalog(id, function() {
|
||||||
|
$.get('nodes/'+id, function(data) {
|
||||||
|
appendNodeConfig(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (addedTypes.length) {
|
||||||
|
typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>";
|
||||||
|
RED.notify(RED._("palette.event.nodeAdded", {count:addedTypes.length})+typeList,"success");
|
||||||
|
}
|
||||||
|
loadIconList();
|
||||||
|
} else if (topic == "notification/node/removed") {
|
||||||
|
for (i=0;i<msg.length;i++) {
|
||||||
|
m = msg[i];
|
||||||
|
info = RED.nodes.removeNodeSet(m.id);
|
||||||
|
if (info.added) {
|
||||||
|
typeList = "<ul><li>"+m.types.join("</li><li>")+"</li></ul>";
|
||||||
|
RED.notify(RED._("palette.event.nodeRemoved", {count:m.types.length})+typeList,"success");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadIconList();
|
||||||
|
} else if (topic == "notification/node/enabled") {
|
||||||
|
if (msg.types) {
|
||||||
|
info = RED.nodes.getNodeSet(msg.id);
|
||||||
|
if (info.added) {
|
||||||
|
RED.nodes.enableNodeSet(msg.id);
|
||||||
|
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
||||||
|
RED.notify(RED._("palette.event.nodeEnabled", {count:msg.types.length})+typeList,"success");
|
||||||
|
} else {
|
||||||
|
$.get('nodes/'+msg.id, function(data) {
|
||||||
|
appendNodeConfig(data);
|
||||||
|
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
||||||
|
RED.notify(RED._("palette.event.nodeAdded", {count:msg.types.length})+typeList,"success");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (topic == "notification/node/disabled") {
|
||||||
|
if (msg.types) {
|
||||||
|
RED.nodes.disableNodeSet(msg.id);
|
||||||
|
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
||||||
|
RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success");
|
||||||
|
}
|
||||||
|
} else if (topic == "node/upgraded") {
|
||||||
|
RED.notify(RED._("palette.event.nodeUpgraded", {module:msg.module,version:msg.version}),"success");
|
||||||
|
RED.nodes.registry.setModulePendingUpdated(msg.module,msg.version);
|
||||||
|
}
|
||||||
|
// Refresh flow library to ensure any examples are updated
|
||||||
|
RED.library.loadFlowLibrary();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function showAbout() {
|
function showAbout() {
|
||||||
$.get('red/about', function(data) {
|
$.get('red/about', function(data) {
|
||||||
var aboutHeader = '<div style="text-align:center;">'+
|
var aboutHeader = '<div style="text-align:center;">'+
|
||||||
@@ -165,20 +379,22 @@ var RED = (function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var statusEnabled = false;
|
|
||||||
function toggleStatus(state) {
|
|
||||||
statusEnabled = state;
|
|
||||||
RED.view.status(statusEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadEditor() {
|
function loadEditor() {
|
||||||
|
|
||||||
var menuOptions = [];
|
var menuOptions = [];
|
||||||
|
if (RED.settings.theme("projects.enabled",false)) {
|
||||||
|
menuOptions.push({id:"menu-item-projects-menu",label:RED._("menu.label.projects"),options:[
|
||||||
|
{id:"menu-item-projects-new",label:RED._("menu.label.projects-new"),disabled:false,onselect:"core:new-project"},
|
||||||
|
{id:"menu-item-projects-open",label:RED._("menu.label.projects-open"),disabled:false,onselect:"core:open-project"},
|
||||||
|
{id:"menu-item-projects-settings",label:RED._("menu.label.projects-settings"),disabled:false,onselect:"core:show-project-settings"}
|
||||||
|
]});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
menuOptions.push({id:"menu-item-view-menu",label:RED._("menu.label.view.view"),options:[
|
menuOptions.push({id:"menu-item-view-menu",label:RED._("menu.label.view.view"),options:[
|
||||||
{id:"menu-item-view-show-grid",label:RED._("menu.label.view.showGrid"),toggle:true,onselect:RED.view.toggleShowGrid},
|
// {id:"menu-item-view-show-grid",setting:"view-show-grid",label:RED._("menu.label.view.showGrid"),toggle:true,onselect:"core:toggle-show-grid"},
|
||||||
{id:"menu-item-view-snap-grid",label:RED._("menu.label.view.snapGrid"),toggle:true,onselect:RED.view.toggleSnapGrid},
|
// {id:"menu-item-view-snap-grid",setting:"view-snap-grid",label:RED._("menu.label.view.snapGrid"),toggle:true,onselect:"core:toggle-snap-grid"},
|
||||||
{id:"menu-item-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:toggleStatus, selected: true},
|
// {id:"menu-item-status",setting:"node-show-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:"core:toggle-status", selected: true},
|
||||||
null,
|
//null,
|
||||||
// {id:"menu-item-bidi",label:RED._("menu.label.view.textDir"),options:[
|
// {id:"menu-item-bidi",label:RED._("menu.label.view.textDir"),options:[
|
||||||
// {id:"menu-item-bidi-default",toggle:"text-direction",label:RED._("menu.label.view.defaultDir"),selected: true, onselect:function(s) { if(s){RED.text.bidi.setTextDirection("")}}},
|
// {id:"menu-item-bidi-default",toggle:"text-direction",label:RED._("menu.label.view.defaultDir"),selected: true, onselect:function(s) { if(s){RED.text.bidi.setTextDirection("")}}},
|
||||||
// {id:"menu-item-bidi-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("ltr")}}},
|
// {id:"menu-item-bidi-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("ltr")}}},
|
||||||
@@ -186,61 +402,82 @@ var RED = (function() {
|
|||||||
// {id:"menu-item-bidi-auto",toggle:"text-direction",label:RED._("menu.label.view.auto"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("auto")}}}
|
// {id:"menu-item-bidi-auto",toggle:"text-direction",label:RED._("menu.label.view.auto"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("auto")}}}
|
||||||
// ]},
|
// ]},
|
||||||
// null,
|
// null,
|
||||||
{id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true}
|
{id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:"core:toggle-sidebar", selected: true},
|
||||||
|
null
|
||||||
]});
|
]});
|
||||||
menuOptions.push(null);
|
menuOptions.push(null);
|
||||||
menuOptions.push({id:"menu-item-import",label:RED._("menu.label.import"),options:[
|
menuOptions.push({id:"menu-item-import",label:RED._("menu.label.import"),options:[
|
||||||
{id:"menu-item-import-clipboard",label:RED._("menu.label.clipboard"),onselect:RED.clipboard.import},
|
{id:"menu-item-import-clipboard",label:RED._("menu.label.clipboard"),onselect:"core:show-import-dialog"},
|
||||||
{id:"menu-item-import-library",label:RED._("menu.label.library"),options:[]}
|
{id:"menu-item-import-library",label:RED._("menu.label.library"),options:[]}
|
||||||
]});
|
]});
|
||||||
menuOptions.push({id:"menu-item-export",label:RED._("menu.label.export"),disabled:true,options:[
|
menuOptions.push({id:"menu-item-export",label:RED._("menu.label.export"),options:[
|
||||||
{id:"menu-item-export-clipboard",label:RED._("menu.label.clipboard"),disabled:true,onselect:RED.clipboard.export},
|
{id:"menu-item-export-clipboard",label:RED._("menu.label.clipboard"),onselect:"core:show-export-dialog"},
|
||||||
{id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:RED.library.export}
|
{id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:"core:library-export"}
|
||||||
]});
|
]});
|
||||||
menuOptions.push(null);
|
menuOptions.push(null);
|
||||||
menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:RED.search.show});
|
menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:"core:search"});
|
||||||
menuOptions.push(null);
|
menuOptions.push(null);
|
||||||
menuOptions.push({id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function() {}});
|
menuOptions.push({id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:"core:show-config-tab"});
|
||||||
menuOptions.push({id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[
|
menuOptions.push({id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[
|
||||||
{id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:RED.workspaces.add},
|
{id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:"core:add-flow"},
|
||||||
{id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:RED.workspaces.edit},
|
{id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:"core:edit-flow"},
|
||||||
{id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:RED.workspaces.remove}
|
{id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:"core:remove-flow"}
|
||||||
]});
|
]});
|
||||||
menuOptions.push({id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [
|
menuOptions.push({id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [
|
||||||
{id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:RED.subflow.createSubflow},
|
{id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:"core:create-subflow"},
|
||||||
{id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:RED.subflow.convertToSubflow},
|
{id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:"core:convert-to-subflow"},
|
||||||
]});
|
]});
|
||||||
menuOptions.push(null);
|
menuOptions.push(null);
|
||||||
if (RED.settings.theme('palette.editable') !== false) {
|
if (RED.settings.theme('palette.editable') !== false) {
|
||||||
RED.palette.editor.init();
|
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:"core:manage-palette"});
|
||||||
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:RED.palette.editor.show});
|
|
||||||
menuOptions.push(null);
|
menuOptions.push(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
menuOptions.push({id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:RED.keyboard.showHelp});
|
menuOptions.push({id:"menu-item-user-settings",label:RED._("menu.label.settings"),onselect:"core:show-user-settings"});
|
||||||
|
menuOptions.push(null);
|
||||||
|
|
||||||
|
menuOptions.push({id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:"core:show-help"});
|
||||||
menuOptions.push({id:"menu-item-help",
|
menuOptions.push({id:"menu-item-help",
|
||||||
label: RED.settings.theme("menu.menu-item-help.label","Node-RED website"),
|
label: RED.settings.theme("menu.menu-item-help.label",RED._("menu.label.help")),
|
||||||
href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs")
|
href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs")
|
||||||
});
|
});
|
||||||
menuOptions.push({id:"menu-item-node-red-version", label:"v"+RED.settings.version, onselect: showAbout });
|
menuOptions.push({id:"menu-item-node-red-version", label:"v"+RED.settings.version, onselect: "core:show-about" });
|
||||||
|
|
||||||
RED.menu.init({id:"btn-sidemenu",options: menuOptions});
|
|
||||||
|
|
||||||
|
RED.view.init();
|
||||||
|
RED.userSettings.init();
|
||||||
RED.user.init();
|
RED.user.init();
|
||||||
|
|
||||||
RED.library.init();
|
RED.library.init();
|
||||||
|
RED.keyboard.init();
|
||||||
RED.palette.init();
|
RED.palette.init();
|
||||||
|
if (RED.settings.theme('palette.editable') !== false) {
|
||||||
|
RED.palette.editor.init();
|
||||||
|
} else {
|
||||||
|
console.log("Palette editor disabled");
|
||||||
|
}
|
||||||
|
|
||||||
RED.sidebar.init();
|
RED.sidebar.init();
|
||||||
|
|
||||||
|
if (RED.settings.theme("projects.enabled",false)) {
|
||||||
|
RED.projects.init();
|
||||||
|
} else {
|
||||||
|
console.log("Projects disabled");
|
||||||
|
}
|
||||||
|
|
||||||
RED.subflow.init();
|
RED.subflow.init();
|
||||||
RED.workspaces.init();
|
RED.workspaces.init();
|
||||||
RED.clipboard.init();
|
RED.clipboard.init();
|
||||||
RED.search.init();
|
RED.search.init();
|
||||||
RED.view.init();
|
|
||||||
RED.editor.init();
|
RED.editor.init();
|
||||||
|
RED.diff.init();
|
||||||
|
|
||||||
|
RED.menu.init({id:"btn-sidemenu",options: menuOptions});
|
||||||
|
|
||||||
RED.deploy.init(RED.settings.theme("deployButton",null));
|
RED.deploy.init(RED.settings.theme("deployButton",null));
|
||||||
|
RED.notifications.init();
|
||||||
|
|
||||||
RED.keyboard.add("workspace", /* ? */ 191,{shift:true},function() {RED.keyboard.showHelp();d3.event.preventDefault();});
|
RED.actions.add("core:show-about", showAbout);
|
||||||
|
RED.nodes.init();
|
||||||
RED.comms.connect();
|
RED.comms.connect();
|
||||||
|
|
||||||
$("#main-container").show();
|
$("#main-container").show();
|
||||||
@@ -261,8 +498,4 @@ var RED = (function() {
|
|||||||
RED.settings.init(loadEditor);
|
RED.settings.init(loadEditor);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -24,21 +24,13 @@ RED.nodes = (function() {
|
|||||||
var workspacesOrder =[];
|
var workspacesOrder =[];
|
||||||
var subflows = {};
|
var subflows = {};
|
||||||
var loadedFlowVersion = null;
|
var loadedFlowVersion = null;
|
||||||
var pending = {
|
|
||||||
deleted: {},
|
var initialLoad;
|
||||||
added: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
var dirty = false;
|
var dirty = false;
|
||||||
|
|
||||||
function setDirty(d) {
|
function setDirty(d) {
|
||||||
dirty = d;
|
dirty = d;
|
||||||
if (!d) {
|
|
||||||
pending = {
|
|
||||||
deleted: {},
|
|
||||||
added: {}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
RED.events.emit("nodes:change",{dirty:dirty});
|
RED.events.emit("nodes:change",{dirty:dirty});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,8 +40,22 @@ RED.nodes = (function() {
|
|||||||
var nodeSets = {};
|
var nodeSets = {};
|
||||||
var typeToId = {};
|
var typeToId = {};
|
||||||
var nodeDefinitions = {};
|
var nodeDefinitions = {};
|
||||||
|
var iconSets = {};
|
||||||
|
|
||||||
|
nodeDefinitions['tab'] = {
|
||||||
|
defaults: {
|
||||||
|
label: {value:""},
|
||||||
|
disabled: {value: false},
|
||||||
|
info: {value: ""}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
var exports = {
|
var exports = {
|
||||||
|
setModulePendingUpdated: function(module,version) {
|
||||||
|
moduleList[module].pending_version = version;
|
||||||
|
RED.events.emit("registry:module-updated",{module:module,version:version});
|
||||||
|
},
|
||||||
getModule: function(module) {
|
getModule: function(module) {
|
||||||
return moduleList[module];
|
return moduleList[module];
|
||||||
},
|
},
|
||||||
@@ -62,6 +68,9 @@ RED.nodes = (function() {
|
|||||||
getNodeList: function() {
|
getNodeList: function() {
|
||||||
return nodeList;
|
return nodeList;
|
||||||
},
|
},
|
||||||
|
getNodeTypes: function() {
|
||||||
|
return Object.keys(nodeDefinitions);
|
||||||
|
},
|
||||||
setNodeList: function(list) {
|
setNodeList: function(list) {
|
||||||
nodeList = [];
|
nodeList = [];
|
||||||
for(var i=0;i<list.length;i++) {
|
for(var i=0;i<list.length;i++) {
|
||||||
@@ -83,6 +92,9 @@ RED.nodes = (function() {
|
|||||||
local:ns.local,
|
local:ns.local,
|
||||||
sets:{}
|
sets:{}
|
||||||
};
|
};
|
||||||
|
if (ns.pending_version) {
|
||||||
|
moduleList[ns.module].pending_version = ns.pending_version;
|
||||||
|
}
|
||||||
moduleList[ns.module].sets[ns.name] = ns;
|
moduleList[ns.module].sets[ns.name] = ns;
|
||||||
RED.events.emit("registry:node-set-added",ns);
|
RED.events.emit("registry:node-set-added",ns);
|
||||||
},
|
},
|
||||||
@@ -120,7 +132,8 @@ RED.nodes = (function() {
|
|||||||
},
|
},
|
||||||
registerNodeType: function(nt,def) {
|
registerNodeType: function(nt,def) {
|
||||||
nodeDefinitions[nt] = def;
|
nodeDefinitions[nt] = def;
|
||||||
if (def.category != "subflows") {
|
def.type = nt;
|
||||||
|
if (nt.substring(0,8) != "subflow:") {
|
||||||
def.set = nodeSets[typeToId[nt]];
|
def.set = nodeSets[typeToId[nt]];
|
||||||
nodeSets[typeToId[nt]].added = true;
|
nodeSets[typeToId[nt]].added = true;
|
||||||
nodeSets[typeToId[nt]].enabled = true;
|
nodeSets[typeToId[nt]].enabled = true;
|
||||||
@@ -133,10 +146,15 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
def["_"] = function() {
|
def["_"] = function() {
|
||||||
var args = Array.prototype.slice.call(arguments, 0);
|
var args = Array.prototype.slice.call(arguments, 0);
|
||||||
|
var original = args[0];
|
||||||
if (args[0].indexOf(":") === -1) {
|
if (args[0].indexOf(":") === -1) {
|
||||||
args[0] = ns+":"+args[0];
|
args[0] = ns+":"+args[0];
|
||||||
}
|
}
|
||||||
return RED._.apply(null,args);
|
var result = RED._.apply(null,args);
|
||||||
|
if (result === args[0]) {
|
||||||
|
result = original;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: too tightly coupled into palette UI
|
// TODO: too tightly coupled into palette UI
|
||||||
@@ -153,6 +171,12 @@ RED.nodes = (function() {
|
|||||||
},
|
},
|
||||||
getNodeType: function(nt) {
|
getNodeType: function(nt) {
|
||||||
return nodeDefinitions[nt];
|
return nodeDefinitions[nt];
|
||||||
|
},
|
||||||
|
setIconSets: function(sets) {
|
||||||
|
iconSets = sets;
|
||||||
|
},
|
||||||
|
getIconSets: function() {
|
||||||
|
return iconSets;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return exports;
|
return exports;
|
||||||
@@ -165,11 +189,14 @@ RED.nodes = (function() {
|
|||||||
function addNode(n) {
|
function addNode(n) {
|
||||||
if (n.type.indexOf("subflow") !== 0) {
|
if (n.type.indexOf("subflow") !== 0) {
|
||||||
n["_"] = n._def._;
|
n["_"] = n._def._;
|
||||||
|
} else {
|
||||||
|
n["_"] = RED._;
|
||||||
}
|
}
|
||||||
if (n._def.category == "config") {
|
if (n._def.category == "config") {
|
||||||
configNodes[n.id] = n;
|
configNodes[n.id] = n;
|
||||||
} else {
|
} else {
|
||||||
n.ports = [];
|
n.ports = [];
|
||||||
|
if (n.wires && (n.wires.length > n.outputs)) { n.outputs = n.wires.length; }
|
||||||
if (n.outputs) {
|
if (n.outputs) {
|
||||||
for (var i=0;i<n.outputs;i++) {
|
for (var i=0;i<n.outputs;i++) {
|
||||||
n.ports.push(i);
|
n.ports.push(i);
|
||||||
@@ -186,8 +213,6 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
nodes.push(n);
|
nodes.push(n);
|
||||||
}
|
}
|
||||||
delete pending.deleted[n.id];
|
|
||||||
pending.added[n.id] = true;
|
|
||||||
RED.events.emit('nodes:add',n);
|
RED.events.emit('nodes:add',n);
|
||||||
}
|
}
|
||||||
function addLink(l) {
|
function addLink(l) {
|
||||||
@@ -247,18 +272,21 @@ RED.nodes = (function() {
|
|||||||
if (updatedConfigNode) {
|
if (updatedConfigNode) {
|
||||||
RED.workspaces.refresh();
|
RED.workspaces.refresh();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
if (node._def.oneditdelete) {
|
||||||
|
node._def.oneditdelete.call(node);
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
console.log("oneditdelete",node.id,node.type,err.toString());
|
||||||
|
}
|
||||||
RED.events.emit('nodes:remove',node);
|
RED.events.emit('nodes:remove',node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node && node._def.onremove) {
|
if (node && node._def.onremove) {
|
||||||
|
// Deprecated: never documented but used by some early nodes
|
||||||
|
console.log("Deprecated API warning: node type ",node.type," has an onremove function - should be oneditremove - please report");
|
||||||
node._def.onremove.call(n);
|
node._def.onremove.call(n);
|
||||||
}
|
}
|
||||||
delete pending.added[id];
|
|
||||||
pending.deleted[id] = true;
|
|
||||||
removedNodes.forEach(function(node) {
|
|
||||||
delete pending.added[node.id];
|
|
||||||
pending.deleted[node.id] = true;
|
|
||||||
});
|
|
||||||
return {links:removedLinks,nodes:removedNodes};
|
return {links:removedLinks,nodes:removedNodes};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,14 +299,7 @@ RED.nodes = (function() {
|
|||||||
|
|
||||||
function addWorkspace(ws) {
|
function addWorkspace(ws) {
|
||||||
workspaces[ws.id] = ws;
|
workspaces[ws.id] = ws;
|
||||||
pending.added[ws.id] = true;
|
ws._def = RED.nodes.getType('tab');
|
||||||
delete pending.deleted[ws.id];
|
|
||||||
ws._def = {
|
|
||||||
defaults: {
|
|
||||||
label: {value:""}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
workspacesOrder.push(ws.id);
|
workspacesOrder.push(ws.id);
|
||||||
}
|
}
|
||||||
function getWorkspace(id) {
|
function getWorkspace(id) {
|
||||||
@@ -310,8 +331,6 @@ RED.nodes = (function() {
|
|||||||
var result = removeNode(removedNodes[n].id);
|
var result = removeNode(removedNodes[n].id);
|
||||||
removedLinks = removedLinks.concat(result.links);
|
removedLinks = removedLinks.concat(result.links);
|
||||||
}
|
}
|
||||||
pending.deleted[id] = true;
|
|
||||||
delete pending.added[id]
|
|
||||||
return {nodes:removedNodes,links:removedLinks};
|
return {nodes:removedNodes,links:removedLinks};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,42 +351,31 @@ RED.nodes = (function() {
|
|||||||
});
|
});
|
||||||
sf.name = subflowName;
|
sf.name = subflowName;
|
||||||
}
|
}
|
||||||
sf._def = {
|
|
||||||
defaults:{},
|
|
||||||
icon:"subflow.png",
|
|
||||||
category: "subflows",
|
|
||||||
color: "#da9",
|
|
||||||
inputs: sf.in.length,
|
|
||||||
outputs: sf.out.length
|
|
||||||
}
|
|
||||||
subflows[sf.id] = sf;
|
subflows[sf.id] = sf;
|
||||||
delete pending.deleted[sf.id];
|
|
||||||
pending.added[sf.id] = true;
|
|
||||||
RED.nodes.registerType("subflow:"+sf.id, {
|
RED.nodes.registerType("subflow:"+sf.id, {
|
||||||
defaults:{name:{value:""}},
|
defaults:{name:{value:""}},
|
||||||
info: sf.info,
|
info: sf.info,
|
||||||
icon:"subflow.png",
|
icon: function() { return sf.icon||"subflow.png" },
|
||||||
category: "subflows",
|
category: sf.category || "subflows",
|
||||||
inputs: sf.in.length,
|
inputs: sf.in.length,
|
||||||
outputs: sf.out.length,
|
outputs: sf.out.length,
|
||||||
color: "#da9",
|
color: "#da9",
|
||||||
label: function() { return this.name||RED.nodes.subflow(sf.id).name },
|
label: function() { return this.name||RED.nodes.subflow(sf.id).name },
|
||||||
labelStyle: function() { return this.name?"node_label_italic":""; },
|
labelStyle: function() { return this.name?"node_label_italic":""; },
|
||||||
paletteLabel: function() { return RED.nodes.subflow(sf.id).name },
|
paletteLabel: function() { return RED.nodes.subflow(sf.id).name },
|
||||||
|
inputLabels: function(i) { return sf.inputLabels?sf.inputLabels[i]:null },
|
||||||
|
outputLabels: function(i) { return sf.outputLabels?sf.outputLabels[i]:null },
|
||||||
set:{
|
set:{
|
||||||
module: "node-red"
|
module: "node-red"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
sf._def = RED.nodes.getType("subflow:"+sf.id);
|
||||||
|
|
||||||
}
|
}
|
||||||
function getSubflow(id) {
|
function getSubflow(id) {
|
||||||
return subflows[id];
|
return subflows[id];
|
||||||
}
|
}
|
||||||
function removeSubflow(sf) {
|
function removeSubflow(sf) {
|
||||||
delete subflows[sf.id];
|
delete subflows[sf.id];
|
||||||
delete pending.added[sf.id];
|
|
||||||
pending.deleted[sf.id] = true;
|
|
||||||
registry.removeNodeType("subflow:"+sf.id);
|
registry.removeNodeType("subflow:"+sf.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,6 +446,7 @@ RED.nodes = (function() {
|
|||||||
node.id = n.id;
|
node.id = n.id;
|
||||||
node.type = n.type;
|
node.type = n.type;
|
||||||
node.z = n.z;
|
node.z = n.z;
|
||||||
|
|
||||||
if (node.type == "unknown") {
|
if (node.type == "unknown") {
|
||||||
for (var p in n._orig) {
|
for (var p in n._orig) {
|
||||||
if (n._orig.hasOwnProperty(p)) {
|
if (n._orig.hasOwnProperty(p)) {
|
||||||
@@ -482,7 +491,22 @@ RED.nodes = (function() {
|
|||||||
for (var j=0;j<wires.length;j++) {
|
for (var j=0;j<wires.length;j++) {
|
||||||
var w = wires[j];
|
var w = wires[j];
|
||||||
if (w.target.type != "subflow") {
|
if (w.target.type != "subflow") {
|
||||||
node.wires[w.sourcePort].push(w.target.id);
|
if (w.sourcePort < node.wires.length) {
|
||||||
|
node.wires[w.sourcePort].push(w.target.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n.inputs > 0 && n.inputLabels && !/^\s*$/.test(n.inputLabels.join(""))) {
|
||||||
|
node.inputLabels = n.inputLabels.slice();
|
||||||
|
}
|
||||||
|
if (n.outputs > 0 && n.outputLabels && !/^\s*$/.test(n.outputLabels.join(""))) {
|
||||||
|
node.outputLabels = n.outputLabels.slice();
|
||||||
|
}
|
||||||
|
if ((!n._def.defaults || !n._def.defaults.hasOwnProperty("icon")) && n.icon) {
|
||||||
|
var defIcon = RED.utils.getDefaultNodeIcon(n._def, n);
|
||||||
|
if (n.icon !== defIcon.module+"/"+defIcon.file) {
|
||||||
|
node.icon = n.icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,6 +519,7 @@ RED.nodes = (function() {
|
|||||||
node.type = n.type;
|
node.type = n.type;
|
||||||
node.name = n.name;
|
node.name = n.name;
|
||||||
node.info = n.info;
|
node.info = n.info;
|
||||||
|
node.category = n.category;
|
||||||
node.in = [];
|
node.in = [];
|
||||||
node.out = [];
|
node.out = [];
|
||||||
|
|
||||||
@@ -522,16 +547,27 @@ RED.nodes = (function() {
|
|||||||
node.out.push(nOut);
|
node.out.push(nOut);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (node.in.length > 0 && n.inputLabels && !/^\s*$/.test(n.inputLabels.join(""))) {
|
||||||
|
node.inputLabels = n.inputLabels.slice();
|
||||||
|
}
|
||||||
|
if (node.out.length > 0 && n.outputLabels && !/^\s*$/.test(n.outputLabels.join(""))) {
|
||||||
|
node.outputLabels = n.outputLabels.slice();
|
||||||
|
}
|
||||||
|
if (n.icon) {
|
||||||
|
if (n.icon !== "node-red/subflow.png") {
|
||||||
|
node.icon = n.icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Converts the current node selection to an exportable JSON Object
|
* Converts the current node selection to an exportable JSON Object
|
||||||
**/
|
**/
|
||||||
function createExportableNodeSet(set) {
|
function createExportableNodeSet(set, exportedSubflows, exportedConfigNodes) {
|
||||||
var nns = [];
|
var nns = [];
|
||||||
var exportedConfigNodes = {};
|
exportedConfigNodes = exportedConfigNodes || {};
|
||||||
var exportedSubflows = {};
|
exportedSubflows = exportedSubflows || {};
|
||||||
for (var n=0;n<set.length;n++) {
|
for (var n=0;n<set.length;n++) {
|
||||||
var node = set[n];
|
var node = set[n];
|
||||||
if (node.type.substring(0,8) == "subflow:") {
|
if (node.type.substring(0,8) == "subflow:") {
|
||||||
@@ -545,7 +581,7 @@ RED.nodes = (function() {
|
|||||||
subflowSet.push(n);
|
subflowSet.push(n);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var exportableSubflow = createExportableNodeSet(subflowSet);
|
var exportableSubflow = createExportableNodeSet(subflowSet, exportedSubflows, exportedConfigNodes);
|
||||||
nns = exportableSubflow.concat(nns);
|
nns = exportableSubflow.concat(nns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -694,6 +730,11 @@ RED.nodes = (function() {
|
|||||||
if (!$.isArray(newNodes)) {
|
if (!$.isArray(newNodes)) {
|
||||||
newNodes = [newNodes];
|
newNodes = [newNodes];
|
||||||
}
|
}
|
||||||
|
var isInitialLoad = false;
|
||||||
|
if (!initialLoad) {
|
||||||
|
isInitialLoad = true;
|
||||||
|
initialLoad = JSON.parse(JSON.stringify(newNodes));
|
||||||
|
}
|
||||||
var unknownTypes = [];
|
var unknownTypes = [];
|
||||||
for (i=0;i<newNodes.length;i++) {
|
for (i=0;i<newNodes.length;i++) {
|
||||||
n = newNodes[i];
|
n = newNodes[i];
|
||||||
@@ -712,24 +753,26 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (unknownTypes.length > 0) {
|
if (!isInitialLoad && unknownTypes.length > 0) {
|
||||||
var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>";
|
var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>";
|
||||||
var type = "type"+(unknownTypes.length > 1?"s":"");
|
var type = "type"+(unknownTypes.length > 1?"s":"");
|
||||||
RED.notify("<strong>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</strong>"+typeList,"error",false,10000);
|
RED.notify("<p>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</p>"+typeList,"error",false,10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var activeWorkspace = RED.workspaces.active();
|
var activeWorkspace = RED.workspaces.active();
|
||||||
|
//TODO: check the z of the subflow instance and check _that_ if it exists
|
||||||
var activeSubflow = getSubflow(activeWorkspace);
|
var activeSubflow = getSubflow(activeWorkspace);
|
||||||
if (activeSubflow) {
|
for (i=0;i<newNodes.length;i++) {
|
||||||
for (i=0;i<newNodes.length;i++) {
|
var m = /^subflow:(.+)$/.exec(newNodes[i].type);
|
||||||
var m = /^subflow:(.+)$/.exec(newNodes[i].type);
|
if (m) {
|
||||||
if (m) {
|
var subflowId = m[1];
|
||||||
var subflowId = m[1];
|
var parent = getSubflow(newNodes[i].z || activeWorkspace);
|
||||||
|
if (parent) {
|
||||||
var err;
|
var err;
|
||||||
if (subflowId === activeSubflow.id) {
|
if (subflowId === parent.id) {
|
||||||
err = new Error(RED._("notification.errors.cannotAddSubflowToItself"));
|
err = new Error(RED._("notification.errors.cannotAddSubflowToItself"));
|
||||||
}
|
}
|
||||||
if (subflowContains(m[1],activeSubflow.id)) {
|
if (subflowContains(subflowId,parent.id)) {
|
||||||
err = new Error(RED._("notification.errors.cannotAddCircularReference"));
|
err = new Error(RED._("notification.errors.cannotAddCircularReference"));
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -807,7 +850,7 @@ RED.nodes = (function() {
|
|||||||
|
|
||||||
// Add a tab if there isn't one there already
|
// Add a tab if there isn't one there already
|
||||||
if (defaultWorkspace == null) {
|
if (defaultWorkspace == null) {
|
||||||
defaultWorkspace = { type:"tab", id:getID(), label:RED._('workspace.defaultName',{number:1})};
|
defaultWorkspace = { type:"tab", id:getID(), disabled: false, info:"", label:RED._('workspace.defaultName',{number:1})};
|
||||||
addWorkspace(defaultWorkspace);
|
addWorkspace(defaultWorkspace);
|
||||||
RED.workspaces.add(defaultWorkspace);
|
RED.workspaces.add(defaultWorkspace);
|
||||||
new_workspaces.push(defaultWorkspace);
|
new_workspaces.push(defaultWorkspace);
|
||||||
@@ -860,7 +903,7 @@ RED.nodes = (function() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!existingConfigNode) { //} || !compareNodes(existingConfigNode,n,true) || existingConfigNode._def.exclusive || existingConfigNode.z !== n.z) {
|
if (!existingConfigNode || existingConfigNode._def.exclusive) { //} || !compareNodes(existingConfigNode,n,true) || existingConfigNode.z !== n.z) {
|
||||||
configNode = {id:n.id, z:n.z, type:n.type, users:[], _config:{}};
|
configNode = {id:n.id, z:n.z, type:n.type, users:[], _config:{}};
|
||||||
for (d in def.defaults) {
|
for (d in def.defaults) {
|
||||||
if (def.defaults.hasOwnProperty(d)) {
|
if (def.defaults.hasOwnProperty(d)) {
|
||||||
@@ -895,7 +938,18 @@ RED.nodes = (function() {
|
|||||||
if (n.type !== "workspace" && n.type !== "tab" && n.type !== "subflow") {
|
if (n.type !== "workspace" && n.type !== "tab" && n.type !== "subflow") {
|
||||||
def = registry.getNodeType(n.type);
|
def = registry.getNodeType(n.type);
|
||||||
if (!def || def.category != "config") {
|
if (!def || def.category != "config") {
|
||||||
var node = {x:n.x,y:n.y,z:n.z,type:0,wires:n.wires,changed:false,_config:{}};
|
var node = {
|
||||||
|
x:n.x,
|
||||||
|
y:n.y,
|
||||||
|
z:n.z,
|
||||||
|
type:0,
|
||||||
|
wires:n.wires,
|
||||||
|
inputLabels: n.inputLabels,
|
||||||
|
outputLabels: n.outputLabels,
|
||||||
|
icon: n.icon,
|
||||||
|
changed:false,
|
||||||
|
_config:{}
|
||||||
|
};
|
||||||
if (createNewIds) {
|
if (createNewIds) {
|
||||||
if (subflow_blacklist[n.z]) {
|
if (subflow_blacklist[n.z]) {
|
||||||
continue;
|
continue;
|
||||||
@@ -961,6 +1015,13 @@ RED.nodes = (function() {
|
|||||||
set: registry.getNodeSet("node-red/unknown")
|
set: registry.getNodeSet("node-red/unknown")
|
||||||
};
|
};
|
||||||
node.users = [];
|
node.users = [];
|
||||||
|
// This is a config node, so delete the default
|
||||||
|
// non-config node properties
|
||||||
|
delete node.x;
|
||||||
|
delete node.y;
|
||||||
|
delete node.wires;
|
||||||
|
delete node.inputLabels;
|
||||||
|
delete node.outputLabels;
|
||||||
}
|
}
|
||||||
var orig = {};
|
var orig = {};
|
||||||
for (var p in n) {
|
for (var p in n) {
|
||||||
@@ -973,10 +1034,31 @@ RED.nodes = (function() {
|
|||||||
node.type = "unknown";
|
node.type = "unknown";
|
||||||
}
|
}
|
||||||
if (node._def.category != "config") {
|
if (node._def.category != "config") {
|
||||||
node.inputs = n.inputs||node._def.inputs;
|
if (n.hasOwnProperty('inputs')) {
|
||||||
node.outputs = n.outputs||node._def.outputs;
|
node.inputs = n.inputs;
|
||||||
|
node._config.inputs = JSON.stringify(n.inputs);
|
||||||
|
} else {
|
||||||
|
node.inputs = node._def.inputs;
|
||||||
|
}
|
||||||
|
if (n.hasOwnProperty('outputs')) {
|
||||||
|
node.outputs = n.outputs;
|
||||||
|
node._config.outputs = JSON.stringify(n.outputs);
|
||||||
|
} else {
|
||||||
|
node.outputs = node._def.outputs;
|
||||||
|
}
|
||||||
|
if (node.hasOwnProperty('wires') && node.wires.length > node.outputs) {
|
||||||
|
if (!node._def.defaults.hasOwnProperty("outputs") || !isNaN(parseInt(n.outputs))) {
|
||||||
|
// If 'wires' is longer than outputs, clip wires
|
||||||
|
console.log("Warning: node.wires longer than node.outputs - trimming wires:",node.id," wires:",node.wires.length," outputs:",node.outputs);
|
||||||
|
node.wires = node.wires.slice(0,node.outputs);
|
||||||
|
} else {
|
||||||
|
// The node declares outputs in its defaults, but has not got a valid value
|
||||||
|
// Defer to the length of the wires array
|
||||||
|
node.outputs = node.wires.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (d in node._def.defaults) {
|
for (d in node._def.defaults) {
|
||||||
if (node._def.defaults.hasOwnProperty(d)) {
|
if (node._def.defaults.hasOwnProperty(d) && d !== 'inputs' && d !== 'outputs') {
|
||||||
node[d] = n[d];
|
node[d] = n[d];
|
||||||
node._config[d] = JSON.stringify(n[d]);
|
node._config[d] = JSON.stringify(n[d]);
|
||||||
}
|
}
|
||||||
@@ -996,7 +1078,9 @@ RED.nodes = (function() {
|
|||||||
addNode(node);
|
addNode(node);
|
||||||
RED.editor.validateNode(node);
|
RED.editor.validateNode(node);
|
||||||
node_map[n.id] = node;
|
node_map[n.id] = node;
|
||||||
if (node._def.category != "config") {
|
// If an 'unknown' config node, it will not have been caught by the
|
||||||
|
// proper config node handling, so needs adding to new_nodes here
|
||||||
|
if (node.type === "unknown" || node._def.category !== "config") {
|
||||||
new_nodes.push(node);
|
new_nodes.push(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1011,7 +1095,6 @@ RED.nodes = (function() {
|
|||||||
"link out":"links"
|
"link out":"links"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Remap all wires and config node references
|
// Remap all wires and config node references
|
||||||
for (i=0;i<new_nodes.length;i++) {
|
for (i=0;i<new_nodes.length;i++) {
|
||||||
n = new_nodes[i];
|
n = new_nodes[i];
|
||||||
@@ -1019,10 +1102,14 @@ RED.nodes = (function() {
|
|||||||
for (var w1=0;w1<n.wires.length;w1++) {
|
for (var w1=0;w1<n.wires.length;w1++) {
|
||||||
var wires = (n.wires[w1] instanceof Array)?n.wires[w1]:[n.wires[w1]];
|
var wires = (n.wires[w1] instanceof Array)?n.wires[w1]:[n.wires[w1]];
|
||||||
for (var w2=0;w2<wires.length;w2++) {
|
for (var w2=0;w2<wires.length;w2++) {
|
||||||
if (wires[w2] in node_map) {
|
if (node_map.hasOwnProperty(wires[w2])) {
|
||||||
var link = {source:n,sourcePort:w1,target:node_map[wires[w2]]};
|
if (n.z === node_map[wires[w2]].z) {
|
||||||
addLink(link);
|
var link = {source:n,sourcePort:w1,target:node_map[wires[w2]]};
|
||||||
new_links.push(link);
|
addLink(link);
|
||||||
|
new_links.push(link);
|
||||||
|
} else {
|
||||||
|
console.log("Warning: dropping link that crosses tabs:",n.id,"->",node_map[wires[w2]].id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1161,7 +1248,84 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clear() {
|
||||||
|
nodes = [];
|
||||||
|
links = [];
|
||||||
|
configNodes = {};
|
||||||
|
workspacesOrder = [];
|
||||||
|
var subflowIds = Object.keys(subflows);
|
||||||
|
subflowIds.forEach(function(id) {
|
||||||
|
RED.subflow.removeSubflow(id)
|
||||||
|
});
|
||||||
|
var workspaceIds = Object.keys(workspaces);
|
||||||
|
workspaceIds.forEach(function(id) {
|
||||||
|
RED.workspaces.remove(workspaces[id]);
|
||||||
|
});
|
||||||
|
defaultWorkspace = null;
|
||||||
|
initialLoad = null;
|
||||||
|
RED.nodes.dirty(false);
|
||||||
|
RED.view.redraw(true);
|
||||||
|
RED.palette.refresh();
|
||||||
|
RED.workspaces.refresh();
|
||||||
|
RED.sidebar.config.refresh();
|
||||||
|
RED.sidebar.info.refresh();
|
||||||
|
|
||||||
|
// var node_defs = {};
|
||||||
|
// var nodes = [];
|
||||||
|
// var configNodes = {};
|
||||||
|
// var links = [];
|
||||||
|
// var defaultWorkspace;
|
||||||
|
// var workspaces = {};
|
||||||
|
// var workspacesOrder =[];
|
||||||
|
// var subflows = {};
|
||||||
|
// var loadedFlowVersion = null;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
init: function() {
|
||||||
|
RED.events.on("registry:node-type-added",function(type) {
|
||||||
|
var def = registry.getNodeType(type);
|
||||||
|
var replaced = false;
|
||||||
|
var replaceNodes = [];
|
||||||
|
RED.nodes.eachNode(function(n) {
|
||||||
|
if (n.type === "unknown" && n.name === type) {
|
||||||
|
replaceNodes.push(n);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.nodes.eachConfig(function(n) {
|
||||||
|
if (n.type === "unknown" && n.name === type) {
|
||||||
|
replaceNodes.push(n);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (replaceNodes.length > 0) {
|
||||||
|
var reimportList = [];
|
||||||
|
replaceNodes.forEach(function(n) {
|
||||||
|
if (configNodes.hasOwnProperty(n.id)) {
|
||||||
|
delete configNodes[n.id];
|
||||||
|
} else {
|
||||||
|
nodes.splice(nodes.indexOf(n),1);
|
||||||
|
}
|
||||||
|
reimportList.push(convertNode(n));
|
||||||
|
});
|
||||||
|
RED.view.redraw(true);
|
||||||
|
var result = importNodes(reimportList,false);
|
||||||
|
var newNodeMap = {};
|
||||||
|
result[0].forEach(function(n) {
|
||||||
|
newNodeMap[n.id] = n;
|
||||||
|
});
|
||||||
|
RED.nodes.eachLink(function(l) {
|
||||||
|
if (newNodeMap.hasOwnProperty(l.source.id)) {
|
||||||
|
l.source = newNodeMap[l.source.id];
|
||||||
|
}
|
||||||
|
if (newNodeMap.hasOwnProperty(l.target.id)) {
|
||||||
|
l.target = newNodeMap[l.target.id];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.view.redraw(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
registry:registry,
|
registry:registry,
|
||||||
setNodeList: registry.setNodeList,
|
setNodeList: registry.setNodeList,
|
||||||
|
|
||||||
@@ -1171,12 +1335,16 @@ RED.nodes = (function() {
|
|||||||
enableNodeSet: registry.enableNodeSet,
|
enableNodeSet: registry.enableNodeSet,
|
||||||
disableNodeSet: registry.disableNodeSet,
|
disableNodeSet: registry.disableNodeSet,
|
||||||
|
|
||||||
|
setIconSets: registry.setIconSets,
|
||||||
|
getIconSets: registry.getIconSets,
|
||||||
|
|
||||||
registerType: registry.registerNodeType,
|
registerType: registry.registerNodeType,
|
||||||
getType: registry.getNodeType,
|
getType: registry.getNodeType,
|
||||||
convertNode: convertNode,
|
convertNode: convertNode,
|
||||||
|
|
||||||
add: addNode,
|
add: addNode,
|
||||||
remove: removeNode,
|
remove: removeNode,
|
||||||
|
clear: clear,
|
||||||
|
|
||||||
addLink: addLink,
|
addLink: addLink,
|
||||||
removeLink: removeLink,
|
removeLink: removeLink,
|
||||||
@@ -1225,14 +1393,19 @@ RED.nodes = (function() {
|
|||||||
node: getNode,
|
node: getNode,
|
||||||
|
|
||||||
version: flowVersion,
|
version: flowVersion,
|
||||||
|
originalFlow: function(flow) {
|
||||||
|
if (flow === undefined) {
|
||||||
|
return initialLoad;
|
||||||
|
} else {
|
||||||
|
initialLoad = flow;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
filterNodes: filterNodes,
|
filterNodes: filterNodes,
|
||||||
filterLinks: filterLinks,
|
filterLinks: filterLinks,
|
||||||
|
|
||||||
import: importNodes,
|
import: importNodes,
|
||||||
|
|
||||||
pending: function() { return pending },
|
|
||||||
|
|
||||||
getAllFlowNodes: getAllFlowNodes,
|
getAllFlowNodes: getAllFlowNodes,
|
||||||
createExportableNodeSet: createExportableNodeSet,
|
createExportableNodeSet: createExportableNodeSet,
|
||||||
createCompleteNodeSet: createCompleteNodeSet,
|
createCompleteNodeSet: createCompleteNodeSet,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -13,7 +13,4 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
var RED = {};
|
||||||
describe("locales api", function() {
|
|
||||||
it.skip("works",function() {});
|
|
||||||
});
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2014 IBM, Antoine Aflalo
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,6 +18,9 @@
|
|||||||
RED.settings = (function () {
|
RED.settings = (function () {
|
||||||
|
|
||||||
var loadedSettings = {};
|
var loadedSettings = {};
|
||||||
|
var userSettings = {};
|
||||||
|
var settingsDirty = false;
|
||||||
|
var pendingSave;
|
||||||
|
|
||||||
var hasLocalStorage = function () {
|
var hasLocalStorage = function () {
|
||||||
try {
|
try {
|
||||||
@@ -31,7 +34,12 @@ RED.settings = (function () {
|
|||||||
if (!hasLocalStorage()) {
|
if (!hasLocalStorage()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localStorage.setItem(key, JSON.stringify(value));
|
if (key === "auth-tokens") {
|
||||||
|
localStorage.setItem(key, JSON.stringify(value));
|
||||||
|
} else {
|
||||||
|
userSettings[key] = value;
|
||||||
|
saveUserSettings();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,14 +52,23 @@ RED.settings = (function () {
|
|||||||
if (!hasLocalStorage()) {
|
if (!hasLocalStorage()) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return JSON.parse(localStorage.getItem(key));
|
if (key === "auth-tokens") {
|
||||||
|
return JSON.parse(localStorage.getItem(key));
|
||||||
|
} else {
|
||||||
|
return userSettings[key];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var remove = function (key) {
|
var remove = function (key) {
|
||||||
if (!hasLocalStorage()) {
|
if (!hasLocalStorage()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localStorage.removeItem(key);
|
if (key === "auth-tokens") {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
} else {
|
||||||
|
delete userSettings[key];
|
||||||
|
saveUserSettings();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var setProperties = function(data) {
|
var setProperties = function(data) {
|
||||||
@@ -68,6 +85,10 @@ RED.settings = (function () {
|
|||||||
loadedSettings = data;
|
loadedSettings = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var setUserSettings = function(data) {
|
||||||
|
userSettings = data;
|
||||||
|
}
|
||||||
|
|
||||||
var init = function (done) {
|
var init = function (done) {
|
||||||
var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search);
|
var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search);
|
||||||
if (accessTokenMatch) {
|
if (accessTokenMatch) {
|
||||||
@@ -102,11 +123,11 @@ RED.settings = (function () {
|
|||||||
url: 'settings',
|
url: 'settings',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
setProperties(data);
|
setProperties(data);
|
||||||
if (RED.settings.user && RED.settings.user.anonymous) {
|
if (!RED.settings.user || RED.settings.user.anonymous) {
|
||||||
RED.settings.remove("auth-tokens");
|
RED.settings.remove("auth-tokens");
|
||||||
}
|
}
|
||||||
console.log("Node-RED: " + data.version);
|
console.log("Node-RED: " + data.version);
|
||||||
done();
|
loadUserSettings(done);
|
||||||
},
|
},
|
||||||
error: function(jqXHR,textStatus,errorThrown) {
|
error: function(jqXHR,textStatus,errorThrown) {
|
||||||
if (jqXHR.status === 401) {
|
if (jqXHR.status === 401) {
|
||||||
@@ -115,12 +136,52 @@ RED.settings = (function () {
|
|||||||
}
|
}
|
||||||
RED.user.login(function() { load(done); });
|
RED.user.login(function() { load(done); });
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected error:",jqXHR.status,textStatus);
|
console.log("Unexpected error loading settings:",jqXHR.status,textStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function loadUserSettings(done) {
|
||||||
|
$.ajax({
|
||||||
|
headers: {
|
||||||
|
"Accept": "application/json"
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
cache: false,
|
||||||
|
url: 'settings/user',
|
||||||
|
success: function (data) {
|
||||||
|
setUserSettings(data);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
error: function(jqXHR,textStatus,errorThrown) {
|
||||||
|
console.log("Unexpected error loading user settings:",jqXHR.status,textStatus);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveUserSettings() {
|
||||||
|
if (RED.user.hasPermission("settings.write")) {
|
||||||
|
if (pendingSave) {
|
||||||
|
clearTimeout(pendingSave);
|
||||||
|
}
|
||||||
|
pendingSave = setTimeout(function() {
|
||||||
|
pendingSave = null;
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
url: 'settings/user',
|
||||||
|
data: JSON.stringify(userSettings),
|
||||||
|
success: function (data) {
|
||||||
|
},
|
||||||
|
error: function(jqXHR,textStatus,errorThrown) {
|
||||||
|
console.log("Unexpected error saving user settings:",jqXHR.status,textStatus);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function theme(property,defaultValue) {
|
function theme(property,defaultValue) {
|
||||||
if (!RED.settings.editorTheme) {
|
if (!RED.settings.editorTheme) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@@ -143,10 +204,10 @@ RED.settings = (function () {
|
|||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
load: load,
|
load: load,
|
||||||
|
loadUserSettings: loadUserSettings,
|
||||||
set: set,
|
set: set,
|
||||||
get: get,
|
get: get,
|
||||||
remove: remove,
|
remove: remove,
|
||||||
theme: theme
|
theme: theme
|
||||||
}
|
}
|
||||||
})
|
})();
|
||||||
();
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
35
editor/js/ui/actions.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
RED.actions = (function() {
|
||||||
|
var actions = {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function addAction(name,handler) {
|
||||||
|
actions[name] = handler;
|
||||||
|
}
|
||||||
|
function removeAction(name) {
|
||||||
|
delete actions[name];
|
||||||
|
}
|
||||||
|
function getAction(name) {
|
||||||
|
return actions[name];
|
||||||
|
}
|
||||||
|
function invokeAction(name) {
|
||||||
|
if (actions.hasOwnProperty(name)) {
|
||||||
|
actions[name]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function listActions() {
|
||||||
|
var result = [];
|
||||||
|
Object.keys(actions).forEach(function(action) {
|
||||||
|
var shortcut = RED.keyboard.getShortcut(action);
|
||||||
|
result.push({id:action,scope:shortcut?shortcut.scope:undefined,key:shortcut?shortcut.key:undefined,user:shortcut?shortcut.user:undefined})
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
add: addAction,
|
||||||
|
remove: removeAction,
|
||||||
|
get: getAction,
|
||||||
|
invoke: invokeAction,
|
||||||
|
list: listActions
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -21,6 +21,7 @@ RED.clipboard = (function() {
|
|||||||
var dialogContainer;
|
var dialogContainer;
|
||||||
var exportNodesDialog;
|
var exportNodesDialog;
|
||||||
var importNodesDialog;
|
var importNodesDialog;
|
||||||
|
var disabled = false;
|
||||||
|
|
||||||
function setupDialogs() {
|
function setupDialogs() {
|
||||||
dialog = $('<div id="clipboard-dialog" class="hide node-red-dialog"><form class="dialog-form form-horizontal"></form></div>')
|
dialog = $('<div id="clipboard-dialog" class="hide node-red-dialog"><form class="dialog-form form-horizontal"></form></div>')
|
||||||
@@ -128,6 +129,9 @@ RED.clipboard = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function importNodes() {
|
function importNodes() {
|
||||||
|
if (disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
dialogContainer.empty();
|
dialogContainer.empty();
|
||||||
dialogContainer.append($(importNodesDialog));
|
dialogContainer.append($(importNodesDialog));
|
||||||
dialogContainer.i18n();
|
dialogContainer.i18n();
|
||||||
@@ -153,13 +157,19 @@ RED.clipboard = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function exportNodes() {
|
function exportNodes() {
|
||||||
|
if (disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dialogContainer.empty();
|
dialogContainer.empty();
|
||||||
dialogContainer.append($(exportNodesDialog));
|
dialogContainer.append($(exportNodesDialog));
|
||||||
dialogContainer.i18n();
|
dialogContainer.i18n();
|
||||||
|
var format = RED.settings.flowFilePretty ? "export-format-full" : "export-format-mini";
|
||||||
|
|
||||||
$("#export-format-group > a").click(function(evt) {
|
$("#export-format-group > a").click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
||||||
|
$("#clipboard-export").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(this).parent().children().removeClass('selected');
|
$(this).parent().children().removeClass('selected');
|
||||||
@@ -169,18 +179,21 @@ RED.clipboard = (function() {
|
|||||||
if (flow.length > 0) {
|
if (flow.length > 0) {
|
||||||
var nodes = JSON.parse(flow);
|
var nodes = JSON.parse(flow);
|
||||||
|
|
||||||
var format = $(this).attr('id');
|
format = $(this).attr('id');
|
||||||
if (format === 'export-format-full') {
|
if (format === 'export-format-full') {
|
||||||
flow = JSON.stringify(nodes,null,4);
|
flow = JSON.stringify(nodes,null,4);
|
||||||
} else {
|
} else {
|
||||||
flow = JSON.stringify(nodes);
|
flow = JSON.stringify(nodes);
|
||||||
}
|
}
|
||||||
$("#clipboard-export").val(flow);
|
$("#clipboard-export").val(flow);
|
||||||
|
$("#clipboard-export").focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#export-range-group > a").click(function(evt) {
|
$("#export-range-group > a").click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
||||||
|
$("#clipboard-export").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(this).parent().children().removeClass('selected');
|
$(this).parent().children().removeClass('selected');
|
||||||
@@ -190,7 +203,8 @@ RED.clipboard = (function() {
|
|||||||
var nodes = null;
|
var nodes = null;
|
||||||
if (type === 'export-range-selected') {
|
if (type === 'export-range-selected') {
|
||||||
var selection = RED.view.selection();
|
var selection = RED.view.selection();
|
||||||
nodes = RED.nodes.createExportableNodeSet(selection.nodes);
|
// Don't include the subflow meta-port nodes in the exported selection
|
||||||
|
nodes = RED.nodes.createExportableNodeSet(selection.nodes.filter(function(n) { return n.type !== 'subflow'}));
|
||||||
} else if (type === 'export-range-flow') {
|
} else if (type === 'export-range-flow') {
|
||||||
var activeWorkspace = RED.workspaces.active();
|
var activeWorkspace = RED.workspaces.active();
|
||||||
nodes = RED.nodes.filterNodes({z:activeWorkspace});
|
nodes = RED.nodes.filterNodes({z:activeWorkspace});
|
||||||
@@ -201,7 +215,7 @@ RED.clipboard = (function() {
|
|||||||
nodes = RED.nodes.createCompleteNodeSet(false);
|
nodes = RED.nodes.createCompleteNodeSet(false);
|
||||||
}
|
}
|
||||||
if (nodes !== null) {
|
if (nodes !== null) {
|
||||||
if (RED.settings.flowFilePretty) {
|
if (format === "export-format-full") {
|
||||||
flow = JSON.stringify(nodes,null,4);
|
flow = JSON.stringify(nodes,null,4);
|
||||||
} else {
|
} else {
|
||||||
flow = JSON.stringify(nodes);
|
flow = JSON.stringify(nodes);
|
||||||
@@ -213,6 +227,7 @@ RED.clipboard = (function() {
|
|||||||
$("#export-copy").addClass('disabled');
|
$("#export-copy").addClass('disabled');
|
||||||
}
|
}
|
||||||
$("#clipboard-export").val(flow);
|
$("#clipboard-export").val(flow);
|
||||||
|
$("#clipboard-export").focus();
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#clipboard-dialog-ok").hide();
|
$("#clipboard-dialog-ok").hide();
|
||||||
@@ -226,7 +241,7 @@ RED.clipboard = (function() {
|
|||||||
$("#export-range-selected").addClass('disabled').removeClass('selected');
|
$("#export-range-selected").addClass('disabled').removeClass('selected');
|
||||||
$("#export-range-flow").click();
|
$("#export-range-flow").click();
|
||||||
}
|
}
|
||||||
if (RED.settings.flowFilePretty) {
|
if (format === "export-format-full") {
|
||||||
$("#export-format-full").click();
|
$("#export-format-full").click();
|
||||||
} else {
|
} else {
|
||||||
$("#export-format-mini").click();
|
$("#export-format-mini").click();
|
||||||
@@ -242,50 +257,92 @@ RED.clipboard = (function() {
|
|||||||
});
|
});
|
||||||
dialog.dialog("option","title",RED._("clipboard.exportNodes")).dialog( "open" );
|
dialog.dialog("option","title",RED._("clipboard.exportNodes")).dialog( "open" );
|
||||||
|
|
||||||
setTimeout(function() {
|
$("#clipboard-export").focus();
|
||||||
$("#clipboard-export").focus();
|
if (!document.queryCommandSupported("copy")) {
|
||||||
if (!document.queryCommandEnabled("copy")) {
|
$("#clipboard-dialog-cancel").hide();
|
||||||
$("#clipboard-dialog-cancel").hide();
|
$("#clipboard-dialog-close").show();
|
||||||
$("#clipboard-dialog-close").show();
|
} else {
|
||||||
} else {
|
$("#clipboard-dialog-cancel").show();
|
||||||
$("#clipboard-dialog-cancel").show();
|
$("#clipboard-dialog-copy").show();
|
||||||
$("#clipboard-dialog-copy").show();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
},0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideDropTarget() {
|
function hideDropTarget() {
|
||||||
$("#dropTarget").hide();
|
$("#dropTarget").hide();
|
||||||
RED.keyboard.remove(/* ESCAPE */ 27);
|
RED.keyboard.remove("escape");
|
||||||
|
}
|
||||||
|
function copyText(value,element,msg) {
|
||||||
|
var truncated = false;
|
||||||
|
if (typeof value !== "string" ) {
|
||||||
|
value = JSON.stringify(value, function(key,value) {
|
||||||
|
if (value !== null && typeof value === 'object') {
|
||||||
|
if (value.__enc__) {
|
||||||
|
if (value.hasOwnProperty('data') && value.hasOwnProperty('length')) {
|
||||||
|
truncated = value.data.length !== value.length;
|
||||||
|
return value.data;
|
||||||
|
}
|
||||||
|
if (value.type === 'function' || value.type === 'internal') {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
if (value.type === 'number') {
|
||||||
|
// Handle NaN and Infinity - they are not permitted
|
||||||
|
// in JSON. We can either substitute with a String
|
||||||
|
// representation or null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (truncated) {
|
||||||
|
msg += "_truncated";
|
||||||
|
}
|
||||||
|
$("#clipboard-hidden").val(value).select();
|
||||||
|
var result = document.execCommand("copy");
|
||||||
|
if (result && element) {
|
||||||
|
var popover = RED.popover.create({
|
||||||
|
target: element,
|
||||||
|
direction: 'left',
|
||||||
|
size: 'small',
|
||||||
|
content: RED._(msg)
|
||||||
|
});
|
||||||
|
setTimeout(function() {
|
||||||
|
popover.close();
|
||||||
|
},1000);
|
||||||
|
popover.open();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: function() {
|
init: function() {
|
||||||
setupDialogs();
|
setupDialogs();
|
||||||
RED.events.on("view:selection-changed",function(selection) {
|
|
||||||
if (!selection.nodes) {
|
$('<input type="text" id="clipboard-hidden">').appendTo("body");
|
||||||
RED.menu.setDisabled("menu-item-export",true);
|
|
||||||
RED.menu.setDisabled("menu-item-export-clipboard",true);
|
RED.actions.add("core:show-export-dialog",exportNodes);
|
||||||
RED.menu.setDisabled("menu-item-export-library",true);
|
RED.actions.add("core:show-import-dialog",importNodes);
|
||||||
} else {
|
|
||||||
RED.menu.setDisabled("menu-item-export",false);
|
|
||||||
RED.menu.setDisabled("menu-item-export-clipboard",false);
|
RED.events.on("editor:open",function() { disabled = true; });
|
||||||
RED.menu.setDisabled("menu-item-export-library",false);
|
RED.events.on("editor:close",function() { disabled = false; });
|
||||||
}
|
RED.events.on("search:open",function() { disabled = true; });
|
||||||
});
|
RED.events.on("search:close",function() { disabled = false; });
|
||||||
RED.keyboard.add("workspace", /* e */ 69,{ctrl:true},function(){exportNodes();d3.event.preventDefault();});
|
RED.events.on("type-search:open",function() { disabled = true; });
|
||||||
RED.keyboard.add("workspace", /* i */ 73,{ctrl:true},function(){importNodes();d3.event.preventDefault();});
|
RED.events.on("type-search:close",function() { disabled = false; });
|
||||||
|
|
||||||
|
|
||||||
$('#chart').on("dragenter",function(event) {
|
$('#chart').on("dragenter",function(event) {
|
||||||
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
|
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1 ||
|
||||||
|
$.inArray("Files",event.originalEvent.dataTransfer.types) != -1) {
|
||||||
$("#dropTarget").css({display:'table'});
|
$("#dropTarget").css({display:'table'});
|
||||||
RED.keyboard.add("*", /* ESCAPE */ 27,hideDropTarget);
|
RED.keyboard.add("*", "escape" ,hideDropTarget);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#dropTarget').on("dragover",function(event) {
|
$('#dropTarget').on("dragover",function(event) {
|
||||||
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
|
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1 ||
|
||||||
|
$.inArray("Files",event.originalEvent.dataTransfer.types) != -1) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -293,15 +350,30 @@ RED.clipboard = (function() {
|
|||||||
hideDropTarget();
|
hideDropTarget();
|
||||||
})
|
})
|
||||||
.on("drop",function(event) {
|
.on("drop",function(event) {
|
||||||
var data = event.originalEvent.dataTransfer.getData("text/plain");
|
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
|
||||||
|
var data = event.originalEvent.dataTransfer.getData("text/plain");
|
||||||
|
data = data.substring(data.indexOf('['),data.lastIndexOf(']')+1);
|
||||||
|
RED.view.importNodes(data);
|
||||||
|
} else if ($.inArray("Files",event.originalEvent.dataTransfer.types) != -1) {
|
||||||
|
var files = event.originalEvent.dataTransfer.files;
|
||||||
|
if (files.length === 1) {
|
||||||
|
var file = files[0];
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.onload = (function(theFile) {
|
||||||
|
return function(e) {
|
||||||
|
RED.view.importNodes(e.target.result);
|
||||||
|
};
|
||||||
|
})(file);
|
||||||
|
reader.readAsText(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
hideDropTarget();
|
hideDropTarget();
|
||||||
data = data.substring(data.indexOf('['),data.lastIndexOf(']')+1);
|
|
||||||
RED.view.importNodes(data);
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
import: importNodes,
|
import: importNodes,
|
||||||
export: exportNodes
|
export: exportNodes,
|
||||||
|
copyText: copyText
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
131
editor/js/ui/common/checkboxSet.js
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
(function($) {
|
||||||
|
$.widget( "nodered.checkboxSet", {
|
||||||
|
_create: function() {
|
||||||
|
var that = this;
|
||||||
|
this.uiElement = this.element.wrap( "<span>" ).parent();
|
||||||
|
this.uiElement.addClass("red-ui-checkboxSet");
|
||||||
|
if (this.options.parent) {
|
||||||
|
this.parent = this.options.parent;
|
||||||
|
this.parent.checkboxSet('addChild',this.element);
|
||||||
|
}
|
||||||
|
this.children = [];
|
||||||
|
this.partialFlag = false;
|
||||||
|
this.stateValue = 0;
|
||||||
|
var initialState = this.element.prop('checked');
|
||||||
|
this.options = [
|
||||||
|
$('<span class="red-ui-checkboxSet-option hide"><i class="fa fa-square-o"></i></span>').appendTo(this.uiElement),
|
||||||
|
$('<span class="red-ui-checkboxSet-option hide"><i class="fa fa-check-square-o"></i></span>').appendTo(this.uiElement),
|
||||||
|
$('<span class="red-ui-checkboxSet-option hide"><i class="fa fa-minus-square-o"></i></span>').appendTo(this.uiElement)
|
||||||
|
];
|
||||||
|
if (initialState) {
|
||||||
|
this.options[1].show();
|
||||||
|
} else {
|
||||||
|
this.options[0].show();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.element.change(function() {
|
||||||
|
if (this.checked) {
|
||||||
|
that.options[0].hide();
|
||||||
|
that.options[1].show();
|
||||||
|
that.options[2].hide();
|
||||||
|
} else {
|
||||||
|
that.options[1].hide();
|
||||||
|
that.options[0].show();
|
||||||
|
that.options[2].hide();
|
||||||
|
}
|
||||||
|
var isChecked = this.checked;
|
||||||
|
that.children.forEach(function(child) {
|
||||||
|
child.checkboxSet('state',isChecked,false,true);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.uiElement.click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
// state returns null for a partial state. Clicking on that should
|
||||||
|
// result in false.
|
||||||
|
that.state((that.state()===false)?true:false);
|
||||||
|
})
|
||||||
|
if (this.parent) {
|
||||||
|
this.parent.checkboxSet('updateChild',this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_destroy: function() {
|
||||||
|
if (this.parent) {
|
||||||
|
this.parent.checkboxSet('removeChild',this.element);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addChild: function(child) {
|
||||||
|
var that = this;
|
||||||
|
this.children.push(child);
|
||||||
|
},
|
||||||
|
removeChild: function(child) {
|
||||||
|
var index = this.children.indexOf(child);
|
||||||
|
if (index > -1) {
|
||||||
|
this.children.splice(index,1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateChild: function(child) {
|
||||||
|
var checkedCount = 0;
|
||||||
|
this.children.forEach(function(c,i) {
|
||||||
|
if (c.checkboxSet('state') === true) {
|
||||||
|
checkedCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (checkedCount === 0) {
|
||||||
|
|
||||||
|
this.state(false,true);
|
||||||
|
} else if (checkedCount === this.children.length) {
|
||||||
|
this.state(true,true);
|
||||||
|
} else {
|
||||||
|
this.state(null,true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
disable: function() {
|
||||||
|
this.uiElement.addClass('disabled');
|
||||||
|
},
|
||||||
|
state: function(state,suppressEvent,suppressParentUpdate) {
|
||||||
|
|
||||||
|
if (arguments.length === 0) {
|
||||||
|
return this.partialFlag?null:this.element.is(":checked");
|
||||||
|
} else {
|
||||||
|
this.partialFlag = (state === null);
|
||||||
|
var trueState = this.partialFlag||state;
|
||||||
|
this.element.prop('checked',trueState);
|
||||||
|
if (state === true) {
|
||||||
|
this.options[0].hide();
|
||||||
|
this.options[1].show();
|
||||||
|
this.options[2].hide();
|
||||||
|
} else if (state === false) {
|
||||||
|
this.options[2].hide();
|
||||||
|
this.options[1].hide();
|
||||||
|
this.options[0].show();
|
||||||
|
} else if (state === null) {
|
||||||
|
this.options[0].hide();
|
||||||
|
this.options[1].hide();
|
||||||
|
this.options[2].show();
|
||||||
|
}
|
||||||
|
if (!suppressEvent) {
|
||||||
|
this.element.trigger('change',null);
|
||||||
|
}
|
||||||
|
if (!suppressParentUpdate && this.parent) {
|
||||||
|
this.parent.checkboxSet('updateChild',this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -27,6 +27,9 @@
|
|||||||
* - removable : boolean - whether to display delete button on items
|
* - removable : boolean - whether to display delete button on items
|
||||||
* - addItem : function(row,index,itemData) - when an item is added
|
* - addItem : function(row,index,itemData) - when an item is added
|
||||||
* - removeItem : function(itemData) - called when an item is removed
|
* - removeItem : function(itemData) - called when an item is removed
|
||||||
|
* - filter : function(itemData) - called for each item to determine if it should be shown
|
||||||
|
* - sort : function(itemDataA,itemDataB) - called to sort items
|
||||||
|
* - scrollOnAdd : boolean - whether to scroll to newly added items
|
||||||
* methods:
|
* methods:
|
||||||
* - addItem(itemData)
|
* - addItem(itemData)
|
||||||
* - removeItem(itemData)
|
* - removeItem(itemData)
|
||||||
@@ -34,6 +37,9 @@
|
|||||||
* - height(height)
|
* - height(height)
|
||||||
* - items()
|
* - items()
|
||||||
* - empty()
|
* - empty()
|
||||||
|
* - filter(filter)
|
||||||
|
* - sort(sort)
|
||||||
|
* - length()
|
||||||
*/
|
*/
|
||||||
$.widget( "nodered.editableList", {
|
$.widget( "nodered.editableList", {
|
||||||
_create: function() {
|
_create: function() {
|
||||||
@@ -44,9 +50,19 @@
|
|||||||
this.uiContainer = this.element
|
this.uiContainer = this.element
|
||||||
.wrap( "<div>" )
|
.wrap( "<div>" )
|
||||||
.parent();
|
.parent();
|
||||||
this.topContainer = this.uiContainer.wrap("<div>").parent();
|
|
||||||
|
|
||||||
|
if (this.options.header) {
|
||||||
|
this.options.header.addClass("red-ui-editableList-header");
|
||||||
|
this.borderContainer = this.uiContainer.wrap("<div>").parent();
|
||||||
|
this.borderContainer.prepend(this.options.header);
|
||||||
|
this.topContainer = this.borderContainer.wrap("<div>").parent();
|
||||||
|
} else {
|
||||||
|
this.topContainer = this.uiContainer.wrap("<div>").parent();
|
||||||
|
}
|
||||||
this.topContainer.addClass('red-ui-editableList');
|
this.topContainer.addClass('red-ui-editableList');
|
||||||
|
if (this.options.class) {
|
||||||
|
this.topContainer.addClass(this.options.class);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.options.addButton !== false) {
|
if (this.options.addButton !== false) {
|
||||||
var addLabel;
|
var addLabel;
|
||||||
@@ -59,7 +75,7 @@
|
|||||||
addLabel = 'add';
|
addLabel = 'add';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$('<a href="#" class="editor-button editor-button-small" style="margin-top: 4px;"><i class="fa fa-plus"></i> '+addLabel+'</a>')
|
$('<a href="#" class="editor-button editor-button-small red-ui-editableList-addButton" style="margin-top: 4px;"><i class="fa fa-plus"></i> '+addLabel+'</a>')
|
||||||
.appendTo(this.topContainer)
|
.appendTo(this.topContainer)
|
||||||
.click(function(evt) {
|
.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@@ -69,7 +85,7 @@
|
|||||||
if (this.element.css("position") === "absolute") {
|
if (this.element.css("position") === "absolute") {
|
||||||
["top","left","bottom","right"].forEach(function(s) {
|
["top","left","bottom","right"].forEach(function(s) {
|
||||||
var v = that.element.css(s);
|
var v = that.element.css(s);
|
||||||
if (s!=="auto" && s!=="") {
|
if (v!=="auto" && v!=="") {
|
||||||
that.topContainer.css(s,v);
|
that.topContainer.css(s,v);
|
||||||
that.uiContainer.css(s,"0");
|
that.uiContainer.css(s,"0");
|
||||||
that.element.css(s,'auto');
|
that.element.css(s,'auto');
|
||||||
@@ -80,6 +96,11 @@
|
|||||||
this.uiContainer.css("position","absolute");
|
this.uiContainer.css("position","absolute");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (this.options.header) {
|
||||||
|
this.borderContainer.addClass("red-ui-editableList-border");
|
||||||
|
} else {
|
||||||
|
this.uiContainer.addClass("red-ui-editableList-border");
|
||||||
|
}
|
||||||
this.uiContainer.addClass("red-ui-editableList-container");
|
this.uiContainer.addClass("red-ui-editableList-container");
|
||||||
|
|
||||||
this.uiHeight = this.element.height();
|
this.uiHeight = this.element.height();
|
||||||
@@ -95,6 +116,11 @@
|
|||||||
this.uiContainer.css("minHeight",minHeight);
|
this.uiContainer.css("minHeight",minHeight);
|
||||||
this.element.css("minHeight",0);
|
this.element.css("minHeight",0);
|
||||||
}
|
}
|
||||||
|
var maxHeight = this.element.css("maxHeight");
|
||||||
|
if (maxHeight !== '0px') {
|
||||||
|
this.uiContainer.css("maxHeight",maxHeight);
|
||||||
|
this.element.css("maxHeight",null);
|
||||||
|
}
|
||||||
if (this.options.height !== 'auto') {
|
if (this.options.height !== 'auto') {
|
||||||
this.uiContainer.css("overflow-y","scroll");
|
this.uiContainer.css("overflow-y","scroll");
|
||||||
if (!isNaN(this.options.height)) {
|
if (!isNaN(this.options.height)) {
|
||||||
@@ -164,7 +190,7 @@
|
|||||||
var that = this;
|
var that = this;
|
||||||
var count = 0;
|
var count = 0;
|
||||||
if (!this.activeFilter) {
|
if (!this.activeFilter) {
|
||||||
this.element.children().show();
|
return this.element.children().show();
|
||||||
}
|
}
|
||||||
var items = this.items();
|
var items = this.items();
|
||||||
items.each(function (i,el) {
|
items.each(function (i,el) {
|
||||||
@@ -234,7 +260,8 @@
|
|||||||
var deleteButton = $('<a/>',{href:"#",class:"red-ui-editableList-item-remove editor-button editor-button-small"}).appendTo(li);
|
var deleteButton = $('<a/>',{href:"#",class:"red-ui-editableList-item-remove editor-button editor-button-small"}).appendTo(li);
|
||||||
$('<i/>',{class:"fa fa-remove"}).appendTo(deleteButton);
|
$('<i/>',{class:"fa fa-remove"}).appendTo(deleteButton);
|
||||||
li.addClass("red-ui-editableList-item-removable");
|
li.addClass("red-ui-editableList-item-removable");
|
||||||
deleteButton.click(function() {
|
deleteButton.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
var data = row.data('data');
|
var data = row.data('data');
|
||||||
li.addClass("red-ui-editableList-item-deleting")
|
li.addClass("red-ui-editableList-item-deleting")
|
||||||
li.fadeOut(300, function() {
|
li.fadeOut(300, function() {
|
||||||
@@ -266,6 +293,11 @@
|
|||||||
},0);
|
},0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
addItems: function(items) {
|
||||||
|
for (var i=0; i<items.length;i++) {
|
||||||
|
this.addItem(items[i]);
|
||||||
|
}
|
||||||
|
},
|
||||||
removeItem: function(data) {
|
removeItem: function(data) {
|
||||||
var items = this.element.children().filter(function(f) {
|
var items = this.element.children().filter(function(f) {
|
||||||
return data === $(this).find(".red-ui-editableList-item-content").data('data');
|
return data === $(this).find(".red-ui-editableList-item-content").data('data');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2014, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -13,9 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RED.menu = (function() {
|
RED.menu = (function() {
|
||||||
|
|
||||||
var menuItems = {};
|
var menuItems = {};
|
||||||
@@ -31,20 +28,30 @@ RED.menu = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setInitialState() {
|
function setInitialState() {
|
||||||
var savedStateActive = isSavedStateActive(opt.id);
|
var savedStateActive = RED.settings.get("menu-" + opt.id);
|
||||||
|
if (opt.setting) {
|
||||||
|
// May need to migrate pre-0.17 setting
|
||||||
|
|
||||||
|
if (savedStateActive !== null) {
|
||||||
|
RED.settings.set(opt.setting,savedStateActive);
|
||||||
|
RED.settings.remove("menu-" + opt.id);
|
||||||
|
} else {
|
||||||
|
savedStateActive = RED.settings.get(opt.setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (savedStateActive) {
|
if (savedStateActive) {
|
||||||
link.addClass("active");
|
link.addClass("active");
|
||||||
opt.onselect.call(opt, true);
|
triggerAction(opt.id,true);
|
||||||
} else if (savedStateActive === false) {
|
} else if (savedStateActive === false) {
|
||||||
link.removeClass("active");
|
link.removeClass("active");
|
||||||
opt.onselect.call(opt, false);
|
triggerAction(opt.id,false);
|
||||||
} else if (opt.hasOwnProperty("selected")) {
|
} else if (opt.hasOwnProperty("selected")) {
|
||||||
if (opt.selected) {
|
if (opt.selected) {
|
||||||
link.addClass("active");
|
link.addClass("active");
|
||||||
} else {
|
} else {
|
||||||
link.removeClass("active");
|
link.removeClass("active");
|
||||||
}
|
}
|
||||||
opt.onselect.call(opt, opt.selected);
|
triggerAction(opt.id,opt.selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +92,8 @@ RED.menu = (function() {
|
|||||||
menuItems[opt.id] = opt;
|
menuItems[opt.id] = opt;
|
||||||
|
|
||||||
if (opt.onselect) {
|
if (opt.onselect) {
|
||||||
link.click(function() {
|
link.click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
if ($(this).parent().hasClass("disabled")) {
|
if ($(this).parent().hasClass("disabled")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -107,10 +115,12 @@ RED.menu = (function() {
|
|||||||
setSelected(opt.id, !selected);
|
setSelected(opt.id, !selected);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
opt.onselect.call(opt);
|
triggerAction(opt.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setInitialState();
|
if (opt.toggle) {
|
||||||
|
setInitialState();
|
||||||
|
}
|
||||||
} else if (opt.href) {
|
} else if (opt.href) {
|
||||||
link.attr("target","_blank").attr("href",opt.href);
|
link.attr("target","_blank").attr("href",opt.href);
|
||||||
} else if (!opt.options) {
|
} else if (!opt.options) {
|
||||||
@@ -141,15 +151,13 @@ RED.menu = (function() {
|
|||||||
}
|
}
|
||||||
function createMenu(options) {
|
function createMenu(options) {
|
||||||
|
|
||||||
var button = $("#"+options.id);
|
var menuParent = $("#"+options.id);
|
||||||
|
|
||||||
//button.click(function(event) {
|
var topMenu = $("<ul/>",{id:options.id+"-submenu", class:"dropdown-menu pull-right"});
|
||||||
// $("#"+options.id+"-submenu").show();
|
|
||||||
// event.preventDefault();
|
|
||||||
//});
|
|
||||||
|
|
||||||
|
if (menuParent.length === 1) {
|
||||||
var topMenu = $("<ul/>",{id:options.id+"-submenu", class:"dropdown-menu pull-right"}).insertAfter(button);
|
topMenu.insertAfter(menuParent);
|
||||||
|
}
|
||||||
|
|
||||||
var lastAddedSeparator = false;
|
var lastAddedSeparator = false;
|
||||||
for (var i=0;i<options.options.length;i++) {
|
for (var i=0;i<options.options.length;i++) {
|
||||||
@@ -162,20 +170,27 @@ RED.menu = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return topMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSavedStateActive(id) {
|
function triggerAction(id, args) {
|
||||||
return RED.settings.get("menu-" + id);
|
var opt = menuItems[id];
|
||||||
|
var callback = opt.onselect;
|
||||||
|
if (typeof opt.onselect === 'string') {
|
||||||
|
callback = RED.actions.get(opt.onselect);
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
callback.call(opt,args);
|
||||||
|
} else {
|
||||||
|
console.log("No callback for",id,opt.onselect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSelected(id) {
|
function isSelected(id) {
|
||||||
return $("#" + id).hasClass("active");
|
return $("#" + id).hasClass("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSavedState(id, state) {
|
|
||||||
RED.settings.set("menu-" + id, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSelected(id,state) {
|
function setSelected(id,state) {
|
||||||
if (isSelected(id) == state) {
|
if (isSelected(id) == state) {
|
||||||
return;
|
return;
|
||||||
@@ -187,9 +202,13 @@ RED.menu = (function() {
|
|||||||
$("#"+id).removeClass("active");
|
$("#"+id).removeClass("active");
|
||||||
}
|
}
|
||||||
if (opt && opt.onselect) {
|
if (opt && opt.onselect) {
|
||||||
opt.onselect.call(opt,state);
|
triggerAction(opt.id,state);
|
||||||
}
|
}
|
||||||
setSavedState(id, state);
|
RED.settings.set(opt.setting||("menu-"+opt.id), state);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleSelected(id) {
|
||||||
|
setSelected(id,!isSelected(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDisabled(id,state) {
|
function setDisabled(id,state) {
|
||||||
@@ -231,16 +250,6 @@ RED.menu = (function() {
|
|||||||
var opt = menuItems[id];
|
var opt = menuItems[id];
|
||||||
if (opt) {
|
if (opt) {
|
||||||
opt.onselect = action;
|
opt.onselect = action;
|
||||||
// $("#"+id).click(function() {
|
|
||||||
// if ($(this).parent().hasClass("disabled")) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (menuItems[id].toggle) {
|
|
||||||
// setSelected(id,!isSelected(id));
|
|
||||||
// } else {
|
|
||||||
// menuItems[id].onselect.call(menuItems[id]);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +257,7 @@ RED.menu = (function() {
|
|||||||
init: createMenu,
|
init: createMenu,
|
||||||
setSelected: setSelected,
|
setSelected: setSelected,
|
||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
|
toggleSelected: toggleSelected,
|
||||||
setDisabled: setDisabled,
|
setDisabled: setDisabled,
|
||||||
addItem: addItem,
|
addItem: addItem,
|
||||||
removeItem: removeItem,
|
removeItem: removeItem,
|
||||||
|
|||||||
81
editor/js/ui/common/panels.js
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
RED.panels = (function() {
|
||||||
|
|
||||||
|
function createPanel(options) {
|
||||||
|
var container = options.container || $("#"+options.id);
|
||||||
|
var children = container.children();
|
||||||
|
if (children.length !== 2) {
|
||||||
|
throw new Error("Container must have exactly two children");
|
||||||
|
}
|
||||||
|
|
||||||
|
container.addClass("red-ui-panels");
|
||||||
|
var separator = $('<div class="red-ui-panels-separator"></div>').insertAfter(children[0]);
|
||||||
|
var startPosition;
|
||||||
|
var panelHeights = [];
|
||||||
|
var modifiedHeights = false;
|
||||||
|
var panelRatio;
|
||||||
|
|
||||||
|
separator.draggable({
|
||||||
|
axis: "y",
|
||||||
|
containment: container,
|
||||||
|
scroll: false,
|
||||||
|
start:function(event,ui) {
|
||||||
|
var height = container.height();
|
||||||
|
startPosition = ui.position.top;
|
||||||
|
panelHeights = [$(children[0]).height(),$(children[1]).height()];
|
||||||
|
},
|
||||||
|
drag: function(event,ui) {
|
||||||
|
var height = container.height();
|
||||||
|
var delta = ui.position.top-startPosition;
|
||||||
|
var newHeights = [panelHeights[0]+delta,panelHeights[1]-delta];
|
||||||
|
$(children[0]).height(newHeights[0]);
|
||||||
|
$(children[1]).height(newHeights[1]);
|
||||||
|
if (options.resize) {
|
||||||
|
options.resize(newHeights[0],newHeights[1]);
|
||||||
|
}
|
||||||
|
ui.position.top -= delta;
|
||||||
|
panelRatio = newHeights[0]/height;
|
||||||
|
},
|
||||||
|
stop:function(event,ui) {
|
||||||
|
modifiedHeights = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
resize: function(height) {
|
||||||
|
var panelHeights = [$(children[0]).height(),$(children[1]).height()];
|
||||||
|
container.height(height);
|
||||||
|
if (modifiedHeights) {
|
||||||
|
var topPanelHeight = panelRatio*height;
|
||||||
|
var bottomPanelHeight = height - topPanelHeight - 48;
|
||||||
|
panelHeights = [topPanelHeight,bottomPanelHeight];
|
||||||
|
$(children[0]).height(panelHeights[0]);
|
||||||
|
$(children[1]).height(panelHeights[1]);
|
||||||
|
}
|
||||||
|
if (options.resize) {
|
||||||
|
options.resize(panelHeights[0],panelHeights[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
create: createPanel
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,65 +15,157 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
RED.popover = (function() {
|
RED.popover = (function() {
|
||||||
|
var deltaSizes = {
|
||||||
|
"default": {
|
||||||
|
top: 10,
|
||||||
|
leftRight: 17,
|
||||||
|
leftLeft: 25,
|
||||||
|
leftBottom: 8,
|
||||||
|
},
|
||||||
|
"small": {
|
||||||
|
top: 5,
|
||||||
|
leftRight: 17,
|
||||||
|
leftLeft: 16,
|
||||||
|
leftBottom: 3,
|
||||||
|
}
|
||||||
|
}
|
||||||
function createPopover(options) {
|
function createPopover(options) {
|
||||||
var target = options.target;
|
var target = options.target;
|
||||||
|
var direction = options.direction || "right";
|
||||||
|
var trigger = options.trigger;
|
||||||
var content = options.content;
|
var content = options.content;
|
||||||
var delay = options.delay;
|
var delay = options.delay;
|
||||||
|
var autoClose = options.autoClose;
|
||||||
|
var width = options.width||"auto";
|
||||||
|
var size = options.size||"default";
|
||||||
|
if (!deltaSizes[size]) {
|
||||||
|
throw new Error("Invalid RED.popover size value:",size);
|
||||||
|
}
|
||||||
|
|
||||||
var timer = null;
|
var timer = null;
|
||||||
var active;
|
var active;
|
||||||
var div;
|
var div;
|
||||||
|
|
||||||
var openPopup = function() {
|
var openPopup = function(instant) {
|
||||||
if (active) {
|
if (active) {
|
||||||
div = $('<div class="red-ui-popover"></div>').html(content).appendTo("body");
|
div = $('<div class="red-ui-popover red-ui-popover-'+direction+'"></div>');
|
||||||
|
if (size !== "default") {
|
||||||
|
div.addClass("red-ui-popover-size-"+size);
|
||||||
|
}
|
||||||
|
if (typeof content === 'function') {
|
||||||
|
var result = content.call(res);
|
||||||
|
if (result === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof result === 'string') {
|
||||||
|
div.text(result);
|
||||||
|
} else {
|
||||||
|
div.append(result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
div.html(content);
|
||||||
|
}
|
||||||
|
if (width !== "auto") {
|
||||||
|
div.width(width);
|
||||||
|
}
|
||||||
|
div.appendTo("body");
|
||||||
|
|
||||||
var targetPos = target.offset();
|
var targetPos = target.offset();
|
||||||
var targetWidth = target.width();
|
var targetWidth = target.outerWidth();
|
||||||
var targetHeight = target.height();
|
var targetHeight = target.outerHeight();
|
||||||
|
|
||||||
var divHeight = div.height();
|
var divHeight = div.height();
|
||||||
div.css({top: targetPos.top+targetHeight/2-divHeight/2-10,left:targetPos.left+targetWidth+17});
|
var divWidth = div.width();
|
||||||
|
if (direction === 'right') {
|
||||||
div.fadeIn("fast");
|
div.css({top: targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top,left:targetPos.left+targetWidth+deltaSizes[size].leftRight});
|
||||||
|
} else if (direction === 'left') {
|
||||||
|
div.css({top: targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top,left:targetPos.left-deltaSizes[size].leftLeft-divWidth});
|
||||||
|
} else if (direction === 'bottom') {
|
||||||
|
div.css({top: targetPos.top+targetHeight+deltaSizes[size].top,left:targetPos.left+targetWidth/2-divWidth/2 - deltaSizes[size].leftBottom});
|
||||||
|
}
|
||||||
|
if (instant) {
|
||||||
|
div.show();
|
||||||
|
} else {
|
||||||
|
div.fadeIn("fast");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var closePopup = function() {
|
var closePopup = function(instant) {
|
||||||
if (!active) {
|
if (!active) {
|
||||||
if (div) {
|
if (div) {
|
||||||
div.fadeOut("fast",function() {
|
if (instant) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
} else {
|
||||||
|
div.fadeOut("fast",function() {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
div = null;
|
div = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
target.on('mouseenter',function(e) {
|
if (trigger === 'hover') {
|
||||||
clearTimeout(timer);
|
target.on('mouseenter',function(e) {
|
||||||
active = true;
|
|
||||||
timer = setTimeout(openPopup,delay.show);
|
|
||||||
});
|
|
||||||
target.on('mouseleave', function(e) {
|
|
||||||
if (timer) {
|
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
active = true;
|
||||||
active = false;
|
timer = setTimeout(openPopup,delay.show);
|
||||||
setTimeout(closePopup,delay.hide);
|
});
|
||||||
});
|
target.on('mouseleave', function(e) {
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer);
|
||||||
|
}
|
||||||
|
active = false;
|
||||||
|
setTimeout(closePopup,delay.hide);
|
||||||
|
});
|
||||||
|
} else if (trigger === 'click') {
|
||||||
|
target.click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
active = !active;
|
||||||
|
if (!active) {
|
||||||
|
closePopup();
|
||||||
|
} else {
|
||||||
|
openPopup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (autoClose) {
|
||||||
|
setTimeout(function() {
|
||||||
|
active = false;
|
||||||
|
closePopup();
|
||||||
|
},autoClose);
|
||||||
|
}
|
||||||
var res = {
|
var res = {
|
||||||
setContent: function(_content) {
|
setContent: function(_content) {
|
||||||
content = _content;
|
content = _content;
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
open: function (instant) {
|
||||||
|
active = true;
|
||||||
|
openPopup(instant);
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
close: function (instant) {
|
||||||
|
active = false;
|
||||||
|
closePopup(instant);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
target.data('popover',res);
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
create: createPopover
|
create: createPopover,
|
||||||
|
tooltip: function(target,content) {
|
||||||
|
RED.popover.create({
|
||||||
|
target:target,
|
||||||
|
trigger: "hover",
|
||||||
|
size: "small",
|
||||||
|
direction: "bottom",
|
||||||
|
content: content,
|
||||||
|
delay: { show: 550, hide: 10 }
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -91,6 +91,9 @@
|
|||||||
} else {
|
} else {
|
||||||
this.resultCount.text(val).show();
|
this.resultCount.text(val).show();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
change: function() {
|
||||||
|
this._trigger("change");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|||||||
161
editor/js/ui/common/stack.js
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
RED.stack = (function() {
|
||||||
|
function createStack(options) {
|
||||||
|
var container = options.container;
|
||||||
|
container.addClass("red-ui-stack");
|
||||||
|
var contentHeight = 0;
|
||||||
|
var entries = [];
|
||||||
|
|
||||||
|
var visible = true;
|
||||||
|
// TODO: make this a singleton function - and watch out for stacks no longer
|
||||||
|
// in the DOM
|
||||||
|
var resizeStack = function() {
|
||||||
|
if (entries.length > 0) {
|
||||||
|
var headerHeight = 0;
|
||||||
|
entries.forEach(function(entry) {
|
||||||
|
headerHeight += entry.header.outerHeight();
|
||||||
|
});
|
||||||
|
|
||||||
|
var height = container.innerHeight();
|
||||||
|
contentHeight = height - headerHeight - (entries.length-1);
|
||||||
|
entries.forEach(function(e) {
|
||||||
|
e.contentWrap.height(contentHeight);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (options.fill && options.singleExpanded) {
|
||||||
|
$(window).resize(resizeStack);
|
||||||
|
$(window).focus(resizeStack);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
add: function(entry) {
|
||||||
|
entries.push(entry);
|
||||||
|
entry.container = $('<div class="palette-category">').appendTo(container);
|
||||||
|
if (!visible) {
|
||||||
|
entry.container.hide();
|
||||||
|
}
|
||||||
|
var header = $('<div class="palette-header"></div>').appendTo(entry.container);
|
||||||
|
entry.header = header;
|
||||||
|
entry.contentWrap = $('<div></div>',{style:"position:relative"}).appendTo(entry.container);
|
||||||
|
if (options.fill) {
|
||||||
|
entry.contentWrap.css("height",contentHeight);
|
||||||
|
}
|
||||||
|
entry.content = $('<div></div>').appendTo(entry.contentWrap);
|
||||||
|
if (entry.collapsible !== false) {
|
||||||
|
header.click(function() {
|
||||||
|
if (options.singleExpanded) {
|
||||||
|
if (!entry.isExpanded()) {
|
||||||
|
for (var i=0;i<entries.length;i++) {
|
||||||
|
if (entries[i].isExpanded()) {
|
||||||
|
entries[i].collapse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entry.expand();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
entry.toggle();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var icon = $('<i class="fa fa-angle-down"></i>').appendTo(header);
|
||||||
|
|
||||||
|
if (entry.expanded) {
|
||||||
|
entry.container.addClass("palette-category-expanded");
|
||||||
|
icon.addClass("expanded");
|
||||||
|
} else {
|
||||||
|
entry.contentWrap.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('<i style="opacity: 0.5;" class="fa fa-angle-down expanded"></i>').appendTo(header);
|
||||||
|
header.css("cursor","default");
|
||||||
|
}
|
||||||
|
entry.title = $('<span></span>').html(entry.title).appendTo(header);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entry.toggle = function() {
|
||||||
|
if (entry.isExpanded()) {
|
||||||
|
entry.collapse();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
entry.expand();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
entry.expand = function() {
|
||||||
|
if (!entry.isExpanded()) {
|
||||||
|
if (entry.onexpand) {
|
||||||
|
entry.onexpand.call(entry);
|
||||||
|
}
|
||||||
|
if (options.singleExpanded) {
|
||||||
|
entries.forEach(function(e) {
|
||||||
|
if (e !== entry) {
|
||||||
|
e.collapse();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
icon.addClass("expanded");
|
||||||
|
entry.container.addClass("palette-category-expanded");
|
||||||
|
entry.contentWrap.slideDown(200);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
entry.collapse = function() {
|
||||||
|
if (entry.isExpanded()) {
|
||||||
|
icon.removeClass("expanded");
|
||||||
|
entry.container.removeClass("palette-category-expanded");
|
||||||
|
entry.contentWrap.slideUp(200);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
entry.isExpanded = function() {
|
||||||
|
return entry.container.hasClass("palette-category-expanded");
|
||||||
|
};
|
||||||
|
if (options.fill && options.singleExpanded) {
|
||||||
|
resizeStack();
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
},
|
||||||
|
|
||||||
|
hide: function() {
|
||||||
|
visible = false;
|
||||||
|
entries.forEach(function(entry) {
|
||||||
|
entry.container.hide();
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
show: function() {
|
||||||
|
visible = true;
|
||||||
|
entries.forEach(function(entry) {
|
||||||
|
entry.container.show();
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
resize: function() {
|
||||||
|
if (resizeStack) {
|
||||||
|
resizeStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
create: createStack
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -17,15 +17,23 @@
|
|||||||
|
|
||||||
|
|
||||||
RED.tabs = (function() {
|
RED.tabs = (function() {
|
||||||
|
|
||||||
|
var defaultTabIcon = "fa fa-lemon-o";
|
||||||
|
|
||||||
function createTabs(options) {
|
function createTabs(options) {
|
||||||
var tabs = {};
|
var tabs = {};
|
||||||
|
var pinnedTabsCount = 0;
|
||||||
var currentTabWidth;
|
var currentTabWidth;
|
||||||
var currentActiveTabWidth = 0;
|
var currentActiveTabWidth = 0;
|
||||||
|
var collapsibleMenu;
|
||||||
|
|
||||||
var ul = $("#"+options.id);
|
var ul = options.element || $("#"+options.id);
|
||||||
var wrapper = ul.wrap( "<div>" ).parent();
|
var wrapper = ul.wrap( "<div>" ).parent();
|
||||||
var scrollContainer = ul.wrap( "<div>" ).parent();
|
var scrollContainer = ul.wrap( "<div>" ).parent();
|
||||||
wrapper.addClass("red-ui-tabs");
|
wrapper.addClass("red-ui-tabs");
|
||||||
|
if (options.vertical) {
|
||||||
|
wrapper.addClass("red-ui-tabs-vertical");
|
||||||
|
}
|
||||||
if (options.addButton && typeof options.addButton === 'function') {
|
if (options.addButton && typeof options.addButton === 'function') {
|
||||||
wrapper.addClass("red-ui-tabs-add");
|
wrapper.addClass("red-ui-tabs-add");
|
||||||
var addButton = $('<div class="red-ui-tab-button"><a href="#"><i class="fa fa-plus"></i></a></div>').appendTo(wrapper);
|
var addButton = $('<div class="red-ui-tab-button"><a href="#"><i class="fa fa-plus"></i></a></div>').appendTo(wrapper);
|
||||||
@@ -47,6 +55,56 @@ RED.tabs = (function() {
|
|||||||
scrollRight = $('<div class="red-ui-tab-button red-ui-tab-scroll red-ui-tab-scroll-right"><a href="#" style="display:none;"><i class="fa fa-caret-right"></i></a></div>').appendTo(wrapper).find("a");
|
scrollRight = $('<div class="red-ui-tab-button red-ui-tab-scroll red-ui-tab-scroll-right"><a href="#" style="display:none;"><i class="fa fa-caret-right"></i></a></div>').appendTo(wrapper).find("a");
|
||||||
scrollRight.on('mousedown',function(evt) { scrollEventHandler(evt,'+=150') }).on('click',function(evt){ evt.preventDefault();});
|
scrollRight.on('mousedown',function(evt) { scrollEventHandler(evt,'+=150') }).on('click',function(evt){ evt.preventDefault();});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.collapsible) {
|
||||||
|
// var dropDown = $('<div>',{class:"red-ui-tabs-select"}).appendTo(wrapper);
|
||||||
|
// ul.hide();
|
||||||
|
wrapper.addClass("red-ui-tabs-collapsible");
|
||||||
|
|
||||||
|
var collapsedButtonsRow = $('<div class="red-ui-tab-link-buttons"></div>').appendTo(wrapper);
|
||||||
|
|
||||||
|
var selectButton = $('<a href="#"><i class="fa fa-caret-down"></i></a>').appendTo(collapsedButtonsRow);
|
||||||
|
selectButton.addClass("red-ui-tab-link-button-menu")
|
||||||
|
selectButton.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
if (!collapsibleMenu) {
|
||||||
|
var pinnedOptions = [];
|
||||||
|
var options = [];
|
||||||
|
ul.children().each(function(i,el) {
|
||||||
|
var id = $(el).data('tabId');
|
||||||
|
var opt = {
|
||||||
|
id:"red-ui-tabs-menu-option-"+id,
|
||||||
|
icon: tabs[id].iconClass || defaultTabIcon,
|
||||||
|
label: tabs[id].name,
|
||||||
|
onselect: function() {
|
||||||
|
activateTab(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (tabs[id].pinned) {
|
||||||
|
pinnedOptions.push(opt);
|
||||||
|
} else {
|
||||||
|
options.push(opt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
options = pinnedOptions.concat(options);
|
||||||
|
collapsibleMenu = RED.menu.init({id:"debug-message-option-menu",options: options});
|
||||||
|
collapsibleMenu.css({
|
||||||
|
position: "absolute"
|
||||||
|
})
|
||||||
|
collapsibleMenu.on('mouseleave', function(){ $(this).hide() });
|
||||||
|
collapsibleMenu.on('mouseup', function() { $(this).hide() });
|
||||||
|
collapsibleMenu.appendTo("body");
|
||||||
|
}
|
||||||
|
var elementPos = selectButton.offset();
|
||||||
|
collapsibleMenu.css({
|
||||||
|
top: (elementPos.top+selectButton.height()-20)+"px",
|
||||||
|
left: (elementPos.left - collapsibleMenu.width() + selectButton.width())+"px"
|
||||||
|
})
|
||||||
|
collapsibleMenu.toggle();
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function scrollEventHandler(evt,dir) {
|
function scrollEventHandler(evt,dir) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if ($(this).hasClass('disabled')) {
|
if ($(this).hasClass('disabled')) {
|
||||||
@@ -73,6 +131,9 @@ RED.tabs = (function() {
|
|||||||
ul.children().addClass("red-ui-tab");
|
ul.children().addClass("red-ui-tab");
|
||||||
|
|
||||||
function onTabClick() {
|
function onTabClick() {
|
||||||
|
if (options.onclick) {
|
||||||
|
options.onclick(tabs[$(this).attr('href').slice(1)]);
|
||||||
|
}
|
||||||
activateTab($(this));
|
activateTab($(this));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -105,10 +166,16 @@ RED.tabs = (function() {
|
|||||||
if (typeof link === "string") {
|
if (typeof link === "string") {
|
||||||
link = ul.find("a[href='#"+link+"']");
|
link = ul.find("a[href='#"+link+"']");
|
||||||
}
|
}
|
||||||
|
if (link.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!link.parent().hasClass("active")) {
|
if (!link.parent().hasClass("active")) {
|
||||||
ul.children().removeClass("active");
|
ul.children().removeClass("active");
|
||||||
ul.children().css({"transition": "width 100ms"});
|
ul.children().css({"transition": "width 100ms"});
|
||||||
link.parent().addClass("active");
|
link.parent().addClass("active");
|
||||||
|
var parentId = link.parent().attr('id');
|
||||||
|
wrapper.find(".red-ui-tab-link-button").removeClass("active selected");
|
||||||
|
$("#"+parentId+"-link-button").addClass("active selected");
|
||||||
if (options.scrollable) {
|
if (options.scrollable) {
|
||||||
var pos = link.parent().position().left;
|
var pos = link.parent().position().left;
|
||||||
if (pos-21 < 0) {
|
if (pos-21 < 0) {
|
||||||
@@ -126,46 +193,90 @@ RED.tabs = (function() {
|
|||||||
},100);
|
},100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function activatePreviousTab() {
|
||||||
|
var previous = ul.find("li.active").prev();
|
||||||
|
if (previous.length > 0) {
|
||||||
|
activateTab(previous.find("a"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function activateNextTab() {
|
||||||
|
var next = ul.find("li.active").next();
|
||||||
|
if (next.length > 0) {
|
||||||
|
activateTab(next.find("a"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateTabWidths() {
|
function updateTabWidths() {
|
||||||
|
if (options.vertical) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var tabs = ul.find("li.red-ui-tab");
|
var tabs = ul.find("li.red-ui-tab");
|
||||||
var width = wrapper.width();
|
var width = wrapper.width();
|
||||||
var tabCount = tabs.size();
|
var tabCount = tabs.size();
|
||||||
var tabWidth = (width-12-(tabCount*6))/tabCount;
|
var tabWidth;
|
||||||
currentTabWidth = (100*tabWidth/width)+"%";
|
|
||||||
currentActiveTabWidth = currentTabWidth+"%";
|
if (options.collapsible) {
|
||||||
if (options.scrollable) {
|
tabWidth = width - collapsedButtonsRow.width()-10;
|
||||||
tabWidth = Math.max(tabWidth,140);
|
if (tabWidth < 198) {
|
||||||
currentTabWidth = tabWidth+"px";
|
var delta = 198 - tabWidth;
|
||||||
currentActiveTabWidth = 0;
|
var b = collapsedButtonsRow.find("a:last").prev();
|
||||||
var listWidth = Math.max(wrapper.width(),12+(tabWidth+6)*tabCount);
|
while (b.is(":not(:visible)")) {
|
||||||
ul.width(listWidth);
|
b = b.prev();
|
||||||
updateScroll();
|
}
|
||||||
} else if (options.hasOwnProperty("minimumActiveTabWidth")) {
|
if (!b.hasClass("red-ui-tab-link-button-pinned")) {
|
||||||
if (tabWidth < options.minimumActiveTabWidth) {
|
b.hide();
|
||||||
tabCount -= 1;
|
}
|
||||||
tabWidth = (width-12-options.minimumActiveTabWidth-(tabCount*6))/tabCount;
|
tabWidth = width - collapsedButtonsRow.width()-10;
|
||||||
currentTabWidth = (100*tabWidth/width)+"%";
|
|
||||||
currentActiveTabWidth = options.minimumActiveTabWidth+"px";
|
|
||||||
} else {
|
} else {
|
||||||
currentActiveTabWidth = 0;
|
var space = width - 198 - collapsedButtonsRow.width();
|
||||||
|
if (space > 40) {
|
||||||
|
collapsedButtonsRow.find("a:not(:visible):first").show();
|
||||||
|
tabWidth = width - collapsedButtonsRow.width()-10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
tabs.css({width:tabWidth});
|
||||||
tabs.css({width:currentTabWidth});
|
|
||||||
if (tabWidth < 50) {
|
|
||||||
ul.find(".red-ui-tab-close").hide();
|
|
||||||
ul.find(".red-ui-tab-icon").hide();
|
|
||||||
ul.find(".red-ui-tab-label").css({paddingLeft:Math.min(12,Math.max(0,tabWidth-38))+"px"})
|
|
||||||
} else {
|
} else {
|
||||||
ul.find(".red-ui-tab-close").show();
|
var tabWidth = (width-12-(tabCount*6))/tabCount;
|
||||||
ul.find(".red-ui-tab-icon").show();
|
currentTabWidth = (100*tabWidth/width)+"%";
|
||||||
ul.find(".red-ui-tab-label").css({paddingLeft:""})
|
currentActiveTabWidth = currentTabWidth+"%";
|
||||||
}
|
if (options.scrollable) {
|
||||||
if (currentActiveTabWidth !== 0) {
|
tabWidth = Math.max(tabWidth,140);
|
||||||
ul.find("li.red-ui-tab.active").css({"width":options.minimumActiveTabWidth});
|
currentTabWidth = tabWidth+"px";
|
||||||
ul.find("li.red-ui-tab.active .red-ui-tab-close").show();
|
currentActiveTabWidth = 0;
|
||||||
ul.find("li.red-ui-tab.active .red-ui-tab-icon").show();
|
var listWidth = Math.max(wrapper.width(),12+(tabWidth+6)*tabCount);
|
||||||
ul.find("li.red-ui-tab.active .red-ui-tab-label").css({paddingLeft:""})
|
ul.width(listWidth);
|
||||||
|
updateScroll();
|
||||||
|
} else if (options.hasOwnProperty("minimumActiveTabWidth")) {
|
||||||
|
if (tabWidth < options.minimumActiveTabWidth) {
|
||||||
|
tabCount -= 1;
|
||||||
|
tabWidth = (width-12-options.minimumActiveTabWidth-(tabCount*6))/tabCount;
|
||||||
|
currentTabWidth = (100*tabWidth/width)+"%";
|
||||||
|
currentActiveTabWidth = options.minimumActiveTabWidth+"px";
|
||||||
|
} else {
|
||||||
|
currentActiveTabWidth = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (options.collapsible) {
|
||||||
|
console.log(currentTabWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
tabs.css({width:currentTabWidth});
|
||||||
|
if (tabWidth < 50) {
|
||||||
|
ul.find(".red-ui-tab-close").hide();
|
||||||
|
ul.find(".red-ui-tab-icon").hide();
|
||||||
|
ul.find(".red-ui-tab-label").css({paddingLeft:Math.min(12,Math.max(0,tabWidth-38))+"px"})
|
||||||
|
} else {
|
||||||
|
ul.find(".red-ui-tab-close").show();
|
||||||
|
ul.find(".red-ui-tab-icon").show();
|
||||||
|
ul.find(".red-ui-tab-label").css({paddingLeft:""})
|
||||||
|
}
|
||||||
|
if (currentActiveTabWidth !== 0) {
|
||||||
|
ul.find("li.red-ui-tab.active").css({"width":options.minimumActiveTabWidth});
|
||||||
|
ul.find("li.red-ui-tab.active .red-ui-tab-close").show();
|
||||||
|
ul.find("li.red-ui-tab.active .red-ui-tab-icon").show();
|
||||||
|
ul.find("li.red-ui-tab.active .red-ui-tab-label").css({paddingLeft:""})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -186,25 +297,65 @@ RED.tabs = (function() {
|
|||||||
activateTab(tab.find("a"));
|
activateTab(tab.find("a"));
|
||||||
}
|
}
|
||||||
li.remove();
|
li.remove();
|
||||||
|
if (tabs[id].pinned) {
|
||||||
|
pinnedTabsCount--;
|
||||||
|
}
|
||||||
if (options.onremove) {
|
if (options.onremove) {
|
||||||
options.onremove(tabs[id]);
|
options.onremove(tabs[id]);
|
||||||
}
|
}
|
||||||
delete tabs[id];
|
delete tabs[id];
|
||||||
updateTabWidths();
|
updateTabWidths();
|
||||||
|
collapsibleMenu = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
addTab: function(tab) {
|
addTab: function(tab) {
|
||||||
tabs[tab.id] = tab;
|
tabs[tab.id] = tab;
|
||||||
var li = $("<li/>",{class:"red-ui-tab"}).appendTo(ul);
|
var li = $("<li/>",{class:"red-ui-tab"}).appendTo(ul);
|
||||||
|
li.attr('id',"red-ui-tab-"+(tab.id.replace(".","-")));
|
||||||
li.data("tabId",tab.id);
|
li.data("tabId",tab.id);
|
||||||
|
|
||||||
|
if (options.maximumTabWidth) {
|
||||||
|
li.css("maxWidth",options.maximumTabWidth+"px");
|
||||||
|
}
|
||||||
var link = $("<a/>",{href:"#"+tab.id, class:"red-ui-tab-label"}).appendTo(li);
|
var link = $("<a/>",{href:"#"+tab.id, class:"red-ui-tab-label"}).appendTo(li);
|
||||||
if (tab.icon) {
|
if (tab.icon) {
|
||||||
$('<img src="'+tab.icon+'" class="red-ui-tab-icon"/>').appendTo(link);
|
$('<img src="'+tab.icon+'" class="red-ui-tab-icon"/>').appendTo(link);
|
||||||
|
} else if (tab.iconClass) {
|
||||||
|
$('<i>',{class:"red-ui-tab-icon "+tab.iconClass}).appendTo(link);
|
||||||
}
|
}
|
||||||
var span = $('<span/>',{class:"bidiAware"}).text(tab.label).appendTo(link);
|
var span = $('<span/>',{class:"bidiAware"}).text(tab.label).appendTo(link);
|
||||||
span.attr('dir', RED.text.bidi.resolveBaseTextDir(tab.label));
|
span.attr('dir', RED.text.bidi.resolveBaseTextDir(tab.label));
|
||||||
|
if (options.collapsible) {
|
||||||
|
li.addClass("red-ui-tab-pinned");
|
||||||
|
var pinnedLink = $('<a href="#'+tab.id+'" class="red-ui-tab-link-button"></a>');
|
||||||
|
if (tab.pinned) {
|
||||||
|
if (pinnedTabsCount === 0) {
|
||||||
|
pinnedLink.prependTo(collapsedButtonsRow)
|
||||||
|
} else {
|
||||||
|
pinnedLink.insertAfter(collapsedButtonsRow.find("a.red-ui-tab-link-button-pinned:last"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pinnedLink.insertBefore(collapsedButtonsRow.find("a:last"));
|
||||||
|
}
|
||||||
|
|
||||||
|
pinnedLink.attr('id',li.attr('id')+"-link-button");
|
||||||
|
if (tab.iconClass) {
|
||||||
|
$('<i>',{class:tab.iconClass}).appendTo(pinnedLink);
|
||||||
|
} else {
|
||||||
|
$('<i>',{class:defaultTabIcon}).appendTo(pinnedLink);
|
||||||
|
}
|
||||||
|
pinnedLink.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
activateTab(tab.id);
|
||||||
|
});
|
||||||
|
if (tab.pinned) {
|
||||||
|
pinnedLink.addClass("red-ui-tab-link-button-pinned");
|
||||||
|
pinnedTabsCount++;
|
||||||
|
}
|
||||||
|
RED.popover.tooltip($(pinnedLink), tab.name);
|
||||||
|
|
||||||
|
}
|
||||||
link.on("click",onTabClick);
|
link.on("click",onTabClick);
|
||||||
link.on("dblclick",onTabDblClick);
|
link.on("dblclick",onTabDblClick);
|
||||||
if (tab.closeable) {
|
if (tab.closeable) {
|
||||||
@@ -212,10 +363,10 @@ RED.tabs = (function() {
|
|||||||
closeLink.append('<i class="fa fa-times" />');
|
closeLink.append('<i class="fa fa-times" />');
|
||||||
|
|
||||||
closeLink.on("click",function(event) {
|
closeLink.on("click",function(event) {
|
||||||
|
event.preventDefault();
|
||||||
removeTab(tab.id);
|
removeTab(tab.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
updateTabWidths();
|
|
||||||
if (options.onadd) {
|
if (options.onadd) {
|
||||||
options.onadd(tab);
|
options.onadd(tab);
|
||||||
}
|
}
|
||||||
@@ -300,9 +451,15 @@ RED.tabs = (function() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
updateTabWidths();
|
||||||
|
},10);
|
||||||
|
collapsibleMenu = null;
|
||||||
},
|
},
|
||||||
removeTab: removeTab,
|
removeTab: removeTab,
|
||||||
activateTab: activateTab,
|
activateTab: activateTab,
|
||||||
|
nextTab: activateNextTab,
|
||||||
|
previousTab: activatePreviousTab,
|
||||||
resize: updateTabWidths,
|
resize: updateTabWidths,
|
||||||
count: function() {
|
count: function() {
|
||||||
return ul.find("li.red-ui-tab").size();
|
return ul.find("li.red-ui-tab").size();
|
||||||
@@ -314,7 +471,7 @@ RED.tabs = (function() {
|
|||||||
tabs[id].label = label;
|
tabs[id].label = label;
|
||||||
var tab = ul.find("a[href='#"+id+"']");
|
var tab = ul.find("a[href='#"+id+"']");
|
||||||
tab.attr("title",label);
|
tab.attr("title",label);
|
||||||
tab.find("span").text(label).attr('dir', RED.text.bidi.resolveBaseTextDir(label));
|
tab.find("span.bidiAware").text(label).attr('dir', RED.text.bidi.resolveBaseTextDir(label));
|
||||||
updateTabWidths();
|
updateTabWidths();
|
||||||
},
|
},
|
||||||
order: function(order) {
|
order: function(order) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,111 +14,141 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
(function($) {
|
(function($) {
|
||||||
function validateExpression(str) {
|
var contextParse = function(v) {
|
||||||
var length = str.length;
|
var parts = RED.utils.parseContextKey(v);
|
||||||
var start = 0;
|
return {
|
||||||
var inString = false;
|
option: parts.store,
|
||||||
var inBox = false;
|
value: parts.key
|
||||||
var quoteChar;
|
|
||||||
var v;
|
|
||||||
for (var i=0;i<length;i++) {
|
|
||||||
var c = str[i];
|
|
||||||
if (!inString) {
|
|
||||||
if (c === "'" || c === '"') {
|
|
||||||
if (!inBox) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
inString = true;
|
|
||||||
quoteChar = c;
|
|
||||||
start = i+1;
|
|
||||||
} else if (c === '.') {
|
|
||||||
if (i===0 || i===length-1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Next char is a-z
|
|
||||||
if (!/[a-z0-9\$\_]/i.test(str[i+1])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
start = i+1;
|
|
||||||
} else if (c === '[') {
|
|
||||||
if (i === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (i===length-1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Next char is either a quote or a number
|
|
||||||
if (!/["'\d]/.test(str[i+1])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
start = i+1;
|
|
||||||
inBox = true;
|
|
||||||
} else if (c === ']') {
|
|
||||||
if (!inBox) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (start != i) {
|
|
||||||
v = str.substring(start,i);
|
|
||||||
if (!/^\d+$/.test(v)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
start = i+1;
|
|
||||||
inBox = false;
|
|
||||||
} else if (c === ' ') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (c === quoteChar) {
|
|
||||||
// Next char must be a ]
|
|
||||||
if (!/\]/.test(str[i+1])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
start = i+1;
|
|
||||||
inString = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (inBox || inString) {
|
}
|
||||||
return false;
|
var contextExport = function(v,opt) {
|
||||||
|
if (!opt) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
var store = ((typeof opt === "string")?opt:opt.value)
|
||||||
|
if (store !== RED.settings.context.default) {
|
||||||
|
return "#:("+store+")::"+v;
|
||||||
|
} else {
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
var allOptions = {
|
var allOptions = {
|
||||||
msg: {value:"msg",label:"msg.",validate:validateExpression},
|
msg: {value:"msg",label:"msg.",validate:RED.utils.validatePropertyExpression},
|
||||||
flow: {value:"flow",label:"flow.",validate:validateExpression},
|
flow: {value:"flow",label:"flow.",hasValue:true,
|
||||||
global: {value:"global",label:"global.",validate:validateExpression},
|
options:[],
|
||||||
|
validate:RED.utils.validatePropertyExpression,
|
||||||
|
parse: contextParse,
|
||||||
|
export: contextExport
|
||||||
|
},
|
||||||
|
global: {value:"global",label:"global.",hasValue:true,
|
||||||
|
options:[],
|
||||||
|
validate:RED.utils.validatePropertyExpression,
|
||||||
|
parse: contextParse,
|
||||||
|
export: contextExport
|
||||||
|
},
|
||||||
str: {value:"str",label:"string",icon:"red/images/typedInput/az.png"},
|
str: {value:"str",label:"string",icon:"red/images/typedInput/az.png"},
|
||||||
num: {value:"num",label:"number",icon:"red/images/typedInput/09.png",validate:/^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/},
|
num: {value:"num",label:"number",icon:"red/images/typedInput/09.png",validate:/^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/},
|
||||||
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.png",options:["true","false"]},
|
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.png",options:["true","false"]},
|
||||||
json: {value:"json",label:"JSON",icon:"red/images/typedInput/json.png", validate: function(v) { try{JSON.parse(v);return true;}catch(e){return false;}}},
|
json: {
|
||||||
|
value:"json",
|
||||||
|
label:"JSON",
|
||||||
|
icon:"red/images/typedInput/json.png",
|
||||||
|
validate: function(v) { try{JSON.parse(v);return true;}catch(e){return false;}},
|
||||||
|
expand: function() {
|
||||||
|
var that = this;
|
||||||
|
var value = this.value();
|
||||||
|
try {
|
||||||
|
value = JSON.stringify(JSON.parse(value),null,4);
|
||||||
|
} catch(err) {
|
||||||
|
}
|
||||||
|
RED.editor.editJSON({
|
||||||
|
value: value,
|
||||||
|
complete: function(v) {
|
||||||
|
var value = v;
|
||||||
|
try {
|
||||||
|
value = JSON.stringify(JSON.parse(v));
|
||||||
|
} catch(err) {
|
||||||
|
}
|
||||||
|
that.value(value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.png"},
|
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.png"},
|
||||||
date: {value:"date",label:"timestamp",hasValue:false}
|
date: {value:"date",label:"timestamp",hasValue:false},
|
||||||
|
jsonata: {
|
||||||
|
value: "jsonata",
|
||||||
|
label: "expression",
|
||||||
|
icon: "red/images/typedInput/expr.png",
|
||||||
|
validate: function(v) { try{jsonata(v);return true;}catch(e){return false;}},
|
||||||
|
expand:function() {
|
||||||
|
var that = this;
|
||||||
|
RED.editor.editExpression({
|
||||||
|
value: this.value().replace(/\t/g,"\n"),
|
||||||
|
complete: function(v) {
|
||||||
|
that.value(v.replace(/\n/g,"\t"));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bin: {
|
||||||
|
value: "bin",
|
||||||
|
label: "buffer",
|
||||||
|
icon: "red/images/typedInput/bin.png",
|
||||||
|
expand: function() {
|
||||||
|
var that = this;
|
||||||
|
RED.editor.editBuffer({
|
||||||
|
value: this.value(),
|
||||||
|
complete: function(v) {
|
||||||
|
that.value(v);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
value: "env",
|
||||||
|
label: "env variable",
|
||||||
|
icon: "red/images/typedInput/env.png"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var nlsd = false;
|
var nlsd = false;
|
||||||
|
|
||||||
$.widget( "nodered.typedInput", {
|
$.widget( "nodered.typedInput", {
|
||||||
_create: function() {
|
_create: function() {
|
||||||
|
try {
|
||||||
if (!nlsd && RED && RED._) {
|
if (!nlsd && RED && RED._) {
|
||||||
for (var i in allOptions) {
|
for (var i in allOptions) {
|
||||||
if (allOptions.hasOwnProperty(i)) {
|
if (allOptions.hasOwnProperty(i)) {
|
||||||
allOptions[i].label = RED._("typedInput.type."+i,{defaultValue:allOptions[i].label});
|
allOptions[i].label = RED._("typedInput.type."+i,{defaultValue:allOptions[i].label});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var contextStores = RED.settings.context.stores;
|
||||||
|
var contextOptions = contextStores.map(function(store) {
|
||||||
|
return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database" style="color: #'+(store==='memory'?'ddd':'777')+'"></i>'}
|
||||||
|
})
|
||||||
|
if (contextOptions.length < 2) {
|
||||||
|
allOptions.flow.options = [];
|
||||||
|
allOptions.global.options = [];
|
||||||
|
} else {
|
||||||
|
allOptions.flow.options = contextOptions;
|
||||||
|
allOptions.global.options = contextOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nlsd = true;
|
nlsd = true;
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
this.disarmClick = false;
|
this.disarmClick = false;
|
||||||
|
this.input = $('<input type="text"></input>');
|
||||||
|
this.input.insertAfter(this.element);
|
||||||
|
this.input.val(this.element.val());
|
||||||
this.element.addClass('red-ui-typedInput');
|
this.element.addClass('red-ui-typedInput');
|
||||||
this.uiWidth = this.element.outerWidth();
|
this.uiWidth = this.element.outerWidth();
|
||||||
this.elementDiv = this.element.wrap("<div>").parent().addClass('red-ui-typedInput-input');
|
this.elementDiv = this.input.wrap("<div>").parent().addClass('red-ui-typedInput-input');
|
||||||
this.uiSelect = this.elementDiv.wrap( "<div>" ).parent();
|
this.uiSelect = this.elementDiv.wrap( "<div>" ).parent();
|
||||||
var attrStyle = this.element.attr('style');
|
var attrStyle = this.element.attr('style');
|
||||||
var m;
|
var m;
|
||||||
if ((m = /width\s*:\s*(\d+%)/i.exec(attrStyle)) !== null) {
|
if ((m = /width\s*:\s*(calc\s*\(.*\)|\d+(%|px))/i.exec(attrStyle)) !== null) {
|
||||||
this.element.css('width','100%');
|
this.input.css('width','100%');
|
||||||
this.uiSelect.width(m[1]);
|
this.uiSelect.width(m[1]);
|
||||||
this.uiWidth = null;
|
this.uiWidth = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -127,15 +157,19 @@
|
|||||||
["Right","Left"].forEach(function(d) {
|
["Right","Left"].forEach(function(d) {
|
||||||
var m = that.element.css("margin"+d);
|
var m = that.element.css("margin"+d);
|
||||||
that.uiSelect.css("margin"+d,m);
|
that.uiSelect.css("margin"+d,m);
|
||||||
that.element.css("margin"+d,0);
|
that.input.css("margin"+d,0);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.uiSelect.addClass("red-ui-typedInput-container");
|
this.uiSelect.addClass("red-ui-typedInput-container");
|
||||||
|
|
||||||
|
this.element.attr('type','hidden');
|
||||||
|
|
||||||
this.options.types = this.options.types||Object.keys(allOptions);
|
this.options.types = this.options.types||Object.keys(allOptions);
|
||||||
|
|
||||||
this.selectTrigger = $('<a href="#"></a>').prependTo(this.uiSelect);
|
this.selectTrigger = $('<button tabindex="0"></button>').prependTo(this.uiSelect);
|
||||||
$('<i class="fa fa-sort-desc"></i>').appendTo(this.selectTrigger);
|
$('<i class="red-ui-typedInput-icon fa fa-sort-desc"></i>').toggle(this.options.types.length > 1).appendTo(this.selectTrigger);
|
||||||
this.selectLabel = $('<span></span>').appendTo(this.selectTrigger);
|
|
||||||
|
this.selectLabel = $('<span class="red-ui-typedInput-type-label"></span>').appendTo(this.selectTrigger);
|
||||||
|
|
||||||
this.types(this.options.types);
|
this.types(this.options.types);
|
||||||
|
|
||||||
@@ -149,43 +183,89 @@
|
|||||||
this.typeField = $("<input>",{type:'hidden'}).appendTo(this.uiSelect);
|
this.typeField = $("<input>",{type:'hidden'}).appendTo(this.uiSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.element.on('focus', function() {
|
this.input.on('focus', function() {
|
||||||
that.uiSelect.addClass('red-ui-typedInput-focus');
|
that.uiSelect.addClass('red-ui-typedInput-focus');
|
||||||
});
|
});
|
||||||
this.element.on('blur', function() {
|
this.input.on('blur', function() {
|
||||||
that.uiSelect.removeClass('red-ui-typedInput-focus');
|
that.uiSelect.removeClass('red-ui-typedInput-focus');
|
||||||
});
|
});
|
||||||
this.element.on('change', function() {
|
this.input.on('change', function() {
|
||||||
that.validate();
|
that.validate();
|
||||||
|
that.element.val(that.value());
|
||||||
|
that.element.trigger('change',that.propertyType,that.value());
|
||||||
})
|
})
|
||||||
this.selectTrigger.click(function(event) {
|
this.selectTrigger.click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (that.typeList.length > 1) {
|
that._showTypeMenu();
|
||||||
that._showMenu(that.menu,that.selectTrigger);
|
|
||||||
} else {
|
|
||||||
that.element.focus();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
this.selectTrigger.on('keydown',function(evt) {
|
||||||
|
if (evt.keyCode === 40) {
|
||||||
|
// Down
|
||||||
|
that._showTypeMenu();
|
||||||
|
}
|
||||||
|
}).on('focus', function() {
|
||||||
|
that.uiSelect.addClass('red-ui-typedInput-focus');
|
||||||
|
})
|
||||||
|
|
||||||
// explicitly set optionSelectTrigger display to inline-block otherwise jQ sets it to 'inline'
|
// explicitly set optionSelectTrigger display to inline-block otherwise jQ sets it to 'inline'
|
||||||
this.optionSelectTrigger = $('<a href="#" class="red-ui-typedInput-option-trigger" style="display:inline-block"><i class="fa fa-sort-desc"></i></a>').appendTo(this.uiSelect);
|
this.optionSelectTrigger = $('<button tabindex="0" class="red-ui-typedInput-option-trigger" style="display:inline-block"><span class="red-ui-typedInput-option-caret"><i class="red-ui-typedInput-icon fa fa-sort-desc"></i></span></button>').appendTo(this.uiSelect);
|
||||||
this.optionSelectLabel = $('<span></span>').prependTo(this.optionSelectTrigger);
|
this.optionSelectLabel = $('<span class="red-ui-typedInput-option-label"></span>').prependTo(this.optionSelectTrigger);
|
||||||
|
RED.popover.tooltip(this.optionSelectLabel,function() {
|
||||||
|
return that.optionValue;
|
||||||
|
});
|
||||||
this.optionSelectTrigger.click(function(event) {
|
this.optionSelectTrigger.click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (that.optionMenu) {
|
that._showOptionSelectMenu();
|
||||||
that.optionMenu.css({
|
}).on('keydown', function(evt) {
|
||||||
minWidth:that.optionSelectLabel.width()
|
if (evt.keyCode === 40) {
|
||||||
});
|
// Down
|
||||||
|
that._showOptionSelectMenu();
|
||||||
that._showMenu(that.optionMenu,that.optionSelectLabel)
|
|
||||||
}
|
}
|
||||||
|
}).on('blur', function() {
|
||||||
|
that.uiSelect.removeClass('red-ui-typedInput-focus');
|
||||||
|
}).on('focus', function() {
|
||||||
|
that.uiSelect.addClass('red-ui-typedInput-focus');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"><i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i></button>').appendTo(this.uiSelect);
|
||||||
this.type(this.options.default||this.typeList[0].value);
|
this.type(this.options.default||this.typeList[0].value);
|
||||||
|
}catch(err) {
|
||||||
|
console.log(err.stack);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_showTypeMenu: function() {
|
||||||
|
if (this.typeList.length > 1) {
|
||||||
|
this._showMenu(this.menu,this.selectTrigger);
|
||||||
|
this.menu.find("[value='"+this.propertyType+"']").focus();
|
||||||
|
} else {
|
||||||
|
this.input.focus();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_showOptionSelectMenu: function() {
|
||||||
|
if (this.optionMenu) {
|
||||||
|
this.optionMenu.css({
|
||||||
|
minWidth:this.optionSelectLabel.width()
|
||||||
|
});
|
||||||
|
|
||||||
|
this._showMenu(this.optionMenu,this.optionSelectTrigger);
|
||||||
|
var selectedOption = this.optionMenu.find("[value='"+this.optionValue+"']");
|
||||||
|
if (selectedOption.length === 0) {
|
||||||
|
selectedOption = this.optionMenu.children(":first");
|
||||||
|
}
|
||||||
|
selectedOption.focus();
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_hideMenu: function(menu) {
|
_hideMenu: function(menu) {
|
||||||
$(document).off("mousedown.close-property-select");
|
$(document).off("mousedown.close-property-select");
|
||||||
menu.hide();
|
menu.hide();
|
||||||
this.element.focus();
|
if (this.elementDiv.is(":visible")) {
|
||||||
|
this.input.focus();
|
||||||
|
} else if (this.optionSelectTrigger.is(":visible")){
|
||||||
|
this.optionSelectTrigger.focus();
|
||||||
|
} else {
|
||||||
|
this.selectTrigger.focus();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_createMenu: function(opts,callback) {
|
_createMenu: function(opts,callback) {
|
||||||
var that = this;
|
var that = this;
|
||||||
@@ -194,15 +274,24 @@
|
|||||||
if (typeof opt === 'string') {
|
if (typeof opt === 'string') {
|
||||||
opt = {value:opt,label:opt};
|
opt = {value:opt,label:opt};
|
||||||
}
|
}
|
||||||
var op = $('<a href="#">').attr("value",opt.value).appendTo(menu);
|
var op = $('<a href="#"></a>').attr("value",opt.value).appendTo(menu);
|
||||||
if (opt.label) {
|
if (opt.label) {
|
||||||
op.text(opt.label);
|
op.text(opt.label);
|
||||||
}
|
}
|
||||||
if (opt.icon) {
|
if (opt.icon) {
|
||||||
$('<img>',{src:opt.icon,style:"margin-right: 4px; height: 18px;"}).prependTo(op);
|
if (opt.icon.indexOf("<") === 0) {
|
||||||
|
$(opt.icon).prependTo(op);
|
||||||
|
} else if (opt.icon.indexOf("/") !== -1) {
|
||||||
|
$('<img>',{src:opt.icon,style:"margin-right: 4px; height: 18px;"}).prependTo(op);
|
||||||
|
} else {
|
||||||
|
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(op);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
op.css({paddingLeft: "18px"});
|
op.css({paddingLeft: "18px"});
|
||||||
}
|
}
|
||||||
|
if (!opt.icon && !opt.label) {
|
||||||
|
op.text(opt.value);
|
||||||
|
}
|
||||||
|
|
||||||
op.click(function(event) {
|
op.click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -214,6 +303,21 @@
|
|||||||
display: "none",
|
display: "none",
|
||||||
});
|
});
|
||||||
menu.appendTo(document.body);
|
menu.appendTo(document.body);
|
||||||
|
|
||||||
|
menu.on('keydown', function(evt) {
|
||||||
|
if (evt.keyCode === 40) {
|
||||||
|
// DOWN
|
||||||
|
$(this).children(":focus").next().focus();
|
||||||
|
} else if (evt.keyCode === 38) {
|
||||||
|
// UP
|
||||||
|
$(this).children(":focus").prev().focus();
|
||||||
|
} else if (evt.keyCode === 27) {
|
||||||
|
that._hideMenu(menu);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -266,18 +370,79 @@
|
|||||||
if (this.uiWidth !== null) {
|
if (this.uiWidth !== null) {
|
||||||
this.uiSelect.width(this.uiWidth);
|
this.uiSelect.width(this.uiWidth);
|
||||||
}
|
}
|
||||||
if (this.typeMap[this.propertyType] && this.typeMap[this.propertyType].hasValue === false) {
|
var type = this.typeMap[this.propertyType];
|
||||||
this.selectTrigger.css('width',"100%");
|
if (type && type.hasValue === false) {
|
||||||
|
this.selectTrigger.addClass("red-ui-typedInput-full-width");
|
||||||
} else {
|
} else {
|
||||||
this.selectTrigger.width('auto');
|
this.selectTrigger.removeClass("red-ui-typedInput-full-width");
|
||||||
var labelWidth = this._getLabelWidth(this.selectTrigger);
|
var labelWidth = this._getLabelWidth(this.selectTrigger);
|
||||||
this.elementDiv.css('left',labelWidth+"px");
|
this.elementDiv.css('left',labelWidth+"px");
|
||||||
|
if (this.optionExpandButton.is(":visible")) {
|
||||||
|
this.elementDiv.css('right',"22px");
|
||||||
|
} else {
|
||||||
|
this.elementDiv.css('right','0');
|
||||||
|
this.input.css({
|
||||||
|
'border-top-right-radius': '4px',
|
||||||
|
'border-bottom-right-radius': '4px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (this.optionSelectTrigger) {
|
||||||
|
// this.optionSelectTrigger.css({'left':(labelWidth)+"px",'width':'calc( 100% - '+labelWidth+'px )'});
|
||||||
|
// }
|
||||||
|
|
||||||
if (this.optionSelectTrigger) {
|
if (this.optionSelectTrigger) {
|
||||||
this.optionSelectTrigger.css('left',(labelWidth+5)+"px");
|
if (type && type.options && type.hasValue === true) {
|
||||||
|
this.optionSelectLabel.css({'left':'auto'})
|
||||||
|
var lw = this._getLabelWidth(this.optionSelectLabel);
|
||||||
|
this.optionSelectTrigger.css({'width':(23+lw)+"px"});
|
||||||
|
this.elementDiv.css('right',(23+lw)+"px");
|
||||||
|
this.input.css({
|
||||||
|
'border-top-right-radius': 0,
|
||||||
|
'border-bottom-right-radius': 0
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.optionSelectLabel.css({'left':'0'})
|
||||||
|
this.optionSelectTrigger.css({'width':'calc( 100% - '+labelWidth+'px )'});
|
||||||
|
if (!this.optionExpandButton.is(":visible")) {
|
||||||
|
this.elementDiv.css({'right':0});
|
||||||
|
this.input.css({
|
||||||
|
'border-top-right-radius': '4px',
|
||||||
|
'border-bottom-right-radius': '4px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_updateOptionSelectLabel: function(o) {
|
||||||
|
var opt = this.typeMap[this.propertyType];
|
||||||
|
this.optionSelectLabel.empty();
|
||||||
|
if (o.icon) {
|
||||||
|
if (o.icon.indexOf("<") === 0) {
|
||||||
|
$(o.icon).prependTo(this.optionSelectLabel);
|
||||||
|
} else if (o.icon.indexOf("/") !== -1) {
|
||||||
|
// url
|
||||||
|
$('<img>',{src:o.icon,style:"height: 18px;"}).prependTo(this.optionSelectLabel);
|
||||||
|
} else {
|
||||||
|
// icon class
|
||||||
|
$('<i>',{class:"red-ui-typedInput-icon "+o.icon}).prependTo(this.optionSelectLabel);
|
||||||
|
}
|
||||||
|
} else if (o.label) {
|
||||||
|
this.optionSelectLabel.text(o.label);
|
||||||
|
} else {
|
||||||
|
this.optionSelectLabel.text(o.value);
|
||||||
|
}
|
||||||
|
if (opt.hasValue) {
|
||||||
|
this.optionValue = o.value;
|
||||||
|
this._resize();
|
||||||
|
this.input.trigger('change',this.propertyType,this.value());
|
||||||
|
}
|
||||||
|
},
|
||||||
_destroy: function() {
|
_destroy: function() {
|
||||||
|
if (this.optionMenu) {
|
||||||
|
this.optionMenu.remove();
|
||||||
|
}
|
||||||
this.menu.remove();
|
this.menu.remove();
|
||||||
},
|
},
|
||||||
types: function(types) {
|
types: function(types) {
|
||||||
@@ -295,13 +460,18 @@
|
|||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
this.selectTrigger.toggleClass("disabled", this.typeList.length === 1);
|
this.selectTrigger.toggleClass("disabled", this.typeList.length === 1);
|
||||||
|
this.selectTrigger.find(".fa-sort-desc").toggle(this.typeList.length > 1)
|
||||||
if (this.menu) {
|
if (this.menu) {
|
||||||
this.menu.remove();
|
this.menu.remove();
|
||||||
}
|
}
|
||||||
this.menu = this._createMenu(this.typeList, function(v) { that.type(v) });
|
this.menu = this._createMenu(this.typeList, function(v) { that.type(v) });
|
||||||
if (currentType && !this.typeMap.hasOwnProperty(currentType)) {
|
if (currentType && !this.typeMap.hasOwnProperty(currentType)) {
|
||||||
this.type(this.typeList[0].value);
|
this.type(this.typeList[0].value);
|
||||||
|
} else {
|
||||||
|
this.propertyType = null;
|
||||||
|
this.type(currentType);
|
||||||
}
|
}
|
||||||
|
setTimeout(function() {that._resize();},0);
|
||||||
},
|
},
|
||||||
width: function(desiredWidth) {
|
width: function(desiredWidth) {
|
||||||
this.uiWidth = desiredWidth;
|
this.uiWidth = desiredWidth;
|
||||||
@@ -309,16 +479,33 @@
|
|||||||
},
|
},
|
||||||
value: function(value) {
|
value: function(value) {
|
||||||
if (!arguments.length) {
|
if (!arguments.length) {
|
||||||
return this.element.val();
|
var v = this.input.val();
|
||||||
} else {
|
if (this.typeMap[this.propertyType].export) {
|
||||||
if (this.typeMap[this.propertyType].options) {
|
v = this.typeMap[this.propertyType].export(v,this.optionValue)
|
||||||
if (this.typeMap[this.propertyType].options.indexOf(value) === -1) {
|
|
||||||
value = "";
|
|
||||||
}
|
|
||||||
this.optionSelectLabel.text(value);
|
|
||||||
}
|
}
|
||||||
this.element.val(value);
|
return v;
|
||||||
this.element.trigger('change',this.type(),value);
|
} else {
|
||||||
|
var selectedOption;
|
||||||
|
if (this.typeMap[this.propertyType].options) {
|
||||||
|
for (var i=0;i<this.typeMap[this.propertyType].options.length;i++) {
|
||||||
|
var op = this.typeMap[this.propertyType].options[i];
|
||||||
|
if (typeof op === "string") {
|
||||||
|
if (op === value) {
|
||||||
|
selectedOption = this.activeOptions[op];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (op.value === value) {
|
||||||
|
selectedOption = op;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!selectedOption) {
|
||||||
|
selectedOption = {value:""}
|
||||||
|
}
|
||||||
|
this._updateOptionSelectLabel(selectedOption)
|
||||||
|
}
|
||||||
|
this.input.val(value);
|
||||||
|
this.input.trigger('change',this.type(),value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
type: function(type) {
|
type: function(type) {
|
||||||
@@ -329,52 +516,148 @@
|
|||||||
var opt = this.typeMap[type];
|
var opt = this.typeMap[type];
|
||||||
if (opt && this.propertyType !== type) {
|
if (opt && this.propertyType !== type) {
|
||||||
this.propertyType = type;
|
this.propertyType = type;
|
||||||
this.typeField.val(type);
|
if (this.typeField) {
|
||||||
|
this.typeField.val(type);
|
||||||
|
}
|
||||||
this.selectLabel.empty();
|
this.selectLabel.empty();
|
||||||
var image;
|
var image;
|
||||||
if (opt.icon) {
|
if (opt.icon) {
|
||||||
image = new Image();
|
if (opt.icon.indexOf("<") === 0) {
|
||||||
image.name = opt.icon;
|
$(opt.icon).prependTo(this.selectLabel);
|
||||||
image.src = opt.icon;
|
}
|
||||||
$('<img>',{src:opt.icon,style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
|
else if (opt.icon.indexOf("/") !== -1) {
|
||||||
|
image = new Image();
|
||||||
|
image.name = opt.icon;
|
||||||
|
image.src = opt.icon;
|
||||||
|
$('<img>',{src:opt.icon,style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(this.selectLabel);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.selectLabel.text(opt.label);
|
this.selectLabel.text(opt.label);
|
||||||
}
|
}
|
||||||
|
if (this.optionMenu) {
|
||||||
|
this.optionMenu.remove();
|
||||||
|
this.optionMenu = null;
|
||||||
|
}
|
||||||
if (opt.options) {
|
if (opt.options) {
|
||||||
|
if (this.optionExpandButton) {
|
||||||
|
this.optionExpandButton.hide();
|
||||||
|
}
|
||||||
if (this.optionSelectTrigger) {
|
if (this.optionSelectTrigger) {
|
||||||
this.optionSelectTrigger.show();
|
this.optionSelectTrigger.show();
|
||||||
this.elementDiv.hide();
|
if (!opt.hasValue) {
|
||||||
this.optionMenu = this._createMenu(opt.options,function(v){
|
this.elementDiv.hide();
|
||||||
that.optionSelectLabel.text(v);
|
|
||||||
that.value(v);
|
|
||||||
});
|
|
||||||
var currentVal = this.element.val();
|
|
||||||
if (opt.options.indexOf(currentVal) !== -1) {
|
|
||||||
this.optionSelectLabel.text(currentVal);
|
|
||||||
} else {
|
} else {
|
||||||
this.value(opt.options[0]);
|
this.elementDiv.show();
|
||||||
|
}
|
||||||
|
this.activeOptions = {};
|
||||||
|
opt.options.forEach(function(o) {
|
||||||
|
if (typeof o === 'string') {
|
||||||
|
that.activeOptions[o] = {label:o,value:o};
|
||||||
|
} else {
|
||||||
|
that.activeOptions[o.value] = o;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!that.activeOptions.hasOwnProperty(that.optionValue)) {
|
||||||
|
that.optionValue = null;
|
||||||
|
}
|
||||||
|
this.optionMenu = this._createMenu(opt.options,function(v){
|
||||||
|
that._updateOptionSelectLabel(that.activeOptions[v]);
|
||||||
|
if (!opt.hasValue) {
|
||||||
|
that.value(that.activeOptions[v].value)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var op;
|
||||||
|
if (!opt.hasValue) {
|
||||||
|
var currentVal = this.input.val();
|
||||||
|
var validValue = false;
|
||||||
|
for (var i=0;i<opt.options.length;i++) {
|
||||||
|
op = opt.options[i];
|
||||||
|
if (typeof op === "string" && op === currentVal) {
|
||||||
|
that._updateOptionSelectLabel({value:currentVal});
|
||||||
|
validValue = true;
|
||||||
|
break;
|
||||||
|
} else if (op.value === currentVal) {
|
||||||
|
that._updateOptionSelectLabel(op);
|
||||||
|
validValue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!validValue) {
|
||||||
|
op = opt.options[0];
|
||||||
|
if (typeof op === "string") {
|
||||||
|
this.value(op);
|
||||||
|
that._updateOptionSelectLabel({value:op});
|
||||||
|
} else {
|
||||||
|
this.value(op.value);
|
||||||
|
that._updateOptionSelectLabel(op);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var selectedOption = this.optionValue||opt.options[0];
|
||||||
|
if (opt.parse) {
|
||||||
|
var parts = opt.parse(this.input.val());
|
||||||
|
if (parts.option) {
|
||||||
|
selectedOption = parts.option;
|
||||||
|
if (!this.activeOptions.hasOwnProperty(selectedOption)) {
|
||||||
|
parts.option = Object.keys(this.activeOptions)[0];
|
||||||
|
selectedOption = parts.option
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.input.val(parts.value);
|
||||||
|
if (opt.export) {
|
||||||
|
this.element.val(opt.export(parts.value,parts.option||selectedOption));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof selectedOption === "string") {
|
||||||
|
this.optionValue = selectedOption;
|
||||||
|
if (!this.activeOptions.hasOwnProperty(selectedOption)) {
|
||||||
|
selectedOption = Object.keys(this.activeOptions)[0];
|
||||||
|
}
|
||||||
|
if (!selectedOption) {
|
||||||
|
this.optionSelectTrigger.hide();
|
||||||
|
} else {
|
||||||
|
this._updateOptionSelectLabel(this.activeOptions[selectedOption]);
|
||||||
|
}
|
||||||
|
} else if (selectedOption) {
|
||||||
|
this.optionValue = selectedOption.value;
|
||||||
|
this._updateOptionSelectLabel(selectedOption);
|
||||||
|
} else {
|
||||||
|
this.optionSelectTrigger.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.optionMenu) {
|
|
||||||
this.optionMenu.remove();
|
|
||||||
this.optionMenu = null;
|
|
||||||
}
|
|
||||||
if (this.optionSelectTrigger) {
|
if (this.optionSelectTrigger) {
|
||||||
this.optionSelectTrigger.hide();
|
this.optionSelectTrigger.hide();
|
||||||
}
|
}
|
||||||
if (opt.hasValue === false) {
|
if (opt.hasValue === false) {
|
||||||
this.oldValue = this.element.val();
|
this.oldValue = this.input.val();
|
||||||
this.element.val("");
|
this.input.val("");
|
||||||
this.elementDiv.hide();
|
this.elementDiv.hide();
|
||||||
} else {
|
} else {
|
||||||
if (this.oldValue !== undefined) {
|
if (this.oldValue !== undefined) {
|
||||||
this.element.val(this.oldValue);
|
this.input.val(this.oldValue);
|
||||||
delete this.oldValue;
|
delete this.oldValue;
|
||||||
}
|
}
|
||||||
this.elementDiv.show();
|
this.elementDiv.show();
|
||||||
}
|
}
|
||||||
this.element.trigger('change',this.propertyType,this.value());
|
if (this.optionExpandButton) {
|
||||||
|
if (opt.expand && typeof opt.expand === 'function') {
|
||||||
|
this.optionExpandButton.show();
|
||||||
|
this.optionExpandButton.off('click');
|
||||||
|
this.optionExpandButton.on('click',function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
opt.expand.call(that);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.optionExpandButton.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.input.trigger('change',this.propertyType,this.value());
|
||||||
}
|
}
|
||||||
if (image) {
|
if (image) {
|
||||||
image.onload = function() { that._resize(); }
|
image.onload = function() { that._resize(); }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,13 +30,15 @@ RED.deploy = (function() {
|
|||||||
|
|
||||||
var deploymentType = "full";
|
var deploymentType = "full";
|
||||||
|
|
||||||
|
var deployInflight = false;
|
||||||
|
|
||||||
|
var currentDiff = null;
|
||||||
|
|
||||||
function changeDeploymentType(type) {
|
function changeDeploymentType(type) {
|
||||||
deploymentType = type;
|
deploymentType = type;
|
||||||
$("#btn-deploy-icon").attr("src",deploymentTypes[type].img);
|
$("#btn-deploy-icon").attr("src",deploymentTypes[type].img);
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentDiff = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* options:
|
* options:
|
||||||
* type: "default" - Button with drop-down options - no further customisation available
|
* type: "default" - Button with drop-down options - no further customisation available
|
||||||
@@ -88,63 +90,14 @@ RED.deploy = (function() {
|
|||||||
'</span></li>').prependTo(".header-toolbar");
|
'</span></li>').prependTo(".header-toolbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#btn-deploy').click(function() { save(); });
|
$('#btn-deploy').click(function(event) {
|
||||||
|
event.preventDefault();
|
||||||
$( "#node-dialog-confirm-deploy" ).dialog({
|
save();
|
||||||
title: RED._('deploy.confirm.button.confirm'),
|
|
||||||
modal: true,
|
|
||||||
autoOpen: false,
|
|
||||||
width: 550,
|
|
||||||
height: "auto",
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: RED._("deploy.confirm.button.cancel"),
|
|
||||||
click: function() {
|
|
||||||
$( this ).dialog( "close" );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// id: "node-dialog-confirm-deploy-review",
|
|
||||||
// text: RED._("deploy.confirm.button.review"),
|
|
||||||
// class: "primary",
|
|
||||||
// click: function() {
|
|
||||||
// showDiff();
|
|
||||||
// $( this ).dialog( "close" );
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
text: RED._("deploy.confirm.button.confirm"),
|
|
||||||
class: "primary",
|
|
||||||
click: function() {
|
|
||||||
|
|
||||||
var ignoreChecked = $( "#node-dialog-confirm-deploy-hide" ).prop("checked");
|
|
||||||
if (ignoreChecked) {
|
|
||||||
ignoreDeployWarnings[$( "#node-dialog-confirm-deploy-type" ).val()] = true;
|
|
||||||
}
|
|
||||||
save(true,$( "#node-dialog-confirm-deploy-type" ).val() === "conflict");
|
|
||||||
$( this ).dialog( "close" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
create: function() {
|
|
||||||
$("#node-dialog-confirm-deploy").parent().find("div.ui-dialog-buttonpane")
|
|
||||||
.prepend('<div style="height:0; vertical-align: middle; display:inline-block; margin-top: 13px; float:left;">'+
|
|
||||||
'<input style="vertical-align:top;" type="checkbox" id="node-dialog-confirm-deploy-hide">'+
|
|
||||||
'<label style="display:inline;" for="node-dialog-confirm-deploy-hide"> do not warn about this again</label>'+
|
|
||||||
'<input type="hidden" id="node-dialog-confirm-deploy-type">'+
|
|
||||||
'</div>');
|
|
||||||
},
|
|
||||||
open: function() {
|
|
||||||
if ($( "#node-dialog-confirm-deploy-type" ).val() === "conflict") {
|
|
||||||
// $("#node-dialog-confirm-deploy-review").show();
|
|
||||||
$("#node-dialog-confirm-deploy-hide").parent().hide();
|
|
||||||
} else {
|
|
||||||
// $("#node-dialog-confirm-deploy-review").hide();
|
|
||||||
$("#node-dialog-confirm-deploy-hide").parent().show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RED.actions.add("core:deploy-flows",save);
|
||||||
|
|
||||||
|
|
||||||
RED.events.on('nodes:change',function(state) {
|
RED.events.on('nodes:change',function(state) {
|
||||||
if (state.dirty) {
|
if (state.dirty) {
|
||||||
window.onbeforeunload = function() {
|
window.onbeforeunload = function() {
|
||||||
@@ -157,198 +110,39 @@ RED.deploy = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// $("#node-dialog-view-diff").dialog({
|
var activeNotifyMessage;
|
||||||
// title: RED._('deploy.confirm.button.review'),
|
RED.comms.subscribe("notification/runtime-deploy",function(topic,msg) {
|
||||||
// modal: true,
|
if (!activeNotifyMessage) {
|
||||||
// autoOpen: false,
|
var currentRev = RED.nodes.version();
|
||||||
// buttons: [
|
if (currentRev === null || deployInflight || currentRev === msg.revision) {
|
||||||
// {
|
return;
|
||||||
// text: RED._("deploy.confirm.button.cancel"),
|
}
|
||||||
// click: function() {
|
var message = $('<p>').text(RED._('deploy.confirm.backgroundUpdate'));
|
||||||
// $( this ).dialog( "close" );
|
activeNotifyMessage = RED.notify(message,{
|
||||||
// }
|
modal: true,
|
||||||
// },
|
fixed: true,
|
||||||
// {
|
buttons: [
|
||||||
// text: RED._("deploy.confirm.button.merge"),
|
{
|
||||||
// class: "primary",
|
text: RED._('deploy.confirm.button.ignore'),
|
||||||
// click: function() {
|
click: function() {
|
||||||
// $( this ).dialog( "close" );
|
activeNotifyMessage.close();
|
||||||
// }
|
activeNotifyMessage = null;
|
||||||
// }
|
}
|
||||||
// ],
|
},
|
||||||
// open: function() {
|
{
|
||||||
// $(this).dialog({width:Math.min($(window).width(),900),height:Math.min($(window).height(),600)});
|
text: RED._('deploy.confirm.button.review'),
|
||||||
// }
|
class: "primary",
|
||||||
// });
|
click: function() {
|
||||||
|
activeNotifyMessage.close();
|
||||||
// $("#node-dialog-view-diff-diff").editableList({
|
var nns = RED.nodes.createCompleteNodeSet();
|
||||||
// addButton: false,
|
resolveConflict(nns,false);
|
||||||
// scrollOnAdd: false,
|
activeNotifyMessage = null;
|
||||||
// addItem: function(container,i,object) {
|
}
|
||||||
// var tab = object.tab.n;
|
}
|
||||||
// var tabDiv = $('<div>',{class:"node-diff-tab collapsed"}).appendTo(container);
|
]
|
||||||
//
|
});
|
||||||
// var titleRow = $('<div>',{class:"node-diff-tab-title"}).appendTo(tabDiv);
|
}
|
||||||
// titleRow.click(function(evt) {
|
});
|
||||||
// evt.preventDefault();
|
|
||||||
// titleRow.parent().toggleClass('collapsed');
|
|
||||||
// })
|
|
||||||
// var chevron = $('<i class="fa fa-angle-down node-diff-chevron ">').appendTo(titleRow);
|
|
||||||
// var title = $('<span>').html(tab.label||tab.id).appendTo(titleRow);
|
|
||||||
//
|
|
||||||
// var stats = $('<span>',{class:"node-diff-tab-stats"}).appendTo(titleRow);
|
|
||||||
//
|
|
||||||
// var addedCount = 0;
|
|
||||||
// var deletedCount = 0;
|
|
||||||
// var changedCount = 0;
|
|
||||||
// var conflictedCount = 0;
|
|
||||||
//
|
|
||||||
// object.tab.nodes.forEach(function(node) {
|
|
||||||
// var realNode = RED.nodes.node(node.id);
|
|
||||||
// var hasChanges = false;
|
|
||||||
// if (currentDiff.added[node.id]) {
|
|
||||||
// addedCount++;
|
|
||||||
// hasChanges = true;
|
|
||||||
// }
|
|
||||||
// if (currentDiff.deleted[node.id]) {
|
|
||||||
// deletedCount++;
|
|
||||||
// hasChanges = true;
|
|
||||||
// }
|
|
||||||
// if (currentDiff.changed[node.id]) {
|
|
||||||
// changedCount++;
|
|
||||||
// hasChanges = true;
|
|
||||||
// }
|
|
||||||
// if (currentDiff.conflicted[node.id]) {
|
|
||||||
// conflictedCount++;
|
|
||||||
// hasChanges = true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (hasChanges) {
|
|
||||||
// var def = RED.nodes.getType(node.type)||{};
|
|
||||||
// var div = $("<div>",{class:"node-diff-node-entry collapsed"}).appendTo(tabDiv);
|
|
||||||
// var nodeTitleDiv = $("<div>",{class:"node-diff-node-entry-title"}).appendTo(div);
|
|
||||||
// nodeTitleDiv.click(function(evt) {
|
|
||||||
// evt.preventDefault();
|
|
||||||
// $(this).parent().toggleClass('collapsed');
|
|
||||||
// })
|
|
||||||
// var newNode = currentDiff.newConfig.all[node.id];
|
|
||||||
// var nodePropertiesDiv = $("<div>",{class:"node-diff-node-entry-properties"}).appendTo(div);
|
|
||||||
//
|
|
||||||
// var nodePropertiesTable = $("<table>").appendTo(nodePropertiesDiv);
|
|
||||||
//
|
|
||||||
// if (node.hasOwnProperty('x')) {
|
|
||||||
// if (newNode.x !== node.x || newNode.y !== node.y) {
|
|
||||||
// var currentPosition = node.x+", "+node.y
|
|
||||||
// var newPosition = newNode.x+", "+newNode.y;
|
|
||||||
// $("<tr><td>position</td><td>"+currentPosition+"</td><td>"+newPosition+"</td></tr>").appendTo(nodePropertiesTable);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// var properties = Object.keys(node).filter(function(p) { return p!='z'&&p!='wires'&&p!=='x'&&p!=='y'&&p!=='id'&&p!=='type'&&(!def.defaults||!def.defaults.hasOwnProperty(p))});
|
|
||||||
// if (def.defaults) {
|
|
||||||
// properties = properties.concat(Object.keys(def.defaults));
|
|
||||||
// }
|
|
||||||
// properties.forEach(function(d) {
|
|
||||||
// var localValue = JSON.stringify(node[d]);
|
|
||||||
// var remoteValue = JSON.stringify(newNode[d]);
|
|
||||||
// var originalValue = realNode._config[d];
|
|
||||||
//
|
|
||||||
// if (remoteValue !== originalValue) {
|
|
||||||
// var formattedProperty = formatNodeProperty(node[d]);
|
|
||||||
// var newFormattedProperty = formatNodeProperty(newNode[d]);
|
|
||||||
// if (localValue === originalValue) {
|
|
||||||
// // no conflict change
|
|
||||||
// } else {
|
|
||||||
// // conflicting change
|
|
||||||
// }
|
|
||||||
// $("<tr><td>"+d+'</td><td class="">'+formattedProperty+'</td><td class="node-diff-property-changed">'+newFormattedProperty+"</td></tr>").appendTo(nodePropertiesTable);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// })
|
|
||||||
// var nodeChevron = $('<i class="fa fa-angle-down node-diff-chevron">').appendTo(nodeTitleDiv);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // var leftColumn = $('<div>',{class:"node-diff-column"}).appendTo(div);
|
|
||||||
// // var rightColumn = $('<div>',{class:"node-diff-column"}).appendTo(div);
|
|
||||||
// // rightColumn.html(" ");
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// var nodeDiv = $("<div>",{class:"node-diff-node-entry-node"}).appendTo(nodeTitleDiv);
|
|
||||||
// var colour = def.color;
|
|
||||||
// var icon_url = "arrow-in.png";
|
|
||||||
// if (node.type === 'tab') {
|
|
||||||
// colour = "#C0DEED";
|
|
||||||
// icon_url = "subflow.png";
|
|
||||||
// } else if (def.category === 'config') {
|
|
||||||
// icon_url = "cog.png";
|
|
||||||
// } else if (node.type === 'unknown') {
|
|
||||||
// icon_url = "alert.png";
|
|
||||||
// } else {
|
|
||||||
// icon_url = def.icon;
|
|
||||||
// }
|
|
||||||
// nodeDiv.css('backgroundColor',colour);
|
|
||||||
//
|
|
||||||
// var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv);
|
|
||||||
// $('<div/>',{class:"palette_icon",style:"background-image: url(icons/"+icon_url+")"}).appendTo(iconContainer);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// var contentDiv = $('<div>',{class:"node-diff-node-description"}).appendTo(nodeTitleDiv);
|
|
||||||
//
|
|
||||||
// $('<span>',{class:"node-diff-node-label"}).html(node.label || node.name || node.id).appendTo(contentDiv);
|
|
||||||
// //$('<div>',{class:"red-ui-search-result-node-type"}).html(node.type).appendTo(contentDiv);
|
|
||||||
// //$('<div>',{class:"red-ui-search-result-node-id"}).html(node.id).appendTo(contentDiv);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// var statsInfo = '<span class="node-diff-count">'+object.tab.nodes.length+" nodes"+
|
|
||||||
// (addedCount+deletedCount+changedCount+conflictedCount > 0 ? " : ":"")+
|
|
||||||
// "</span> "+
|
|
||||||
// ((addedCount > 0)?'<span class="node-diff-added">'+addedCount+' added</span> ':'')+
|
|
||||||
// ((deletedCount > 0)?'<span class="node-diff-deleted">'+deletedCount+' deleted</span> ':'')+
|
|
||||||
// ((changedCount > 0)?'<span class="node-diff-changed">'+changedCount+' changed</span> ':'')+
|
|
||||||
// ((conflictedCount > 0)?'<span class="node-diff-conflicted">'+conflictedCount+' conflicts</span>':'');
|
|
||||||
// stats.html(statsInfo);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// //
|
|
||||||
// //
|
|
||||||
// // var node = object.node;
|
|
||||||
// // var realNode = RED.nodes.node(node.id);
|
|
||||||
// // var def = RED.nodes.getType(object.node.type)||{};
|
|
||||||
// // var l = "";
|
|
||||||
// // if (def && def.label && realNode) {
|
|
||||||
// // l = def.label;
|
|
||||||
// // try {
|
|
||||||
// // l = (typeof l === "function" ? l.call(realNode) : l);
|
|
||||||
// // } catch(err) {
|
|
||||||
// // console.log("Definition error: "+node.type+".label",err);
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // l = l||node.label||node.name||node.id||"";
|
|
||||||
// // console.log(node);
|
|
||||||
// // var div = $('<div>').appendTo(container);
|
|
||||||
// // div.html(l);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatNodeProperty(prop) {
|
|
||||||
var formattedProperty = prop;
|
|
||||||
if (formattedProperty === null) {
|
|
||||||
formattedProperty = 'null';
|
|
||||||
} else if (formattedProperty === undefined) {
|
|
||||||
formattedProperty = 'undefined';
|
|
||||||
} else if (typeof formattedProperty === 'object') {
|
|
||||||
formattedProperty = JSON.stringify(formattedProperty);
|
|
||||||
}
|
|
||||||
if (/\n/.test(formattedProperty)) {
|
|
||||||
formattedProperty = "<pre>"+formattedProperty+"</pre>"
|
|
||||||
}
|
|
||||||
return formattedProperty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodeInfo(node) {
|
function getNodeInfo(node) {
|
||||||
@@ -362,18 +156,7 @@ RED.deploy = (function() {
|
|||||||
tabLabel = tab.label;
|
tabLabel = tab.label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var label = "";
|
var label = RED.utils.getNodeLabel(node,node.id);
|
||||||
if (typeof node._def.label == "function") {
|
|
||||||
try {
|
|
||||||
label = node._def.label.call(node);
|
|
||||||
} catch(err) {
|
|
||||||
console.log("Definition error: "+node_def.type+".label",err);
|
|
||||||
label = node_def.type;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
label = node._def.label;
|
|
||||||
}
|
|
||||||
label = label || node.id;
|
|
||||||
return {tab:tabLabel,type:node.type,label:label};
|
return {tab:tabLabel,type:node.type,label:label};
|
||||||
}
|
}
|
||||||
function sortNodeInfo(A,B) {
|
function sortNodeInfo(A,B) {
|
||||||
@@ -386,154 +169,100 @@ RED.deploy = (function() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveConflict(currentNodes) {
|
function resolveConflict(currentNodes, activeDeploy) {
|
||||||
$( "#node-dialog-confirm-deploy-config" ).hide();
|
var message = $('<div>');
|
||||||
$( "#node-dialog-confirm-deploy-unknown" ).hide();
|
$('<p data-i18n="deploy.confirm.conflict"></p>').appendTo(message);
|
||||||
$( "#node-dialog-confirm-deploy-unused" ).hide();
|
var conflictCheck = $('<div id="node-dialog-confirm-deploy-conflict-checking" class="node-dialog-confirm-conflict-row">'+
|
||||||
$( "#node-dialog-confirm-deploy-conflict" ).show();
|
'<img src="red/images/spin.svg"/><div data-i18n="deploy.confirm.conflictChecking"></div>'+
|
||||||
$( "#node-dialog-confirm-deploy-type" ).val("conflict");
|
'</div>').appendTo(message);
|
||||||
$( "#node-dialog-confirm-deploy" ).dialog( "open" );
|
var conflictAutoMerge = $('<div class="node-dialog-confirm-conflict-row">'+
|
||||||
|
'<i style="color: #3a3;" class="fa fa-check"></i><div data-i18n="deploy.confirm.conflictAutoMerge"></div>'+
|
||||||
|
'</div>').hide().appendTo(message);
|
||||||
|
var conflictManualMerge = $('<div id="node-dialog-confirm-deploy-conflict-manual-merge" class="node-dialog-confirm-conflict-row">'+
|
||||||
|
'<i style="color: #999;" class="fa fa-exclamation"></i><div data-i18n="deploy.confirm.conflictManualMerge"></div>'+
|
||||||
|
'</div>').hide().appendTo(message);
|
||||||
|
|
||||||
// $("#node-dialog-confirm-deploy-review").append($('<img src="red/images/spin.svg" style="background: rgba(255,255,255,0.8); margin-top: -16px; margin-left: -8px; height:16px; position: absolute; "/>'));
|
message.i18n();
|
||||||
// $("#node-dialog-confirm-deploy-review .ui-button-text").css("opacity",0.4);
|
currentDiff = null;
|
||||||
// $("#node-dialog-confirm-deploy-review").attr("disabled",true).addClass("disabled");
|
var buttons = [
|
||||||
// $.ajax({
|
{
|
||||||
// headers: {
|
text: RED._("common.label.cancel"),
|
||||||
// "Accept":"application/json",
|
click: function() {
|
||||||
// },
|
conflictNotification.close();
|
||||||
// cache: false,
|
}
|
||||||
// url: 'flows',
|
},
|
||||||
// success: function(nodes) {
|
{
|
||||||
// var newNodes = nodes.flows;
|
id: "node-dialog-confirm-deploy-review",
|
||||||
// var newRevision = nodes.rev;
|
text: RED._("deploy.confirm.button.review"),
|
||||||
// generateDiff(currentNodes,newNodes);
|
class: "primary disabled",
|
||||||
// $("#node-dialog-confirm-deploy-review").attr("disabled",false).removeClass("disabled");
|
click: function() {
|
||||||
// $("#node-dialog-confirm-deploy-review img").remove();
|
if (!$("#node-dialog-confirm-deploy-review").hasClass('disabled')) {
|
||||||
// $("#node-dialog-confirm-deploy-review .ui-button-text").css("opacity",1);
|
RED.diff.showRemoteDiff();
|
||||||
// }
|
conflictNotification.close();
|
||||||
// });
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "node-dialog-confirm-deploy-merge",
|
||||||
|
text: RED._("deploy.confirm.button.merge"),
|
||||||
|
class: "primary disabled",
|
||||||
|
click: function() {
|
||||||
|
if (!$("#node-dialog-confirm-deploy-merge").hasClass('disabled')) {
|
||||||
|
RED.diff.mergeDiff(currentDiff);
|
||||||
|
conflictNotification.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
if (activeDeploy) {
|
||||||
|
buttons.push({
|
||||||
|
id: "node-dialog-confirm-deploy-overwrite",
|
||||||
|
text: RED._("deploy.confirm.button.overwrite"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
save(true,activeDeploy);
|
||||||
|
conflictNotification.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
var conflictNotification = RED.notify(message,{
|
||||||
|
modal: true,
|
||||||
|
fixed: true,
|
||||||
|
width: 600,
|
||||||
|
buttons: buttons
|
||||||
|
});
|
||||||
|
|
||||||
|
var now = Date.now();
|
||||||
|
RED.diff.getRemoteDiff(function(diff) {
|
||||||
|
var ellapsed = Math.max(1000 - (Date.now()-now), 0);
|
||||||
|
currentDiff = diff;
|
||||||
|
setTimeout(function() {
|
||||||
|
conflictCheck.hide();
|
||||||
|
var d = Object.keys(diff.conflicts);
|
||||||
|
if (d.length === 0) {
|
||||||
|
conflictAutoMerge.show();
|
||||||
|
$("#node-dialog-confirm-deploy-merge").removeClass('disabled')
|
||||||
|
} else {
|
||||||
|
conflictManualMerge.show();
|
||||||
|
}
|
||||||
|
$("#node-dialog-confirm-deploy-review").removeClass('disabled')
|
||||||
|
},ellapsed);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function cropList(list) {
|
||||||
|
if (list.length > 5) {
|
||||||
|
var remainder = list.length - 5;
|
||||||
|
list = list.slice(0,5);
|
||||||
|
list.push(RED._("deploy.confirm.plusNMore",{count:remainder}));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
// function parseNodes(nodeList) {
|
|
||||||
// var tabOrder = [];
|
|
||||||
// var tabs = {};
|
|
||||||
// var subflows = {};
|
|
||||||
// var globals = [];
|
|
||||||
// var all = {};
|
|
||||||
//
|
|
||||||
// nodeList.forEach(function(node) {
|
|
||||||
// all[node.id] = node;
|
|
||||||
// if (node.type === 'tab') {
|
|
||||||
// tabOrder.push(node.id);
|
|
||||||
// tabs[node.id] = {n:node,nodes:[]};
|
|
||||||
// } else if (node.type === 'subflow') {
|
|
||||||
// subflows[node.id] = {n:node,nodes:[]};
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// nodeList.forEach(function(node) {
|
|
||||||
// if (node.type !== 'tab' && node.type !== 'subflow') {
|
|
||||||
// if (tabs[node.z]) {
|
|
||||||
// tabs[node.z].nodes.push(node);
|
|
||||||
// } else if (subflows[node.z]) {
|
|
||||||
// subflows[node.z].nodes.push(node);
|
|
||||||
// } else {
|
|
||||||
// globals.push(node);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// return {
|
|
||||||
// all: all,
|
|
||||||
// tabOrder: tabOrder,
|
|
||||||
// tabs: tabs,
|
|
||||||
// subflows: subflows,
|
|
||||||
// globals: globals
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function generateDiff(currentNodes,newNodes) {
|
|
||||||
// var currentConfig = parseNodes(currentNodes);
|
|
||||||
// var newConfig = parseNodes(newNodes);
|
|
||||||
// var pending = RED.nodes.pending();
|
|
||||||
// var added = {};
|
|
||||||
// var deleted = {};
|
|
||||||
// var changed = {};
|
|
||||||
// var conflicted = {};
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Object.keys(currentConfig.all).forEach(function(id) {
|
|
||||||
// var node = RED.nodes.workspace(id)||RED.nodes.subflow(id)||RED.nodes.node(id);
|
|
||||||
// if (!newConfig.all.hasOwnProperty(id)) {
|
|
||||||
// if (!pending.added.hasOwnProperty(id)) {
|
|
||||||
// deleted[id] = true;
|
|
||||||
// conflicted[id] = node.changed;
|
|
||||||
// }
|
|
||||||
// } else if (JSON.stringify(currentConfig.all[id]) !== JSON.stringify(newConfig.all[id])) {
|
|
||||||
// changed[id] = true;
|
|
||||||
// conflicted[id] = node.changed;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// Object.keys(newConfig.all).forEach(function(id) {
|
|
||||||
// if (!currentConfig.all.hasOwnProperty(id) && !pending.deleted.hasOwnProperty(id)) {
|
|
||||||
// added[id] = true;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // console.log("Added",added);
|
|
||||||
// // console.log("Deleted",deleted);
|
|
||||||
// // console.log("Changed",changed);
|
|
||||||
// // console.log("Conflicted",conflicted);
|
|
||||||
//
|
|
||||||
// var formatString = function(id) {
|
|
||||||
// return conflicted[id]?"!":(added[id]?"+":(deleted[id]?"-":(changed[id]?"~":" ")));
|
|
||||||
// }
|
|
||||||
// newConfig.tabOrder.forEach(function(tabId) {
|
|
||||||
// var tab = newConfig.tabs[tabId];
|
|
||||||
// console.log(formatString(tabId),"Flow:",tab.n.label, "("+tab.n.id+")");
|
|
||||||
// tab.nodes.forEach(function(node) {
|
|
||||||
// console.log(" ",formatString(node.id),node.type,node.name || node.id);
|
|
||||||
// })
|
|
||||||
// if (currentConfig.tabs[tabId]) {
|
|
||||||
// currentConfig.tabs[tabId].nodes.forEach(function(node) {
|
|
||||||
// if (deleted[node.id]) {
|
|
||||||
// console.log(" ",formatString(node.id),node.type,node.name || node.id);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// currentConfig.tabOrder.forEach(function(tabId) {
|
|
||||||
// if (deleted[tabId]) {
|
|
||||||
// console.log(formatString(tabId),"Flow:",tab.n.label, "("+tab.n.id+")");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// currentDiff = {
|
|
||||||
// currentConfig: currentConfig,
|
|
||||||
// newConfig: newConfig,
|
|
||||||
// added: added,
|
|
||||||
// deleted: deleted,
|
|
||||||
// changed: changed,
|
|
||||||
// conflicted: conflicted
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function showDiff() {
|
|
||||||
// if (currentDiff) {
|
|
||||||
// var list = $("#node-dialog-view-diff-diff");
|
|
||||||
// list.editableList('empty');
|
|
||||||
// var currentConfig = currentDiff.currentConfig;
|
|
||||||
// currentConfig.tabOrder.forEach(function(tabId) {
|
|
||||||
// var tab = currentConfig.tabs[tabId];
|
|
||||||
// list.editableList('addItem',{tab:tab})
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// $("#node-dialog-view-diff").dialog("open");
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
function save(skipValidation,force) {
|
function save(skipValidation,force) {
|
||||||
if (!$("#btn-deploy").hasClass("disabled")) {
|
if (!$("#btn-deploy").hasClass("disabled")) {
|
||||||
|
if (!RED.user.hasPermission("flows.write")) {
|
||||||
|
RED.notify(RED._("user.errors.deploy"),"error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!skipValidation) {
|
if (!skipValidation) {
|
||||||
var hasUnknown = false;
|
var hasUnknown = false;
|
||||||
var hasInvalid = false;
|
var hasInvalid = false;
|
||||||
@@ -563,39 +292,62 @@ RED.deploy = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$( "#node-dialog-confirm-deploy-config" ).hide();
|
|
||||||
$( "#node-dialog-confirm-deploy-unknown" ).hide();
|
|
||||||
$( "#node-dialog-confirm-deploy-unused" ).hide();
|
|
||||||
$( "#node-dialog-confirm-deploy-conflict" ).hide();
|
|
||||||
|
|
||||||
var showWarning = false;
|
var showWarning = false;
|
||||||
|
var notificationMessage;
|
||||||
|
var notificationButtons = [];
|
||||||
|
var notification;
|
||||||
if (hasUnknown && !ignoreDeployWarnings.unknown) {
|
if (hasUnknown && !ignoreDeployWarnings.unknown) {
|
||||||
showWarning = true;
|
showWarning = true;
|
||||||
$( "#node-dialog-confirm-deploy-type" ).val("unknown");
|
notificationMessage = "<p>"+RED._('deploy.confirm.unknown')+"</p>"+
|
||||||
$( "#node-dialog-confirm-deploy-unknown" ).show();
|
'<ul class="node-dialog-configm-deploy-list"><li>'+cropList(unknownNodes).join("</li><li>")+"</li></ul><p>"+
|
||||||
$( "#node-dialog-confirm-deploy-unknown-list" )
|
RED._('deploy.confirm.confirm')+
|
||||||
.html("<li>"+unknownNodes.join("</li><li>")+"</li>");
|
"</p>";
|
||||||
|
|
||||||
|
notificationButtons= [
|
||||||
|
{
|
||||||
|
id: "node-dialog-confirm-deploy-deploy",
|
||||||
|
text: RED._("deploy.confirm.button.confirm"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
save(true);
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
} else if (hasInvalid && !ignoreDeployWarnings.invalid) {
|
} else if (hasInvalid && !ignoreDeployWarnings.invalid) {
|
||||||
showWarning = true;
|
showWarning = true;
|
||||||
$( "#node-dialog-confirm-deploy-type" ).val("invalid");
|
|
||||||
$( "#node-dialog-confirm-deploy-config" ).show();
|
|
||||||
invalidNodes.sort(sortNodeInfo);
|
invalidNodes.sort(sortNodeInfo);
|
||||||
$( "#node-dialog-confirm-deploy-invalid-list" )
|
|
||||||
.html("<li>"+invalidNodes.map(function(A) { return (A.tab?"["+A.tab+"] ":"")+A.label+" ("+A.type+")"}).join("</li><li>")+"</li>");
|
|
||||||
|
|
||||||
} else if (hasUnusedConfig && !ignoreDeployWarnings.unusedConfig) {
|
notificationMessage = "<p>"+RED._('deploy.confirm.improperlyConfigured')+"</p>"+
|
||||||
// showWarning = true;
|
'<ul class="node-dialog-configm-deploy-list"><li>'+cropList(invalidNodes.map(function(A) { return (A.tab?"["+A.tab+"] ":"")+A.label+" ("+A.type+")"})).join("</li><li>")+"</li></ul><p>"+
|
||||||
// $( "#node-dialog-confirm-deploy-type" ).val("unusedConfig");
|
RED._('deploy.confirm.confirm')+
|
||||||
// $( "#node-dialog-confirm-deploy-unused" ).show();
|
"</p>";
|
||||||
//
|
notificationButtons= [
|
||||||
// unusedConfigNodes.sort(sortNodeInfo);
|
{
|
||||||
// $( "#node-dialog-confirm-deploy-unused-list" )
|
id: "node-dialog-confirm-deploy-deploy",
|
||||||
// .html("<li>"+unusedConfigNodes.map(function(A) { return (A.tab?"["+A.tab+"] ":"")+A.label+" ("+A.type+")"}).join("</li><li>")+"</li>");
|
text: RED._("deploy.confirm.button.confirm"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
save(true);
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
if (showWarning) {
|
if (showWarning) {
|
||||||
$( "#node-dialog-confirm-deploy-hide" ).prop("checked",false);
|
notificationButtons.unshift(
|
||||||
$( "#node-dialog-confirm-deploy" ).dialog( "open" );
|
{
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
notification = RED.notify(notificationMessage,{
|
||||||
|
modal: true,
|
||||||
|
fixed: true,
|
||||||
|
buttons:notificationButtons
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,6 +365,11 @@ RED.deploy = (function() {
|
|||||||
data.rev = RED.nodes.version();
|
data.rev = RED.nodes.version();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deployInflight = true;
|
||||||
|
$("#header-shade").show();
|
||||||
|
$("#editor-shade").show();
|
||||||
|
$("#palette-shade").show();
|
||||||
|
$("#sidebar-shade").show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"flows",
|
url:"flows",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -624,18 +381,23 @@ RED.deploy = (function() {
|
|||||||
}).done(function(data,textStatus,xhr) {
|
}).done(function(data,textStatus,xhr) {
|
||||||
RED.nodes.dirty(false);
|
RED.nodes.dirty(false);
|
||||||
RED.nodes.version(data.rev);
|
RED.nodes.version(data.rev);
|
||||||
|
RED.nodes.originalFlow(nns);
|
||||||
if (hasUnusedConfig) {
|
if (hasUnusedConfig) {
|
||||||
RED.notify(
|
RED.notify(
|
||||||
'<p>'+RED._("deploy.successfulDeploy")+'</p>'+
|
'<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);
|
'<p>'+RED._("deploy.unusedConfigNodes")+' <a href="#" onclick="RED.sidebar.config.show(true); return false;">'+RED._("deploy.unusedConfigNodesLink")+'</a></p>',"success",false,6000);
|
||||||
} else {
|
} else {
|
||||||
RED.notify(RED._("deploy.successfulDeploy"),"success");
|
RED.notify('<p>'+RED._("deploy.successfulDeploy")+'</p>',"success");
|
||||||
}
|
}
|
||||||
RED.nodes.eachNode(function(node) {
|
RED.nodes.eachNode(function(node) {
|
||||||
if (node.changed) {
|
if (node.changed) {
|
||||||
node.dirty = true;
|
node.dirty = true;
|
||||||
node.changed = false;
|
node.changed = false;
|
||||||
}
|
}
|
||||||
|
if (node.moved) {
|
||||||
|
node.dirty = true;
|
||||||
|
node.moved = false;
|
||||||
|
}
|
||||||
if(node.credentials) {
|
if(node.credentials) {
|
||||||
delete node.credentials;
|
delete node.credentials;
|
||||||
}
|
}
|
||||||
@@ -646,9 +408,12 @@ RED.deploy = (function() {
|
|||||||
delete confNode.credentials;
|
delete confNode.credentials;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
RED.nodes.eachSubflow(function(subflow) {
|
||||||
|
subflow.changed = false;
|
||||||
|
});
|
||||||
RED.nodes.eachWorkspace(function(ws) {
|
RED.nodes.eachWorkspace(function(ws) {
|
||||||
ws.changed = false;
|
ws.changed = false;
|
||||||
})
|
});
|
||||||
// Once deployed, cannot undo back to a clean state
|
// Once deployed, cannot undo back to a clean state
|
||||||
RED.history.markAllDirty();
|
RED.history.markAllDirty();
|
||||||
RED.view.redraw();
|
RED.view.redraw();
|
||||||
@@ -659,22 +424,31 @@ RED.deploy = (function() {
|
|||||||
if (xhr.status === 401) {
|
if (xhr.status === 401) {
|
||||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||||
} else if (xhr.status === 409) {
|
} else if (xhr.status === 409) {
|
||||||
resolveConflict(nns);
|
resolveConflict(nns, true);
|
||||||
} else if (xhr.responseText) {
|
} else if (xhr.responseText) {
|
||||||
RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error");
|
RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error");
|
||||||
} else {
|
} else {
|
||||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("deploy.errors.noResponse")}),"error");
|
RED.notify(RED._("deploy.deployFailed",{message:RED._("deploy.errors.noResponse")}),"error");
|
||||||
}
|
}
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
|
deployInflight = false;
|
||||||
var delta = Math.max(0,300-(Date.now()-startTime));
|
var delta = Math.max(0,300-(Date.now()-startTime));
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$(".deploy-button-content").css('opacity',1);
|
$(".deploy-button-content").css('opacity',1);
|
||||||
$(".deploy-button-spinner").hide();
|
$(".deploy-button-spinner").hide();
|
||||||
|
$("#header-shade").hide();
|
||||||
|
$("#editor-shade").hide();
|
||||||
|
$("#palette-shade").hide();
|
||||||
|
$("#sidebar-shade").hide();
|
||||||
},delta);
|
},delta);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
init: init
|
init: init,
|
||||||
|
setDeployInflight: function(state) {
|
||||||
|
deployInflight = state;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
2199
editor/js/ui/diff.js
Normal file
209
editor/js/ui/editors/buffer.js
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
RED.editor.types._buffer = (function() {
|
||||||
|
|
||||||
|
|
||||||
|
var template = '<script type="text/x-red" data-template-name="_buffer"><div id="node-input-buffer-panels"><div id="node-input-buffer-panel-str" class="red-ui-panel"><div class="form-row" style="margin-bottom: 3px; text-align: right;"><span class="node-input-buffer-type"><i class="fa fa-exclamation-circle"></i> <span id="node-input-buffer-type-string" data-i18n="bufferEditor.modeString"></span><span id="node-input-buffer-type-array" data-i18n="bufferEditor.modeArray"></span></span></div><div class="form-row node-text-editor-row"><div class="node-text-editor" id="node-input-buffer-str"></div></div></div><div id="node-input-buffer-panel-bin" class="red-ui-panel"><div class="form-row node-text-editor-row" style="margin-top: 10px"><div class="node-text-editor" id="node-input-buffer-bin"></div></div></div></div></script>';
|
||||||
|
|
||||||
|
function stringToUTF8Array(str) {
|
||||||
|
var data = [];
|
||||||
|
var i=0, l = str.length;
|
||||||
|
for (i=0; i<l; i++) {
|
||||||
|
var char = str.charCodeAt(i);
|
||||||
|
if (char < 0x80) {
|
||||||
|
data.push(char);
|
||||||
|
} else if (char < 0x800) {
|
||||||
|
data.push(0xc0 | (char >> 6));
|
||||||
|
data.push(0x80 | (char & 0x3f));
|
||||||
|
} else if (char < 0xd800 || char >= 0xe000) {
|
||||||
|
data.push(0xe0 | (char >> 12));
|
||||||
|
data.push(0x80 | ((char>>6) & 0x3f));
|
||||||
|
data.push(0x80 | (char & 0x3f));
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
char = 0x10000 + (((char & 0x3ff)<<10) | (str.charAt(i) & 0x3ff));
|
||||||
|
data.push(0xf0 | (char >>18));
|
||||||
|
data.push(0x80 | ((char>>12) & 0x3f));
|
||||||
|
data.push(0x80 | ((char>>6) & 0x3f));
|
||||||
|
data.push(0x80 | (char & 0x3f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
$(template).appendTo(document.body);
|
||||||
|
},
|
||||||
|
show: function(options) {
|
||||||
|
var value = options.value;
|
||||||
|
var onComplete = options.complete;
|
||||||
|
var type = "_buffer"
|
||||||
|
RED.view.state(RED.state.EDITING);
|
||||||
|
var bufferStringEditor = [];
|
||||||
|
var bufferBinValue;
|
||||||
|
|
||||||
|
var panels;
|
||||||
|
|
||||||
|
var trayOptions = {
|
||||||
|
title: options.title,
|
||||||
|
width: "inherit",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "node-dialog-cancel",
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "node-dialog-ok",
|
||||||
|
text: RED._("common.label.done"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
onComplete(JSON.stringify(bufferBinValue));
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
var height = $("#dialog-form").height();
|
||||||
|
if (panels) {
|
||||||
|
panels.resize(height);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
open: function(tray) {
|
||||||
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
|
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form',type,'editor');
|
||||||
|
|
||||||
|
bufferStringEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-buffer-str',
|
||||||
|
value: "",
|
||||||
|
mode:"ace/mode/text"
|
||||||
|
});
|
||||||
|
bufferStringEditor.getSession().setValue(value||"",-1);
|
||||||
|
|
||||||
|
bufferBinEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-buffer-bin',
|
||||||
|
value: "",
|
||||||
|
mode:"ace/mode/text",
|
||||||
|
readOnly: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var changeTimer;
|
||||||
|
var buildBuffer = function(data) {
|
||||||
|
var valid = true;
|
||||||
|
var isString = typeof data === 'string';
|
||||||
|
var binBuffer = [];
|
||||||
|
if (isString) {
|
||||||
|
bufferBinValue = stringToUTF8Array(data);
|
||||||
|
} else {
|
||||||
|
bufferBinValue = data;
|
||||||
|
}
|
||||||
|
var i=0,l=bufferBinValue.length;
|
||||||
|
var c = 0;
|
||||||
|
for(i=0;i<l;i++) {
|
||||||
|
var d = parseInt(bufferBinValue[i]);
|
||||||
|
if (!isString && (isNaN(d) || d < 0 || d > 255)) {
|
||||||
|
valid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i>0) {
|
||||||
|
if (i%8 === 0) {
|
||||||
|
if (i%16 === 0) {
|
||||||
|
binBuffer.push("\n");
|
||||||
|
} else {
|
||||||
|
binBuffer.push(" ");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binBuffer.push(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binBuffer.push((d<16?"0":"")+d.toString(16).toUpperCase());
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
$("#node-input-buffer-type-string").toggle(isString);
|
||||||
|
$("#node-input-buffer-type-array").toggle(!isString);
|
||||||
|
bufferBinEditor.setValue(binBuffer.join(""),1);
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
var bufferStringUpdate = function() {
|
||||||
|
var value = bufferStringEditor.getValue();
|
||||||
|
var isValidArray = false;
|
||||||
|
if (/^[\s]*\[[\s\S]*\][\s]*$/.test(value)) {
|
||||||
|
isValidArray = true;
|
||||||
|
try {
|
||||||
|
var data = JSON.parse(value);
|
||||||
|
isValidArray = buildBuffer(data);
|
||||||
|
} catch(err) {
|
||||||
|
isValidArray = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isValidArray) {
|
||||||
|
buildBuffer(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
bufferStringEditor.getSession().on('change', function() {
|
||||||
|
clearTimeout(changeTimer);
|
||||||
|
changeTimer = setTimeout(bufferStringUpdate,200);
|
||||||
|
});
|
||||||
|
|
||||||
|
bufferStringUpdate();
|
||||||
|
|
||||||
|
dialogForm.i18n();
|
||||||
|
|
||||||
|
panels = RED.panels.create({
|
||||||
|
id:"node-input-buffer-panels",
|
||||||
|
resize: function(p1Height,p2Height) {
|
||||||
|
var p1 = $("#node-input-buffer-panel-str");
|
||||||
|
p1Height -= $(p1.children()[0]).outerHeight(true);
|
||||||
|
var editorRow = $(p1.children()[1]);
|
||||||
|
p1Height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||||
|
$("#node-input-buffer-str").css("height",(p1Height-5)+"px");
|
||||||
|
bufferStringEditor.resize();
|
||||||
|
|
||||||
|
var p2 = $("#node-input-buffer-panel-bin");
|
||||||
|
editorRow = $(p2.children()[0]);
|
||||||
|
p2Height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||||
|
$("#node-input-buffer-bin").css("height",(p2Height-5)+"px");
|
||||||
|
bufferBinEditor.resize();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".node-input-buffer-type").click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
RED.sidebar.info.set(RED._("bufferEditor.modeDesc"));
|
||||||
|
RED.sidebar.info.show();
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
if (options.onclose) {
|
||||||
|
options.onclose();
|
||||||
|
}
|
||||||
|
bufferStringEditor.destroy();
|
||||||
|
bufferBinEditor.destroy();
|
||||||
|
},
|
||||||
|
show: function() {}
|
||||||
|
}
|
||||||
|
RED.tray.show(trayOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
325
editor/js/ui/editors/expression.js
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
RED.editor.types._expression = (function() {
|
||||||
|
|
||||||
|
|
||||||
|
var template = '<script type="text/x-red" data-template-name="_expression"><div id="node-input-expression-panels"><div id="node-input-expression-panel-expr" class="red-ui-panel"><div class="form-row" style="margin-bottom: 3px; text-align: right;"><span class="node-input-expression-legacy"><i class="fa fa-exclamation-circle"></i> <span data-i18n="expressionEditor.compatMode"></span></span><button id="node-input-expression-reformat" class="editor-button editor-button-small"><span data-i18n="expressionEditor.format"></span></button></div><div class="form-row node-text-editor-row"><div class="node-text-editor" id="node-input-expression"></div></div></div><div id="node-input-expression-panel-info" class="red-ui-panel"><div class="form-row"><ul id="node-input-expression-tabs"></ul><div id="node-input-expression-tab-help" class="node-input-expression-tab-content hide"><div><select id="node-input-expression-func"></select><button id="node-input-expression-func-insert" class="editor-button" data-i18n="expressionEditor.insert"></button></div><div id="node-input-expression-help"></div></div><div id="node-input-expression-tab-test" class="node-input-expression-tab-content hide"><div><span style="display: inline-block; width: calc(50% - 5px);"><span data-i18n="expressionEditor.data"></span><button style="float: right; margin-right: 5px;" id="node-input-example-reformat" class="editor-button editor-button-small"><span data-i18n="jsonEditor.format"></span></button></span><span style="display: inline-block; width: calc(50% - 5px);" data-i18n="expressionEditor.result"></span></div><div style="display: inline-block; width: calc(50% - 5px);" class="node-text-editor" id="node-input-expression-test-data"></div><div style="display: inline-block; width: calc(50% - 5px);" class="node-text-editor" id="node-input-expression-test-result"></div></div></div></div></div></script>';
|
||||||
|
var expressionTestCache = {};
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
$(template).appendTo(document.body);
|
||||||
|
},
|
||||||
|
show: function(options) {
|
||||||
|
var expressionTestCacheId = options.parent||"_";
|
||||||
|
var value = options.value;
|
||||||
|
var onComplete = options.complete;
|
||||||
|
var type = "_expression"
|
||||||
|
RED.view.state(RED.state.EDITING);
|
||||||
|
var expressionEditor;
|
||||||
|
var testDataEditor;
|
||||||
|
var testResultEditor
|
||||||
|
var panels;
|
||||||
|
|
||||||
|
var trayOptions = {
|
||||||
|
title: options.title,
|
||||||
|
width: "inherit",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "node-dialog-cancel",
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "node-dialog-ok",
|
||||||
|
text: RED._("common.label.done"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
$("#node-input-expression-help").text("");
|
||||||
|
onComplete(expressionEditor.getValue());
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
var height = $("#dialog-form").height();
|
||||||
|
if (panels) {
|
||||||
|
panels.resize(height);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
open: function(tray) {
|
||||||
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
|
trayBody.addClass("node-input-expression-editor")
|
||||||
|
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form','_expression','editor');
|
||||||
|
var funcSelect = $("#node-input-expression-func");
|
||||||
|
Object.keys(jsonata.functions).forEach(function(f) {
|
||||||
|
funcSelect.append($("<option></option>").val(f).text(f));
|
||||||
|
})
|
||||||
|
funcSelect.change(function(e) {
|
||||||
|
var f = $(this).val();
|
||||||
|
var args = RED._('jsonata:'+f+".args",{defaultValue:''});
|
||||||
|
var title = "<h5>"+f+"("+args+")</h5>";
|
||||||
|
var body = marked(RED._('jsonata:'+f+'.desc',{defaultValue:''}));
|
||||||
|
$("#node-input-expression-help").html(title+"<p>"+body+"</p>");
|
||||||
|
|
||||||
|
})
|
||||||
|
expressionEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-expression',
|
||||||
|
value: "",
|
||||||
|
mode:"ace/mode/jsonata",
|
||||||
|
options: {
|
||||||
|
enableBasicAutocompletion:true,
|
||||||
|
enableSnippets:true,
|
||||||
|
enableLiveAutocompletion: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var currentToken = null;
|
||||||
|
var currentTokenPos = -1;
|
||||||
|
var currentFunctionMarker = null;
|
||||||
|
|
||||||
|
expressionEditor.getSession().setValue(value||"",-1);
|
||||||
|
expressionEditor.on("changeSelection", function() {
|
||||||
|
var c = expressionEditor.getCursorPosition();
|
||||||
|
var token = expressionEditor.getSession().getTokenAt(c.row,c.column);
|
||||||
|
if (token !== currentToken || (token && /paren/.test(token.type) && c.column !== currentTokenPos)) {
|
||||||
|
currentToken = token;
|
||||||
|
var r,p;
|
||||||
|
var scopedFunction = null;
|
||||||
|
if (token && token.type === 'keyword') {
|
||||||
|
r = c.row;
|
||||||
|
scopedFunction = token;
|
||||||
|
} else {
|
||||||
|
var depth = 0;
|
||||||
|
var next = false;
|
||||||
|
if (token) {
|
||||||
|
if (token.type === 'paren.rparen') {
|
||||||
|
// If this is a block of parens ')))', set
|
||||||
|
// depth to offset against the cursor position
|
||||||
|
// within the block
|
||||||
|
currentTokenPos = c.column;
|
||||||
|
depth = c.column - (token.start + token.value.length);
|
||||||
|
}
|
||||||
|
r = c.row;
|
||||||
|
p = token.index;
|
||||||
|
} else {
|
||||||
|
r = c.row-1;
|
||||||
|
p = -1;
|
||||||
|
}
|
||||||
|
while ( scopedFunction === null && r > -1) {
|
||||||
|
var rowTokens = expressionEditor.getSession().getTokens(r);
|
||||||
|
if (p === -1) {
|
||||||
|
p = rowTokens.length-1;
|
||||||
|
}
|
||||||
|
while (p > -1) {
|
||||||
|
var type = rowTokens[p].type;
|
||||||
|
if (next) {
|
||||||
|
if (type === 'keyword') {
|
||||||
|
scopedFunction = rowTokens[p];
|
||||||
|
// console.log("HIT",scopedFunction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
next = false;
|
||||||
|
}
|
||||||
|
if (type === 'paren.lparen') {
|
||||||
|
depth-=rowTokens[p].value.length;
|
||||||
|
} else if (type === 'paren.rparen') {
|
||||||
|
depth+=rowTokens[p].value.length;
|
||||||
|
}
|
||||||
|
if (depth < 0) {
|
||||||
|
next = true;
|
||||||
|
depth = 0;
|
||||||
|
}
|
||||||
|
// console.log(r,p,depth,next,rowTokens[p]);
|
||||||
|
p--;
|
||||||
|
}
|
||||||
|
if (!scopedFunction) {
|
||||||
|
r--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expressionEditor.session.removeMarker(currentFunctionMarker);
|
||||||
|
if (scopedFunction) {
|
||||||
|
//console.log(token,.map(function(t) { return t.type}));
|
||||||
|
funcSelect.val(scopedFunction.value).change();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogForm.i18n();
|
||||||
|
$("#node-input-expression-func-insert").click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var pos = expressionEditor.getCursorPosition();
|
||||||
|
var f = funcSelect.val();
|
||||||
|
var snippet = jsonata.getFunctionSnippet(f);
|
||||||
|
expressionEditor.insertSnippet(snippet);
|
||||||
|
expressionEditor.focus();
|
||||||
|
});
|
||||||
|
$("#node-input-expression-reformat").click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
var v = expressionEditor.getValue()||"";
|
||||||
|
try {
|
||||||
|
v = jsonata.format(v);
|
||||||
|
} catch(err) {
|
||||||
|
// TODO: do an optimistic auto-format
|
||||||
|
}
|
||||||
|
expressionEditor.getSession().setValue(v||"",-1);
|
||||||
|
});
|
||||||
|
|
||||||
|
var tabs = RED.tabs.create({
|
||||||
|
element: $("#node-input-expression-tabs"),
|
||||||
|
onchange:function(tab) {
|
||||||
|
$(".node-input-expression-tab-content").hide();
|
||||||
|
tab.content.show();
|
||||||
|
trayOptions.resize();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
tabs.addTab({
|
||||||
|
id: 'expression-help',
|
||||||
|
label: RED._('expressionEditor.functionReference'),
|
||||||
|
content: $("#node-input-expression-tab-help")
|
||||||
|
});
|
||||||
|
tabs.addTab({
|
||||||
|
id: 'expression-tests',
|
||||||
|
label: RED._('expressionEditor.test'),
|
||||||
|
content: $("#node-input-expression-tab-test")
|
||||||
|
});
|
||||||
|
testDataEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-expression-test-data',
|
||||||
|
value: expressionTestCache[expressionTestCacheId] || '{\n "payload": "hello world"\n}',
|
||||||
|
mode:"ace/mode/json",
|
||||||
|
lineNumbers: false
|
||||||
|
});
|
||||||
|
var changeTimer;
|
||||||
|
$(".node-input-expression-legacy").click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
RED.sidebar.info.set(RED._("expressionEditor.compatModeDesc"));
|
||||||
|
RED.sidebar.info.show();
|
||||||
|
})
|
||||||
|
var testExpression = function() {
|
||||||
|
var value = testDataEditor.getValue();
|
||||||
|
var parsedData;
|
||||||
|
var currentExpression = expressionEditor.getValue();
|
||||||
|
var expr;
|
||||||
|
var usesContext = false;
|
||||||
|
var legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression);
|
||||||
|
$(".node-input-expression-legacy").toggle(legacyMode);
|
||||||
|
try {
|
||||||
|
expr = jsonata(currentExpression);
|
||||||
|
expr.assign('flowContext',function(val) {
|
||||||
|
usesContext = true;
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
expr.assign('globalContext',function(val) {
|
||||||
|
usesContext = true;
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
} catch(err) {
|
||||||
|
testResultEditor.setValue(RED._("expressionEditor.errors.invalid-expr",{message:err.message}),-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
parsedData = JSON.parse(value);
|
||||||
|
} catch(err) {
|
||||||
|
testResultEditor.setValue(RED._("expressionEditor.errors.invalid-msg",{message:err.toString()}))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var result = expr.evaluate(legacyMode?{msg:parsedData}:parsedData);
|
||||||
|
if (usesContext) {
|
||||||
|
testResultEditor.setValue(RED._("expressionEditor.errors.context-unsupported"),-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var formattedResult;
|
||||||
|
if (result !== undefined) {
|
||||||
|
formattedResult = JSON.stringify(result,null,4);
|
||||||
|
} else {
|
||||||
|
formattedResult = RED._("expressionEditor.noMatch");
|
||||||
|
}
|
||||||
|
testResultEditor.setValue(formattedResult,-1);
|
||||||
|
} catch(err) {
|
||||||
|
testResultEditor.setValue(RED._("expressionEditor.errors.eval",{message:err.message}),-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
testDataEditor.getSession().on('change', function() {
|
||||||
|
clearTimeout(changeTimer);
|
||||||
|
changeTimer = setTimeout(testExpression,200);
|
||||||
|
expressionTestCache[expressionTestCacheId] = testDataEditor.getValue();
|
||||||
|
});
|
||||||
|
expressionEditor.getSession().on('change', function() {
|
||||||
|
clearTimeout(changeTimer);
|
||||||
|
changeTimer = setTimeout(testExpression,200);
|
||||||
|
});
|
||||||
|
|
||||||
|
testResultEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-expression-test-result',
|
||||||
|
value: "",
|
||||||
|
mode:"ace/mode/json",
|
||||||
|
lineNumbers: false,
|
||||||
|
readOnly: true
|
||||||
|
});
|
||||||
|
panels = RED.panels.create({
|
||||||
|
id:"node-input-expression-panels",
|
||||||
|
resize: function(p1Height,p2Height) {
|
||||||
|
var p1 = $("#node-input-expression-panel-expr");
|
||||||
|
p1Height -= $(p1.children()[0]).outerHeight(true);
|
||||||
|
var editorRow = $(p1.children()[1]);
|
||||||
|
p1Height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||||
|
$("#node-input-expression").css("height",(p1Height-5)+"px");
|
||||||
|
expressionEditor.resize();
|
||||||
|
|
||||||
|
var p2 = $("#node-input-expression-panel-info > .form-row > div:first-child");
|
||||||
|
p2Height -= p2.outerHeight(true) + 20;
|
||||||
|
$(".node-input-expression-tab-content").height(p2Height);
|
||||||
|
$("#node-input-expression-test-data").css("height",(p2Height-5)+"px");
|
||||||
|
testDataEditor.resize();
|
||||||
|
$("#node-input-expression-test-result").css("height",(p2Height-5)+"px");
|
||||||
|
testResultEditor.resize();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#node-input-example-reformat").click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
var v = testDataEditor.getValue()||"";
|
||||||
|
try {
|
||||||
|
v = JSON.stringify(JSON.parse(v),null,4);
|
||||||
|
} catch(err) {
|
||||||
|
// TODO: do an optimistic auto-format
|
||||||
|
}
|
||||||
|
testDataEditor.getSession().setValue(v||"",-1);
|
||||||
|
});
|
||||||
|
|
||||||
|
testExpression();
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
if (options.onclose) {
|
||||||
|
options.onclose();
|
||||||
|
}
|
||||||
|
expressionEditor.destroy();
|
||||||
|
testDataEditor.destroy();
|
||||||
|
},
|
||||||
|
show: function() {}
|
||||||
|
}
|
||||||
|
RED.tray.show(trayOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
102
editor/js/ui/editors/js.js
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
RED.editor.types._js = (function() {
|
||||||
|
|
||||||
|
|
||||||
|
var template = '<script type="text/x-red" data-template-name="_js"><div class="form-row node-text-editor-row"><div style="height: 200px;min-height: 150px;" class="node-text-editor" id="node-input-js"></div></div></script>';
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
$(template).appendTo(document.body);
|
||||||
|
},
|
||||||
|
show: function(options) {
|
||||||
|
var value = options.value;
|
||||||
|
var onComplete = options.complete;
|
||||||
|
var type = "_js"
|
||||||
|
RED.view.state(RED.state.EDITING);
|
||||||
|
var expressionEditor;
|
||||||
|
var changeTimer;
|
||||||
|
|
||||||
|
var trayOptions = {
|
||||||
|
title: options.title,
|
||||||
|
width: options.width||"inherit",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "node-dialog-cancel",
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "node-dialog-ok",
|
||||||
|
text: RED._("common.label.done"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
onComplete(expressionEditor.getValue(),expressionEditor.getCursorPosition());
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
|
||||||
|
var editorRow = $("#dialog-form>div.node-text-editor-row");
|
||||||
|
var height = $("#dialog-form").height();
|
||||||
|
for (var i=0;i<rows.size();i++) {
|
||||||
|
height -= $(rows[i]).outerHeight(true);
|
||||||
|
}
|
||||||
|
$(".node-text-editor").css("height",height+"px");
|
||||||
|
expressionEditor.resize();
|
||||||
|
},
|
||||||
|
open: function(tray) {
|
||||||
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
|
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form',type,'editor');
|
||||||
|
expressionEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-js',
|
||||||
|
mode: 'ace/mode/javascript',
|
||||||
|
value: value,
|
||||||
|
globals: {
|
||||||
|
msg:true,
|
||||||
|
context:true,
|
||||||
|
RED: true,
|
||||||
|
util: true,
|
||||||
|
flow: true,
|
||||||
|
global: true,
|
||||||
|
console: true,
|
||||||
|
Buffer: true,
|
||||||
|
setTimeout: true,
|
||||||
|
clearTimeout: true,
|
||||||
|
setInterval: true,
|
||||||
|
clearInterval: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (options.cursor) {
|
||||||
|
expressionEditor.gotoLine(options.cursor.row+1,options.cursor.column,false);
|
||||||
|
}
|
||||||
|
dialogForm.i18n();
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
expressionEditor.destroy();
|
||||||
|
if (options.onclose) {
|
||||||
|
options.onclose();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show: function() {}
|
||||||
|
}
|
||||||
|
RED.tray.show(trayOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
118
editor/js/ui/editors/json.js
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
RED.editor.types._json = (function() {
|
||||||
|
|
||||||
|
|
||||||
|
var template = '<script type="text/x-red" data-template-name="_json"><div class="form-row" style="margin-bottom: 3px; text-align: right;"><button id="node-input-json-reformat" class="editor-button editor-button-small"><span data-i18n="jsonEditor.format"></span></button></div><div class="form-row node-text-editor-row"><div style="height: 200px;min-height: 150px;" class="node-text-editor" id="node-input-json"></div></div></script>';
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
$(template).appendTo(document.body);
|
||||||
|
},
|
||||||
|
show: function(options) {
|
||||||
|
var value = options.value;
|
||||||
|
var onComplete = options.complete;
|
||||||
|
var type = "_json"
|
||||||
|
RED.view.state(RED.state.EDITING);
|
||||||
|
var expressionEditor;
|
||||||
|
var changeTimer;
|
||||||
|
|
||||||
|
var checkValid = function() {
|
||||||
|
var v = expressionEditor.getValue();
|
||||||
|
try {
|
||||||
|
JSON.parse(v);
|
||||||
|
$("#node-dialog-ok").removeClass('disabled');
|
||||||
|
return true;
|
||||||
|
} catch(err) {
|
||||||
|
$("#node-dialog-ok").addClass('disabled');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var trayOptions = {
|
||||||
|
title: options.title,
|
||||||
|
width: "inherit",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "node-dialog-cancel",
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "node-dialog-ok",
|
||||||
|
text: RED._("common.label.done"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
if (options.requireValid && !checkValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onComplete(expressionEditor.getValue());
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
|
||||||
|
var editorRow = $("#dialog-form>div.node-text-editor-row");
|
||||||
|
var height = $("#dialog-form").height();
|
||||||
|
for (var i=0;i<rows.size();i++) {
|
||||||
|
height -= $(rows[i]).outerHeight(true);
|
||||||
|
}
|
||||||
|
height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom")));
|
||||||
|
$(".node-text-editor").css("height",height+"px");
|
||||||
|
expressionEditor.resize();
|
||||||
|
},
|
||||||
|
open: function(tray) {
|
||||||
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
|
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form',type,'editor');
|
||||||
|
expressionEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-json',
|
||||||
|
value: "",
|
||||||
|
mode:"ace/mode/json"
|
||||||
|
});
|
||||||
|
expressionEditor.getSession().setValue(value||"",-1);
|
||||||
|
if (options.requireValid) {
|
||||||
|
expressionEditor.getSession().on('change', function() {
|
||||||
|
clearTimeout(changeTimer);
|
||||||
|
changeTimer = setTimeout(checkValid,200);
|
||||||
|
});
|
||||||
|
checkValid();
|
||||||
|
}
|
||||||
|
$("#node-input-json-reformat").click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
var v = expressionEditor.getValue()||"";
|
||||||
|
try {
|
||||||
|
v = JSON.stringify(JSON.parse(v),null,4);
|
||||||
|
} catch(err) {
|
||||||
|
// TODO: do an optimistic auto-format
|
||||||
|
}
|
||||||
|
expressionEditor.getSession().setValue(v||"",-1);
|
||||||
|
});
|
||||||
|
dialogForm.i18n();
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
expressionEditor.destroy();
|
||||||
|
if (options.onclose) {
|
||||||
|
options.onclose();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show: function() {}
|
||||||
|
}
|
||||||
|
RED.tray.show(trayOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
90
editor/js/ui/editors/markdown.js
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
RED.editor.types._markdown = (function() {
|
||||||
|
|
||||||
|
|
||||||
|
var template = '<script type="text/x-red" data-template-name="_markdown"><div class="form-row" id="node-input-markdown-title" style="margin-bottom: 3px; text-align: right;"></div><div class="form-row node-text-editor-row"><div style="height: 200px;min-height: 150px;" class="node-text-editor" id="node-input-markdown"></div></div></script>';
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
$(template).appendTo(document.body);
|
||||||
|
},
|
||||||
|
show: function(options) {
|
||||||
|
var value = options.value;
|
||||||
|
var onComplete = options.complete;
|
||||||
|
var type = "_markdown"
|
||||||
|
RED.view.state(RED.state.EDITING);
|
||||||
|
var expressionEditor;
|
||||||
|
|
||||||
|
var trayOptions = {
|
||||||
|
title: options.title,
|
||||||
|
width: "inherit",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "node-dialog-cancel",
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "node-dialog-ok",
|
||||||
|
text: RED._("common.label.done"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
onComplete(expressionEditor.getValue());
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
|
||||||
|
var editorRow = $("#dialog-form>div.node-text-editor-row");
|
||||||
|
var height = $("#dialog-form").height();
|
||||||
|
for (var i=0;i<rows.size();i++) {
|
||||||
|
height -= $(rows[i]).outerHeight(true);
|
||||||
|
}
|
||||||
|
height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom")));
|
||||||
|
$(".node-text-editor").css("height",height+"px");
|
||||||
|
expressionEditor.resize();
|
||||||
|
},
|
||||||
|
open: function(tray) {
|
||||||
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
|
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form',type,'editor');
|
||||||
|
expressionEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-markdown',
|
||||||
|
value: value,
|
||||||
|
mode:"ace/mode/markdown"
|
||||||
|
});
|
||||||
|
if (options.header) {
|
||||||
|
options.header.appendTo(tray.find('#node-input-markdown-title'));
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogForm.i18n();
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
expressionEditor.destroy();
|
||||||
|
if (options.onclose) {
|
||||||
|
options.onclose();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show: function() {}
|
||||||
|
}
|
||||||
|
RED.tray.show(trayOptions);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,10 +15,154 @@
|
|||||||
**/
|
**/
|
||||||
RED.keyboard = (function() {
|
RED.keyboard = (function() {
|
||||||
|
|
||||||
|
var isMac = /Mac/i.test(window.navigator.platform);
|
||||||
|
|
||||||
var handlers = {};
|
var handlers = {};
|
||||||
|
var partialState;
|
||||||
|
|
||||||
|
var keyMap = {
|
||||||
|
"left":37,
|
||||||
|
"up":38,
|
||||||
|
"right":39,
|
||||||
|
"down":40,
|
||||||
|
"escape":27,
|
||||||
|
"enter": 13,
|
||||||
|
"backspace": 8,
|
||||||
|
"delete": 46,
|
||||||
|
"space": 32,
|
||||||
|
";":186,
|
||||||
|
"=":187,
|
||||||
|
",":188,
|
||||||
|
"-":189,
|
||||||
|
".":190,
|
||||||
|
"/":191,
|
||||||
|
"\\":220,
|
||||||
|
"'":222,
|
||||||
|
"?":191 // <- QWERTY specific
|
||||||
|
}
|
||||||
|
var metaKeyCodes = {
|
||||||
|
16:true,
|
||||||
|
17:true,
|
||||||
|
18: true,
|
||||||
|
91:true,
|
||||||
|
93: true
|
||||||
|
}
|
||||||
|
var actionToKeyMap = {}
|
||||||
|
var defaultKeyMap = {};
|
||||||
|
|
||||||
|
// FF generates some different keycodes because reasons.
|
||||||
|
var firefoxKeyCodeMap = {
|
||||||
|
59:186,
|
||||||
|
61:187,
|
||||||
|
173:189
|
||||||
|
}
|
||||||
|
|
||||||
|
function migrateOldKeymap() {
|
||||||
|
if ('localStorage' in window && window['localStorage'] !== null) {
|
||||||
|
var oldKeyMap = localStorage.getItem("keymap");
|
||||||
|
if (oldKeyMap !== null) {
|
||||||
|
localStorage.removeItem("keymap");
|
||||||
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
|
currentEditorSettings.keymap = JSON.parse(oldKeyMap);
|
||||||
|
RED.settings.set('editor',currentEditorSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function init() {
|
||||||
|
// Migrate from pre-0.18
|
||||||
|
migrateOldKeymap();
|
||||||
|
|
||||||
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
|
var userKeymap = currentEditorSettings.keymap || {};
|
||||||
|
|
||||||
|
$.getJSON("red/keymap.json",function(data) {
|
||||||
|
for (var scope in data) {
|
||||||
|
if (data.hasOwnProperty(scope)) {
|
||||||
|
var keys = data[scope];
|
||||||
|
for (var key in keys) {
|
||||||
|
if (keys.hasOwnProperty(key)) {
|
||||||
|
if (!userKeymap.hasOwnProperty(keys[key])) {
|
||||||
|
addHandler(scope,key,keys[key],false);
|
||||||
|
}
|
||||||
|
defaultKeyMap[keys[key]] = {
|
||||||
|
scope:scope,
|
||||||
|
key:key,
|
||||||
|
user:false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var action in userKeymap) {
|
||||||
|
if (userKeymap.hasOwnProperty(action)) {
|
||||||
|
var obj = userKeymap[action];
|
||||||
|
if (obj.hasOwnProperty('key')) {
|
||||||
|
addHandler(obj.scope, obj.key, action, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
RED.userSettings.add({
|
||||||
|
id:'keyboard',
|
||||||
|
title: RED._("keyboard.keyboard"),
|
||||||
|
get: getSettingsPane,
|
||||||
|
focus: function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
$("#user-settings-tab-keyboard-filter").focus();
|
||||||
|
},200);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function revertToDefault(action) {
|
||||||
|
var currentAction = actionToKeyMap[action];
|
||||||
|
if (currentAction) {
|
||||||
|
removeHandler(currentAction.key);
|
||||||
|
}
|
||||||
|
if (defaultKeyMap.hasOwnProperty(action)) {
|
||||||
|
var obj = defaultKeyMap[action];
|
||||||
|
addHandler(obj.scope, obj.key, action, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function parseKeySpecifier(key) {
|
||||||
|
var parts = key.toLowerCase().split("-");
|
||||||
|
var modifiers = {};
|
||||||
|
var keycode;
|
||||||
|
var blank = 0;
|
||||||
|
for (var i=0;i<parts.length;i++) {
|
||||||
|
switch(parts[i]) {
|
||||||
|
case "ctrl":
|
||||||
|
case "cmd":
|
||||||
|
modifiers.ctrl = true;
|
||||||
|
modifiers.meta = true;
|
||||||
|
break;
|
||||||
|
case "alt":
|
||||||
|
modifiers.alt = true;
|
||||||
|
break;
|
||||||
|
case "shift":
|
||||||
|
modifiers.shift = true;
|
||||||
|
break;
|
||||||
|
case "":
|
||||||
|
blank++;
|
||||||
|
keycode = keyMap["-"];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (keyMap.hasOwnProperty(parts[i])) {
|
||||||
|
keycode = keyMap[parts[i]];
|
||||||
|
} else if (parts[i].length > 1) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
keycode = parts[i].toUpperCase().charCodeAt(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [keycode,modifiers];
|
||||||
|
}
|
||||||
|
|
||||||
function resolveKeyEvent(evt) {
|
function resolveKeyEvent(evt) {
|
||||||
var slot = handlers;
|
var slot = partialState||handlers;
|
||||||
if (evt.ctrlKey || evt.metaKey) {
|
if (evt.ctrlKey || evt.metaKey) {
|
||||||
slot = slot.ctrl;
|
slot = slot.ctrl;
|
||||||
}
|
}
|
||||||
@@ -28,9 +172,21 @@ RED.keyboard = (function() {
|
|||||||
if (slot && evt.altKey) {
|
if (slot && evt.altKey) {
|
||||||
slot = slot.alt;
|
slot = slot.alt;
|
||||||
}
|
}
|
||||||
if (slot && slot[evt.keyCode]) {
|
var keyCode = firefoxKeyCodeMap[evt.keyCode] || evt.keyCode;
|
||||||
var handler = slot[evt.keyCode];
|
if (slot && slot[keyCode]) {
|
||||||
if (handler.scope && handler.scope !== "*") {
|
var handler = slot[keyCode];
|
||||||
|
if (!handler.scope) {
|
||||||
|
if (partialState) {
|
||||||
|
partialState = null;
|
||||||
|
return resolveKeyEvent(evt);
|
||||||
|
} else if (Object.keys(handler).length > 0) {
|
||||||
|
partialState = handler;
|
||||||
|
evt.preventDefault();
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (handler.scope && handler.scope !== "*") {
|
||||||
var target = evt.target;
|
var target = evt.target;
|
||||||
while (target.nodeName !== 'BODY' && target.id !== handler.scope) {
|
while (target.nodeName !== 'BODY' && target.id !== handler.scope) {
|
||||||
target = target.parentElement;
|
target = target.parentElement;
|
||||||
@@ -39,121 +195,359 @@ RED.keyboard = (function() {
|
|||||||
handler = null;
|
handler = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
partialState = null;
|
||||||
return handler;
|
return handler;
|
||||||
|
} else if (partialState) {
|
||||||
|
partialState = null;
|
||||||
|
return resolveKeyEvent(evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d3.select(window).on("keydown",function() {
|
d3.select(window).on("keydown",function() {
|
||||||
|
if (metaKeyCodes[d3.event.keyCode]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var handler = resolveKeyEvent(d3.event);
|
var handler = resolveKeyEvent(d3.event);
|
||||||
if (handler && handler.ondown) {
|
if (handler && handler.ondown) {
|
||||||
handler.ondown();
|
if (typeof handler.ondown === "string") {
|
||||||
}
|
RED.actions.invoke(handler.ondown);
|
||||||
});
|
} else {
|
||||||
d3.select(window).on("keyup",function() {
|
handler.ondown();
|
||||||
var handler = resolveKeyEvent(d3.event);
|
}
|
||||||
if (handler && handler.onup) {
|
d3.event.preventDefault();
|
||||||
handler.onup();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function addHandler(scope,key,modifiers,ondown,onup) {
|
function addHandler(scope,key,modifiers,ondown) {
|
||||||
var mod = modifiers;
|
var mod = modifiers;
|
||||||
var cbdown = ondown;
|
var cbdown = ondown;
|
||||||
var cbup = onup;
|
if (typeof modifiers == "function" || typeof modifiers === "string") {
|
||||||
if (typeof modifiers == "function") {
|
|
||||||
mod = {};
|
mod = {};
|
||||||
cbdown = modifiers;
|
cbdown = modifiers;
|
||||||
cbup = ondown;
|
}
|
||||||
|
var keys = [];
|
||||||
|
var i=0;
|
||||||
|
if (typeof key === 'string') {
|
||||||
|
if (typeof cbdown === 'string') {
|
||||||
|
actionToKeyMap[cbdown] = {scope:scope,key:key};
|
||||||
|
if (typeof ondown === 'boolean') {
|
||||||
|
actionToKeyMap[cbdown].user = ondown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var parts = key.split(" ");
|
||||||
|
for (i=0;i<parts.length;i++) {
|
||||||
|
var parsedKey = parseKeySpecifier(parts[i]);
|
||||||
|
if (parsedKey) {
|
||||||
|
keys.push(parsedKey);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
keys.push([key,mod])
|
||||||
}
|
}
|
||||||
var slot = handlers;
|
var slot = handlers;
|
||||||
if (mod.ctrl) {
|
for (i=0;i<keys.length;i++) {
|
||||||
slot.ctrl = slot.ctrl||{};
|
key = keys[i][0];
|
||||||
slot = slot.ctrl;
|
mod = keys[i][1];
|
||||||
|
if (mod.ctrl) {
|
||||||
|
slot.ctrl = slot.ctrl||{};
|
||||||
|
slot = slot.ctrl;
|
||||||
|
}
|
||||||
|
if (mod.shift) {
|
||||||
|
slot.shift = slot.shift||{};
|
||||||
|
slot = slot.shift;
|
||||||
|
}
|
||||||
|
if (mod.alt) {
|
||||||
|
slot.alt = slot.alt||{};
|
||||||
|
slot = slot.alt;
|
||||||
|
}
|
||||||
|
slot[key] = slot[key] || {};
|
||||||
|
slot = slot[key];
|
||||||
|
//slot[key] = {scope: scope, ondown:cbdown};
|
||||||
}
|
}
|
||||||
if (mod.shift) {
|
slot.scope = scope;
|
||||||
slot.shift = slot.shift||{};
|
slot.ondown = cbdown;
|
||||||
slot = slot.shift;
|
|
||||||
}
|
|
||||||
if (mod.alt) {
|
|
||||||
slot.alt = slot.alt||{};
|
|
||||||
slot = slot.alt;
|
|
||||||
}
|
|
||||||
slot[key] = {scope: scope, ondown:cbdown, onup:cbup};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeHandler(key,modifiers) {
|
function removeHandler(key,modifiers) {
|
||||||
var mod = modifiers || {};
|
var mod = modifiers || {};
|
||||||
|
var keys = [];
|
||||||
|
var i=0;
|
||||||
|
if (typeof key === 'string') {
|
||||||
|
|
||||||
|
var parts = key.split(" ");
|
||||||
|
for (i=0;i<parts.length;i++) {
|
||||||
|
var parsedKey = parseKeySpecifier(parts[i]);
|
||||||
|
if (parsedKey) {
|
||||||
|
keys.push(parsedKey);
|
||||||
|
} else {
|
||||||
|
console.log("Unrecognised key specifier:",key)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
keys.push([key,mod])
|
||||||
|
}
|
||||||
var slot = handlers;
|
var slot = handlers;
|
||||||
if (mod.ctrl) {
|
for (i=0;i<keys.length;i++) {
|
||||||
slot = slot.ctrl;
|
key = keys[i][0];
|
||||||
|
mod = keys[i][1];
|
||||||
|
if (mod.ctrl) {
|
||||||
|
slot = slot.ctrl;
|
||||||
|
}
|
||||||
|
if (slot && mod.shift) {
|
||||||
|
slot = slot.shift;
|
||||||
|
}
|
||||||
|
if (slot && mod.alt) {
|
||||||
|
slot = slot.alt;
|
||||||
|
}
|
||||||
|
if (!slot[key]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
slot = slot[key];
|
||||||
}
|
}
|
||||||
if (slot && mod.shift) {
|
if (typeof slot.ondown === "string") {
|
||||||
slot = slot.shift;
|
if (typeof modifiers === 'boolean' && modifiers) {
|
||||||
|
actionToKeyMap[slot.ondown] = {user: modifiers}
|
||||||
|
} else {
|
||||||
|
delete actionToKeyMap[slot.ondown];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (slot && mod.alt) {
|
delete slot.scope;
|
||||||
slot = slot.alt;
|
delete slot.ondown;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cmdCtrlKey = '<span class="help-key">'+(isMac?'⌘':'Ctrl')+'</span>';
|
||||||
|
|
||||||
|
function formatKey(key) {
|
||||||
|
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/,"↓")
|
||||||
|
return '<span class="help-key-block"><span class="help-key">'+formattedKey.split(" ").join('</span> <span class="help-key">')+'</span></span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateKey(key) {
|
||||||
|
key = key.trim();
|
||||||
|
var parts = key.split(" ");
|
||||||
|
for (i=0;i<parts.length;i++) {
|
||||||
|
var parsedKey = parseKeySpecifier(parts[i]);
|
||||||
|
if (!parsedKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (slot) {
|
return true;
|
||||||
delete slot[key];
|
}
|
||||||
|
|
||||||
|
function editShortcut(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var container = $(this);
|
||||||
|
var object = container.data('data');
|
||||||
|
|
||||||
|
|
||||||
|
if (!container.hasClass('keyboard-shortcut-entry-expanded')) {
|
||||||
|
endEditShortcut();
|
||||||
|
|
||||||
|
var key = container.find(".keyboard-shortcut-entry-key");
|
||||||
|
var scope = container.find(".keyboard-shortcut-entry-scope");
|
||||||
|
container.addClass('keyboard-shortcut-entry-expanded');
|
||||||
|
|
||||||
|
var keyInput = $('<input type="text">').attr('placeholder',RED._('keyboard.unassigned')).val(object.key||"").appendTo(key);
|
||||||
|
keyInput.on("keyup",function(e) {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
return endEditShortcut();
|
||||||
|
}
|
||||||
|
var currentVal = $(this).val();
|
||||||
|
currentVal = currentVal.trim();
|
||||||
|
var valid = (currentVal === "" || RED.keyboard.validateKey(currentVal));
|
||||||
|
$(this).toggleClass("input-error",!valid);
|
||||||
|
})
|
||||||
|
|
||||||
|
var scopeSelect = $('<select><option value="*" data-i18n="keyboard.global"></option><option value="workspace" data-i18n="keyboard.workspace"></option></select>').appendTo(scope);
|
||||||
|
scopeSelect.i18n();
|
||||||
|
scopeSelect.val(object.scope||'*');
|
||||||
|
|
||||||
|
var div = $('<div class="keyboard-shortcut-edit button-group-vertical"></div>').appendTo(scope);
|
||||||
|
var okButton = $('<button class="editor-button editor-button-small"><i class="fa fa-check"></i></button>').appendTo(div);
|
||||||
|
var revertButton = $('<button class="editor-button editor-button-small"><i class="fa fa-reply"></i></button>').appendTo(div);
|
||||||
|
|
||||||
|
okButton.click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
endEditShortcut();
|
||||||
|
});
|
||||||
|
revertButton.click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
RED.keyboard.revertToDefault(object.id);
|
||||||
|
container.empty();
|
||||||
|
container.removeClass('keyboard-shortcut-entry-expanded');
|
||||||
|
var shortcut = RED.keyboard.getShortcut(object.id);
|
||||||
|
var userKeymap = RED.settings.get('keymap') || {};
|
||||||
|
|
||||||
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
|
var userKeymap = currentEditorSettings.keymap || {};
|
||||||
|
userKeymap[object.id] = null;
|
||||||
|
currentEditorSettings.keymap = userKeymap;
|
||||||
|
RED.settings.set('editor',currentEditorSettings);
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
id:object.id,
|
||||||
|
scope:shortcut?shortcut.scope:undefined,
|
||||||
|
key:shortcut?shortcut.key:undefined,
|
||||||
|
user:shortcut?shortcut.user:undefined
|
||||||
|
}
|
||||||
|
buildShortcutRow(container,obj);
|
||||||
|
})
|
||||||
|
|
||||||
|
keyInput.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialog = null;
|
function endEditShortcut(cancel) {
|
||||||
|
var container = $('.keyboard-shortcut-entry-expanded');
|
||||||
|
if (container.length === 1) {
|
||||||
|
var object = container.data('data');
|
||||||
|
var keyInput = container.find(".keyboard-shortcut-entry-key input");
|
||||||
|
var scopeSelect = container.find(".keyboard-shortcut-entry-scope select");
|
||||||
|
if (!cancel) {
|
||||||
|
var key = keyInput.val().trim();
|
||||||
|
var scope = scopeSelect.val();
|
||||||
|
var valid = (key === "" || RED.keyboard.validateKey(key));
|
||||||
|
if (valid) {
|
||||||
|
var current = RED.keyboard.getShortcut(object.id);
|
||||||
|
if ((!current && key) || (current && (current.scope !== scope || current.key !== key))) {
|
||||||
|
var keyDiv = container.find(".keyboard-shortcut-entry-key");
|
||||||
|
var scopeDiv = container.find(".keyboard-shortcut-entry-scope");
|
||||||
|
keyDiv.empty();
|
||||||
|
scopeDiv.empty();
|
||||||
|
if (object.key) {
|
||||||
|
RED.keyboard.remove(object.key,true);
|
||||||
|
}
|
||||||
|
container.find(".keyboard-shortcut-entry-text i").css("opacity",1);
|
||||||
|
if (key === "") {
|
||||||
|
keyDiv.parent().addClass("keyboard-shortcut-entry-unassigned");
|
||||||
|
keyDiv.append($('<span>').text(RED._('keyboard.unassigned')) );
|
||||||
|
delete object.key;
|
||||||
|
delete object.scope;
|
||||||
|
} else {
|
||||||
|
keyDiv.parent().removeClass("keyboard-shortcut-entry-unassigned");
|
||||||
|
keyDiv.append(RED.keyboard.formatKey(key))
|
||||||
|
$("<span>").text(scope).appendTo(scopeDiv);
|
||||||
|
object.key = key;
|
||||||
|
object.scope = scope;
|
||||||
|
RED.keyboard.add(object.scope,object.key,object.id,true);
|
||||||
|
}
|
||||||
|
|
||||||
function showKeyboardHelp() {
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
if (!RED.settings.theme("menu.menu-item-keyboard-shortcuts",true)) {
|
var userKeymap = currentEditorSettings.keymap || {};
|
||||||
return;
|
userKeymap[object.id] = RED.keyboard.getShortcut(object.id);
|
||||||
|
currentEditorSettings.keymap = userKeymap;
|
||||||
|
RED.settings.set('editor',currentEditorSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keyInput.remove();
|
||||||
|
scopeSelect.remove();
|
||||||
|
$('.keyboard-shortcut-edit').remove();
|
||||||
|
container.removeClass('keyboard-shortcut-entry-expanded');
|
||||||
}
|
}
|
||||||
if (!dialog) {
|
}
|
||||||
dialog = $('<div id="keyboard-help-dialog" class="hide">'+
|
|
||||||
'<div style="vertical-align: top;display:inline-block; box-sizing: border-box; width:50%; padding: 10px;">'+
|
function buildShortcutRow(container,object) {
|
||||||
'<table class="keyboard-shortcuts">'+
|
var item = $('<div class="keyboard-shortcut-entry">').appendTo(container);
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">a</span></td><td>'+RED._("keyboard.selectAll")+'</td></tr>'+
|
container.data('data',object);
|
||||||
'<tr><td><span class="help-key">Shift</span> + <span class="help-key">Click</span></td><td>'+RED._("keyboard.selectAllConnected")+'</td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">Click</span></td><td>'+RED._("keyboard.addRemoveNode")+'</td></tr>'+
|
var text = object.id.replace(/(^.+:([a-z]))|(-([a-z]))/g,function() {
|
||||||
'<tr><td> </td><td></td></tr>'+
|
if (arguments[5] === 0) {
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">i</span></td><td>'+RED._("keyboard.importNode")+'</td></tr>'+
|
return arguments[2].toUpperCase();
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">e</span></td><td>'+RED._("keyboard.exportNode")+'</td></tr>'+
|
} else {
|
||||||
'<tr><td> </td><td></td></tr>'+
|
return " "+arguments[4].toUpperCase();
|
||||||
'<tr><td><span class="help-key"> ← </span> <span class="help-key"> ↑ </span> <span class="help-key"> → </span> <span class="help-key"> ↓ </span></td><td>'+RED._("keyboard.nudgeNode")+'</td></tr>'+
|
}
|
||||||
'<tr><td><span class="help-key">Shift</span> + <span class="help-key"> ← </span></td><td rowspan="4">'+RED._("keyboard.moveNode")+'</td></tr>'+
|
});
|
||||||
'<tr><td><span class="help-key">Shift</span> + <span class="help-key"> ↑ </span></td></tr>'+
|
var label = $('<div>').addClass("keyboard-shortcut-entry-text").text(text).appendTo(item);
|
||||||
'<tr><td><span class="help-key">Shift</span> + <span class="help-key"> → </span></td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Shift</span> + <span class="help-key"> ↓ </span></td></tr>'+
|
var user = $('<i class="fa fa-user"></i>').prependTo(label);
|
||||||
'</table>'+
|
|
||||||
'</div>'+
|
if (!object.user) {
|
||||||
'<div style="vertical-align: top;display:inline-block; box-sizing: border-box; width:50%; padding: 10px;">'+
|
user.css("opacity",0);
|
||||||
'<table class="keyboard-shortcuts">'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">Space</span></td><td>'+RED._("keyboard.toggleSidebar")+'</td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">.</span></td><td>'+RED._("keyboard.searchBox")+'</td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">Shift</span> + <span class="help-key">p</span></td><td>'+RED._("keyboard.managePalette")+'</td></tr>'+
|
|
||||||
'<tr><td></td><td></td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Delete</span></td><td rowspan="2">'+RED._("keyboard.deleteSelected")+'</td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Backspace</span></td></tr>'+
|
|
||||||
'<tr><td></td><td></td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">c</span></td><td>'+RED._("keyboard.copyNode")+'</td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">x</span></td><td>'+RED._("keyboard.cutNode")+'</td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">v</span></td><td>'+RED._("keyboard.pasteNode")+'</td></tr>'+
|
|
||||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">z</span></td><td>'+RED._("keyboard.undoChange")+'</td></tr>'+
|
|
||||||
'</table>'+
|
|
||||||
'</div>'+
|
|
||||||
'</div>')
|
|
||||||
.appendTo("body")
|
|
||||||
.dialog({
|
|
||||||
modal: true,
|
|
||||||
autoOpen: false,
|
|
||||||
width: "800",
|
|
||||||
title:"Keyboard shortcuts",
|
|
||||||
resizable: false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.dialog("open");
|
var key = $('<div class="keyboard-shortcut-entry-key">').appendTo(item);
|
||||||
|
if (object.key) {
|
||||||
|
key.append(RED.keyboard.formatKey(object.key));
|
||||||
|
} else {
|
||||||
|
item.addClass("keyboard-shortcut-entry-unassigned");
|
||||||
|
key.append($('<span>').text(RED._('keyboard.unassigned')) );
|
||||||
|
}
|
||||||
|
|
||||||
|
var scope = $('<div class="keyboard-shortcut-entry-scope">').appendTo(item);
|
||||||
|
|
||||||
|
$("<span>").text(object.scope === '*'?'global':object.scope||"").appendTo(scope);
|
||||||
|
container.click(editShortcut);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSettingsPane() {
|
||||||
|
var pane = $('<div id="user-settings-tab-keyboard"></div>');
|
||||||
|
|
||||||
|
$('<div class="keyboard-shortcut-entry keyboard-shortcut-list-header">'+
|
||||||
|
'<div class="keyboard-shortcut-entry-key keyboard-shortcut-entry-text"><input id="user-settings-tab-keyboard-filter" type="text" data-i18n="[placeholder]keyboard.filterActions"></div>'+
|
||||||
|
'<div class="keyboard-shortcut-entry-key" data-i18n="keyboard.shortcut"></div>'+
|
||||||
|
'<div class="keyboard-shortcut-entry-scope" data-i18n="keyboard.scope"></div>'+
|
||||||
|
'</div>').appendTo(pane);
|
||||||
|
|
||||||
|
pane.find("input").searchBox({
|
||||||
|
delay: 100,
|
||||||
|
change: function() {
|
||||||
|
var filterValue = $(this).val().trim();
|
||||||
|
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 shortcutList = $('<ol class="keyboard-shortcut-list"></ol>').css({
|
||||||
|
position: "absolute",
|
||||||
|
top: "32px",
|
||||||
|
bottom: "0",
|
||||||
|
left: "0",
|
||||||
|
right: "0"
|
||||||
|
}).appendTo(pane).editableList({
|
||||||
|
addButton: false,
|
||||||
|
scrollOnAdd: false,
|
||||||
|
addItem: function(container,i,object) {
|
||||||
|
buildShortcutRow(container,object);
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
shortcuts.forEach(function(s) {
|
||||||
|
shortcutList.editableList('addItem',s);
|
||||||
|
});
|
||||||
|
return pane;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
init: init,
|
||||||
add: addHandler,
|
add: addHandler,
|
||||||
remove: removeHandler,
|
remove: removeHandler,
|
||||||
showHelp: showKeyboardHelp
|
getShortcut: function(actionName) {
|
||||||
|
return actionToKeyMap[actionName];
|
||||||
|
},
|
||||||
|
revertToDefault: revertToDefault,
|
||||||
|
formatKey: formatKey,
|
||||||
|
validateKey: validateKey
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
**/
|
**/
|
||||||
RED.library = (function() {
|
RED.library = (function() {
|
||||||
|
|
||||||
|
|
||||||
var exportToLibraryDialog;
|
var exportToLibraryDialog;
|
||||||
|
var elementPrefix = "node-input-";
|
||||||
|
|
||||||
function loadFlowLibrary() {
|
function loadFlowLibrary() {
|
||||||
$.getJSON("library/flows",function(data) {
|
$.getJSON("library/flows",function(data) {
|
||||||
@@ -38,7 +38,7 @@ RED.library = (function() {
|
|||||||
li.className = "dropdown-submenu pull-left";
|
li.className = "dropdown-submenu pull-left";
|
||||||
a = document.createElement("a");
|
a = document.createElement("a");
|
||||||
a.href="#";
|
a.href="#";
|
||||||
var label = i.replace(/^node-red-contrib-/,"").replace(/^node-red-node-/,"").replace(/-/," ").replace(/_/," ");
|
var label = i.replace(/^@.*\//,"").replace(/^node-red-contrib-/,"").replace(/^node-red-node-/,"").replace(/-/," ").replace(/_/," ");
|
||||||
a.innerHTML = label;
|
a.innerHTML = label;
|
||||||
li.appendChild(a);
|
li.appendChild(a);
|
||||||
li.appendChild(buildMenu(data.d[i],root+(root!==""?"/":"")+i));
|
li.appendChild(buildMenu(data.d[i],root+(root!==""?"/":"")+i));
|
||||||
@@ -86,6 +86,7 @@ RED.library = (function() {
|
|||||||
var libraryData = {};
|
var libraryData = {};
|
||||||
var selectedLibraryItem = null;
|
var selectedLibraryItem = null;
|
||||||
var libraryEditor = null;
|
var libraryEditor = null;
|
||||||
|
elementPrefix = options.elementPrefix || "node-input-";
|
||||||
|
|
||||||
// Orion editor has set/getText
|
// Orion editor has set/getText
|
||||||
// ACE editor has set/getValue
|
// ACE editor has set/getValue
|
||||||
@@ -110,7 +111,7 @@ RED.library = (function() {
|
|||||||
function buildFileList(root,data) {
|
function buildFileList(root,data) {
|
||||||
var ul = document.createElement("ul");
|
var ul = document.createElement("ul");
|
||||||
var li;
|
var li;
|
||||||
for (var i=0;i<data.length;i++) {
|
for (var i=0; i<data.length; i++) {
|
||||||
var v = data[i];
|
var v = data[i];
|
||||||
if (typeof v === "string") {
|
if (typeof v === "string") {
|
||||||
// directory
|
// directory
|
||||||
@@ -157,8 +158,8 @@ RED.library = (function() {
|
|||||||
return ul;
|
return ul;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#node-input-name').css("width","60%").after(
|
$('#'+elementPrefix+"name").css("width","calc(100% - 52px)").after(
|
||||||
'<div class="btn-group" style="margin-left: 5px;">'+
|
'<div class="btn-group" style="margin-left:5px;">'+
|
||||||
'<a id="node-input-'+options.type+'-lookup" class="editor-button" data-toggle="dropdown"><i class="fa fa-book"></i> <i class="fa fa-caret-down"></i></a>'+
|
'<a id="node-input-'+options.type+'-lookup" class="editor-button" data-toggle="dropdown"><i class="fa fa-book"></i> <i class="fa fa-caret-down"></i></a>'+
|
||||||
'<ul class="dropdown-menu pull-right" role="menu">'+
|
'<ul class="dropdown-menu pull-right" role="menu">'+
|
||||||
'<li><a id="node-input-'+options.type+'-menu-open-library" tabindex="-1" href="#">'+RED._("library.openLibrary")+'</a></li>'+
|
'<li><a id="node-input-'+options.type+'-menu-open-library" tabindex="-1" href="#">'+RED._("library.openLibrary")+'</a></li>'+
|
||||||
@@ -166,8 +167,6 @@ RED.library = (function() {
|
|||||||
'</ul></div>'
|
'</ul></div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#node-input-'+options.type+'-menu-open-library').click(function(e) {
|
$('#node-input-'+options.type+'-menu-open-library').click(function(e) {
|
||||||
$("#node-select-library").children().remove();
|
$("#node-select-library").children().remove();
|
||||||
var bc = $("#node-dialog-library-breadcrumbs");
|
var bc = $("#node-dialog-library-breadcrumbs");
|
||||||
@@ -189,7 +188,7 @@ RED.library = (function() {
|
|||||||
|
|
||||||
$('#node-input-'+options.type+'-menu-save-library').click(function(e) {
|
$('#node-input-'+options.type+'-menu-save-library').click(function(e) {
|
||||||
//var found = false;
|
//var found = false;
|
||||||
var name = $("#node-input-name").val().replace(/(^\s*)|(\s*$)/g,"");
|
var name = $("#"+elementPrefix+"name").val().replace(/(^\s*)|(\s*$)/g,"");
|
||||||
|
|
||||||
//var buildPathList = function(data,root) {
|
//var buildPathList = function(data,root) {
|
||||||
// var paths = [];
|
// var paths = [];
|
||||||
@@ -264,9 +263,9 @@ RED.library = (function() {
|
|||||||
class: "primary",
|
class: "primary",
|
||||||
click: function() {
|
click: function() {
|
||||||
if (selectedLibraryItem) {
|
if (selectedLibraryItem) {
|
||||||
for (var i=0;i<options.fields.length;i++) {
|
for (var i=0; i<options.fields.length; i++) {
|
||||||
var field = options.fields[i];
|
var field = options.fields[i];
|
||||||
$("#node-input-"+field).val(selectedLibraryItem[field]);
|
$("#"+elementPrefix+field).val(selectedLibraryItem[field]);
|
||||||
}
|
}
|
||||||
options.editor.setValue(libraryEditor.getValue(),-1);
|
options.editor.setValue(libraryEditor.getValue(),-1);
|
||||||
}
|
}
|
||||||
@@ -288,7 +287,7 @@ RED.library = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function saveToLibrary(overwrite) {
|
function saveToLibrary(overwrite) {
|
||||||
var name = $("#node-input-name").val().replace(/(^\s*)|(\s*$)/g,"");
|
var name = $("#"+elementPrefix+"name").val().replace(/(^\s*)|(\s*$)/g,"");
|
||||||
if (name === "") {
|
if (name === "") {
|
||||||
name = RED._("library.unnamedType",{type:options.type});
|
name = RED._("library.unnamedType",{type:options.type});
|
||||||
}
|
}
|
||||||
@@ -327,12 +326,12 @@ RED.library = (function() {
|
|||||||
}
|
}
|
||||||
var queryArgs = [];
|
var queryArgs = [];
|
||||||
var data = {};
|
var data = {};
|
||||||
for (var i=0;i<options.fields.length;i++) {
|
for (var i=0; i<options.fields.length; i++) {
|
||||||
var field = options.fields[i];
|
var field = options.fields[i];
|
||||||
if (field == "name") {
|
if (field == "name") {
|
||||||
data.name = name;
|
data.name = name;
|
||||||
} else {
|
} else {
|
||||||
data[field] = $("#node-input-"+field).val();
|
data[field] = $("#"+elementPrefix+field).val();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,14 +409,13 @@ RED.library = (function() {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
init: function() {
|
init: function() {
|
||||||
|
|
||||||
|
RED.actions.add("core:library-export",exportFlow);
|
||||||
|
|
||||||
RED.events.on("view:selection-changed",function(selection) {
|
RED.events.on("view:selection-changed",function(selection) {
|
||||||
if (!selection.nodes) {
|
if (!selection.nodes) {
|
||||||
RED.menu.setDisabled("menu-item-export",true);
|
|
||||||
RED.menu.setDisabled("menu-item-export-clipboard",true);
|
|
||||||
RED.menu.setDisabled("menu-item-export-library",true);
|
RED.menu.setDisabled("menu-item-export-library",true);
|
||||||
} else {
|
} else {
|
||||||
RED.menu.setDisabled("menu-item-export",false);
|
|
||||||
RED.menu.setDisabled("menu-item-export-clipboard",false);
|
|
||||||
RED.menu.setDisabled("menu-item-export-library",false);
|
RED.menu.setDisabled("menu-item-export-library",false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -13,10 +13,49 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
RED.notify = (function() {
|
RED.notifications = (function() {
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Example usage for a modal dialog with buttons
|
||||||
|
var myNotification = RED.notify("This is the message to display",{
|
||||||
|
modal: true,
|
||||||
|
fixed: true,
|
||||||
|
type: 'warning',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: "cancel",
|
||||||
|
click: function(e) {
|
||||||
|
myNotification.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "okay",
|
||||||
|
class:"primary",
|
||||||
|
click: function(e) {
|
||||||
|
myNotification.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
var persistentNotifications = {};
|
||||||
|
|
||||||
var currentNotifications = [];
|
var currentNotifications = [];
|
||||||
var c = 0;
|
var c = 0;
|
||||||
return function(msg,type,fixed,timeout) {
|
function notify(msg,type,fixed,timeout) {
|
||||||
|
var options = {};
|
||||||
|
if (type !== null && typeof type === 'object') {
|
||||||
|
options = type;
|
||||||
|
fixed = options.fixed;
|
||||||
|
timeout = options.timeout;
|
||||||
|
type = options.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.modal) {
|
||||||
|
$("#full-shade").show();
|
||||||
|
}
|
||||||
|
|
||||||
if (currentNotifications.length > 4) {
|
if (currentNotifications.length > 4) {
|
||||||
var ll = currentNotifications.length;
|
var ll = currentNotifications.length;
|
||||||
for (var i = 0;ll > 4 && i<currentNotifications.length;i+=1) {
|
for (var i = 0;ll > 4 && i<currentNotifications.length;i+=1) {
|
||||||
@@ -35,27 +74,126 @@ RED.notify = (function() {
|
|||||||
if (type) {
|
if (type) {
|
||||||
n.className = "notification notification-"+type;
|
n.className = "notification notification-"+type;
|
||||||
}
|
}
|
||||||
|
if (options.width) {
|
||||||
|
var parentWidth = $("#notifications").width();
|
||||||
|
if (options.width > parentWidth) {
|
||||||
|
var margin = -(options.width-parentWidth)/2;
|
||||||
|
$(n).css({
|
||||||
|
width: options.width+"px",
|
||||||
|
marginLeft: margin+"px"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
n.style.display = "none";
|
n.style.display = "none";
|
||||||
n.innerHTML = msg;
|
if (typeof msg === "string") {
|
||||||
|
if (!/<p>/i.test(msg)) {
|
||||||
|
msg = "<p>"+msg+"</p>";
|
||||||
|
}
|
||||||
|
n.innerHTML = msg;
|
||||||
|
} else {
|
||||||
|
$(n).append(msg);
|
||||||
|
}
|
||||||
|
if (options.buttons) {
|
||||||
|
var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(n)
|
||||||
|
options.buttons.forEach(function(buttonDef) {
|
||||||
|
var b = $('<button>').html(buttonDef.text).click(buttonDef.click).appendTo(buttonSet);
|
||||||
|
if (buttonDef.id) {
|
||||||
|
b.attr('id',buttonDef.id);
|
||||||
|
}
|
||||||
|
if (buttonDef.class) {
|
||||||
|
b.addClass(buttonDef.class);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$("#notifications").append(n);
|
$("#notifications").append(n);
|
||||||
$(n).slideDown(300);
|
$(n).slideDown(300);
|
||||||
n.close = (function() {
|
n.close = (function() {
|
||||||
var nn = n;
|
var nn = n;
|
||||||
return function() {
|
return function() {
|
||||||
|
if (nn.closed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nn.closed = true;
|
||||||
currentNotifications.splice(currentNotifications.indexOf(nn),1);
|
currentNotifications.splice(currentNotifications.indexOf(nn),1);
|
||||||
|
if (options.id) {
|
||||||
|
delete persistentNotifications[options.id];
|
||||||
|
if (Object.keys(persistentNotifications).length === 0) {
|
||||||
|
notificationButtonWrapper.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
$(nn).slideUp(300, function() {
|
$(nn).slideUp(300, function() {
|
||||||
nn.parentNode.removeChild(nn);
|
nn.parentNode.removeChild(nn);
|
||||||
});
|
});
|
||||||
|
if (options.modal) {
|
||||||
|
$("#full-shade").hide();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
n.hideNotification = (function() {
|
||||||
|
var nn = n;
|
||||||
|
return function() {
|
||||||
|
if (nn.closed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nn.hidden = true;
|
||||||
|
$(nn).slideUp(300);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
n.showNotification = (function() {
|
||||||
|
var nn = n;
|
||||||
|
return function() {
|
||||||
|
if (nn.closed || !nn.hidden) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nn.hidden = false;
|
||||||
|
$(nn).slideDown(300);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
n.update = (function() {
|
n.update = (function() {
|
||||||
var nn = n;
|
var nn = n;
|
||||||
return function(msg) {
|
return function(msg,options) {
|
||||||
nn.innerHTML = msg;
|
if (typeof msg === "string") {
|
||||||
|
if (!/<p>/i.test(msg)) {
|
||||||
|
msg = "<p>"+msg+"</p>";
|
||||||
|
}
|
||||||
|
nn.innerHTML = msg;
|
||||||
|
} else {
|
||||||
|
$(nn).empty().append(msg);
|
||||||
|
}
|
||||||
|
var timeout;
|
||||||
|
if (typeof options === 'number') {
|
||||||
|
timeout = options;
|
||||||
|
} else if (options !== undefined) {
|
||||||
|
timeout = options.timeout;
|
||||||
|
if (options.buttons) {
|
||||||
|
var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(nn)
|
||||||
|
options.buttons.forEach(function(buttonDef) {
|
||||||
|
var b = $('<button>').text(buttonDef.text).click(buttonDef.click).appendTo(buttonSet);
|
||||||
|
if (buttonDef.id) {
|
||||||
|
b.attr('id',buttonDef.id);
|
||||||
|
}
|
||||||
|
if (buttonDef.class) {
|
||||||
|
b.addClass(buttonDef.class);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (timeout !== undefined && timeout > 0) {
|
||||||
|
window.clearTimeout(nn.timeoutid);
|
||||||
|
nn.timeoutid = window.setTimeout(nn.close,timeout);
|
||||||
|
} else {
|
||||||
|
window.clearTimeout(nn.timeoutid);
|
||||||
|
}
|
||||||
|
if (nn.hidden) {
|
||||||
|
nn.showNotification();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
if (!fixed) {
|
if (!fixed) {
|
||||||
$(n).click((function() {
|
$(n).click((function() {
|
||||||
var nn = n;
|
var nn = n;
|
||||||
@@ -64,10 +202,48 @@ RED.notify = (function() {
|
|||||||
window.clearTimeout(nn.timeoutid);
|
window.clearTimeout(nn.timeoutid);
|
||||||
};
|
};
|
||||||
})());
|
})());
|
||||||
n.timeoutid = window.setTimeout(n.close,timeout||3000);
|
n.timeoutid = window.setTimeout(n.close,timeout||5000);
|
||||||
}
|
}
|
||||||
currentNotifications.push(n);
|
currentNotifications.push(n);
|
||||||
|
if (options.id) {
|
||||||
|
persistentNotifications[options.id] = n;
|
||||||
|
notificationButtonWrapper.show();
|
||||||
|
}
|
||||||
c+=1;
|
c+=1;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RED.notify = notify;
|
||||||
|
|
||||||
|
|
||||||
|
function hidePersistent() {
|
||||||
|
for(var i in persistentNotifications) {
|
||||||
|
if (persistentNotifications.hasOwnProperty(i)) {
|
||||||
|
persistentNotifications[i].hideNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showPersistent() {
|
||||||
|
for(var i in persistentNotifications) {
|
||||||
|
if (persistentNotifications.hasOwnProperty(i)) {
|
||||||
|
persistentNotifications[i].showNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var notificationButtonWrapper;
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
notificationButtonWrapper = $('<li>'+
|
||||||
|
'<a id="btn-notifications" class="button" href="#">'+
|
||||||
|
'<i class="fa fa-warning"></i>'+
|
||||||
|
'</a>'+
|
||||||
|
'</li>').prependTo(".header-toolbar").hide();
|
||||||
|
$('#btn-notifications').click(function() {
|
||||||
|
showPersistent();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
notify: notify
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -31,6 +31,17 @@ RED.palette.editor = (function() {
|
|||||||
var eventTimers = {};
|
var eventTimers = {};
|
||||||
var activeFilter = "";
|
var activeFilter = "";
|
||||||
|
|
||||||
|
function semVerCompare(A,B) {
|
||||||
|
var aParts = A.split(".").map(function(m) { return parseInt(m);});
|
||||||
|
var bParts = B.split(".").map(function(m) { return parseInt(m);});
|
||||||
|
for (var i=0;i<3;i++) {
|
||||||
|
var j = aParts[i]-bParts[i];
|
||||||
|
if (j<0) { return -1 }
|
||||||
|
if (j>0) { return 1 }
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
function delayCallback(start,callback) {
|
function delayCallback(start,callback) {
|
||||||
var delta = Date.now() - start;
|
var delta = Date.now() - start;
|
||||||
if (delta < 300) {
|
if (delta < 300) {
|
||||||
@@ -64,20 +75,21 @@ RED.palette.editor = (function() {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function installNodeModule(id,shade,callback) {
|
function installNodeModule(id,version,callback) {
|
||||||
shade.show();
|
var requestBody = {
|
||||||
|
module: id
|
||||||
|
};
|
||||||
|
if (version) {
|
||||||
|
requestBody.version = version;
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"nodes",
|
url:"nodes",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify(requestBody),
|
||||||
module: id
|
|
||||||
}),
|
|
||||||
contentType: "application/json; charset=utf-8"
|
contentType: "application/json; charset=utf-8"
|
||||||
}).done(function(data,textStatus,xhr) {
|
}).done(function(data,textStatus,xhr) {
|
||||||
shade.hide();
|
|
||||||
callback();
|
callback();
|
||||||
}).fail(function(xhr,textStatus,err) {
|
}).fail(function(xhr,textStatus,err) {
|
||||||
shade.hide();
|
|
||||||
callback(xhr);
|
callback(xhr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -189,16 +201,15 @@ RED.palette.editor = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodeEntries[module].index = index.join(",").toLowerCase();
|
nodeEntries[module].index = index.join(",").toLowerCase();
|
||||||
|
|
||||||
nodeList.editableList('addItem', nodeEntries[module]);
|
nodeList.editableList('addItem', nodeEntries[module]);
|
||||||
//console.log(nodeList.editableList('items'));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var moduleInfo = nodeEntries[module].info;
|
var moduleInfo = nodeEntries[module].info;
|
||||||
var nodeEntry = nodeEntries[module].elements;
|
var nodeEntry = nodeEntries[module].elements;
|
||||||
if (nodeEntry) {
|
if (nodeEntry) {
|
||||||
var activeTypeCount = 0;
|
var activeTypeCount = 0;
|
||||||
var typeCount = 0;
|
var typeCount = 0;
|
||||||
|
var errorCount = 0;
|
||||||
|
nodeEntry.errorList.empty();
|
||||||
nodeEntries[module].totalUseCount = 0;
|
nodeEntries[module].totalUseCount = 0;
|
||||||
nodeEntries[module].setUseCount = {};
|
nodeEntries[module].setUseCount = {};
|
||||||
|
|
||||||
@@ -207,7 +218,10 @@ RED.palette.editor = (function() {
|
|||||||
var inUseCount = 0;
|
var inUseCount = 0;
|
||||||
var set = moduleInfo.sets[setName];
|
var set = moduleInfo.sets[setName];
|
||||||
var setElements = nodeEntry.sets[setName];
|
var setElements = nodeEntry.sets[setName];
|
||||||
|
if (set.err) {
|
||||||
|
errorCount++;
|
||||||
|
$("<li>").text(set.err).appendTo(nodeEntry.errorList);
|
||||||
|
}
|
||||||
if (set.enabled) {
|
if (set.enabled) {
|
||||||
activeTypeCount += set.types.length;
|
activeTypeCount += set.types.length;
|
||||||
}
|
}
|
||||||
@@ -219,7 +233,7 @@ RED.palette.editor = (function() {
|
|||||||
if (set.enabled) {
|
if (set.enabled) {
|
||||||
var def = RED.nodes.getType(t);
|
var def = RED.nodes.getType(t);
|
||||||
if (def && def.color) {
|
if (def && def.color) {
|
||||||
swatch.css({background:def.color});
|
swatch.css({background:RED.utils.getNodeColor(t,def)});
|
||||||
swatch.css({border: "1px solid "+getContrastingBorder(swatch.css('backgroundColor'))})
|
swatch.css({border: "1px solid "+getContrastingBorder(swatch.css('backgroundColor'))})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -233,94 +247,61 @@ RED.palette.editor = (function() {
|
|||||||
nodeEntries[module].totalUseCount += inUseCount;
|
nodeEntries[module].totalUseCount += inUseCount;
|
||||||
|
|
||||||
if (inUseCount > 0) {
|
if (inUseCount > 0) {
|
||||||
setElements.enableButton.html(RED._('palette.editor.inuse'));
|
setElements.enableButton.text(RED._('palette.editor.inuse'));
|
||||||
setElements.enableButton.addClass('disabled');
|
setElements.enableButton.addClass('disabled');
|
||||||
} else {
|
} else {
|
||||||
setElements.enableButton.removeClass('disabled');
|
setElements.enableButton.removeClass('disabled');
|
||||||
if (set.enabled) {
|
if (set.enabled) {
|
||||||
setElements.enableButton.html(RED._('palette.editor.disable'));
|
setElements.enableButton.text(RED._('palette.editor.disable'));
|
||||||
} else {
|
} else {
|
||||||
setElements.enableButton.html(RED._('palette.editor.enable'));
|
setElements.enableButton.text(RED._('palette.editor.enable'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setElements.setRow.toggleClass("palette-module-set-disabled",!set.enabled);
|
setElements.setRow.toggleClass("palette-module-set-disabled",!set.enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorCount === 0) {
|
||||||
|
nodeEntry.errorRow.hide()
|
||||||
|
} else {
|
||||||
|
nodeEntry.errorRow.show();
|
||||||
|
}
|
||||||
|
|
||||||
var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount;
|
var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount;
|
||||||
nodeEntry.setCount.html(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount}));
|
nodeEntry.setCount.text(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount}));
|
||||||
|
|
||||||
if (nodeEntries[module].totalUseCount > 0) {
|
if (nodeEntries[module].totalUseCount > 0) {
|
||||||
nodeEntry.enableButton.html(RED._('palette.editor.inuse'));
|
nodeEntry.enableButton.text(RED._('palette.editor.inuse'));
|
||||||
nodeEntry.enableButton.addClass('disabled');
|
nodeEntry.enableButton.addClass('disabled');
|
||||||
nodeEntry.removeButton.hide();
|
nodeEntry.removeButton.hide();
|
||||||
} else {
|
} else {
|
||||||
nodeEntry.enableButton.removeClass('disabled');
|
nodeEntry.enableButton.removeClass('disabled');
|
||||||
if (moduleInfo.local) {
|
if (moduleInfo.local) {
|
||||||
nodeEntry.removeButton.show();
|
nodeEntry.removeButton.css('display', 'inline-block');
|
||||||
}
|
}
|
||||||
if (activeTypeCount === 0) {
|
if (activeTypeCount === 0) {
|
||||||
nodeEntry.enableButton.html(RED._('palette.editor.enableall'));
|
nodeEntry.enableButton.text(RED._('palette.editor.enableall'));
|
||||||
} else {
|
} else {
|
||||||
nodeEntry.enableButton.html(RED._('palette.editor.disableall'));
|
nodeEntry.enableButton.text(RED._('palette.editor.disableall'));
|
||||||
}
|
}
|
||||||
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (moduleInfo.pending_version) {
|
||||||
nodeEntry.updateButton.hide();
|
nodeEntry.versionSpan.html(moduleInfo.version+' <i class="fa fa-long-arrow-right"></i> '+moduleInfo.pending_version).appendTo(nodeEntry.metaRow)
|
||||||
// if (loadedIndex.hasOwnProperty(module)) {
|
nodeEntry.updateButton.text(RED._('palette.editor.updated')).addClass('disabled').show();
|
||||||
// if (moduleInfo.version !== loadedIndex[module].version) {
|
} else if (loadedIndex.hasOwnProperty(module)) {
|
||||||
// nodeEntry.updateButton.show();
|
if (semVerCompare(loadedIndex[module].version,moduleInfo.version) === 1) {
|
||||||
// nodeEntry.updateButton.html(RED._('palette.editor.update',{version:loadedIndex[module].version}));
|
nodeEntry.updateButton.show();
|
||||||
// } else {
|
nodeEntry.updateButton.text(RED._('palette.editor.update',{version:loadedIndex[module].version}));
|
||||||
// nodeEntry.updateButton.hide();
|
} else {
|
||||||
// }
|
nodeEntry.updateButton.hide();
|
||||||
//
|
}
|
||||||
// } else {
|
} else {
|
||||||
// nodeEntry.updateButton.hide();
|
nodeEntry.updateButton.hide();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
function showPaletteEditor() {
|
|
||||||
if (RED.settings.theme('palette.editable') === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (disabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
initInstallTab();
|
|
||||||
$("#header-shade").show();
|
|
||||||
$("#editor-shade").show();
|
|
||||||
$("#sidebar-shade").show();
|
|
||||||
$("#sidebar-separator").hide();
|
|
||||||
|
|
||||||
editorTabs.activateTab('nodes');
|
|
||||||
|
|
||||||
$("#main-container").addClass("palette-expanded");
|
|
||||||
setTimeout(function() {
|
|
||||||
editorTabs.resize();
|
|
||||||
filterInput.focus();
|
|
||||||
},250);
|
|
||||||
RED.events.emit("palette-editor:open");
|
|
||||||
RED.keyboard.add("*",/* ESCAPE */ 27,function(){hidePaletteEditor();d3.event.preventDefault();});
|
|
||||||
}
|
|
||||||
function hidePaletteEditor() {
|
|
||||||
RED.keyboard.remove("*");
|
|
||||||
$("#main-container").removeClass("palette-expanded");
|
|
||||||
$("#header-shade").hide();
|
|
||||||
$("#editor-shade").hide();
|
|
||||||
$("#sidebar-shade").hide();
|
|
||||||
$("#sidebar-separator").show();
|
|
||||||
$("#palette-editor").find('.expanded').each(function(i,el) {
|
|
||||||
$(el).find(".palette-module-content").slideUp();
|
|
||||||
$(el).removeClass('expanded');
|
|
||||||
});
|
|
||||||
filterInput.searchBox('value',"");
|
|
||||||
searchInput.searchBox('value',"");
|
|
||||||
RED.events.emit("palette-editor:close");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterChange(val) {
|
function filterChange(val) {
|
||||||
@@ -338,36 +319,45 @@ RED.palette.editor = (function() {
|
|||||||
var catalogueCount;
|
var catalogueCount;
|
||||||
var catalogueLoadStatus = [];
|
var catalogueLoadStatus = [];
|
||||||
var catalogueLoadStart;
|
var catalogueLoadStart;
|
||||||
|
var catalogueLoadErrors = false;
|
||||||
|
|
||||||
var activeSort = sortModulesAZ;
|
var activeSort = sortModulesAZ;
|
||||||
|
|
||||||
function handleCatalogResponse(catalog,index,v) {
|
function handleCatalogResponse(err,catalog,index,v) {
|
||||||
catalogueLoadStatus.push(v);
|
catalogueLoadStatus.push(err||v);
|
||||||
if (v.modules) {
|
if (!err) {
|
||||||
v.modules.forEach(function(m) {
|
if (v.modules) {
|
||||||
loadedIndex[m.id] = m;
|
v.modules.forEach(function(m) {
|
||||||
m.index = [m.id];
|
loadedIndex[m.id] = m;
|
||||||
if (m.keywords) {
|
m.index = [m.id];
|
||||||
m.index = m.index.concat(m.keywords);
|
if (m.keywords) {
|
||||||
}
|
m.index = m.index.concat(m.keywords);
|
||||||
if (m.updated_at) {
|
}
|
||||||
m.timestamp = new Date(m.updated_at).getTime();
|
if (m.updated_at) {
|
||||||
} else {
|
m.timestamp = new Date(m.updated_at).getTime();
|
||||||
m.timestamp = 0;
|
} else {
|
||||||
}
|
m.timestamp = 0;
|
||||||
m.index = m.index.join(",").toLowerCase();
|
}
|
||||||
})
|
m.index = m.index.join(",").toLowerCase();
|
||||||
loadedList = loadedList.concat(v.modules);
|
})
|
||||||
|
loadedList = loadedList.concat(v.modules);
|
||||||
|
}
|
||||||
|
searchInput.searchBox('count',loadedList.length);
|
||||||
|
} else {
|
||||||
|
catalogueLoadErrors = true;
|
||||||
}
|
}
|
||||||
searchInput.searchBox('count',loadedList.length);
|
|
||||||
if (catalogueCount > 1) {
|
if (catalogueCount > 1) {
|
||||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>"+catalogueLoadStatus.length+"/"+catalogueCount);
|
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>"+catalogueLoadStatus.length+"/"+catalogueCount);
|
||||||
}
|
}
|
||||||
if (catalogueLoadStatus.length === catalogueCount) {
|
if (catalogueLoadStatus.length === catalogueCount) {
|
||||||
|
if (catalogueLoadErrors) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.catalogLoadFailed',{url: catalog}),"error",false,8000);
|
||||||
|
}
|
||||||
var delta = 250-(Date.now() - catalogueLoadStart);
|
var delta = 250-(Date.now() - catalogueLoadStart);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$("#palette-module-install-shade").hide();
|
$("#palette-module-install-shade").hide();
|
||||||
},Math.max(delta,0));
|
},Math.max(delta,0));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,19 +366,29 @@ RED.palette.editor = (function() {
|
|||||||
loadedList = [];
|
loadedList = [];
|
||||||
loadedIndex = {};
|
loadedIndex = {};
|
||||||
packageList.editableList('empty');
|
packageList.editableList('empty');
|
||||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading'));
|
|
||||||
|
$(".palette-module-shade-status").text(RED._('palette.editor.loading'));
|
||||||
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
||||||
catalogueLoadStatus = [];
|
catalogueLoadStatus = [];
|
||||||
|
catalogueLoadErrors = false;
|
||||||
catalogueCount = catalogues.length;
|
catalogueCount = catalogues.length;
|
||||||
if (catalogues.length > 1) {
|
if (catalogues.length > 1) {
|
||||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>0/"+catalogues.length);
|
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>0/"+catalogues.length);
|
||||||
}
|
}
|
||||||
$("#palette-module-install-shade").show();
|
$("#palette-module-install-shade").show();
|
||||||
catalogueLoadStart = Date.now();
|
catalogueLoadStart = Date.now();
|
||||||
|
var handled = 0;
|
||||||
catalogues.forEach(function(catalog,index) {
|
catalogues.forEach(function(catalog,index) {
|
||||||
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
||||||
handleCatalogResponse(catalog,index,v);
|
handleCatalogResponse(null,catalog,index,v);
|
||||||
refreshNodeModuleList();
|
refreshNodeModuleList();
|
||||||
|
}).fail(function(jqxhr, textStatus, error) {
|
||||||
|
handleCatalogResponse(jqxhr,catalog,index);
|
||||||
|
}).always(function() {
|
||||||
|
handled++;
|
||||||
|
if (handled === catalogueCount) {
|
||||||
|
searchInput.searchBox('change');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -396,6 +396,11 @@ RED.palette.editor = (function() {
|
|||||||
|
|
||||||
function refreshFilteredItems() {
|
function refreshFilteredItems() {
|
||||||
packageList.editableList('empty');
|
packageList.editableList('empty');
|
||||||
|
var currentFilter = searchInput.searchBox('value').trim();
|
||||||
|
if (currentFilter === ""){
|
||||||
|
packageList.editableList('addItem',{count:loadedList.length})
|
||||||
|
return;
|
||||||
|
}
|
||||||
filteredList.sort(activeSort);
|
filteredList.sort(activeSort);
|
||||||
for (var i=0;i<Math.min(10,filteredList.length);i++) {
|
for (var i=0;i<Math.min(10,filteredList.length);i++) {
|
||||||
packageList.editableList('addItem',filteredList[i]);
|
packageList.editableList('addItem',filteredList[i]);
|
||||||
@@ -415,22 +420,123 @@ RED.palette.editor = (function() {
|
|||||||
return -1 * (A.info.timestamp-B.info.timestamp);
|
return -1 * (A.info.timestamp-B.info.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if (RED.settings.theme('palette.editable') === false) {
|
if (RED.settings.theme('palette.editable') === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
createSettingsPane();
|
||||||
|
|
||||||
RED.events.on("editor:open",function() { disabled = true; });
|
RED.userSettings.add({
|
||||||
RED.events.on("editor:close",function() { disabled = false; });
|
id:'palette',
|
||||||
RED.events.on("search:open",function() { disabled = true; });
|
title: RED._("palette.editor.palette"),
|
||||||
RED.events.on("search:close",function() { disabled = false; });
|
get: getSettingsPane,
|
||||||
|
close: function() {
|
||||||
|
settingsPane.detach();
|
||||||
|
},
|
||||||
|
focus: function() {
|
||||||
|
editorTabs.resize();
|
||||||
|
setTimeout(function() {
|
||||||
|
filterInput.focus();
|
||||||
|
},200);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
RED.keyboard.add("*", /* p */ 80,{shift:true,ctrl:true},function() {RED.palette.editor.show();d3.event.preventDefault();});
|
RED.actions.add("core:manage-palette",function() {
|
||||||
|
RED.userSettings.show('palette');
|
||||||
|
});
|
||||||
|
|
||||||
|
RED.events.on('registry:module-updated', function(ns) {
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
});
|
||||||
|
RED.events.on('registry:node-set-enabled', function(ns) {
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
});
|
||||||
|
RED.events.on('registry:node-set-disabled', function(ns) {
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
});
|
||||||
|
RED.events.on('registry:node-type-added', function(nodeType) {
|
||||||
|
if (!/^subflow:/.test(nodeType)) {
|
||||||
|
var ns = RED.nodes.registry.getNodeSetForType(nodeType);
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.events.on('registry:node-type-removed', function(nodeType) {
|
||||||
|
if (!/^subflow:/.test(nodeType)) {
|
||||||
|
var ns = RED.nodes.registry.getNodeSetForType(nodeType);
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.events.on('registry:node-set-added', function(ns) {
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
for (var i=0;i<filteredList.length;i++) {
|
||||||
|
if (filteredList[i].info.id === ns.module) {
|
||||||
|
var installButton = filteredList[i].elements.installButton;
|
||||||
|
installButton.addClass('disabled');
|
||||||
|
installButton.text(RED._('palette.editor.installed'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.events.on('registry:node-set-removed', function(ns) {
|
||||||
|
var module = RED.nodes.registry.getModule(ns.module);
|
||||||
|
if (!module) {
|
||||||
|
var entry = nodeEntries[ns.module];
|
||||||
|
if (entry) {
|
||||||
|
nodeList.editableList('removeItem', entry);
|
||||||
|
delete nodeEntries[ns.module];
|
||||||
|
for (var i=0;i<filteredList.length;i++) {
|
||||||
|
if (filteredList[i].info.id === ns.module) {
|
||||||
|
var installButton = filteredList[i].elements.installButton;
|
||||||
|
installButton.removeClass('disabled');
|
||||||
|
installButton.text(RED._('palette.editor.install'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.events.on('nodes:add', function(n) {
|
||||||
|
if (!/^subflow:/.test(n.type)) {
|
||||||
|
typesInUse[n.type] = (typesInUse[n.type]||0)+1;
|
||||||
|
if (typesInUse[n.type] === 1) {
|
||||||
|
var ns = RED.nodes.registry.getNodeSetForType(n.type);
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
RED.events.on('nodes:remove', function(n) {
|
||||||
|
if (typesInUse.hasOwnProperty(n.type)) {
|
||||||
|
typesInUse[n.type]--;
|
||||||
|
if (typesInUse[n.type] === 0) {
|
||||||
|
delete typesInUse[n.type];
|
||||||
|
var ns = RED.nodes.registry.getNodeSetForType(n.type);
|
||||||
|
refreshNodeModule(ns.module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var settingsPane;
|
||||||
|
|
||||||
|
function getSettingsPane() {
|
||||||
|
initInstallTab();
|
||||||
|
editorTabs.activateTab('nodes');
|
||||||
|
return settingsPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function createSettingsPane() {
|
||||||
|
settingsPane = $('<div id="user-settings-tab-palette"></div>');
|
||||||
|
var content = $('<div id="palette-editor">'+
|
||||||
|
'<ul id="palette-editor-tabs"></ul>'+
|
||||||
|
'</div>').appendTo(settingsPane);
|
||||||
|
|
||||||
editorTabs = RED.tabs.create({
|
editorTabs = RED.tabs.create({
|
||||||
id:"palette-editor-tabs",
|
element: settingsPane.find('#palette-editor-tabs'),
|
||||||
onchange:function(tab) {
|
onchange:function(tab) {
|
||||||
$("#palette-editor .palette-editor-tab").hide();
|
content.find(".palette-editor-tab").hide();
|
||||||
tab.content.show();
|
tab.content.show();
|
||||||
if (filterInput) {
|
if (filterInput) {
|
||||||
filterInput.searchBox('value',"");
|
filterInput.searchBox('value',"");
|
||||||
@@ -452,17 +558,7 @@ RED.palette.editor = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#editor-shade").click(function() {
|
var modulesTab = $('<div>',{class:"palette-editor-tab"}).appendTo(content);
|
||||||
if ($("#main-container").hasClass("palette-expanded")) {
|
|
||||||
hidePaletteEditor();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#palette-editor-close").on("click", function(e) {
|
|
||||||
hidePaletteEditor();
|
|
||||||
})
|
|
||||||
|
|
||||||
var modulesTab = $('<div>',{class:"palette-editor-tab"}).appendTo("#palette-editor");
|
|
||||||
|
|
||||||
editorTabs.addTab({
|
editorTabs.addTab({
|
||||||
id: 'nodes',
|
id: 'nodes',
|
||||||
@@ -499,32 +595,38 @@ RED.palette.editor = (function() {
|
|||||||
if (entry) {
|
if (entry) {
|
||||||
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
||||||
var titleRow = $('<div class="palette-module-meta palette-module-name"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
var titleRow = $('<div class="palette-module-meta palette-module-name"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
||||||
$('<span>').html(entry.name).appendTo(titleRow);
|
$('<span>').text(entry.name).appendTo(titleRow);
|
||||||
var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow);
|
var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow);
|
||||||
$('<span>').html(entry.version).appendTo(metaRow);
|
var versionSpan = $('<span>').text(entry.version).appendTo(metaRow);
|
||||||
|
|
||||||
|
var errorRow = $('<div class="palette-module-meta palette-module-errors"><i class="fa fa-warning"></i></div>').hide().appendTo(headerRow);
|
||||||
|
var errorList = $('<ul class="palette-module-error-list"></ul>').appendTo(errorRow);
|
||||||
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
|
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
|
||||||
var setButton = $('<a href="#" class="editor-button editor-button-small palette-module-set-button"><i class="fa fa-angle-right palette-module-node-chevron"></i> </a>').appendTo(buttonRow);
|
var setButton = $('<a href="#" class="editor-button editor-button-small palette-module-set-button"><i class="fa fa-angle-right palette-module-node-chevron"></i> </a>').appendTo(buttonRow);
|
||||||
var setCount = $('<span>').appendTo(setButton);
|
var setCount = $('<span>').appendTo(setButton);
|
||||||
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
||||||
|
|
||||||
var updateButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.update')).appendTo(buttonGroup);
|
var updateButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.update')).appendTo(buttonGroup);
|
||||||
|
updateButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
|
||||||
updateButton.click(function(evt) {
|
updateButton.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
if ($(this).hasClass('disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
update(entry,loadedIndex[entry.name].version,container,function(err){});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.remove')).appendTo(buttonGroup);
|
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.remove')).appendTo(buttonGroup);
|
||||||
|
removeButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
|
||||||
removeButton.click(function(evt) {
|
removeButton.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
shade.show();
|
remove(entry,container,function(err){});
|
||||||
removeNodeModule(entry.name, function(xhr) {
|
|
||||||
console.log(xhr);
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
if (!entry.local) {
|
if (!entry.local) {
|
||||||
removeButton.hide();
|
removeButton.hide();
|
||||||
}
|
}
|
||||||
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.disableall')).appendTo(buttonGroup);
|
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.disableall')).appendTo(buttonGroup);
|
||||||
|
|
||||||
var contentRow = $('<div>',{class:"palette-module-content"}).appendTo(container);
|
var contentRow = $('<div>',{class:"palette-module-content"}).appendTo(container);
|
||||||
var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container);
|
var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container);
|
||||||
@@ -533,9 +635,12 @@ RED.palette.editor = (function() {
|
|||||||
updateButton: updateButton,
|
updateButton: updateButton,
|
||||||
removeButton: removeButton,
|
removeButton: removeButton,
|
||||||
enableButton: enableButton,
|
enableButton: enableButton,
|
||||||
|
errorRow: errorRow,
|
||||||
|
errorList: errorList,
|
||||||
setCount: setCount,
|
setCount: setCount,
|
||||||
container: container,
|
container: container,
|
||||||
shade: shade,
|
shade: shade,
|
||||||
|
versionSpan: versionSpan,
|
||||||
sets: {}
|
sets: {}
|
||||||
}
|
}
|
||||||
setButton.click(function(evt) {
|
setButton.click(function(evt) {
|
||||||
@@ -561,17 +666,21 @@ RED.palette.editor = (function() {
|
|||||||
set.types.forEach(function(t) {
|
set.types.forEach(function(t) {
|
||||||
var typeDiv = $('<div>',{class:"palette-module-type"}).appendTo(setRow);
|
var typeDiv = $('<div>',{class:"palette-module-type"}).appendTo(setRow);
|
||||||
typeSwatches[t] = $('<span>',{class:"palette-module-type-swatch"}).appendTo(typeDiv);
|
typeSwatches[t] = $('<span>',{class:"palette-module-type-swatch"}).appendTo(typeDiv);
|
||||||
$('<span>',{class:"palette-module-type-node"}).html(t).appendTo(typeDiv);
|
$('<span>',{class:"palette-module-type-node"}).text(t).appendTo(typeDiv);
|
||||||
})
|
})
|
||||||
|
|
||||||
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').appendTo(buttonGroup);
|
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').appendTo(buttonGroup);
|
||||||
enableButton.click(function(evt) {
|
enableButton.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if (object.setUseCount[setName] === 0) {
|
if (object.setUseCount[setName] === 0) {
|
||||||
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
||||||
shade.show();
|
shade.show();
|
||||||
changeNodeState(set.id,!currentSet.enabled,shade,function(xhr){
|
var newState = !currentSet.enabled
|
||||||
console.log(xhr)
|
changeNodeState(set.id,newState,shade,function(xhr){
|
||||||
|
if (xhr) {
|
||||||
|
if (xhr.responseJSON) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.'+(newState?'enable':'disable')+'Failed',{module: id,message:xhr.responseJSON.message}));
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -586,20 +695,24 @@ RED.palette.editor = (function() {
|
|||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if (object.totalUseCount === 0) {
|
if (object.totalUseCount === 0) {
|
||||||
changeNodeState(entry.name,(container.hasClass('disabled')),shade,function(xhr){
|
changeNodeState(entry.name,(container.hasClass('disabled')),shade,function(xhr){
|
||||||
console.log(xhr)
|
if (xhr) {
|
||||||
|
if (xhr.responseJSON) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.installFailed',{module: id,message:xhr.responseJSON.message}));
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
refreshNodeModule(entry.name);
|
refreshNodeModule(entry.name);
|
||||||
} else {
|
} else {
|
||||||
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container);
|
$('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var installTab = $('<div>',{class:"palette-editor-tab hide"}).appendTo("#palette-editor");
|
var installTab = $('<div>',{class:"palette-editor-tab hide"}).appendTo(content);
|
||||||
|
|
||||||
editorTabs.addTab({
|
editorTabs.addTab({
|
||||||
id: 'install',
|
id: 'install',
|
||||||
@@ -615,7 +728,7 @@ RED.palette.editor = (function() {
|
|||||||
.searchBox({
|
.searchBox({
|
||||||
delay: 300,
|
delay: 300,
|
||||||
change: function() {
|
change: function() {
|
||||||
var searchTerm = $(this).val().toLowerCase();
|
var searchTerm = $(this).val().trim().toLowerCase();
|
||||||
if (searchTerm.length > 0) {
|
if (searchTerm.length > 0) {
|
||||||
filteredList = loadedList.filter(function(m) {
|
filteredList = loadedList.filter(function(m) {
|
||||||
return (m.index.indexOf(searchTerm) > -1);
|
return (m.index.indexOf(searchTerm) > -1);
|
||||||
@@ -625,13 +738,15 @@ RED.palette.editor = (function() {
|
|||||||
} else {
|
} else {
|
||||||
searchInput.searchBox('count',loadedList.length);
|
searchInput.searchBox('count',loadedList.length);
|
||||||
packageList.editableList('empty');
|
packageList.editableList('empty');
|
||||||
|
packageList.editableList('addItem',{count:loadedList.length});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('<span>').html(RED._("palette.editor.sort")+' ').appendTo(toolBar);
|
$('<span>').text(RED._("palette.editor.sort")+' ').appendTo(toolBar);
|
||||||
var sortGroup = $('<span class="button-group"></span> ').appendTo(toolBar);
|
var sortGroup = $('<span class="button-group"></span>').appendTo(toolBar);
|
||||||
var sortAZ = $('<a href="#" class="sidebar-header-button-toggle selected" data-i18n="palette.editor.sortAZ"></a>').appendTo(sortGroup);
|
var sortAZ = $('<a href="#" class="sidebar-header-button-toggle selected" data-i18n="palette.editor.sortAZ"></a>').appendTo(sortGroup);
|
||||||
var sortRecent = $('<a href="#" class="sidebar-header-button-toggle" data-i18n="palette.editor.sortRecent"></a>').appendTo(sortGroup);
|
var sortRecent = $('<a href="#" class="sidebar-header-button-toggle" data-i18n="palette.editor.sortRecent"></a>').appendTo(sortGroup);
|
||||||
|
|
||||||
@@ -668,138 +783,185 @@ RED.palette.editor = (function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
packageList = $('<ol>',{style:"position: absolute;top: 78px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
|
packageList = $('<ol>',{style:"position: absolute;top: 78px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
|
||||||
addButton: false,
|
addButton: false,
|
||||||
scrollOnAdd: false,
|
scrollOnAdd: false,
|
||||||
addItem: function(container,i,object) {
|
addItem: function(container,i,object) {
|
||||||
|
if (object.count) {
|
||||||
|
$('<div>',{class:"red-ui-search-empty"}).text(RED._('palette.editor.moduleCount',{count:object.count})).appendTo(container);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (object.more) {
|
||||||
|
container.addClass('palette-module-more');
|
||||||
|
var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container);
|
||||||
|
var moreLink = $('<a href="#"></a>').text(RED._('palette.editor.more',{count:object.more})).appendTo(moreRow);
|
||||||
|
moreLink.click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
packageList.editableList('removeItem',object);
|
||||||
|
for (var i=object.start;i<Math.min(object.start+10,object.start+object.more);i++) {
|
||||||
|
packageList.editableList('addItem',filteredList[i]);
|
||||||
|
}
|
||||||
|
if (object.more > 10) {
|
||||||
|
packageList.editableList('addItem',{start:object.start+10, more:object.more-10})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (object.info) {
|
||||||
|
var entry = object.info;
|
||||||
|
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
||||||
|
var titleRow = $('<div class="palette-module-meta"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
||||||
|
$('<span>',{class:"palette-module-name"}).text(entry.name||entry.id).appendTo(titleRow);
|
||||||
|
$('<a target="_blank" class="palette-module-link"><i class="fa fa-external-link"></i></a>').attr('href',entry.url).appendTo(titleRow);
|
||||||
|
var descRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
||||||
|
$('<div>',{class:"palette-module-description"}).text(entry.description).appendTo(descRow);
|
||||||
|
|
||||||
if (object.more) {
|
var metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
||||||
container.addClass('palette-module-more');
|
$('<span class="palette-module-version"><i class="fa fa-tag"></i> '+entry.version+'</span>').appendTo(metaRow);
|
||||||
var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container);
|
$('<span class="palette-module-updated"><i class="fa fa-calendar"></i> '+formatUpdatedAt(entry.updated_at)+'</span>').appendTo(metaRow);
|
||||||
var moreLink = $('<a href="#"></a>').html(RED._('palette.editor.more',{count:object.more})).appendTo(moreRow);
|
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
|
||||||
moreLink.click(function(e) {
|
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
||||||
e.preventDefault();
|
var installButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.install')).appendTo(buttonGroup);
|
||||||
packageList.editableList('removeItem',object);
|
installButton.click(function(e) {
|
||||||
for (var i=object.start;i<Math.min(object.start+10,object.start+object.more);i++) {
|
e.preventDefault();
|
||||||
packageList.editableList('addItem',filteredList[i]);
|
if (!$(this).hasClass('disabled')) {
|
||||||
}
|
install(entry,container,function(xhr) {});
|
||||||
if (object.more > 10) {
|
}
|
||||||
packageList.editableList('addItem',{start:object.start+10, more:object.more-10})
|
})
|
||||||
}
|
if (nodeEntries.hasOwnProperty(entry.id)) {
|
||||||
})
|
installButton.addClass('disabled');
|
||||||
return;
|
installButton.text(RED._('palette.editor.installed'));
|
||||||
}
|
}
|
||||||
if (object.info) {
|
|
||||||
var entry = object.info;
|
|
||||||
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
|
||||||
var titleRow = $('<div class="palette-module-meta"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
|
||||||
$('<span>',{class:"palette-module-name"}).html(entry.name||entry.id).appendTo(titleRow);
|
|
||||||
$('<a target="_blank" class="palette-module-link"><i class="fa fa-external-link"></i></a>').attr('href',entry.url).appendTo(titleRow);
|
|
||||||
var descRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
|
||||||
$('<div>',{class:"palette-module-description"}).html(entry.description).appendTo(descRow);
|
|
||||||
|
|
||||||
var metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
object.elements = {
|
||||||
$('<span class="palette-module-version"><i class="fa fa-tag"></i> '+entry.version+'</span>').appendTo(metaRow);
|
installButton:installButton
|
||||||
$('<span class="palette-module-updated"><i class="fa fa-calendar"></i> '+formatUpdatedAt(entry.updated_at)+'</span>').appendTo(metaRow);
|
}
|
||||||
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
|
} else {
|
||||||
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
$('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
|
||||||
var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container);
|
|
||||||
var installButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.install')).appendTo(buttonGroup);
|
|
||||||
installButton.click(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
if (!$(this).hasClass('disabled')) {
|
|
||||||
installNodeModule(entry.id,shade,function(xhr) {
|
|
||||||
if (xhr) {
|
|
||||||
if (xhr.responseJSON) {
|
|
||||||
RED.notify(RED._('palette.editor.errors.installFailed',{module: entry.id,message:xhr.responseJSON.message}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (nodeEntries.hasOwnProperty(entry.id)) {
|
|
||||||
installButton.addClass('disabled');
|
|
||||||
installButton.html(RED._('palette.editor.installed'));
|
|
||||||
}
|
|
||||||
|
|
||||||
object.elements = {
|
|
||||||
installButton:installButton
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('<div id="palette-module-install-shade" class="palette-module-shade hide"><div class="palette-module-shade-status"></div><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(installTab);
|
|
||||||
|
|
||||||
RED.events.on('registry:node-set-enabled', function(ns) {
|
|
||||||
refreshNodeModule(ns.module);
|
|
||||||
});
|
|
||||||
RED.events.on('registry:node-set-disabled', function(ns) {
|
|
||||||
refreshNodeModule(ns.module);
|
|
||||||
});
|
|
||||||
RED.events.on('registry:node-type-added', function(nodeType) {
|
|
||||||
if (!/^subflow:/.test(nodeType)) {
|
|
||||||
var ns = RED.nodes.registry.getNodeSetForType(nodeType);
|
|
||||||
refreshNodeModule(ns.module);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
RED.events.on('registry:node-type-removed', function(nodeType) {
|
|
||||||
if (!/^subflow:/.test(nodeType)) {
|
|
||||||
var ns = RED.nodes.registry.getNodeSetForType(nodeType);
|
|
||||||
refreshNodeModule(ns.module);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
RED.events.on('registry:node-set-added', function(ns) {
|
|
||||||
refreshNodeModule(ns.module);
|
|
||||||
for (var i=0;i<filteredList.length;i++) {
|
|
||||||
if (filteredList[i].info.id === ns.module) {
|
|
||||||
filteredList[i].elements.installButton.hide();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RED.events.on('registry:node-set-removed', function(ns) {
|
|
||||||
var module = RED.nodes.registry.getModule(ns.module);
|
$('<div id="palette-module-install-shade" class="palette-module-shade hide"><div class="palette-module-shade-status"></div><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(installTab);
|
||||||
if (!module) {
|
}
|
||||||
var entry = nodeEntries[ns.module];
|
function update(entry,version,container,done) {
|
||||||
if (entry) {
|
if (RED.settings.theme('palette.editable') === false) {
|
||||||
nodeList.editableList('removeItem', entry);
|
done(new Error('Palette not editable'));
|
||||||
delete nodeEntries[ns.module];
|
return;
|
||||||
for (var i=0;i<filteredList.length;i++) {
|
}
|
||||||
if (filteredList[i].info.id === ns.module) {
|
var notification = RED.notify(RED._("palette.editor.confirm.update.body",{module:entry.name}),{
|
||||||
filteredList[i].elements.installButton.show();
|
modal: true,
|
||||||
break;
|
fixed: true,
|
||||||
}
|
buttons: [
|
||||||
|
{
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: RED._("palette.editor.confirm.button.update"),
|
||||||
|
class: "primary palette-module-install-confirm-button-update",
|
||||||
|
click: function() {
|
||||||
|
var spinner = RED.utils.addSpinnerOverlay(container, true);
|
||||||
|
installNodeModule(entry.name,version,function(xhr) {
|
||||||
|
spinner.remove();
|
||||||
|
if (xhr) {
|
||||||
|
if (xhr.responseJSON) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.updateFailed',{module: entry.name,message:xhr.responseJSON.message}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
done(xhr);
|
||||||
|
});
|
||||||
|
notification.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function remove(entry,container,done) {
|
||||||
|
if (RED.settings.theme('palette.editable') === false) {
|
||||||
|
done(new Error('Palette not editable'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var notification = RED.notify(RED._("palette.editor.confirm.remove.body",{module:entry.name}),{
|
||||||
|
modal: true,
|
||||||
|
fixed: true,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: RED._("palette.editor.confirm.button.remove"),
|
||||||
|
class: "primary palette-module-install-confirm-button-remove",
|
||||||
|
click: function() {
|
||||||
|
var spinner = RED.utils.addSpinnerOverlay(container, true);
|
||||||
|
removeNodeModule(entry.name, function(xhr) {
|
||||||
|
spinner.remove();
|
||||||
|
if (xhr) {
|
||||||
|
if (xhr.responseJSON) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.removeFailed',{module: entry.name,message:xhr.responseJSON.message}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function install(entry,container,done) {
|
||||||
|
if (RED.settings.theme('palette.editable') === false) {
|
||||||
|
done(new Error('Palette not editable'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var buttons = [
|
||||||
|
{
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
if (entry.url) {
|
||||||
|
buttons.push({
|
||||||
|
text: RED._("palette.editor.confirm.button.review"),
|
||||||
|
class: "primary palette-module-install-confirm-button-install",
|
||||||
|
click: function() {
|
||||||
|
var url = entry.url||"";
|
||||||
|
window.open(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
buttons.push({
|
||||||
|
text: RED._("palette.editor.confirm.button.install"),
|
||||||
|
class: "primary palette-module-install-confirm-button-install",
|
||||||
|
click: function() {
|
||||||
|
var spinner = RED.utils.addSpinnerOverlay(container, true);
|
||||||
|
installNodeModule(entry.id,entry.version,function(xhr) {
|
||||||
|
spinner.remove();
|
||||||
|
if (xhr) {
|
||||||
|
if (xhr.responseJSON) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.installFailed',{module: entry.id,message:xhr.responseJSON.message}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
done(xhr);
|
||||||
|
});
|
||||||
|
notification.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RED.events.on('nodes:add', function(n) {
|
|
||||||
if (!/^subflow:/.test(n.type)) {
|
|
||||||
typesInUse[n.type] = (typesInUse[n.type]||0)+1;
|
|
||||||
if (typesInUse[n.type] === 1) {
|
|
||||||
var ns = RED.nodes.registry.getNodeSetForType(n.type);
|
|
||||||
refreshNodeModule(ns.module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
RED.events.on('nodes:remove', function(n) {
|
|
||||||
if (typesInUse.hasOwnProperty(n.type)) {
|
|
||||||
typesInUse[n.type]--;
|
|
||||||
if (typesInUse[n.type] === 0) {
|
|
||||||
delete typesInUse[n.type];
|
|
||||||
var ns = RED.nodes.registry.getNodeSetForType(n.type);
|
|
||||||
refreshNodeModule(ns.module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
var notification = RED.notify(RED._("palette.editor.confirm.install.body",{module:entry.id}),{
|
||||||
|
modal: true,
|
||||||
|
fixed: true,
|
||||||
|
buttons: buttons
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
show: showPaletteEditor
|
install: install
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -21,8 +21,19 @@ RED.palette = (function() {
|
|||||||
|
|
||||||
var categoryContainers = {};
|
var categoryContainers = {};
|
||||||
|
|
||||||
function createCategoryContainer(category, label){
|
|
||||||
label = label || category.replace("_", " ");
|
function createCategory(originalCategory,rootCategory,category,ns) {
|
||||||
|
if ($("#palette-base-category-"+rootCategory).length === 0) {
|
||||||
|
createCategoryContainer(originalCategory,rootCategory, ns+":palette.label."+rootCategory);
|
||||||
|
}
|
||||||
|
$("#palette-container-"+rootCategory).show();
|
||||||
|
if ($("#palette-"+category).length === 0) {
|
||||||
|
$("#palette-base-category-"+rootCategory).append('<div id="palette-'+category+'"></div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function createCategoryContainer(originalCategory,category, labelId) {
|
||||||
|
var label = RED._(labelId, {defaultValue:category});
|
||||||
|
label = (label || category).replace(/_/g, " ");
|
||||||
var catDiv = $('<div id="palette-container-'+category+'" class="palette-category palette-close hide">'+
|
var catDiv = $('<div id="palette-container-'+category+'" class="palette-category palette-close hide">'+
|
||||||
'<div id="palette-header-'+category+'" class="palette-header"><i class="expanded fa fa-angle-down"></i><span>'+label+'</span></div>'+
|
'<div id="palette-header-'+category+'" class="palette-header"><i class="expanded fa fa-angle-down"></i><span>'+label+'</span></div>'+
|
||||||
'<div class="palette-content" id="palette-base-category-'+category+'">'+
|
'<div class="palette-content" id="palette-base-category-'+category+'">'+
|
||||||
@@ -31,7 +42,8 @@ RED.palette = (function() {
|
|||||||
'<div id="palette-'+category+'-function"></div>'+
|
'<div id="palette-'+category+'-function"></div>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'</div>').appendTo("#palette-container");
|
'</div>').appendTo("#palette-container");
|
||||||
|
catDiv.data('category',originalCategory);
|
||||||
|
catDiv.data('label',label);
|
||||||
categoryContainers[category] = {
|
categoryContainers[category] = {
|
||||||
container: catDiv,
|
container: catDiv,
|
||||||
close: function() {
|
close: function() {
|
||||||
@@ -101,7 +113,7 @@ RED.palette = (function() {
|
|||||||
if (label != type) {
|
if (label != type) {
|
||||||
l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b><br/><i>"+type+"</i></p>";
|
l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b><br/><i>"+type+"</i></p>";
|
||||||
}
|
}
|
||||||
popOverContent = $(l+(info?info:$("script[data-help-name$='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim())
|
popOverContent = $(l+(info?info:$("script[data-help-name='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim())
|
||||||
.filter(function(n) {
|
.filter(function(n) {
|
||||||
return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0)
|
return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0)
|
||||||
}).slice(0,2);
|
}).slice(0,2);
|
||||||
@@ -116,6 +128,12 @@ RED.palette = (function() {
|
|||||||
el.data('popover').setContent(popOverContent);
|
el.data('popover').setContent(popOverContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setIcon(element,sf) {
|
||||||
|
var iconElement = element.find(".palette_icon");
|
||||||
|
var icon_url = RED.utils.getNodeIcon(sf._def,sf);
|
||||||
|
iconElement.attr("style", "background-image: url("+icon_url+")");
|
||||||
|
}
|
||||||
|
|
||||||
function escapeNodeType(nt) {
|
function escapeNodeType(nt) {
|
||||||
return nt.replace(" ","_").replace(".","_").replace(":","_");
|
return nt.replace(" ","_").replace(".","_").replace(":","_");
|
||||||
}
|
}
|
||||||
@@ -127,7 +145,8 @@ RED.palette = (function() {
|
|||||||
}
|
}
|
||||||
if (exclusion.indexOf(def.category)===-1) {
|
if (exclusion.indexOf(def.category)===-1) {
|
||||||
|
|
||||||
var category = def.category.replace(" ","_");
|
var originalCategory = def.category;
|
||||||
|
var category = def.category.replace(/ /g,"_");
|
||||||
var rootCategory = category.split("-")[0];
|
var rootCategory = category.split("-")[0];
|
||||||
|
|
||||||
var d = document.createElement("div");
|
var d = document.createElement("div");
|
||||||
@@ -147,19 +166,13 @@ RED.palette = (function() {
|
|||||||
|
|
||||||
d.className="palette_node";
|
d.className="palette_node";
|
||||||
|
|
||||||
|
|
||||||
if (def.icon) {
|
if (def.icon) {
|
||||||
var icon_url = "arrow-in.png";
|
var icon_url = RED.utils.getNodeIcon(def);
|
||||||
try {
|
|
||||||
icon_url = (typeof def.icon === "function" ? def.icon.call({}) : def.icon);
|
|
||||||
} catch(err) {
|
|
||||||
console.log("Definition error: "+nt+".icon",err);
|
|
||||||
}
|
|
||||||
var iconContainer = $('<div/>',{class:"palette_icon_container"+(def.align=="right"?" palette_icon_container_right":"")}).appendTo(d);
|
var iconContainer = $('<div/>',{class:"palette_icon_container"+(def.align=="right"?" palette_icon_container_right":"")}).appendTo(d);
|
||||||
$('<div/>',{class:"palette_icon",style:"background-image: url(icons/"+icon_url+")"}).appendTo(iconContainer);
|
$('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
d.style.backgroundColor = def.color;
|
d.style.backgroundColor = RED.utils.getNodeColor(nt,def);
|
||||||
|
|
||||||
if (def.outputs > 0) {
|
if (def.outputs > 0) {
|
||||||
var portOut = document.createElement("div");
|
var portOut = document.createElement("div");
|
||||||
@@ -173,28 +186,22 @@ RED.palette = (function() {
|
|||||||
d.appendChild(portIn);
|
d.appendChild(portIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("#palette-base-category-"+rootCategory).length === 0) {
|
createCategory(def.category,rootCategory,category,(coreCategories.indexOf(rootCategory) !== -1)?"node-red":def.set.id);
|
||||||
if(coreCategories.indexOf(rootCategory) !== -1){
|
|
||||||
createCategoryContainer(rootCategory, RED._("node-red:palette.label."+rootCategory, {defaultValue:rootCategory}));
|
|
||||||
} else {
|
|
||||||
var ns = def.set.id;
|
|
||||||
createCategoryContainer(rootCategory, RED._(ns+":palette.label."+rootCategory, {defaultValue:rootCategory}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#palette-container-"+rootCategory).show();
|
|
||||||
|
|
||||||
if ($("#palette-"+category).length === 0) {
|
|
||||||
$("#palette-base-category-"+rootCategory).append('<div id="palette-'+category+'"></div>');
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#palette-"+category).append(d);
|
$("#palette-"+category).append(d);
|
||||||
|
|
||||||
|
$(d).data('category',rootCategory);
|
||||||
|
|
||||||
d.onmousedown = function(e) { e.preventDefault(); };
|
d.onmousedown = function(e) { e.preventDefault(); };
|
||||||
|
|
||||||
RED.popover.create({
|
var popover = RED.popover.create({
|
||||||
target:$(d),
|
target:$(d),
|
||||||
|
trigger: "hover",
|
||||||
|
width: "300px",
|
||||||
content: "hi",
|
content: "hi",
|
||||||
delay: { show: 750, hide: 50 }
|
delay: { show: 750, hide: 50 }
|
||||||
});
|
});
|
||||||
|
$(d).data('popover',popover);
|
||||||
|
|
||||||
// $(d).popover({
|
// $(d).popover({
|
||||||
// title:d.type,
|
// title:d.type,
|
||||||
@@ -208,12 +215,11 @@ RED.palette = (function() {
|
|||||||
RED.view.focus();
|
RED.view.focus();
|
||||||
var helpText;
|
var helpText;
|
||||||
if (nt.indexOf("subflow:") === 0) {
|
if (nt.indexOf("subflow:") === 0) {
|
||||||
helpText = marked(RED.nodes.subflow(nt.substring(8)).info||"");
|
helpText = marked(RED.nodes.subflow(nt.substring(8)).info||"")||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||||
} else {
|
} else {
|
||||||
helpText = $("script[data-help-name$='"+d.type+"']").html()||"";
|
helpText = $("script[data-help-name='"+d.type+"']").html()||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||||
}
|
}
|
||||||
var help = '<div class="node-help">'+helpText+"</div>";
|
RED.sidebar.info.set(helpText,RED._("sidebar.info.nodeHelp"));
|
||||||
RED.sidebar.info.set(help);
|
|
||||||
});
|
});
|
||||||
var chart = $("#chart");
|
var chart = $("#chart");
|
||||||
var chartOffset = chart.offset();
|
var chartOffset = chart.offset();
|
||||||
@@ -222,13 +228,19 @@ RED.palette = (function() {
|
|||||||
var mouseX;
|
var mouseX;
|
||||||
var mouseY;
|
var mouseY;
|
||||||
var spliceTimer;
|
var spliceTimer;
|
||||||
|
var paletteWidth;
|
||||||
|
var paletteTop;
|
||||||
$(d).draggable({
|
$(d).draggable({
|
||||||
helper: 'clone',
|
helper: 'clone',
|
||||||
appendTo: 'body',
|
appendTo: 'body',
|
||||||
revert: true,
|
revert: true,
|
||||||
revertDuration: 50,
|
revertDuration: 50,
|
||||||
containment:'#main-container',
|
containment:'#main-container',
|
||||||
start: function() {RED.view.focus();},
|
start: function() {
|
||||||
|
paletteWidth = $("#palette").width();
|
||||||
|
paletteTop = $("#palette").parent().position().top + $("#palette-container").position().top;
|
||||||
|
RED.view.focus();
|
||||||
|
},
|
||||||
stop: function() { d3.select('.link_splice').classed('link_splice',false); if (spliceTimer) { clearTimeout(spliceTimer); spliceTimer = null;}},
|
stop: function() { d3.select('.link_splice').classed('link_splice',false); if (spliceTimer) { clearTimeout(spliceTimer); spliceTimer = null;}},
|
||||||
drag: function(e,ui) {
|
drag: function(e,ui) {
|
||||||
|
|
||||||
@@ -236,11 +248,10 @@ RED.palette = (function() {
|
|||||||
// it here makes me sad
|
// it here makes me sad
|
||||||
//console.log(ui.helper.position());
|
//console.log(ui.helper.position());
|
||||||
ui.position.left += 17.5;
|
ui.position.left += 17.5;
|
||||||
|
|
||||||
if (def.inputs > 0 && def.outputs > 0) {
|
|
||||||
mouseX = ui.position.left+(ui.helper.width()/2) - chartOffset.left + chart.scrollLeft();
|
|
||||||
mouseY = ui.position.top+(ui.helper.height()/2) - chartOffset.top + chart.scrollTop();
|
|
||||||
|
|
||||||
|
if (def.inputs > 0 && def.outputs > 0) {
|
||||||
|
mouseX = ui.position.left-paletteWidth+(ui.helper.width()/2) - chartOffset.left + chart.scrollLeft();
|
||||||
|
mouseY = ui.position.top-paletteTop+(ui.helper.height()/2) - chartOffset.top + chart.scrollTop();
|
||||||
if (!spliceTimer) {
|
if (!spliceTimer) {
|
||||||
spliceTimer = setTimeout(function() {
|
spliceTimer = setTimeout(function() {
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
@@ -262,8 +273,10 @@ RED.palette = (function() {
|
|||||||
mouseY /= RED.view.scale();
|
mouseY /= RED.view.scale();
|
||||||
nodes = RED.view.getLinksAtPoint(mouseX,mouseY);
|
nodes = RED.view.getLinksAtPoint(mouseX,mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i=0;i<nodes.length;i++) {
|
for (var i=0;i<nodes.length;i++) {
|
||||||
if (d3.select(nodes[i]).classed('link_background')) {
|
var node = d3.select(nodes[i]);
|
||||||
|
if (node.classed('link_background') && !node.classed('link_link')) {
|
||||||
var length = nodes[i].getTotalLength();
|
var length = nodes[i].getTotalLength();
|
||||||
for (var j=0;j<length;j+=10) {
|
for (var j=0;j<length;j+=10) {
|
||||||
var p = nodes[i].getPointAtLength(j);
|
var p = nodes[i].getPointAtLength(j);
|
||||||
@@ -299,7 +312,7 @@ RED.palette = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var nodeInfo = null;
|
var nodeInfo = null;
|
||||||
if (def.category == "subflows") {
|
if (nt.indexOf("subflow:") === 0) {
|
||||||
$(d).dblclick(function(e) {
|
$(d).dblclick(function(e) {
|
||||||
RED.workspaces.show(nt.substring(8));
|
RED.workspaces.show(nt.substring(8));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -308,9 +321,9 @@ RED.palette = (function() {
|
|||||||
}
|
}
|
||||||
setLabel(nt,$(d),label,nodeInfo);
|
setLabel(nt,$(d),label,nodeInfo);
|
||||||
|
|
||||||
var categoryNode = $("#palette-container-"+category);
|
var categoryNode = $("#palette-container-"+rootCategory);
|
||||||
if (categoryNode.find(".palette_node").length === 1) {
|
if (categoryNode.find(".palette_node").length === 1) {
|
||||||
categoryContainers[category].open();
|
categoryContainers[rootCategory].open();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -328,14 +341,26 @@ RED.palette = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideNodeType(nt) {
|
function hideNodeType(nt) {
|
||||||
var nodeTypeId = escapeNodeType(nt);
|
var nodeTypeId = escapeNodeType(nt);
|
||||||
$("#palette_node_"+nodeTypeId).hide();
|
var paletteNode = $("#palette_node_"+nodeTypeId);
|
||||||
|
paletteNode.hide();
|
||||||
|
var categoryNode = paletteNode.closest(".palette-category");
|
||||||
|
var cl = categoryNode.find(".palette_node");
|
||||||
|
var c = 0;
|
||||||
|
for (var i = 0; i < cl.length; i++) {
|
||||||
|
if ($(cl[i]).css('display') === 'none') { c += 1; }
|
||||||
|
}
|
||||||
|
if (c === cl.length) { categoryNode.hide(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNodeType(nt) {
|
function showNodeType(nt) {
|
||||||
var nodeTypeId = escapeNodeType(nt);
|
var nodeTypeId = escapeNodeType(nt);
|
||||||
$("#palette_node_"+nodeTypeId).show();
|
var paletteNode = $("#palette_node_"+nodeTypeId);
|
||||||
|
var categoryNode = paletteNode.closest(".palette-category");
|
||||||
|
categoryNode.show();
|
||||||
|
paletteNode.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshNodeTypes() {
|
function refreshNodeTypes() {
|
||||||
@@ -360,6 +385,32 @@ RED.palette = (function() {
|
|||||||
portOutput.remove();
|
portOutput.remove();
|
||||||
}
|
}
|
||||||
setLabel(sf.type+":"+sf.id,paletteNode,sf.name,marked(sf.info||""));
|
setLabel(sf.type+":"+sf.id,paletteNode,sf.name,marked(sf.info||""));
|
||||||
|
setIcon(paletteNode,sf);
|
||||||
|
|
||||||
|
var currentCategory = paletteNode.data('category');
|
||||||
|
var newCategory = (sf.category||"subflows");
|
||||||
|
if (currentCategory !== newCategory) {
|
||||||
|
var category = newCategory.replace(/ /g,"_");
|
||||||
|
createCategory(newCategory,category,category,"node-red");
|
||||||
|
|
||||||
|
var currentCategoryNode = paletteNode.closest(".palette-category");
|
||||||
|
var newCategoryNode = $("#palette-"+category);
|
||||||
|
newCategoryNode.append(paletteNode);
|
||||||
|
if (newCategoryNode.find(".palette_node").length === 1) {
|
||||||
|
categoryContainers[category].open();
|
||||||
|
}
|
||||||
|
|
||||||
|
paletteNode.data('category',newCategory);
|
||||||
|
if (currentCategoryNode.find(".palette_node").length === 0) {
|
||||||
|
if (currentCategoryNode.find("i").hasClass("expanded")) {
|
||||||
|
currentCategoryNode.find(".palette-content").slideToggle();
|
||||||
|
currentCategoryNode.find("i").toggleClass("expanded");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,12 +450,11 @@ RED.palette = (function() {
|
|||||||
RED.events.on('registry:node-type-removed', function(nodeType) {
|
RED.events.on('registry:node-type-removed', function(nodeType) {
|
||||||
removeNodeType(nodeType);
|
removeNodeType(nodeType);
|
||||||
});
|
});
|
||||||
|
|
||||||
RED.events.on('registry:node-set-enabled', function(nodeSet) {
|
RED.events.on('registry:node-set-enabled', function(nodeSet) {
|
||||||
for (var j=0;j<nodeSet.types.length;j++) {
|
for (var j=0;j<nodeSet.types.length;j++) {
|
||||||
showNodeType(nodeSet.types[j]);
|
showNodeType(nodeSet.types[j]);
|
||||||
var def = RED.nodes.getType(nodeSet.types[j]);
|
var def = RED.nodes.getType(nodeSet.types[j]);
|
||||||
if (def.onpaletteadd && typeof def.onpaletteadd === "function") {
|
if (def && def.onpaletteadd && typeof def.onpaletteadd === "function") {
|
||||||
def.onpaletteadd.call(def);
|
def.onpaletteadd.call(def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,7 +463,7 @@ RED.palette = (function() {
|
|||||||
for (var j=0;j<nodeSet.types.length;j++) {
|
for (var j=0;j<nodeSet.types.length;j++) {
|
||||||
hideNodeType(nodeSet.types[j]);
|
hideNodeType(nodeSet.types[j]);
|
||||||
var def = RED.nodes.getType(nodeSet.types[j]);
|
var def = RED.nodes.getType(nodeSet.types[j]);
|
||||||
if (def.onpaletteremove && typeof def.onpaletteremove === "function") {
|
if (def && def.onpaletteremove && typeof def.onpaletteremove === "function") {
|
||||||
def.onpaletteremove.call(def);
|
def.onpaletteremove.call(def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -423,14 +473,13 @@ RED.palette = (function() {
|
|||||||
for (var j=0;j<nodeSet.types.length;j++) {
|
for (var j=0;j<nodeSet.types.length;j++) {
|
||||||
removeNodeType(nodeSet.types[j]);
|
removeNodeType(nodeSet.types[j]);
|
||||||
var def = RED.nodes.getType(nodeSet.types[j]);
|
var def = RED.nodes.getType(nodeSet.types[j]);
|
||||||
if (def.onpaletteremove && typeof def.onpaletteremove === "function") {
|
if (def && def.onpaletteremove && typeof def.onpaletteremove === "function") {
|
||||||
def.onpaletteremove.call(def);
|
def.onpaletteremove.call(def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#palette > .palette-spinner").show();
|
$("#palette > .palette-spinner").show();
|
||||||
|
|
||||||
$("#palette-search input").searchBox({
|
$("#palette-search input").searchBox({
|
||||||
@@ -450,7 +499,7 @@ RED.palette = (function() {
|
|||||||
categoryList = coreCategories
|
categoryList = coreCategories
|
||||||
}
|
}
|
||||||
categoryList.forEach(function(category){
|
categoryList.forEach(function(category){
|
||||||
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
|
createCategoryContainer(category, category, "palette.label."+category);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#palette-collapse-all").on("click", function(e) {
|
$("#palette-collapse-all").on("click", function(e) {
|
||||||
@@ -470,13 +519,20 @@ RED.palette = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function getCategories() {
|
||||||
|
var categories = [];
|
||||||
|
$("#palette-container .palette-category").each(function(i,d) {
|
||||||
|
categories.push({id:$(d).data('category'),label:$(d).data('label')});
|
||||||
|
})
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
add:addNodeType,
|
add:addNodeType,
|
||||||
remove:removeNodeType,
|
remove:removeNodeType,
|
||||||
hide:hideNodeType,
|
hide:hideNodeType,
|
||||||
show:showNodeType,
|
show:showNodeType,
|
||||||
refresh:refreshNodeTypes
|
refresh:refreshNodeTypes,
|
||||||
|
getCategories: getCategories
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
1539
editor/js/ui/projects/projectSettings.js
Normal file
418
editor/js/ui/projects/projectUserSettings.js
Normal file
@@ -0,0 +1,418 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
RED.projects.userSettings = (function() {
|
||||||
|
|
||||||
|
var gitUsernameInput;
|
||||||
|
var gitEmailInput;
|
||||||
|
|
||||||
|
function createGitUserSection(pane) {
|
||||||
|
|
||||||
|
var currentGitSettings = RED.settings.get('git') || {};
|
||||||
|
currentGitSettings.user = currentGitSettings.user || {};
|
||||||
|
|
||||||
|
var title = $('<h3></h3>').text(RED._("editor:sidebar.project.userSettings.committerDetail")).appendTo(pane);
|
||||||
|
|
||||||
|
var gitconfigContainer = $('<div class="user-settings-section"></div>').appendTo(pane);
|
||||||
|
$('<div style="color:#aaa;"></div>').appendTo(gitconfigContainer).text(RED._("editor:sidebar.project.userSettings.committerTip"));
|
||||||
|
|
||||||
|
var row = $('<div class="user-settings-row"></div>').appendTo(gitconfigContainer);
|
||||||
|
$('<label for=""></label>').text(RED._("editor:sidebar.project.userSettings.userName")).appendTo(row);
|
||||||
|
gitUsernameInput = $('<input type="text">').appendTo(row);
|
||||||
|
gitUsernameInput.val(currentGitSettings.user.name||"");
|
||||||
|
|
||||||
|
row = $('<div class="user-settings-row"></div>').appendTo(gitconfigContainer);
|
||||||
|
$('<label for=""></label>').text(RED._("editor:sidebar.project.userSettings.email")).appendTo(row);
|
||||||
|
gitEmailInput = $('<input type="text">').appendTo(row);
|
||||||
|
gitEmailInput.val(currentGitSettings.user.email||"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function createSSHKeySection(pane) {
|
||||||
|
var container = $('<div class="user-settings-section"></div>').appendTo(pane);
|
||||||
|
var popover;
|
||||||
|
var title = $('<h3></h3>').text(RED._("editor:sidebar.project.userSettings.sshKeys")).appendTo(container);
|
||||||
|
var subtitle = $('<div style="color:#aaa;"></div>').appendTo(container).text(RED._("editor:sidebar.project.userSettings.sshKeysTip"));
|
||||||
|
|
||||||
|
var addKeyButton = $('<button id="user-settings-gitconfig-add-key" class="editor-button editor-button-small" style="float: right; margin-right: 10px;">'+RED._("editor:sidebar.project.userSettings.add")+'</button>')
|
||||||
|
.appendTo(subtitle)
|
||||||
|
.click(function(evt) {
|
||||||
|
addKeyButton.attr('disabled',true);
|
||||||
|
saveButton.attr('disabled',true);
|
||||||
|
// bg.children().removeClass("selected");
|
||||||
|
// addLocalButton.click();
|
||||||
|
addKeyDialog.slideDown(200);
|
||||||
|
keyNameInput.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
var validateForm = function() {
|
||||||
|
var valid = /^[a-zA-Z0-9\-_]+$/.test(keyNameInput.val());
|
||||||
|
keyNameInput.toggleClass('input-error',keyNameInputChanged&&!valid);
|
||||||
|
|
||||||
|
// var selectedButton = bg.find(".selected");
|
||||||
|
// if (selectedButton[0] === addLocalButton[0]) {
|
||||||
|
// valid = valid && localPublicKeyPathInput.val().length > 0 && localPrivateKeyPathInput.val().length > 0;
|
||||||
|
// } else if (selectedButton[0] === uploadButton[0]) {
|
||||||
|
// valid = valid && publicKeyInput.val().length > 0 && privateKeyInput.val().length > 0;
|
||||||
|
// } else if (selectedButton[0] === generateButton[0]) {
|
||||||
|
var passphrase = passphraseInput.val();
|
||||||
|
var validPassphrase = passphrase.length === 0 || passphrase.length >= 8;
|
||||||
|
passphraseInput.toggleClass('input-error',!validPassphrase);
|
||||||
|
if (!validPassphrase) {
|
||||||
|
passphraseInputSubLabel.text(RED._("editor:sidebar.project.userSettings.passphraseShort"));
|
||||||
|
} else if (passphrase.length === 0) {
|
||||||
|
passphraseInputSubLabel.text(RED._("editor:sidebar.project.userSettings.optional"));
|
||||||
|
} else {
|
||||||
|
passphraseInputSubLabel.text("");
|
||||||
|
}
|
||||||
|
valid = valid && validPassphrase;
|
||||||
|
// }
|
||||||
|
|
||||||
|
saveButton.attr('disabled',!valid);
|
||||||
|
|
||||||
|
if (popover) {
|
||||||
|
popover.close();
|
||||||
|
popover = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var row = $('<div class="user-settings-row"></div>').appendTo(container);
|
||||||
|
var addKeyDialog = $('<div class="projects-dialog-list-dialog"></div>').hide().appendTo(row);
|
||||||
|
$('<div class="projects-dialog-list-dialog-header">').text(RED._("editor:sidebar.project.userSettings.addSshKey")).appendTo(addKeyDialog);
|
||||||
|
var addKeyDialogBody = $('<div>').appendTo(addKeyDialog);
|
||||||
|
|
||||||
|
row = $('<div class="user-settings-row"></div>').appendTo(addKeyDialogBody);
|
||||||
|
$('<div style="color:#aaa;"></div>').appendTo(row).text(RED._("editor:sidebar.project.userSettings.addSshKeyTip"));
|
||||||
|
// var bg = $('<div></div>',{class:"button-group", style:"text-align: center"}).appendTo(row);
|
||||||
|
// var addLocalButton = $('<button class="editor-button toggle selected">use local key</button>').appendTo(bg);
|
||||||
|
// var uploadButton = $('<button class="editor-button toggle">upload key</button>').appendTo(bg);
|
||||||
|
// var generateButton = $('<button class="editor-button toggle">generate key</button>').appendTo(bg);
|
||||||
|
// bg.children().click(function(e) {
|
||||||
|
// e.preventDefault();
|
||||||
|
// if ($(this).hasClass("selected")) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// bg.children().removeClass("selected");
|
||||||
|
// $(this).addClass("selected");
|
||||||
|
// if (this === addLocalButton[0]) {
|
||||||
|
// addLocalKeyPane.show();
|
||||||
|
// generateKeyPane.hide();
|
||||||
|
// uploadKeyPane.hide();
|
||||||
|
// } else if (this === uploadButton[0]) {
|
||||||
|
// addLocalKeyPane.hide();
|
||||||
|
// generateKeyPane.hide();
|
||||||
|
// uploadKeyPane.show();
|
||||||
|
// } else if (this === generateButton[0]){
|
||||||
|
// addLocalKeyPane.hide();
|
||||||
|
// generateKeyPane.show();
|
||||||
|
// uploadKeyPane.hide();
|
||||||
|
// }
|
||||||
|
// validateForm();
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
row = $('<div class="user-settings-row"></div>').appendTo(addKeyDialogBody);
|
||||||
|
$('<label for=""></label>').text(RED._("editor:sidebar.project.userSettings.name")).appendTo(row);
|
||||||
|
var keyNameInputChanged = false;
|
||||||
|
var keyNameInput = $('<input type="text">').appendTo(row).on("change keyup paste",function() {
|
||||||
|
keyNameInputChanged = true;
|
||||||
|
validateForm();
|
||||||
|
});
|
||||||
|
$('<label class="projects-edit-form-sublabel"><small>'+RED._("editor:sidebar.project.userSettings.nameRule")+'</small></label>').appendTo(row).find("small");
|
||||||
|
|
||||||
|
var generateKeyPane = $('<div>').appendTo(addKeyDialogBody);
|
||||||
|
row = $('<div class="user-settings-row"></div>').appendTo(generateKeyPane);
|
||||||
|
$('<label for=""></label>').text(RED._("editor:sidebar.project.userSettings.passphrase")).appendTo(row);
|
||||||
|
var passphraseInput = $('<input type="password">').appendTo(row).on("change keyup paste",validateForm);
|
||||||
|
var passphraseInputSubLabel = $('<label class="projects-edit-form-sublabel"><small>'+RED._("editor:sidebar.project.userSettings.optional")+'</small></label>').appendTo(row).find("small");
|
||||||
|
|
||||||
|
// var addLocalKeyPane = $('<div>').hide().appendTo(addKeyDialogBody);
|
||||||
|
// row = $('<div class="user-settings-row"></div>').appendTo(addLocalKeyPane);
|
||||||
|
// $('<label for=""></label>').text('Public key').appendTo(row);
|
||||||
|
// var localPublicKeyPathInput = $('<input type="text">').appendTo(row).on("change keyup paste",validateForm);
|
||||||
|
// $('<label class="projects-edit-form-sublabel"><small>Public key file path, for example: ~/.ssh/id_rsa.pub</small></label>').appendTo(row).find("small");
|
||||||
|
// row = $('<div class="user-settings-row"></div>').appendTo(addLocalKeyPane);
|
||||||
|
// $('<label for=""></label>').text('Private key').appendTo(row);
|
||||||
|
// var localPrivateKeyPathInput = $('<input type="text">').appendTo(row).on("change keyup paste",validateForm);
|
||||||
|
// $('<label class="projects-edit-form-sublabel"><small>Private key file path, for example: ~/.ssh/id_rsa</small></label>').appendTo(row).find("small");
|
||||||
|
//
|
||||||
|
// var uploadKeyPane = $('<div>').hide().appendTo(addKeyDialogBody);
|
||||||
|
// row = $('<div class="user-settings-row"></div>').appendTo(uploadKeyPane);
|
||||||
|
// $('<label for=""></label>').text('Public key').appendTo(row);
|
||||||
|
// var publicKeyInput = $('<textarea>').appendTo(row).on("change keyup paste",validateForm);
|
||||||
|
// $('<label class="projects-edit-form-sublabel"><small>Paste in public key contents, for example: ~/.ssh/id_rsa.pub</small></label>').appendTo(row).find("small");
|
||||||
|
// row = $('<div class="user-settings-row"></div>').appendTo(uploadKeyPane);
|
||||||
|
// $('<label for=""></label>').text('Private key').appendTo(row);
|
||||||
|
// var privateKeyInput = $('<textarea>').appendTo(row).on("change keyup paste",validateForm);
|
||||||
|
// $('<label class="projects-edit-form-sublabel"><small>Paste in private key contents, for example: ~/.ssh/id_rsa</small></label>').appendTo(row).find("small");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var hideEditForm = function() {
|
||||||
|
addKeyButton.attr('disabled',false);
|
||||||
|
addKeyDialog.hide();
|
||||||
|
|
||||||
|
keyNameInput.val("");
|
||||||
|
keyNameInputChanged = false;
|
||||||
|
passphraseInput.val("");
|
||||||
|
// localPublicKeyPathInput.val("");
|
||||||
|
// localPrivateKeyPathInput.val("");
|
||||||
|
// publicKeyInput.val("");
|
||||||
|
// privateKeyInput.val("");
|
||||||
|
if (popover) {
|
||||||
|
popover.close();
|
||||||
|
popover = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var formButtons = $('<span class="button-row" style="position: relative; float: right; margin: 10px;"></span>').appendTo(addKeyDialog);
|
||||||
|
$('<button class="editor-button">'+RED._("editor:sidebar.project.userSettings.cancel")+'</button>')
|
||||||
|
.appendTo(formButtons)
|
||||||
|
.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
hideEditForm();
|
||||||
|
});
|
||||||
|
var saveButton = $('<button class="editor-button">'+RED._("editor:sidebar.project.userSettings.generate")+'</button>')
|
||||||
|
.appendTo(formButtons)
|
||||||
|
.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
var spinner = utils.addSpinnerOverlay(addKeyDialog).addClass('projects-dialog-spinner-contain');
|
||||||
|
var payload = {
|
||||||
|
name: keyNameInput.val()
|
||||||
|
};
|
||||||
|
|
||||||
|
// var selectedButton = bg.find(".selected");
|
||||||
|
// if (selectedButton[0] === addLocalButton[0]) {
|
||||||
|
// payload.type = "local";
|
||||||
|
// payload.publicKeyPath = localPublicKeyPathInput.val();
|
||||||
|
// payload.privateKeyPath = localPrivateKeyPathInput.val();
|
||||||
|
// } else if (selectedButton[0] === uploadButton[0]) {
|
||||||
|
// payload.type = "upload";
|
||||||
|
// payload.publicKey = publicKeyInput.val();
|
||||||
|
// payload.privateKey = privateKeyInput.val();
|
||||||
|
// } else if (selectedButton[0] === generateButton[0]) {
|
||||||
|
payload.type = "generate";
|
||||||
|
payload.comment = gitEmailInput.val();
|
||||||
|
payload.password = passphraseInput.val();
|
||||||
|
payload.size = 4096;
|
||||||
|
// }
|
||||||
|
var done = function(err) {
|
||||||
|
spinner.remove();
|
||||||
|
if (err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hideEditForm();
|
||||||
|
}
|
||||||
|
// console.log(JSON.stringify(payload,null,4));
|
||||||
|
RED.deploy.setDeployInflight(true);
|
||||||
|
utils.sendRequest({
|
||||||
|
url: "settings/user/keys",
|
||||||
|
type: "POST",
|
||||||
|
responses: {
|
||||||
|
0: function(error) {
|
||||||
|
done(error);
|
||||||
|
},
|
||||||
|
200: function(data) {
|
||||||
|
refreshSSHKeyList(payload.name);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
400: {
|
||||||
|
'unexpected_error': function(error) {
|
||||||
|
console.log(error);
|
||||||
|
done(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},payload);
|
||||||
|
});
|
||||||
|
|
||||||
|
row = $('<div class="user-settings-row projects-dialog-list"></div>').appendTo(container);
|
||||||
|
var emptyItem = { empty: true };
|
||||||
|
var expandKey = function(container,entry) {
|
||||||
|
var row = $('<div class="projects-dialog-ssh-public-key">',{style:"position:relative"}).appendTo(container);
|
||||||
|
var keyBox = $('<pre>',{style:"min-height: 80px"}).appendTo(row);
|
||||||
|
var spinner = utils.addSpinnerOverlay(keyBox).addClass('projects-dialog-spinner-contain');
|
||||||
|
var options = {
|
||||||
|
url: 'settings/user/keys/'+entry.name,
|
||||||
|
type: "GET",
|
||||||
|
responses: {
|
||||||
|
200: function(data) {
|
||||||
|
keyBox.text(data.publickey);
|
||||||
|
spinner.remove();
|
||||||
|
},
|
||||||
|
400: {
|
||||||
|
'unexpected_error': function(error) {
|
||||||
|
console.log(error);
|
||||||
|
spinner.remove();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
utils.sendRequest(options);
|
||||||
|
|
||||||
|
var formButtons = $('<span class="button-row" style="position: relative; float: right; margin: 10px;"></span>').appendTo(row);
|
||||||
|
$('<button class="editor-button editor-button-small">'+RED._("editor:sidebar.project.userSettings.copyPublicKey")+'</button>')
|
||||||
|
.appendTo(formButtons)
|
||||||
|
.click(function(evt) {
|
||||||
|
try {
|
||||||
|
evt.stopPropagation();
|
||||||
|
evt.preventDefault();
|
||||||
|
document.getSelection().selectAllChildren(keyBox[0]);
|
||||||
|
var ret = document.execCommand('copy');
|
||||||
|
document.getSelection().empty();
|
||||||
|
} catch(err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
var keyList = $('<ol class="projects-dialog-ssh-key-list">').appendTo(row).editableList({
|
||||||
|
height: 'auto',
|
||||||
|
addButton: false,
|
||||||
|
scrollOnAdd: false,
|
||||||
|
addItem: function(row,index,entry) {
|
||||||
|
var container = $('<div class="projects-dialog-list-entry">').appendTo(row);
|
||||||
|
if (entry.empty) {
|
||||||
|
container.addClass('red-ui-search-empty');
|
||||||
|
container.text(RED._("editor:sidebar.project.userSettings.noSshKeys"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var topRow = $('<div class="projects-dialog-ssh-key-header">').appendTo(container);
|
||||||
|
$('<span class="entry-icon"><i class="fa fa-key"></i></span>').appendTo(topRow);
|
||||||
|
$('<span class="entry-name">').text(entry.name).appendTo(topRow);
|
||||||
|
var tools = $('<span class="button-row entry-tools">').appendTo(topRow);
|
||||||
|
var expandedRow;
|
||||||
|
topRow.click(function(e) {
|
||||||
|
if (expandedRow) {
|
||||||
|
expandedRow.slideUp(200,function() {
|
||||||
|
expandedRow.remove();
|
||||||
|
expandedRow = null;
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
expandedRow = expandKey(container,entry);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!entry.system) {
|
||||||
|
$('<button class="editor-button editor-button-small"><i class="fa fa-trash"></i></button>')
|
||||||
|
.appendTo(tools)
|
||||||
|
.click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
var spinner = utils.addSpinnerOverlay(row).addClass('projects-dialog-spinner-contain');
|
||||||
|
var notification = RED.notify(RED._("editor:sidebar.project.userSettings.deleteConfirm", {name:entry.name}), {
|
||||||
|
type: 'warning',
|
||||||
|
modal: true,
|
||||||
|
fixed: true,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: RED._("common.label.cancel"),
|
||||||
|
click: function() {
|
||||||
|
spinner.remove();
|
||||||
|
notification.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: RED._("editor:sidebar.project.userSettings.delete"),
|
||||||
|
click: function() {
|
||||||
|
notification.close();
|
||||||
|
var url = "settings/user/keys/"+entry.name;
|
||||||
|
var options = {
|
||||||
|
url: url,
|
||||||
|
type: "DELETE",
|
||||||
|
responses: {
|
||||||
|
200: function(data) {
|
||||||
|
row.fadeOut(200,function() {
|
||||||
|
keyList.editableList('removeItem',entry);
|
||||||
|
setTimeout(spinner.remove, 100);
|
||||||
|
if (keyList.editableList('length') === 0) {
|
||||||
|
keyList.editableList('addItem',emptyItem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
400: {
|
||||||
|
'unexpected_error': function(error) {
|
||||||
|
console.log(error);
|
||||||
|
spinner.remove();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
utils.sendRequest(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (entry.expand) {
|
||||||
|
expandedRow = expandKey(container,entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var refreshSSHKeyList = function(justAdded) {
|
||||||
|
$.getJSON("settings/user/keys",function(result) {
|
||||||
|
if (result.keys) {
|
||||||
|
result.keys.sort(function(A,B) {
|
||||||
|
return A.name.localeCompare(B.name);
|
||||||
|
});
|
||||||
|
keyList.editableList('empty');
|
||||||
|
result.keys.forEach(function(key) {
|
||||||
|
if (key.name === justAdded) {
|
||||||
|
key.expand = true;
|
||||||
|
}
|
||||||
|
keyList.editableList('addItem',key);
|
||||||
|
});
|
||||||
|
if (keyList.editableList('length') === 0) {
|
||||||
|
keyList.editableList('addItem',emptyItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
refreshSSHKeyList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function createSettingsPane(activeProject) {
|
||||||
|
var pane = $('<div id="user-settings-tab-gitconfig" class="project-settings-tab-pane node-help"></div>');
|
||||||
|
createGitUserSection(pane);
|
||||||
|
createSSHKeySection(pane);
|
||||||
|
return pane;
|
||||||
|
}
|
||||||
|
|
||||||
|
var utils;
|
||||||
|
function init(_utils) {
|
||||||
|
utils = _utils;
|
||||||
|
RED.userSettings.add({
|
||||||
|
id:'gitconfig',
|
||||||
|
title: RED._("editor:sidebar.project.userSettings.gitConfig"),
|
||||||
|
get: createSettingsPane,
|
||||||
|
close: function() {
|
||||||
|
var currentGitSettings = RED.settings.get('git') || {};
|
||||||
|
currentGitSettings.user = currentGitSettings.user || {};
|
||||||
|
currentGitSettings.user.name = gitUsernameInput.val();
|
||||||
|
currentGitSettings.user.email = gitEmailInput.val();
|
||||||
|
RED.settings.set('git', currentGitSettings);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: init,
|
||||||
|
};
|
||||||
|
})();
|
||||||
2377
editor/js/ui/projects/projects.js
Normal file
1374
editor/js/ui/projects/tab-versionControl.js
Normal file
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -26,38 +26,45 @@ RED.search = (function() {
|
|||||||
var keys = [];
|
var keys = [];
|
||||||
var results = [];
|
var results = [];
|
||||||
|
|
||||||
function indexNode(n) {
|
|
||||||
var l = "";
|
function indexProperty(node,label,property) {
|
||||||
if (n._def && n._def.label) {
|
if (typeof property === 'string' || typeof property === 'number') {
|
||||||
l = n._def.label;
|
property = (""+property).toLowerCase();
|
||||||
try {
|
index[property] = index[property] || {};
|
||||||
l = (typeof l === "function" ? l.call(n) : l);
|
index[property][node.id] = {node:node,label:label};
|
||||||
if (l) {
|
} else if (Array.isArray(property)) {
|
||||||
l = (""+l).toLowerCase();
|
property.forEach(function(prop) {
|
||||||
index[l] = index[l] || {};
|
indexProperty(node,label,prop);
|
||||||
index[l][n.id] = {node:n,label:l}
|
})
|
||||||
|
} else if (typeof property === 'object') {
|
||||||
|
for (var prop in property) {
|
||||||
|
if (property.hasOwnProperty(prop)) {
|
||||||
|
indexProperty(node,label,property[prop])
|
||||||
}
|
}
|
||||||
} catch(err) {
|
|
||||||
console.log("Definition error: "+n.type+".label",err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
function indexNode(n) {
|
||||||
|
var l = RED.utils.getNodeLabel(n);
|
||||||
|
if (l) {
|
||||||
|
l = (""+l).toLowerCase();
|
||||||
|
index[l] = index[l] || {};
|
||||||
|
index[l][n.id] = {node:n,label:l}
|
||||||
|
}
|
||||||
l = l||n.label||n.name||n.id||"";
|
l = l||n.label||n.name||n.id||"";
|
||||||
|
|
||||||
|
|
||||||
var properties = ['id','type','name','label','info'];
|
var properties = ['id','type','name','label','info'];
|
||||||
|
if (n._def && n._def.defaults) {
|
||||||
|
properties = properties.concat(Object.keys(n._def.defaults));
|
||||||
|
}
|
||||||
for (var i=0;i<properties.length;i++) {
|
for (var i=0;i<properties.length;i++) {
|
||||||
if (n.hasOwnProperty(properties[i])) {
|
if (n.hasOwnProperty(properties[i])) {
|
||||||
var v = n[properties[i]];
|
indexProperty(n, l, n[properties[i]]);
|
||||||
if (typeof v === 'string' || typeof v === 'number') {
|
|
||||||
v = (""+v).toLowerCase();
|
|
||||||
index[v] = index[v] || {};
|
|
||||||
index[v][n.id] = {node:n,label:l};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function indexWorkspace() {
|
function indexWorkspace() {
|
||||||
index = {};
|
index = {};
|
||||||
RED.nodes.eachWorkspace(indexNode);
|
RED.nodes.eachWorkspace(indexNode);
|
||||||
@@ -130,7 +137,7 @@ RED.search = (function() {
|
|||||||
function createDialog() {
|
function createDialog() {
|
||||||
dialog = $("<div>",{id:"red-ui-search",class:"red-ui-search"}).appendTo("#main-container");
|
dialog = $("<div>",{id:"red-ui-search",class:"red-ui-search"}).appendTo("#main-container");
|
||||||
var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(dialog);
|
var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(dialog);
|
||||||
searchInput = $('<input type="text" placeholder="search your flows">').appendTo(searchDiv).searchBox({
|
searchInput = $('<input type="text" data-i18n="[placeholder]menu.label.searchInput">').appendTo(searchDiv).searchBox({
|
||||||
delay: 200,
|
delay: 200,
|
||||||
change: function() {
|
change: function() {
|
||||||
search($(this).val());
|
search($(this).val());
|
||||||
@@ -171,6 +178,7 @@ RED.search = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
searchInput.i18n();
|
||||||
|
|
||||||
var searchResultsDiv = $("<div>",{class:"red-ui-search-results-container"}).appendTo(dialog);
|
var searchResultsDiv = $("<div>",{class:"red-ui-search-results-container"}).appendTo(dialog);
|
||||||
searchResults = $('<ol>',{id:"search-result-list", style:"position: absolute;top: 5px;bottom: 5px;left: 5px;right: 5px;"}).appendTo(searchResultsDiv).editableList({
|
searchResults = $('<ol>',{id:"search-result-list", style:"position: absolute;top: 5px;bottom: 5px;left: 5px;right: 5px;"}).appendTo(searchResultsDiv).editableList({
|
||||||
@@ -178,33 +186,22 @@ RED.search = (function() {
|
|||||||
addItem: function(container,i,object) {
|
addItem: function(container,i,object) {
|
||||||
var node = object.node;
|
var node = object.node;
|
||||||
if (node === undefined) {
|
if (node === undefined) {
|
||||||
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container);
|
$('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var def = node._def;
|
var def = node._def;
|
||||||
var div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container);
|
var div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container);
|
||||||
|
|
||||||
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div);
|
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div);
|
||||||
var colour = def.color;
|
var colour = RED.utils.getNodeColor(node.type,def);
|
||||||
var icon_url = "arrow-in.png";
|
var icon_url = RED.utils.getNodeIcon(def,node);
|
||||||
if (node.type === 'tab') {
|
if (node.type === 'tab') {
|
||||||
colour = "#C0DEED";
|
colour = "#C0DEED";
|
||||||
icon_url = "subflow.png";
|
|
||||||
} else if (def.category === 'config') {
|
|
||||||
icon_url = "cog.png";
|
|
||||||
} else if (node.type === 'unknown') {
|
|
||||||
icon_url = "alert.png";
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
icon_url = (typeof def.icon === "function" ? def.icon.call({}) : def.icon);
|
|
||||||
} catch(err) {
|
|
||||||
console.log("Definition error: "+nt+".icon",err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
nodeDiv.css('backgroundColor',colour);
|
nodeDiv.css('backgroundColor',colour);
|
||||||
|
|
||||||
var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv);
|
var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv);
|
||||||
$('<div/>',{class:"palette_icon",style:"background-image: url(icons/"+icon_url+")"}).appendTo(iconContainer);
|
$('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer);
|
||||||
|
|
||||||
var contentDiv = $('<div>',{class:"red-ui-search-result-description"}).appendTo(div);
|
var contentDiv = $('<div>',{class:"red-ui-search-result-description"}).appendTo(div);
|
||||||
if (node.z) {
|
if (node.z) {
|
||||||
@@ -215,12 +212,12 @@ RED.search = (function() {
|
|||||||
} else {
|
} else {
|
||||||
workspace = "flow:"+workspace.label;
|
workspace = "flow:"+workspace.label;
|
||||||
}
|
}
|
||||||
$('<div>',{class:"red-ui-search-result-node-flow"}).html(workspace).appendTo(contentDiv);
|
$('<div>',{class:"red-ui-search-result-node-flow"}).text(workspace).appendTo(contentDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('<div>',{class:"red-ui-search-result-node-label"}).html(object.label || node.id).appendTo(contentDiv);
|
$('<div>',{class:"red-ui-search-result-node-label"}).text(object.label || node.id).appendTo(contentDiv);
|
||||||
$('<div>',{class:"red-ui-search-result-node-type"}).html(node.type).appendTo(contentDiv);
|
$('<div>',{class:"red-ui-search-result-node-type"}).text(node.type).appendTo(contentDiv);
|
||||||
$('<div>',{class:"red-ui-search-result-node-id"}).html(node.id).appendTo(contentDiv);
|
$('<div>',{class:"red-ui-search-result-node-id"}).text(node.id).appendTo(contentDiv);
|
||||||
|
|
||||||
div.click(function(evt) {
|
div.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@@ -238,8 +235,11 @@ RED.search = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
|
if (disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
RED.keyboard.add("*",/* ESCAPE */ 27,function(){hide();d3.event.preventDefault();});
|
RED.keyboard.add("*","escape",function(){hide()});
|
||||||
$("#header-shade").show();
|
$("#header-shade").show();
|
||||||
$("#editor-shade").show();
|
$("#editor-shade").show();
|
||||||
$("#palette-shade").show();
|
$("#palette-shade").show();
|
||||||
@@ -249,7 +249,7 @@ RED.search = (function() {
|
|||||||
if (dialog === null) {
|
if (dialog === null) {
|
||||||
createDialog();
|
createDialog();
|
||||||
}
|
}
|
||||||
dialog.slideDown();
|
dialog.slideDown(300);
|
||||||
RED.events.emit("search:open");
|
RED.events.emit("search:open");
|
||||||
visible = true;
|
visible = true;
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ RED.search = (function() {
|
|||||||
}
|
}
|
||||||
function hide() {
|
function hide() {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
RED.keyboard.remove(/* ESCAPE */ 27);
|
RED.keyboard.remove("escape");
|
||||||
visible = false;
|
visible = false;
|
||||||
$("#header-shade").hide();
|
$("#header-shade").hide();
|
||||||
$("#editor-shade").hide();
|
$("#editor-shade").hide();
|
||||||
@@ -274,11 +274,12 @@ RED.search = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
RED.keyboard.add("*",/* . */ 190,{ctrl:true},function(){if (!disabled) { show(); } d3.event.preventDefault();});
|
RED.actions.add("core:search",show);
|
||||||
|
|
||||||
RED.events.on("editor:open",function() { disabled = true; });
|
RED.events.on("editor:open",function() { disabled = true; });
|
||||||
RED.events.on("editor:close",function() { disabled = false; });
|
RED.events.on("editor:close",function() { disabled = false; });
|
||||||
RED.events.on("palette-editor:open",function() { disabled = true; });
|
RED.events.on("type-search:open",function() { disabled = true; });
|
||||||
RED.events.on("palette-editor:close",function() { disabled = false; });
|
RED.events.on("type-search:close",function() { disabled = false; });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -35,7 +35,9 @@ RED.sidebar = (function() {
|
|||||||
tab.onremove.call(tab);
|
tab.onremove.call(tab);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
minimumActiveTabWidth: 110
|
// minimumActiveTabWidth: 70,
|
||||||
|
collapsible: true
|
||||||
|
// scrollable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
var knownTabs = {
|
var knownTabs = {
|
||||||
@@ -58,6 +60,8 @@ RED.sidebar = (function() {
|
|||||||
options = title;
|
options = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete options.closeable;
|
||||||
|
|
||||||
options.wrapper = $('<div>',{style:"height:100%"}).appendTo("#sidebar-content")
|
options.wrapper = $('<div>',{style:"height:100%"}).appendTo("#sidebar-content")
|
||||||
options.wrapper.append(options.content);
|
options.wrapper.append(options.content);
|
||||||
options.wrapper.hide();
|
options.wrapper.hide();
|
||||||
@@ -81,6 +85,8 @@ RED.sidebar = (function() {
|
|||||||
group: "sidebar-tabs"
|
group: "sidebar-tabs"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
options.iconClass = options.iconClass || "fa fa-square-o"
|
||||||
|
|
||||||
knownTabs[options.id] = options;
|
knownTabs[options.id] = options;
|
||||||
|
|
||||||
if (options.visible !== false) {
|
if (options.visible !== false) {
|
||||||
@@ -202,12 +208,19 @@ RED.sidebar = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
RED.keyboard.add("*",/* SPACE */ 32,{ctrl:true},function(){RED.menu.setSelected("menu-item-sidebar",!RED.menu.isSelected("menu-item-sidebar"));d3.event.preventDefault();});
|
RED.actions.add("core:toggle-sidebar",function(state){
|
||||||
|
if (state === undefined) {
|
||||||
|
RED.menu.toggleSelected("menu-item-sidebar");
|
||||||
|
} else {
|
||||||
|
toggleSidebar(state);
|
||||||
|
}
|
||||||
|
});
|
||||||
showSidebar();
|
showSidebar();
|
||||||
RED.sidebar.info.init();
|
RED.sidebar.info.init();
|
||||||
RED.sidebar.config.init();
|
RED.sidebar.config.init();
|
||||||
|
RED.sidebar.context.init();
|
||||||
// hide info bar at start if screen rather narrow...
|
// hide info bar at start if screen rather narrow...
|
||||||
if ($(window).width() < 600) { toggleSidebar(); }
|
if ($(window).width() < 600) { RED.menu.setSelected("menu-item-sidebar",false); }
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -22,5 +22,7 @@ RED.state = {
|
|||||||
EDITING: 5,
|
EDITING: 5,
|
||||||
EXPORT: 6,
|
EXPORT: 6,
|
||||||
IMPORT: 7,
|
IMPORT: 7,
|
||||||
IMPORT_DRAGGING: 8
|
IMPORT_DRAGGING: 8,
|
||||||
|
QUICK_JOINING: 9,
|
||||||
|
PANNING: 10
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -139,7 +139,7 @@ RED.subflow = (function() {
|
|||||||
RED.view.select();
|
RED.view.select();
|
||||||
RED.nodes.dirty(true);
|
RED.nodes.dirty(true);
|
||||||
RED.view.redraw();
|
RED.view.redraw();
|
||||||
$("#workspace-subflow-output .spinner-value").html(subflow.out.length);
|
$("#workspace-subflow-output .spinner-value").text(subflow.out.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeSubflowOutput(removedSubflowOutputs) {
|
function removeSubflowOutput(removedSubflowOutputs) {
|
||||||
@@ -216,7 +216,7 @@ RED.subflow = (function() {
|
|||||||
$("#workspace-subflow-input-add").toggleClass("active", activeSubflow.in.length !== 0);
|
$("#workspace-subflow-input-add").toggleClass("active", activeSubflow.in.length !== 0);
|
||||||
$("#workspace-subflow-input-remove").toggleClass("active",activeSubflow.in.length === 0);
|
$("#workspace-subflow-input-remove").toggleClass("active",activeSubflow.in.length === 0);
|
||||||
|
|
||||||
$("#workspace-subflow-output .spinner-value").html(activeSubflow.out.length);
|
$("#workspace-subflow-output .spinner-value").text(activeSubflow.out.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,50 +306,13 @@ RED.subflow = (function() {
|
|||||||
|
|
||||||
$("#workspace-subflow-delete").click(function(event) {
|
$("#workspace-subflow-delete").click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var removedNodes = [];
|
|
||||||
var removedLinks = [];
|
|
||||||
var startDirty = RED.nodes.dirty();
|
var startDirty = RED.nodes.dirty();
|
||||||
|
var historyEvent = removeSubflow(RED.workspaces.active());
|
||||||
|
historyEvent.t = 'delete';
|
||||||
|
historyEvent.dirty = startDirty;
|
||||||
|
|
||||||
var activeSubflow = getSubflow();
|
RED.history.push(historyEvent);
|
||||||
|
|
||||||
RED.nodes.eachNode(function(n) {
|
|
||||||
if (n.type == "subflow:"+activeSubflow.id) {
|
|
||||||
removedNodes.push(n);
|
|
||||||
}
|
|
||||||
if (n.z == activeSubflow.id) {
|
|
||||||
removedNodes.push(n);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
RED.nodes.eachConfig(function(n) {
|
|
||||||
if (n.z == activeSubflow.id) {
|
|
||||||
removedNodes.push(n);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var removedConfigNodes = [];
|
|
||||||
for (var i=0;i<removedNodes.length;i++) {
|
|
||||||
var removedEntities = RED.nodes.remove(removedNodes[i].id);
|
|
||||||
removedLinks = removedLinks.concat(removedEntities.links);
|
|
||||||
removedConfigNodes = removedConfigNodes.concat(removedEntities.nodes);
|
|
||||||
}
|
|
||||||
// TODO: this whole delete logic should be in RED.nodes.removeSubflow..
|
|
||||||
removedNodes = removedNodes.concat(removedConfigNodes);
|
|
||||||
|
|
||||||
RED.nodes.removeSubflow(activeSubflow);
|
|
||||||
|
|
||||||
RED.history.push({
|
|
||||||
t:'delete',
|
|
||||||
nodes:removedNodes,
|
|
||||||
links:removedLinks,
|
|
||||||
subflow: {
|
|
||||||
subflow: activeSubflow
|
|
||||||
},
|
|
||||||
dirty:startDirty
|
|
||||||
});
|
|
||||||
|
|
||||||
RED.workspaces.remove(activeSubflow);
|
|
||||||
RED.nodes.dirty(true);
|
|
||||||
RED.view.redraw();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
refreshToolbar(activeSubflow);
|
refreshToolbar(activeSubflow);
|
||||||
@@ -362,7 +325,48 @@ RED.subflow = (function() {
|
|||||||
$("#chart").css({"margin-top": "0"});
|
$("#chart").css({"margin-top": "0"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeSubflow(id) {
|
||||||
|
var removedNodes = [];
|
||||||
|
var removedLinks = [];
|
||||||
|
|
||||||
|
var activeSubflow = RED.nodes.subflow(id);
|
||||||
|
|
||||||
|
RED.nodes.eachNode(function(n) {
|
||||||
|
if (n.type == "subflow:"+activeSubflow.id) {
|
||||||
|
removedNodes.push(n);
|
||||||
|
}
|
||||||
|
if (n.z == activeSubflow.id) {
|
||||||
|
removedNodes.push(n);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
RED.nodes.eachConfig(function(n) {
|
||||||
|
if (n.z == activeSubflow.id) {
|
||||||
|
removedNodes.push(n);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var removedConfigNodes = [];
|
||||||
|
for (var i=0;i<removedNodes.length;i++) {
|
||||||
|
var removedEntities = RED.nodes.remove(removedNodes[i].id);
|
||||||
|
removedLinks = removedLinks.concat(removedEntities.links);
|
||||||
|
removedConfigNodes = removedConfigNodes.concat(removedEntities.nodes);
|
||||||
|
}
|
||||||
|
// TODO: this whole delete logic should be in RED.nodes.removeSubflow..
|
||||||
|
removedNodes = removedNodes.concat(removedConfigNodes);
|
||||||
|
|
||||||
|
RED.nodes.removeSubflow(activeSubflow);
|
||||||
|
RED.workspaces.remove(activeSubflow);
|
||||||
|
RED.nodes.dirty(true);
|
||||||
|
RED.view.redraw();
|
||||||
|
|
||||||
|
return {
|
||||||
|
nodes:removedNodes,
|
||||||
|
links:removedLinks,
|
||||||
|
subflow: {
|
||||||
|
subflow: activeSubflow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
function init() {
|
function init() {
|
||||||
RED.events.on("workspace:change",function(event) {
|
RED.events.on("workspace:change",function(event) {
|
||||||
var activeSubflow = RED.nodes.subflow(event.workspace);
|
var activeSubflow = RED.nodes.subflow(event.workspace);
|
||||||
@@ -380,6 +384,8 @@ RED.subflow = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RED.actions.add("core:create-subflow",createSubflow);
|
||||||
|
RED.actions.add("core:convert-to-subflow",convertToSubflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSubflow() {
|
function createSubflow() {
|
||||||
@@ -617,6 +623,7 @@ RED.subflow = (function() {
|
|||||||
init: init,
|
init: init,
|
||||||
createSubflow: createSubflow,
|
createSubflow: createSubflow,
|
||||||
convertToSubflow: convertToSubflow,
|
convertToSubflow: convertToSubflow,
|
||||||
|
removeSubflow: removeSubflow,
|
||||||
refresh: refresh,
|
refresh: refresh,
|
||||||
removeInput: removeSubflowInput,
|
removeInput: removeSubflowInput,
|
||||||
removeOutput: removeSubflowOutput
|
removeOutput: removeSubflowOutput
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -113,7 +113,7 @@ RED.sidebar.config = (function() {
|
|||||||
if (showUnusedOnly) {
|
if (showUnusedOnly) {
|
||||||
var hiddenCount = nodes.length;
|
var hiddenCount = nodes.length;
|
||||||
nodes = nodes.filter(function(n) {
|
nodes = nodes.filter(function(n) {
|
||||||
return n.users.length === 0;
|
return n._def.hasUsers!==false && n.users.length === 0;
|
||||||
})
|
})
|
||||||
hiddenCount = hiddenCount - nodes.length;
|
hiddenCount = hiddenCount - nodes.length;
|
||||||
if (hiddenCount > 0) {
|
if (hiddenCount > 0) {
|
||||||
@@ -131,19 +131,7 @@ RED.sidebar.config = (function() {
|
|||||||
} else {
|
} else {
|
||||||
var currentType = "";
|
var currentType = "";
|
||||||
nodes.forEach(function(node) {
|
nodes.forEach(function(node) {
|
||||||
var label = "";
|
var label = RED.utils.getNodeLabel(node,node.id);
|
||||||
if (typeof node._def.label == "function") {
|
|
||||||
try {
|
|
||||||
label = node._def.label.call(node);
|
|
||||||
} catch(err) {
|
|
||||||
console.log("Definition error: "+node._def.type+".label",err);
|
|
||||||
label = node._def.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
label = node._def.label;
|
|
||||||
}
|
|
||||||
label = label || node.id;
|
|
||||||
if (node.type != currentType) {
|
if (node.type != currentType) {
|
||||||
$('<li class="config_node_type">'+node.type+'</li>').appendTo(list);
|
$('<li class="config_node_type">'+node.type+'</li>').appendTo(list);
|
||||||
currentType = node.type;
|
currentType = node.type;
|
||||||
@@ -151,10 +139,11 @@ RED.sidebar.config = (function() {
|
|||||||
|
|
||||||
var entry = $('<li class="palette_node config_node palette_node_id_'+node.id.replace(/\./g,"-")+'"></li>').appendTo(list);
|
var entry = $('<li class="palette_node config_node palette_node_id_'+node.id.replace(/\./g,"-")+'"></li>').appendTo(list);
|
||||||
$('<div class="palette_label"></div>').text(label).appendTo(entry);
|
$('<div class="palette_label"></div>').text(label).appendTo(entry);
|
||||||
|
if (node._def.hasUsers !== false) {
|
||||||
var iconContainer = $('<div/>',{class:"palette_icon_container palette_icon_container_right"}).text(node.users.length).appendTo(entry);
|
var iconContainer = $('<div/>',{class:"palette_icon_container palette_icon_container_right"}).text(node.users.length).appendTo(entry);
|
||||||
if (node.users.length === 0) {
|
if (node.users.length === 0) {
|
||||||
entry.addClass("config_node_unused");
|
entry.addClass("config_node_unused");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
entry.on('click',function(e) {
|
entry.on('click',function(e) {
|
||||||
RED.sidebar.info.refresh(node);
|
RED.sidebar.info.refresh(node);
|
||||||
@@ -232,14 +221,10 @@ RED.sidebar.config = (function() {
|
|||||||
name: RED._("sidebar.config.name"),
|
name: RED._("sidebar.config.name"),
|
||||||
content: content,
|
content: content,
|
||||||
toolbar: toolbar,
|
toolbar: toolbar,
|
||||||
closeable: true,
|
iconClass: "fa fa-cog",
|
||||||
visible: false,
|
|
||||||
onchange: function() { refreshConfigNodeList(); }
|
onchange: function() { refreshConfigNodeList(); }
|
||||||
});
|
});
|
||||||
|
RED.actions.add("core:show-config-tab",function() {RED.sidebar.show('config')});
|
||||||
RED.menu.setAction('menu-item-config-nodes',function() {
|
|
||||||
RED.sidebar.show('config');
|
|
||||||
})
|
|
||||||
|
|
||||||
$("#workspace-config-node-collapse-all").on("click", function(e) {
|
$("#workspace-config-node-collapse-all").on("click", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
292
editor/js/ui/tab-context.js
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
RED.sidebar.context = (function() {
|
||||||
|
|
||||||
|
var content;
|
||||||
|
var sections;
|
||||||
|
|
||||||
|
var localCache = {};
|
||||||
|
|
||||||
|
|
||||||
|
var nodeSection;
|
||||||
|
// var subflowSection;
|
||||||
|
var flowSection;
|
||||||
|
var globalSection;
|
||||||
|
|
||||||
|
var currentNode;
|
||||||
|
var currentFlow;
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
|
||||||
|
content = $("<div>").css({"position":"relative","height":"100%"});
|
||||||
|
content.className = "sidebar-context"
|
||||||
|
// var toolbar = $('<div class="sidebar-header">'+
|
||||||
|
// '</div>').appendTo(content);
|
||||||
|
|
||||||
|
var footerToolbar = $('<div>'+
|
||||||
|
// '<span class="button-group"><a class="sidebar-footer-button" href="#" data-i18n="[title]node-red:debug.sidebar.openWindow"><i class="fa fa-desktop"></i></a></span> ' +
|
||||||
|
'</div>');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var stackContainer = $("<div>",{class:"sidebar-context-stack"}).appendTo(content);
|
||||||
|
sections = RED.stack.create({
|
||||||
|
container: stackContainer
|
||||||
|
});
|
||||||
|
|
||||||
|
nodeSection = sections.add({
|
||||||
|
title: RED._("sidebar.context.node"),
|
||||||
|
collapsible: true,
|
||||||
|
// onexpand: function() {
|
||||||
|
// updateNode(currentNode,true);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
nodeSection.expand();
|
||||||
|
nodeSection.content.css({height:"100%"});
|
||||||
|
nodeSection.timestamp = $('<div class="sidebar-context-updated"> </div>').appendTo(nodeSection.content);
|
||||||
|
var table = $('<table class="node-info"></table>').appendTo(nodeSection.content);
|
||||||
|
nodeSection.table = $('<tbody>').appendTo(table);
|
||||||
|
var bg = $('<div style="float: right"></div>').appendTo(nodeSection.header);
|
||||||
|
$('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>')
|
||||||
|
.appendTo(bg)
|
||||||
|
.click(function(evt) {
|
||||||
|
evt.stopPropagation();
|
||||||
|
evt.preventDefault();
|
||||||
|
updateNode(currentNode, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
// subflowSection = sections.add({
|
||||||
|
// title: "Subflow",
|
||||||
|
// collapsible: true
|
||||||
|
// });
|
||||||
|
// subflowSection.expand();
|
||||||
|
// subflowSection.content.css({height:"100%"});
|
||||||
|
// bg = $('<div style="float: right"></div>').appendTo(subflowSection.header);
|
||||||
|
// $('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>')
|
||||||
|
// .appendTo(bg)
|
||||||
|
// .click(function(evt) {
|
||||||
|
// evt.stopPropagation();
|
||||||
|
// evt.preventDefault();
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
// subflowSection.container.hide();
|
||||||
|
|
||||||
|
flowSection = sections.add({
|
||||||
|
title: RED._("sidebar.context.flow"),
|
||||||
|
collapsible: true
|
||||||
|
});
|
||||||
|
flowSection.expand();
|
||||||
|
flowSection.content.css({height:"100%"});
|
||||||
|
flowSection.timestamp = $('<div class="sidebar-context-updated"> </div>').appendTo(flowSection.content);
|
||||||
|
var table = $('<table class="node-info"></table>').appendTo(flowSection.content);
|
||||||
|
flowSection.table = $('<tbody>').appendTo(table);
|
||||||
|
bg = $('<div style="float: right"></div>').appendTo(flowSection.header);
|
||||||
|
$('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>')
|
||||||
|
.appendTo(bg)
|
||||||
|
.click(function(evt) {
|
||||||
|
evt.stopPropagation();
|
||||||
|
evt.preventDefault();
|
||||||
|
updateFlow(currentFlow);
|
||||||
|
})
|
||||||
|
|
||||||
|
globalSection = sections.add({
|
||||||
|
title: RED._("sidebar.context.global"),
|
||||||
|
collapsible: true
|
||||||
|
});
|
||||||
|
globalSection.expand();
|
||||||
|
globalSection.content.css({height:"100%"});
|
||||||
|
globalSection.timestamp = $('<div class="sidebar-context-updated"> </div>').appendTo(globalSection.content);
|
||||||
|
var table = $('<table class="node-info"></table>').appendTo(globalSection.content);
|
||||||
|
globalSection.table = $('<tbody>').appendTo(table);
|
||||||
|
|
||||||
|
bg = $('<div style="float: right"></div>').appendTo(globalSection.header);
|
||||||
|
$('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>')
|
||||||
|
.appendTo(bg)
|
||||||
|
.click(function(evt) {
|
||||||
|
evt.stopPropagation();
|
||||||
|
evt.preventDefault();
|
||||||
|
updateEntry(globalSection,"context/global","global");
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
RED.actions.add("core:show-context-tab",show);
|
||||||
|
|
||||||
|
RED.sidebar.addTab({
|
||||||
|
id: "context",
|
||||||
|
label: RED._("sidebar.context.label"),
|
||||||
|
name: RED._("sidebar.context.name"),
|
||||||
|
iconClass: "fa fa-database",
|
||||||
|
content: content,
|
||||||
|
toolbar: footerToolbar,
|
||||||
|
// pinned: true,
|
||||||
|
enableOnEdit: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// var toggleLiveButton = $("#sidebar-context-toggle-live");
|
||||||
|
// toggleLiveButton.click(function(evt) {
|
||||||
|
// evt.preventDefault();
|
||||||
|
// if ($(this).hasClass("selected")) {
|
||||||
|
// $(this).removeClass("selected");
|
||||||
|
// $(this).find("i").removeClass("fa-pause");
|
||||||
|
// $(this).find("i").addClass("fa-play");
|
||||||
|
// } else {
|
||||||
|
// $(this).addClass("selected");
|
||||||
|
// $(this).find("i").removeClass("fa-play");
|
||||||
|
// $(this).find("i").addClass("fa-pause");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// RED.popover.tooltip(toggleLiveButton, function() {
|
||||||
|
// if (toggleLiveButton.hasClass("selected")) {
|
||||||
|
// return "Pause live updates"
|
||||||
|
// } else {
|
||||||
|
// return "Start live updates"
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
RED.events.on("view:selection-changed", function(event) {
|
||||||
|
var selectedNode = event.nodes && event.nodes.length === 1 && event.nodes[0];
|
||||||
|
updateNode(selectedNode);
|
||||||
|
})
|
||||||
|
|
||||||
|
RED.events.on("workspace:change", function(event) {
|
||||||
|
updateFlow(RED.nodes.workspace(event.workspace));
|
||||||
|
})
|
||||||
|
|
||||||
|
updateEntry(globalSection,"context/global","global");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateNode(node,force) {
|
||||||
|
currentNode = node;
|
||||||
|
if (force) {
|
||||||
|
if (node) {
|
||||||
|
updateEntry(nodeSection,"context/node/"+node.id,node.id);
|
||||||
|
// if (/^subflow:/.test(node.type)) {
|
||||||
|
// subflowSection.container.show();
|
||||||
|
// updateEntry(subflowSection,"context/flow/"+node.id,node.id);
|
||||||
|
// } else {
|
||||||
|
// subflowSection.container.hide();
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
// subflowSection.container.hide();
|
||||||
|
updateEntry(nodeSection)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$(nodeSection.table).empty();
|
||||||
|
if (node) {
|
||||||
|
$('<tr class="node-info-node-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.refresh"></td></tr>').appendTo(nodeSection.table).i18n();
|
||||||
|
} else {
|
||||||
|
$('<tr class="node-info-node-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.none"></td></tr>').appendTo(nodeSection.table).i18n();
|
||||||
|
}
|
||||||
|
nodeSection.timestamp.html(" ");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function updateFlow(flow) {
|
||||||
|
currentFlow = flow;
|
||||||
|
if (flow) {
|
||||||
|
updateEntry(flowSection,"context/flow/"+flow.id,flow.id);
|
||||||
|
} else {
|
||||||
|
updateEntry(flowSection)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshEntry(section,baseUrl,id) {
|
||||||
|
|
||||||
|
var contextStores = RED.settings.context.stores;
|
||||||
|
var container = section.table;
|
||||||
|
|
||||||
|
$.getJSON(baseUrl, function(data) {
|
||||||
|
$(container).empty();
|
||||||
|
var sortedData = {};
|
||||||
|
for (var store in data) {
|
||||||
|
if (data.hasOwnProperty(store)) {
|
||||||
|
for (var key in data[store]) {
|
||||||
|
if (data[store].hasOwnProperty(key)) {
|
||||||
|
if (!sortedData.hasOwnProperty(key)) {
|
||||||
|
sortedData[key] = [];
|
||||||
|
}
|
||||||
|
data[store][key].store = store;
|
||||||
|
sortedData[key].push(data[store][key])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var keys = Object.keys(sortedData);
|
||||||
|
keys.sort();
|
||||||
|
var l = keys.length;
|
||||||
|
for (var i = 0; i < l; i++) {
|
||||||
|
sortedData[keys[i]].forEach(function(v) {
|
||||||
|
var k = keys[i];
|
||||||
|
var l2 = sortedData[k].length;
|
||||||
|
var propRow = $('<tr class="node-info-node-row"><td class="sidebar-context-property"></td><td></td></tr>').appendTo(container);
|
||||||
|
var obj = $(propRow.children()[0]);
|
||||||
|
obj.text(k);
|
||||||
|
var tools = $('<span class="debug-message-tools button-group"></span>').appendTo(obj);
|
||||||
|
var refreshItem = $('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>').appendTo(tools).click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
$.getJSON(baseUrl+"/"+k+"?store="+v.store, function(data) {
|
||||||
|
$(propRow.children()[1]).empty();
|
||||||
|
var payload = data.msg;
|
||||||
|
var format = data.format;
|
||||||
|
payload = RED.utils.decodeObject(payload,format);
|
||||||
|
RED.utils.createObjectElement(payload, {
|
||||||
|
typeHint: data.format,
|
||||||
|
sourceId: id+"."+k
|
||||||
|
}).appendTo(propRow.children()[1]);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var payload = v.msg;
|
||||||
|
var format = v.format;
|
||||||
|
payload = RED.utils.decodeObject(payload,format);
|
||||||
|
RED.utils.createObjectElement(payload, {
|
||||||
|
typeHint: v.format,
|
||||||
|
sourceId: id+"."+k
|
||||||
|
}).appendTo(propRow.children()[1]);
|
||||||
|
if (contextStores.length > 1) {
|
||||||
|
$("<span>",{class:"sidebar-context-property-storename"}).text(v.store).appendTo($(propRow.children()[0]))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (l === 0) {
|
||||||
|
$('<tr class="node-info-node-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.empty"></td></tr>').appendTo(container).i18n();
|
||||||
|
}
|
||||||
|
$(section.timestamp).text(new Date().toLocaleString());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function updateEntry(section,baseUrl,id) {
|
||||||
|
var container = section.table;
|
||||||
|
if (id) {
|
||||||
|
refreshEntry(section,baseUrl,id);
|
||||||
|
} else {
|
||||||
|
$(container).empty();
|
||||||
|
$('<tr class="node-info-node-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.none"></td></tr>').appendTo(container).i18n();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
RED.sidebar.show("context");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
init: init
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -26,22 +26,73 @@ RED.sidebar.info = (function() {
|
|||||||
smartypants: false
|
smartypants: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var content = document.createElement("div");
|
var content;
|
||||||
content.style.paddingTop = "4px";
|
var sections;
|
||||||
content.style.paddingLeft = "4px";
|
var nodeSection;
|
||||||
content.style.paddingRight = "4px";
|
var infoSection;
|
||||||
content.className = "sidebar-node-info"
|
var tipBox;
|
||||||
|
|
||||||
var propertiesExpanded = false;
|
var expandedSections = {
|
||||||
|
"property": false
|
||||||
|
};
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
|
content = document.createElement("div");
|
||||||
|
content.className = "sidebar-node-info"
|
||||||
|
|
||||||
|
RED.actions.add("core:show-info-tab",show);
|
||||||
|
|
||||||
|
var stackContainer = $("<div>",{class:"sidebar-node-info-stack"}).appendTo(content);
|
||||||
|
|
||||||
|
sections = RED.stack.create({
|
||||||
|
container: stackContainer
|
||||||
|
}).hide();
|
||||||
|
|
||||||
|
nodeSection = sections.add({
|
||||||
|
title: RED._("sidebar.info.info"),
|
||||||
|
collapsible: true
|
||||||
|
});
|
||||||
|
nodeSection.expand();
|
||||||
|
infoSection = sections.add({
|
||||||
|
title: RED._("sidebar.info.nodeHelp"),
|
||||||
|
collapsible: true
|
||||||
|
});
|
||||||
|
infoSection.expand();
|
||||||
|
infoSection.content.css("padding","6px");
|
||||||
|
infoSection.container.css("border-bottom","none");
|
||||||
|
|
||||||
|
var tipContainer = $('<div class="node-info-tips"></div>').appendTo(content);
|
||||||
|
tipBox = $('<div class="node-info-tip"></div>').appendTo(tipContainer);
|
||||||
|
var tipButtons = $('<div class="node-info-tips-buttons"></div>').appendTo(tipContainer);
|
||||||
|
|
||||||
|
var tipRefresh = $('<a href="#" class="workspace-footer-button"><i class="fa fa-refresh"></a>').appendTo(tipButtons);
|
||||||
|
tipRefresh.click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
tips.next();
|
||||||
|
})
|
||||||
|
|
||||||
|
var tipClose = $('<a href="#" class="workspace-footer-button"><i class="fa fa-times"></a>').appendTo(tipButtons);
|
||||||
|
tipClose.click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
RED.actions.invoke("core:toggle-show-tips");
|
||||||
|
RED.notify(RED._("sidebar.info.showTips"));
|
||||||
|
});
|
||||||
|
|
||||||
RED.sidebar.addTab({
|
RED.sidebar.addTab({
|
||||||
id: "info",
|
id: "info",
|
||||||
label: RED._("sidebar.info.label"),
|
label: RED._("sidebar.info.label"),
|
||||||
name: RED._("sidebar.info.name"),
|
name: RED._("sidebar.info.name"),
|
||||||
|
iconClass: "fa fa-info",
|
||||||
content: content,
|
content: content,
|
||||||
|
pinned: true,
|
||||||
enableOnEdit: true
|
enableOnEdit: true
|
||||||
});
|
});
|
||||||
|
if (tips.enabled()) {
|
||||||
|
tips.start();
|
||||||
|
} else {
|
||||||
|
tips.stop();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,137 +100,311 @@ RED.sidebar.info = (function() {
|
|||||||
RED.sidebar.show("info");
|
RED.sidebar.show("info");
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonFilter(key,value) {
|
// TODO: DRY - projects.js
|
||||||
if (key === "") {
|
function addTargetToExternalLinks(el) {
|
||||||
return value;
|
$(el).find("a").each(function(el) {
|
||||||
}
|
var href = $(this).attr('href');
|
||||||
var t = typeof value;
|
if (/^https?:/.test(href)) {
|
||||||
if ($.isArray(value)) {
|
$(this).attr('target','_blank');
|
||||||
return "[array:"+value.length+"]";
|
|
||||||
} else if (t === "object") {
|
|
||||||
return "[object]"
|
|
||||||
} else if (t === "string") {
|
|
||||||
if (value.length > 30) {
|
|
||||||
return value.substring(0,30)+" ...";
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return value;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh(node) {
|
function refresh(node) {
|
||||||
var table = '<table class="node-info"><tbody>';
|
if (node === undefined) {
|
||||||
table += '<tr class="blank"><td colspan="2">'+RED._("sidebar.info.node")+'</td></tr>';
|
refreshSelection();
|
||||||
if (node.type != "subflow" && node.name) {
|
return;
|
||||||
table += '<tr><td>'+RED._("common.label.name")+'</td><td> <span class="bidiAware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'">'+node.name+'</span></td></tr>';
|
|
||||||
}
|
}
|
||||||
table += "<tr><td>"+RED._("sidebar.info.type")+"</td><td> "+node.type+"</td></tr>";
|
sections.show();
|
||||||
table += "<tr><td>"+RED._("sidebar.info.id")+"</td><td> "+node.id+"</td></tr>";
|
$(nodeSection.content).empty();
|
||||||
|
$(infoSection.content).empty();
|
||||||
|
|
||||||
var m = /^subflow(:(.+))?$/.exec(node.type);
|
var propRow;
|
||||||
|
|
||||||
|
var table = $('<table class="node-info"></table>').appendTo(nodeSection.content);
|
||||||
|
var tableBody = $('<tbody>').appendTo(table);
|
||||||
var subflowNode;
|
var subflowNode;
|
||||||
if (m) {
|
var subflowUserCount;
|
||||||
if (m[2]) {
|
|
||||||
subflowNode = RED.nodes.subflow(m[2]);
|
|
||||||
} else {
|
|
||||||
subflowNode = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
table += '<tr class="blank"><td colspan="2">'+RED._("sidebar.info.subflow")+'</td></tr>';
|
var activeProject = RED.projects.getActiveProject();
|
||||||
|
if (activeProject) {
|
||||||
var userCount = 0;
|
propRow = $('<tr class="node-info-node-row"><td>Project</td><td></td></tr>').appendTo(tableBody);
|
||||||
var subflowType = "subflow:"+subflowNode.id;
|
$(propRow.children()[1]).text(activeProject.name||"");
|
||||||
RED.nodes.eachNode(function(n) {
|
$('<tr class="node-info-property-expand blank"><td colspan="2"></td></tr>').appendTo(tableBody);
|
||||||
if (n.type === subflowType) {
|
$('<button class="editor-button editor-button-small" style="position:absolute;right:2px;"><i class="fa fa-ellipsis-h"></i></button>')
|
||||||
userCount++;
|
.appendTo(propRow.children()[1])
|
||||||
}
|
.click(function(evt) {
|
||||||
});
|
evt.preventDefault();
|
||||||
table += '<tr><td>'+RED._("common.label.name")+'</td><td><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.name)+'">'+subflowNode.name+'</span></td></tr>';
|
RED.projects.editProject();
|
||||||
table += "<tr><td>"+RED._("sidebar.info.instances")+"</td><td>"+userCount+"</td></tr>";
|
});
|
||||||
}
|
}
|
||||||
|
infoSection.container.show();
|
||||||
|
if (node === null) {
|
||||||
|
return;
|
||||||
|
} else if (Array.isArray(node)) {
|
||||||
|
infoSection.container.hide();
|
||||||
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.selection")+"</td><td></td></tr>").appendTo(tableBody);
|
||||||
|
$(propRow.children()[1]).text(RED._("sidebar.info.nodes",{count:node.length}))
|
||||||
|
} else {
|
||||||
|
var m = /^subflow(:(.+))?$/.exec(node.type);
|
||||||
|
if (m) {
|
||||||
|
if (m[2]) {
|
||||||
|
subflowNode = RED.nodes.subflow(m[2]);
|
||||||
|
} else {
|
||||||
|
subflowNode = node;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m && node.type != "subflow" && node.type != "comment") {
|
subflowUserCount = 0;
|
||||||
table += '<tr class="blank"><td colspan="2"><a href="#" class="node-info-property-header"><i style="width: 10px; text-align: center;" class="fa fa-caret-'+(propertiesExpanded?"down":"right")+'"></i> '+RED._("sidebar.info.properties")+'</a></td></tr>';
|
var subflowType = "subflow:"+subflowNode.id;
|
||||||
if (node._def) {
|
RED.nodes.eachNode(function(n) {
|
||||||
for (var n in node._def.defaults) {
|
if (n.type === subflowType) {
|
||||||
if (n != "name" && node._def.defaults.hasOwnProperty(n)) {
|
subflowUserCount++;
|
||||||
var val = node[n];
|
}
|
||||||
var type = typeof val;
|
});
|
||||||
if (val === null || val === undefined) {
|
}
|
||||||
val = '<span style="font-style: italic; color: #ccc;">'+RED._("sidebar.info.null")+'</span>';
|
if (node.type === "tab" || node.type === "subflow") {
|
||||||
} else if (type === "string") {
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info."+(node.type==='tab'?'flow':'subflow'))+'</td><td></td></tr>').appendTo(tableBody);
|
||||||
if (val.length === 0) {
|
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
|
||||||
val = '<span style="font-style: italic; color: #ccc;">'+RED._("sidebar.info.blank")+'</span>';
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.tabName")+"</td><td></td></tr>").appendTo(tableBody);
|
||||||
} else {
|
$(propRow.children()[1]).text(node.label||node.name||"");
|
||||||
if (val.length > 30) {
|
if (node.type === "tab") {
|
||||||
val = val.substring(0,30)+" ...";
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.status")+'</td><td></td></tr>').appendTo(tableBody);
|
||||||
|
$(propRow.children()[1]).text((!!!node.disabled)?RED._("sidebar.info.enabled"):RED._("sidebar.info.disabled"))
|
||||||
|
} else if (node.type === "subflow") {
|
||||||
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("subflow.category")+'</td><td></td></tr>').appendTo(tableBody);
|
||||||
|
var category = node.category||"subflows";
|
||||||
|
$(propRow.children()[1]).text(RED._("palette.label."+category,{defaultValue:category}))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.node")+"</td><td></td></tr>").appendTo(tableBody);
|
||||||
|
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
|
||||||
|
|
||||||
|
|
||||||
|
if (node.type !== "subflow" && node.type !== "unknown" && node.name) {
|
||||||
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("common.label.name")+'</td><td></td></tr>').appendTo(tableBody);
|
||||||
|
$('<span class="bidiAware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'"></span>').text(node.name).appendTo(propRow.children()[1]);
|
||||||
|
}
|
||||||
|
if (!m) {
|
||||||
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.type")+"</td><td></td></tr>").appendTo(tableBody);
|
||||||
|
$(propRow.children()[1]).text((node.type === "unknown")?node._orig.type:node.type);
|
||||||
|
if (node.type === "unknown") {
|
||||||
|
$('<span style="float: right; font-size: 0.8em"><i class="fa fa-warning"></i></span>').prependTo($(propRow.children()[1]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!m && node.type != "subflow" && node.type != "comment") {
|
||||||
|
var defaults;
|
||||||
|
if (node.type === 'unknown') {
|
||||||
|
defaults = {};
|
||||||
|
Object.keys(node._orig).forEach(function(k) {
|
||||||
|
if (k !== 'type') {
|
||||||
|
defaults[k] = {};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (node._def) {
|
||||||
|
defaults = node._def.defaults;
|
||||||
|
}
|
||||||
|
if (defaults) {
|
||||||
|
var count = 0;
|
||||||
|
for (var n in defaults) {
|
||||||
|
if (n != "name" && defaults.hasOwnProperty(n)) {
|
||||||
|
var val = node[n];
|
||||||
|
var type = typeof val;
|
||||||
|
count++;
|
||||||
|
propRow = $('<tr class="node-info-property-row'+(expandedSections.property?"":" hide")+'"><td>'+n+"</td><td></td></tr>").appendTo(tableBody);
|
||||||
|
if (defaults[n].type) {
|
||||||
|
var configNode = RED.nodes.node(val);
|
||||||
|
if (!configNode) {
|
||||||
|
RED.utils.createObjectElement(undefined).appendTo(propRow.children()[1]);
|
||||||
|
} else {
|
||||||
|
var configLabel = RED.utils.getNodeLabel(configNode,val);
|
||||||
|
var container = propRow.children()[1];
|
||||||
|
|
||||||
|
var div = $('<span>',{class:""}).appendTo(container);
|
||||||
|
var nodeDiv = $('<div>',{class:"palette_node palette_node_small"}).appendTo(div);
|
||||||
|
var colour = RED.utils.getNodeColor(configNode.type,configNode._def);
|
||||||
|
var icon_url = RED.utils.getNodeIcon(configNode._def);
|
||||||
|
nodeDiv.css({'backgroundColor':colour, "cursor":"pointer"});
|
||||||
|
var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv);
|
||||||
|
$('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer);
|
||||||
|
var nodeContainer = $('<span></span>').css({"verticalAlign":"top","marginLeft":"6px"}).text(configLabel).appendTo(container);
|
||||||
|
|
||||||
|
nodeDiv.on('dblclick',function() {
|
||||||
|
RED.editor.editConfig("", configNode.type, configNode.id);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
RED.utils.createObjectElement(val).appendTo(propRow.children()[1]);
|
||||||
}
|
}
|
||||||
val = val.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
|
||||||
}
|
}
|
||||||
} else if (type === "number") {
|
|
||||||
val = val.toString();
|
|
||||||
} else if ($.isArray(val)) {
|
|
||||||
val = "[<br/>";
|
|
||||||
for (var i=0;i<Math.min(node[n].length,10);i++) {
|
|
||||||
var vv = JSON.stringify(node[n][i],jsonFilter," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
|
||||||
val += " "+i+": "+vv+"<br/>";
|
|
||||||
}
|
|
||||||
if (node[n].length > 10) {
|
|
||||||
val += " ... "+RED._("sidebar.info.arrayItems",{count:node[n].length})+"<br/>";
|
|
||||||
}
|
|
||||||
val += "]";
|
|
||||||
} else {
|
|
||||||
val = JSON.stringify(val,jsonFilter," ");
|
|
||||||
val = val.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
|
||||||
}
|
}
|
||||||
|
if (count > 0) {
|
||||||
table += '<tr class="node-info-property-row'+(propertiesExpanded?"":" hide")+'"><td>'+n+"</td><td>"+val+"</td></tr>";
|
$('<tr class="node-info-property-expand blank"><td colspan="2"><a href="#" class=" node-info-property-header'+(expandedSections.property?" expanded":"")+'"><span class="node-info-property-show-more">'+RED._("sidebar.info.showMore")+'</span><span class="node-info-property-show-less">'+RED._("sidebar.info.showLess")+'</span> <i class="fa fa-caret-down"></i></a></td></tr>').appendTo(tableBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (node.type !== 'tab') {
|
||||||
|
if (m) {
|
||||||
|
$('<tr class="blank"><th colspan="2">'+RED._("sidebar.info.subflow")+'</th></tr>').appendTo(tableBody);
|
||||||
|
$('<tr class="node-info-subflow-row"><td>'+RED._("common.label.name")+'</td><td><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.name)+'">'+subflowNode.name+'</span></td></tr>').appendTo(tableBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (m) {
|
||||||
table += "</tbody></table><hr/>";
|
propRow = $('<tr class="node-info-node-row"><td>'+RED._("subflow.category")+'</td><td></td></tr>').appendTo(tableBody);
|
||||||
if (!subflowNode && node.type != "comment") {
|
var category = subflowNode.category||"subflows";
|
||||||
var helpText = $("script[data-help-name$='"+node.type+"']").html()||"";
|
$(propRow.children()[1]).text(RED._("palette.label."+category,{defaultValue:category}))
|
||||||
table += '<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(helpText)+'">'+helpText+'</span></div>';
|
$('<tr class="node-info-subflow-row"><td>'+RED._("sidebar.info.instances")+"</td><td>"+subflowUserCount+'</td></tr>').appendTo(tableBody);
|
||||||
}
|
|
||||||
if (subflowNode) {
|
|
||||||
table += '<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.info||"")+'">'+marked(subflowNode.info||"")+'</span></div>';
|
|
||||||
} else if (node._def && node._def.info) {
|
|
||||||
var info = node._def.info;
|
|
||||||
var textInfo = (typeof info === "function" ? info.call(node) : info);
|
|
||||||
table += '<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(textInfo)+'">'+marked(textInfo)+'</span></div>';
|
|
||||||
//table += '<div class="node-help">'+(typeof info === "function" ? info.call(node) : info)+'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$(content).html(table);
|
|
||||||
|
|
||||||
$(".node-info-property-header").click(function(e) {
|
|
||||||
var icon = $(this).find("i");
|
|
||||||
if (icon.hasClass("fa-caret-right")) {
|
|
||||||
icon.removeClass("fa-caret-right");
|
|
||||||
icon.addClass("fa-caret-down");
|
|
||||||
$(".node-info-property-row").show();
|
|
||||||
propertiesExpanded = true;
|
|
||||||
} else {
|
|
||||||
icon.addClass("fa-caret-right");
|
|
||||||
icon.removeClass("fa-caret-down");
|
|
||||||
$(".node-info-property-row").hide();
|
|
||||||
propertiesExpanded = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
var infoText = "";
|
||||||
});
|
if (!subflowNode && node.type !== "comment" && node.type !== "tab") {
|
||||||
|
infoSection.title.text(RED._("sidebar.info.nodeHelp"));
|
||||||
|
var helpText = $("script[data-help-name='"+node.type+"']").html()||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||||
|
infoText = helpText;
|
||||||
|
} else if (node.type === "tab") {
|
||||||
|
infoSection.title.text(RED._("sidebar.info.flowDesc"));
|
||||||
|
infoText = marked(node.info||"")||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subflowNode) {
|
||||||
|
infoText = infoText + (marked(subflowNode.info||"")||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>'));
|
||||||
|
infoSection.title.text(RED._("sidebar.info.subflowDesc"));
|
||||||
|
} else if (node._def && node._def.info) {
|
||||||
|
infoSection.title.text(RED._("sidebar.info.nodeHelp"));
|
||||||
|
var info = node._def.info;
|
||||||
|
var textInfo = (typeof info === "function" ? info.call(node) : info);
|
||||||
|
// TODO: help
|
||||||
|
infoText = infoText + marked(textInfo);
|
||||||
|
}
|
||||||
|
if (infoText) {
|
||||||
|
setInfoText(infoText);
|
||||||
|
}
|
||||||
|
$(".sidebar-node-info-stack").scrollTop(0);
|
||||||
|
$(".node-info-property-header").click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
expandedSections["property"] = !expandedSections["property"];
|
||||||
|
$(this).toggleClass("expanded",expandedSections["property"]);
|
||||||
|
$(".node-info-property-row").toggle(expandedSections["property"]);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
function setInfoText(infoText) {
|
||||||
|
var info = addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(infoText)+'">'+infoText+'</span></div>')).appendTo(infoSection.content);
|
||||||
|
info.find(".bidiAware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" );
|
||||||
|
var foldingHeader = "H3";
|
||||||
|
info.find(foldingHeader).wrapInner('<a class="node-info-header expanded" href="#"></a>')
|
||||||
|
.find("a").prepend('<i class="fa fa-angle-right">').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var isExpanded = $(this).hasClass('expanded');
|
||||||
|
var el = $(this).parent().next();
|
||||||
|
while(el.length === 1 && el[0].nodeName !== foldingHeader) {
|
||||||
|
el.toggle(!isExpanded);
|
||||||
|
el = el.next();
|
||||||
|
}
|
||||||
|
$(this).toggleClass('expanded',!isExpanded);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
var tips = (function() {
|
||||||
|
var enabled = true;
|
||||||
|
var startDelay = 1000;
|
||||||
|
var cycleDelay = 15000;
|
||||||
|
var startTimeout;
|
||||||
|
var refreshTimeout;
|
||||||
|
var tipCount = -1;
|
||||||
|
|
||||||
|
RED.actions.add("core:toggle-show-tips",function(state) {
|
||||||
|
if (state === undefined) {
|
||||||
|
RED.userSettings.toggle("view-show-tips");
|
||||||
|
} else {
|
||||||
|
enabled = state;
|
||||||
|
if (enabled) {
|
||||||
|
startTips();
|
||||||
|
} else {
|
||||||
|
stopTips();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function setTip() {
|
||||||
|
var r = Math.floor(Math.random() * tipCount);
|
||||||
|
var tip = RED._("infotips:info.tip"+r);
|
||||||
|
|
||||||
|
var m;
|
||||||
|
while ((m=/({{(.*?)}})/.exec(tip))) {
|
||||||
|
var shortcut = RED.keyboard.getShortcut(m[2]);
|
||||||
|
if (shortcut) {
|
||||||
|
tip = tip.replace(m[1],RED.keyboard.formatKey(shortcut.key));
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while ((m=/(\[(.*?)\])/.exec(tip))) {
|
||||||
|
tip = tip.replace(m[1],RED.keyboard.formatKey(m[2]));
|
||||||
|
}
|
||||||
|
tipBox.html(tip).fadeIn(200);
|
||||||
|
if (startTimeout) {
|
||||||
|
startTimeout = null;
|
||||||
|
refreshTimeout = setInterval(cycleTips,cycleDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cycleTips() {
|
||||||
|
tipBox.fadeOut(300,function() {
|
||||||
|
setTip();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function startTips() {
|
||||||
|
$(".sidebar-node-info").addClass('show-tips');
|
||||||
|
if (enabled) {
|
||||||
|
if (!startTimeout && !refreshTimeout) {
|
||||||
|
if (tipCount === -1) {
|
||||||
|
do {
|
||||||
|
tipCount++;
|
||||||
|
} while(RED._("infotips:info.tip"+tipCount)!=="infotips:info.tip"+tipCount);
|
||||||
|
}
|
||||||
|
startTimeout = setTimeout(setTip,startDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function stopTips() {
|
||||||
|
$(".sidebar-node-info").removeClass('show-tips');
|
||||||
|
clearInterval(refreshTimeout);
|
||||||
|
clearTimeout(startTimeout);
|
||||||
|
refreshTimeout = null;
|
||||||
|
startTimeout = null;
|
||||||
|
}
|
||||||
|
function nextTip() {
|
||||||
|
clearInterval(refreshTimeout);
|
||||||
|
startTimeout = true;
|
||||||
|
setTip();
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
start: startTips,
|
||||||
|
stop: stopTips,
|
||||||
|
next: nextTip,
|
||||||
|
enabled: function() { return enabled; }
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
$(content).html("");
|
// sections.hide();
|
||||||
|
refresh(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set(html) {
|
function set(html,title) {
|
||||||
$(content).html(html);
|
// tips.stop();
|
||||||
|
// sections.show();
|
||||||
|
refresh(null);
|
||||||
|
nodeSection.container.hide();
|
||||||
|
infoSection.title.text(title||RED._("sidebar.info.info"));
|
||||||
|
setInfoText(html);
|
||||||
|
$(".sidebar-node-info-stack").scrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.events.on("view:selection-changed",function(selection) {
|
function refreshSelection(selection) {
|
||||||
|
if (selection === undefined) {
|
||||||
|
selection = RED.view.selection();
|
||||||
|
}
|
||||||
if (selection.nodes) {
|
if (selection.nodes) {
|
||||||
if (selection.nodes.length == 1) {
|
if (selection.nodes.length == 1) {
|
||||||
var node = selection.nodes[0];
|
var node = selection.nodes[0];
|
||||||
@@ -188,21 +413,34 @@ RED.sidebar.info = (function() {
|
|||||||
} else {
|
} else {
|
||||||
refresh(node);
|
refresh(node);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
refresh(selection.nodes);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var subflow = RED.nodes.subflow(RED.workspaces.active());
|
var activeWS = RED.workspaces.active();
|
||||||
if (subflow) {
|
|
||||||
refresh(subflow);
|
var flow = RED.nodes.workspace(activeWS) || RED.nodes.subflow(activeWS);
|
||||||
|
if (flow) {
|
||||||
|
refresh(flow);
|
||||||
} else {
|
} else {
|
||||||
clear();
|
var workspace = RED.nodes.workspace(RED.workspaces.active());
|
||||||
|
if (workspace && workspace.info) {
|
||||||
|
refresh(workspace);
|
||||||
|
} else {
|
||||||
|
refresh(null)
|
||||||
|
// clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RED.events.on("view:selection-changed",refreshSelection);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
show: show,
|
show: show,
|
||||||
refresh:refresh,
|
refresh: refresh,
|
||||||
clear: clear,
|
clear: clear,
|
||||||
set: set
|
set: set
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2014 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -32,7 +32,15 @@ RED.tray = (function() {
|
|||||||
// var growButton = $('<a class="editor-tray-resize-button" style="cursor: w-resize;"><i class="fa fa-angle-left"></i></a>').appendTo(resizer);
|
// var growButton = $('<a class="editor-tray-resize-button" style="cursor: w-resize;"><i class="fa fa-angle-left"></i></a>').appendTo(resizer);
|
||||||
// var shrinkButton = $('<a class="editor-tray-resize-button" style="cursor: e-resize;"><i style="margin-left: 1px;" class="fa fa-angle-right"></i></a>').appendTo(resizer);
|
// var shrinkButton = $('<a class="editor-tray-resize-button" style="cursor: e-resize;"><i style="margin-left: 1px;" class="fa fa-angle-right"></i></a>').appendTo(resizer);
|
||||||
if (options.title) {
|
if (options.title) {
|
||||||
$('<div class="editor-tray-titlebar">'+options.title+'</div>').appendTo(header);
|
var titles = stack.map(function(e) { return e.options.title });
|
||||||
|
titles.push(options.title);
|
||||||
|
var title = '<ul class="editor-tray-breadcrumbs"><li>'+titles.join("</li><li>")+'</li></ul>';
|
||||||
|
|
||||||
|
$('<div class="editor-tray-titlebar">'+title+'</div>').appendTo(header);
|
||||||
|
}
|
||||||
|
if (options.width === Infinity) {
|
||||||
|
options.maximized = true;
|
||||||
|
resizer.addClass('editor-tray-resize-maximised');
|
||||||
}
|
}
|
||||||
var buttonBar = $('<div class="editor-tray-toolbar"></div>').appendTo(header);
|
var buttonBar = $('<div class="editor-tray-toolbar"></div>').appendTo(header);
|
||||||
var primaryButton;
|
var primaryButton;
|
||||||
@@ -44,7 +52,7 @@ RED.tray = (function() {
|
|||||||
b.attr('id',button.id);
|
b.attr('id',button.id);
|
||||||
}
|
}
|
||||||
if (button.text) {
|
if (button.text) {
|
||||||
b.html(button.text);
|
b.text(button.text);
|
||||||
}
|
}
|
||||||
if (button.click) {
|
if (button.click) {
|
||||||
b.click((function(action) {
|
b.click((function(action) {
|
||||||
@@ -74,7 +82,8 @@ RED.tray = (function() {
|
|||||||
};
|
};
|
||||||
stack.push(tray);
|
stack.push(tray);
|
||||||
|
|
||||||
el.draggable({
|
if (!options.maximized) {
|
||||||
|
el.draggable({
|
||||||
handle: resizer,
|
handle: resizer,
|
||||||
axis: "x",
|
axis: "x",
|
||||||
start:function(event,ui) {
|
start:function(event,ui) {
|
||||||
@@ -103,92 +112,80 @@ RED.tray = (function() {
|
|||||||
tray.width = -ui.position.left;
|
tray.width = -ui.position.left;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (options.open) {
|
|
||||||
options.open(el);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#header-shade").show();
|
function finishBuild() {
|
||||||
$("#editor-shade").show();
|
$("#header-shade").show();
|
||||||
$("#palette-shade").show();
|
$("#editor-shade").show();
|
||||||
$(".sidebar-shade").show();
|
$("#palette-shade").show();
|
||||||
|
$(".sidebar-shade").show();
|
||||||
tray.preferredWidth = Math.max(el.width(),500);
|
tray.preferredWidth = Math.max(el.width(),500);
|
||||||
body.css({"minWidth":tray.preferredWidth-40});
|
if (!options.maximized) {
|
||||||
|
body.css({"minWidth":tray.preferredWidth-40});
|
||||||
if (options.width) {
|
}
|
||||||
if (options.width > $("#editor-stack").position().left-8) {
|
if (options.width) {
|
||||||
options.width = $("#editor-stack").position().left-8;
|
if (options.width > $("#editor-stack").position().left-8) {
|
||||||
|
options.width = $("#editor-stack").position().left-8;
|
||||||
|
}
|
||||||
|
el.width(options.width);
|
||||||
|
} else {
|
||||||
|
el.width(tray.preferredWidth);
|
||||||
}
|
}
|
||||||
el.width(options.width);
|
|
||||||
} else {
|
|
||||||
el.width(tray.preferredWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
tray.width = el.width();
|
tray.width = el.width();
|
||||||
if (tray.width > $("#editor-stack").position().left-8) {
|
if (tray.width > $("#editor-stack").position().left-8) {
|
||||||
tray.width = Math.max(0/*tray.preferredWidth*/,$("#editor-stack").position().left-8);
|
tray.width = Math.max(0/*tray.preferredWidth*/,$("#editor-stack").position().left-8);
|
||||||
el.width(tray.width);
|
el.width(tray.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tray.body.parent().width(Math.min($("#editor-stack").position().left-8,tray.width));
|
// tray.body.parent().width(Math.min($("#editor-stack").position().left-8,tray.width));
|
||||||
|
|
||||||
el.css({
|
el.css({
|
||||||
right: -(el.width()+10)+"px",
|
right: -(el.width()+10)+"px",
|
||||||
transition: "right 0.25s ease"
|
transition: "right 0.25s ease"
|
||||||
});
|
});
|
||||||
$("#workspace").scrollLeft(0);
|
$("#workspace").scrollLeft(0);
|
||||||
handleWindowResize();
|
handleWindowResize();
|
||||||
openingTray = true;
|
openingTray = true;
|
||||||
setTimeout(function() {
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!options.width) {
|
|
||||||
el.width(Math.min(tray.preferredWidth,$("#editor-stack").position().left-8));
|
|
||||||
}
|
|
||||||
if (options.resize) {
|
|
||||||
options.resize({width:el.width()});
|
|
||||||
}
|
|
||||||
if (options.show) {
|
|
||||||
options.show();
|
|
||||||
}
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
// Delay resetting the flag, so we don't close prematurely
|
if (!options.width) {
|
||||||
openingTray = false;
|
el.width(Math.min(tray.preferredWidth,$("#editor-stack").position().left-8));
|
||||||
},200);
|
}
|
||||||
},150);
|
if (options.resize) {
|
||||||
el.css({right:0});
|
options.resize({width:el.width()});
|
||||||
},0);
|
}
|
||||||
|
if (options.show) {
|
||||||
// growButton.click(function(e) {
|
options.show();
|
||||||
// e.preventDefault();
|
}
|
||||||
// tray.lastWidth = tray.width;
|
setTimeout(function() {
|
||||||
// tray.width = $("#editor-stack").position().left-8;
|
// Delay resetting the flag, so we don't close prematurely
|
||||||
// el.width(tray.width);
|
openingTray = false;
|
||||||
// if (options.resize) {
|
},200);
|
||||||
// options.resize({width:tray.width});
|
body.find(":focusable:first").focus();
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// shrinkButton.click(function(e) {
|
|
||||||
// e.preventDefault();
|
|
||||||
// if (tray.lastWidth && tray.width > tray.lastWidth) {
|
|
||||||
// tray.width = tray.lastWidth;
|
|
||||||
// } else if (tray.width > tray.preferredWidth) {
|
|
||||||
// tray.width = tray.preferredWidth;
|
|
||||||
// }
|
|
||||||
// el.width(tray.width);
|
|
||||||
// if (options.resize) {
|
|
||||||
// options.resize({width:tray.width});
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
},150);
|
||||||
|
el.css({right:0});
|
||||||
|
},0);
|
||||||
|
}
|
||||||
|
if (options.open) {
|
||||||
|
if (options.open.length === 1) {
|
||||||
|
options.open(el);
|
||||||
|
finishBuild();
|
||||||
|
} else {
|
||||||
|
options.open(el,finishBuild);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
finishBuild();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleWindowResize() {
|
function handleWindowResize() {
|
||||||
if (stack.length > 0) {
|
if (stack.length > 0) {
|
||||||
var tray = stack[stack.length-1];
|
var tray = stack[stack.length-1];
|
||||||
var trayHeight = tray.tray.height()-tray.header.outerHeight()-tray.footer.outerHeight();
|
var trayHeight = tray.tray.height()-tray.header.outerHeight()-tray.footer.outerHeight();
|
||||||
tray.body.height(trayHeight-40);
|
tray.body.height(trayHeight);
|
||||||
if (tray.width > $("#editor-stack").position().left-8) {
|
if (tray.options.maximized || tray.width > $("#editor-stack").position().left-8) {
|
||||||
tray.width = $("#editor-stack").position().left-8;
|
tray.width = $("#editor-stack").position().left-8;
|
||||||
tray.tray.width(tray.width);
|
tray.tray.width(tray.width);
|
||||||
// tray.body.parent().width(tray.width);
|
// tray.body.parent().width(tray.width);
|
||||||
@@ -198,7 +195,7 @@ RED.tray = (function() {
|
|||||||
// tray.body.parent().width(tray.width);
|
// tray.body.parent().width(tray.width);
|
||||||
}
|
}
|
||||||
if (tray.options.resize) {
|
if (tray.options.resize) {
|
||||||
tray.options.resize({width:tray.width});
|
tray.options.resize({width:tray.width, height:trayHeight});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,8 +214,11 @@ RED.tray = (function() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
show: function show(options) {
|
show: function show(options) {
|
||||||
if (stack.length > 0) {
|
if (stack.length > 0 && !options.overlay) {
|
||||||
var oldTray = stack[stack.length-1];
|
var oldTray = stack[stack.length-1];
|
||||||
|
if (options.width === "inherit") {
|
||||||
|
options.width = oldTray.tray.width();
|
||||||
|
}
|
||||||
oldTray.tray.css({
|
oldTray.tray.css({
|
||||||
right: -(oldTray.tray.width()+10)+"px"
|
right: -(oldTray.tray.width()+10)+"px"
|
||||||
});
|
});
|
||||||
@@ -245,14 +245,21 @@ RED.tray = (function() {
|
|||||||
tray.tray.remove();
|
tray.tray.remove();
|
||||||
if (stack.length > 0) {
|
if (stack.length > 0) {
|
||||||
var oldTray = stack[stack.length-1];
|
var oldTray = stack[stack.length-1];
|
||||||
oldTray.tray.appendTo("#editor-stack");
|
if (!oldTray.options.overlay) {
|
||||||
setTimeout(function() {
|
oldTray.tray.appendTo("#editor-stack");
|
||||||
|
setTimeout(function() {
|
||||||
|
handleWindowResize();
|
||||||
|
oldTray.tray.css({right:0});
|
||||||
|
if (oldTray.options.show) {
|
||||||
|
oldTray.options.show();
|
||||||
|
}
|
||||||
|
},0);
|
||||||
|
} else {
|
||||||
handleWindowResize();
|
handleWindowResize();
|
||||||
oldTray.tray.css({right:0});
|
|
||||||
if (oldTray.options.show) {
|
if (oldTray.options.show) {
|
||||||
oldTray.options.show();
|
oldTray.options.show();
|
||||||
}
|
}
|
||||||
},0);
|
}
|
||||||
}
|
}
|
||||||
if (done) {
|
if (done) {
|
||||||
done();
|
done();
|
||||||
|
|||||||
330
editor/js/ui/typeSearch.js
Normal file
@@ -0,0 +1,330 @@
|
|||||||
|
RED.typeSearch = (function() {
|
||||||
|
|
||||||
|
var shade;
|
||||||
|
|
||||||
|
var disabled = false;
|
||||||
|
var dialog = null;
|
||||||
|
var searchInput;
|
||||||
|
var searchResults;
|
||||||
|
var searchResultsDiv;
|
||||||
|
var selected = -1;
|
||||||
|
var visible = false;
|
||||||
|
|
||||||
|
var activeFilter = "";
|
||||||
|
var addCallback;
|
||||||
|
var cancelCallback;
|
||||||
|
|
||||||
|
var typesUsed = {};
|
||||||
|
|
||||||
|
function search(val) {
|
||||||
|
activeFilter = val.toLowerCase();
|
||||||
|
var visible = searchResults.editableList('filter');
|
||||||
|
searchResults.editableList('sort');
|
||||||
|
setTimeout(function() {
|
||||||
|
selected = 0;
|
||||||
|
searchResults.children().removeClass('selected');
|
||||||
|
searchResults.children(":visible:first").addClass('selected');
|
||||||
|
},100);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureSelectedIsVisible() {
|
||||||
|
var selectedEntry = searchResults.find("li.selected");
|
||||||
|
if (selectedEntry.length === 1) {
|
||||||
|
var scrollWindow = searchResults.parent();
|
||||||
|
var scrollHeight = scrollWindow.height();
|
||||||
|
var scrollOffset = scrollWindow.scrollTop();
|
||||||
|
var y = selectedEntry.position().top;
|
||||||
|
var h = selectedEntry.height();
|
||||||
|
if (y+h > scrollHeight) {
|
||||||
|
scrollWindow.animate({scrollTop: '-='+(scrollHeight-(y+h)-10)},50);
|
||||||
|
} else if (y<0) {
|
||||||
|
scrollWindow.animate({scrollTop: '+='+(y-10)},50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDialog() {
|
||||||
|
//shade = $('<div>',{class:"red-ui-type-search-shade"}).appendTo("#main-container");
|
||||||
|
dialog = $("<div>",{id:"red-ui-type-search",class:"red-ui-search red-ui-type-search"}).appendTo("#main-container");
|
||||||
|
var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(dialog);
|
||||||
|
searchInput = $('<input type="text">').attr("placeholder",RED._("search.addNode")).appendTo(searchDiv).searchBox({
|
||||||
|
delay: 50,
|
||||||
|
change: function() {
|
||||||
|
search($(this).val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
searchInput.on('keydown',function(evt) {
|
||||||
|
var children = searchResults.children(":visible");
|
||||||
|
if (children.length > 0) {
|
||||||
|
if (evt.keyCode === 40) {
|
||||||
|
// Down
|
||||||
|
if (selected < children.length-1) {
|
||||||
|
if (selected > -1) {
|
||||||
|
$(children[selected]).removeClass('selected');
|
||||||
|
}
|
||||||
|
selected++;
|
||||||
|
}
|
||||||
|
$(children[selected]).addClass('selected');
|
||||||
|
ensureSelectedIsVisible();
|
||||||
|
evt.preventDefault();
|
||||||
|
} else if (evt.keyCode === 38) {
|
||||||
|
// Up
|
||||||
|
if (selected > 0) {
|
||||||
|
if (selected < children.length) {
|
||||||
|
$(children[selected]).removeClass('selected');
|
||||||
|
}
|
||||||
|
selected--;
|
||||||
|
}
|
||||||
|
$(children[selected]).addClass('selected');
|
||||||
|
ensureSelectedIsVisible();
|
||||||
|
evt.preventDefault();
|
||||||
|
} else if (evt.keyCode === 13) {
|
||||||
|
// Enter
|
||||||
|
var index = Math.max(0,selected);
|
||||||
|
if (index < children.length) {
|
||||||
|
// TODO: dips into editableList impl details
|
||||||
|
confirm($(children[index]).find(".red-ui-editableList-item-content").data('data'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
searchResultsDiv = $("<div>",{class:"red-ui-search-results-container"}).appendTo(dialog);
|
||||||
|
searchResults = $('<ol>',{id:"search-result-list", style:"position: absolute;top: 0;bottom: 0;left: 0;right: 0;"}).appendTo(searchResultsDiv).editableList({
|
||||||
|
addButton: false,
|
||||||
|
filter: function(data) {
|
||||||
|
if (activeFilter === "" ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (data.recent || data.common) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (activeFilter==="")||(data.index.indexOf(activeFilter) > -1);
|
||||||
|
},
|
||||||
|
sort: function(A,B) {
|
||||||
|
if (activeFilter === "") {
|
||||||
|
return A.i - B.i;
|
||||||
|
}
|
||||||
|
var Ai = A.index.indexOf(activeFilter);
|
||||||
|
var Bi = B.index.indexOf(activeFilter);
|
||||||
|
if (Ai === -1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (Bi === -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (Ai === Bi) {
|
||||||
|
return sortTypeLabels(A,B);
|
||||||
|
}
|
||||||
|
return Ai-Bi;
|
||||||
|
},
|
||||||
|
addItem: function(container,i,object) {
|
||||||
|
var def = object.def;
|
||||||
|
object.index = object.type.toLowerCase();
|
||||||
|
if (object.separator) {
|
||||||
|
container.addClass("red-ui-search-result-separator")
|
||||||
|
}
|
||||||
|
var div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container);
|
||||||
|
|
||||||
|
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div);
|
||||||
|
var colour = RED.utils.getNodeColor(object.type,def);
|
||||||
|
var icon_url = RED.utils.getNodeIcon(def);
|
||||||
|
nodeDiv.css('backgroundColor',colour);
|
||||||
|
|
||||||
|
var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv);
|
||||||
|
$('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer);
|
||||||
|
|
||||||
|
if (def.inputs > 0) {
|
||||||
|
$('<div/>',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv);
|
||||||
|
}
|
||||||
|
if (def.outputs > 0) {
|
||||||
|
$('<div/>',{class:"red-ui-search-result-node-port red-ui-search-result-node-output"}).appendTo(nodeDiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
var contentDiv = $('<div>',{class:"red-ui-search-result-description"}).appendTo(div);
|
||||||
|
|
||||||
|
var label = object.label;
|
||||||
|
object.index += "|"+label.toLowerCase();
|
||||||
|
|
||||||
|
$('<div>',{class:"red-ui-search-result-node-label"}).text(label).appendTo(contentDiv);
|
||||||
|
|
||||||
|
div.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
confirm(object);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
scrollOnAdd: false
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
function confirm(def) {
|
||||||
|
hide();
|
||||||
|
typesUsed[def.type] = Date.now();
|
||||||
|
addCallback(def.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseActivity(evt) {
|
||||||
|
if (visible) {
|
||||||
|
var t = $(evt.target);
|
||||||
|
while (t.prop('nodeName').toLowerCase() !== 'body') {
|
||||||
|
if (t.attr('id') === 'red-ui-type-search') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t = t.parent();
|
||||||
|
}
|
||||||
|
hide(true);
|
||||||
|
if (cancelCallback) {
|
||||||
|
cancelCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function show(opts) {
|
||||||
|
if (!visible) {
|
||||||
|
RED.keyboard.add("*","escape",function(){
|
||||||
|
hide();
|
||||||
|
if (cancelCallback) {
|
||||||
|
cancelCallback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (dialog === null) {
|
||||||
|
createDialog();
|
||||||
|
}
|
||||||
|
visible = true;
|
||||||
|
setTimeout(function() {
|
||||||
|
$(document).on('mousedown.type-search',handleMouseActivity);
|
||||||
|
$(document).on('mouseup.type-search',handleMouseActivity);
|
||||||
|
$(document).on('click.type-search',handleMouseActivity);
|
||||||
|
},200);
|
||||||
|
} else {
|
||||||
|
dialog.hide();
|
||||||
|
searchResultsDiv.hide();
|
||||||
|
}
|
||||||
|
refreshTypeList();
|
||||||
|
addCallback = opts.add;
|
||||||
|
closeCallback = opts.close;
|
||||||
|
RED.events.emit("type-search:open");
|
||||||
|
//shade.show();
|
||||||
|
dialog.css({left:opts.x+"px",top:opts.y+"px"}).show();
|
||||||
|
searchResultsDiv.slideDown(300);
|
||||||
|
setTimeout(function() {
|
||||||
|
searchResultsDiv.find(".red-ui-editableList-container").scrollTop(0);
|
||||||
|
searchInput.focus();
|
||||||
|
},100);
|
||||||
|
}
|
||||||
|
function hide(fast) {
|
||||||
|
if (visible) {
|
||||||
|
RED.keyboard.remove("escape");
|
||||||
|
visible = false;
|
||||||
|
if (dialog !== null) {
|
||||||
|
searchResultsDiv.slideUp(fast?50:200,function() {
|
||||||
|
dialog.hide();
|
||||||
|
searchInput.searchBox('value','');
|
||||||
|
});
|
||||||
|
//shade.hide();
|
||||||
|
}
|
||||||
|
RED.events.emit("type-search:close");
|
||||||
|
RED.view.focus();
|
||||||
|
$(document).off('mousedown.type-search');
|
||||||
|
$(document).off('mouseup.type-search');
|
||||||
|
$(document).off('click.type-search');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTypeLabel(type, def) {
|
||||||
|
var label = type;
|
||||||
|
if (typeof def.paletteLabel !== "undefined") {
|
||||||
|
try {
|
||||||
|
label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||"";
|
||||||
|
label += " ("+type+")";
|
||||||
|
} catch(err) {
|
||||||
|
console.log("Definition error: "+type+".paletteLabel",err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
function sortTypeLabels(a,b) {
|
||||||
|
var al = a.label.toLowerCase();
|
||||||
|
var bl = b.label.toLowerCase();
|
||||||
|
if (al < bl) {
|
||||||
|
return -1;
|
||||||
|
} else if (al === bl) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function refreshTypeList() {
|
||||||
|
var i;
|
||||||
|
searchResults.editableList('empty');
|
||||||
|
searchInput.searchBox('value','');
|
||||||
|
selected = -1;
|
||||||
|
var common = [
|
||||||
|
'inject','debug','function','change','switch'
|
||||||
|
];
|
||||||
|
|
||||||
|
var recentlyUsed = Object.keys(typesUsed);
|
||||||
|
recentlyUsed.sort(function(a,b) {
|
||||||
|
return typesUsed[b]-typesUsed[a];
|
||||||
|
});
|
||||||
|
recentlyUsed = recentlyUsed.filter(function(t) {
|
||||||
|
return common.indexOf(t) === -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
var items = [];
|
||||||
|
RED.nodes.registry.getNodeTypes().forEach(function(t) {
|
||||||
|
var def = RED.nodes.getType(t);
|
||||||
|
if (def.category !== 'config' && t !== 'unknown' && t !== 'tab') {
|
||||||
|
items.push({type:t,def: def, label:getTypeLabel(t,def)});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
items.sort(sortTypeLabels);
|
||||||
|
|
||||||
|
var commonCount = 0;
|
||||||
|
var item;
|
||||||
|
var index = 0;
|
||||||
|
for(i=0;i<common.length;i++) {
|
||||||
|
var itemDef = RED.nodes.getType(common[i]);
|
||||||
|
if (itemDef) {
|
||||||
|
item = {
|
||||||
|
type: common[i],
|
||||||
|
common: true,
|
||||||
|
def: itemDef,
|
||||||
|
i: index++
|
||||||
|
};
|
||||||
|
item.label = getTypeLabel(item.type,item.def);
|
||||||
|
if (i === common.length-1) {
|
||||||
|
item.separator = true;
|
||||||
|
}
|
||||||
|
searchResults.editableList('addItem', item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(i=0;i<Math.min(5,recentlyUsed.length);i++) {
|
||||||
|
item = {
|
||||||
|
type:recentlyUsed[i],
|
||||||
|
def: RED.nodes.getType(recentlyUsed[i]),
|
||||||
|
recent: true,
|
||||||
|
i: index++
|
||||||
|
};
|
||||||
|
item.label = getTypeLabel(item.type,item.def);
|
||||||
|
if (i === recentlyUsed.length-1) {
|
||||||
|
item.separator = true;
|
||||||
|
}
|
||||||
|
searchResults.editableList('addItem', item);
|
||||||
|
}
|
||||||
|
for (i=0;i<items.length;i++) {
|
||||||
|
items[i].i = index++;
|
||||||
|
searchResults.editableList('addItem', items[i]);
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
selected = 0;
|
||||||
|
searchResults.children(":first").addClass('selected');
|
||||||
|
},100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
show: show,
|
||||||
|
hide: hide
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
242
editor/js/ui/userSettings.js
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
RED.userSettings = (function() {
|
||||||
|
|
||||||
|
var trayWidth = 700;
|
||||||
|
var settingsVisible = false;
|
||||||
|
|
||||||
|
var panes = [];
|
||||||
|
|
||||||
|
function addPane(options) {
|
||||||
|
panes.push(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function show(initialTab) {
|
||||||
|
if (settingsVisible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!RED.user.hasPermission("settings.write")) {
|
||||||
|
RED.notify(RED._("user.errors.settings"),"error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
settingsVisible = true;
|
||||||
|
var tabContainer;
|
||||||
|
|
||||||
|
var trayOptions = {
|
||||||
|
title: RED._("menu.label.userSettings"),
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "node-dialog-ok",
|
||||||
|
text: RED._("common.label.close"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
RED.tray.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
trayWidth = dimensions.width;
|
||||||
|
},
|
||||||
|
open: function(tray) {
|
||||||
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
|
var settingsContent = $('<div></div>').appendTo(trayBody);
|
||||||
|
var tabContainer = $('<div></div>',{id:"user-settings-tabs-container"}).appendTo(settingsContent);
|
||||||
|
|
||||||
|
$('<ul></ul>',{id:"user-settings-tabs"}).appendTo(tabContainer);
|
||||||
|
var settingsTabs = RED.tabs.create({
|
||||||
|
id: "user-settings-tabs",
|
||||||
|
vertical: true,
|
||||||
|
onchange: function(tab) {
|
||||||
|
setTimeout(function() {
|
||||||
|
$("#user-settings-tabs-content").children().hide();
|
||||||
|
$("#" + tab.id).show();
|
||||||
|
if (tab.pane.focus) {
|
||||||
|
tab.pane.focus();
|
||||||
|
}
|
||||||
|
},50);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var tabContents = $('<div></div>',{id:"user-settings-tabs-content"}).appendTo(settingsContent);
|
||||||
|
|
||||||
|
panes.forEach(function(pane) {
|
||||||
|
settingsTabs.addTab({
|
||||||
|
id: "user-settings-tab-"+pane.id,
|
||||||
|
label: pane.title,
|
||||||
|
pane: pane
|
||||||
|
});
|
||||||
|
pane.get().hide().appendTo(tabContents);
|
||||||
|
});
|
||||||
|
settingsContent.i18n();
|
||||||
|
settingsTabs.activateTab("user-settings-tab-"+(initialTab||'view'))
|
||||||
|
$("#sidebar-shade").show();
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
settingsVisible = false;
|
||||||
|
panes.forEach(function(pane) {
|
||||||
|
if (pane.close) {
|
||||||
|
pane.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#sidebar-shade").hide();
|
||||||
|
|
||||||
|
},
|
||||||
|
show: function() {}
|
||||||
|
}
|
||||||
|
if (trayWidth !== null) {
|
||||||
|
trayOptions.width = trayWidth;
|
||||||
|
}
|
||||||
|
RED.tray.show(trayOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
var viewSettings = [
|
||||||
|
{
|
||||||
|
title: "menu.label.view.grid",
|
||||||
|
options: [
|
||||||
|
{setting:"view-show-grid",oldSetting:"menu-menu-item-view-show-grid",label:"menu.label.view.showGrid",toggle:true,onchange:"core:toggle-show-grid"},
|
||||||
|
{setting:"view-snap-grid",oldSetting:"menu-menu-item-view-snap-grid",label:"menu.label.view.snapGrid",toggle:true,onchange:"core:toggle-snap-grid"},
|
||||||
|
{setting:"view-grid-size",label:"menu.label.view.gridSize",type:"number",default: 20, onchange:RED.view.gridSize}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "menu.label.nodes",
|
||||||
|
options: [
|
||||||
|
{setting:"view-node-status",oldSetting:"menu-menu-item-status",label:"menu.label.displayStatus",default: true, toggle:true,onchange:"core:toggle-status"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "menu.label.other",
|
||||||
|
options: [
|
||||||
|
{setting:"view-show-tips",oldSettings:"menu-menu-item-show-tips",label:"menu.label.showTips",toggle:true,default:true,onchange:"core:toggle-show-tips"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
var allSettings = {};
|
||||||
|
|
||||||
|
function createViewPane() {
|
||||||
|
|
||||||
|
var pane = $('<div id="user-settings-tab-view" class="node-help"></div>');
|
||||||
|
|
||||||
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
|
currentEditorSettings.view = currentEditorSettings.view || {};
|
||||||
|
|
||||||
|
viewSettings.forEach(function(section) {
|
||||||
|
$('<h3></h3>').text(RED._(section.title)).appendTo(pane);
|
||||||
|
section.options.forEach(function(opt) {
|
||||||
|
var initialState = currentEditorSettings.view[opt.setting];
|
||||||
|
var row = $('<div class="user-settings-row"></div>').appendTo(pane);
|
||||||
|
var input;
|
||||||
|
if (opt.toggle) {
|
||||||
|
input = $('<label for="user-settings-'+opt.setting+'"><input id="user-settings-'+opt.setting+'" type="checkbox"> '+RED._(opt.label)+'</label>').appendTo(row).find("input");
|
||||||
|
input.prop('checked',initialState);
|
||||||
|
} else {
|
||||||
|
$('<label for="user-settings-'+opt.setting+'">'+RED._(opt.label)+'</label>').appendTo(row);
|
||||||
|
$('<input id="user-settings-'+opt.setting+'" type="'+(opt.type||"text")+'">').appendTo(row).val(initialState);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
return pane;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSelected(id, value) {
|
||||||
|
var opt = allSettings[id];
|
||||||
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
|
currentEditorSettings.view = currentEditorSettings.view || {};
|
||||||
|
currentEditorSettings.view[opt.setting] = value;
|
||||||
|
RED.settings.set('editor', currentEditorSettings);
|
||||||
|
var callback = opt.onchange;
|
||||||
|
if (typeof callback === 'string') {
|
||||||
|
callback = RED.actions.get(callback);
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
callback.call(opt,value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function toggle(id) {
|
||||||
|
var opt = allSettings[id];
|
||||||
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
|
currentEditorSettings.view = currentEditorSettings.view || {};
|
||||||
|
setSelected(id,!currentEditorSettings.view[opt.setting]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
RED.actions.add("core:show-user-settings",show);
|
||||||
|
RED.actions.add("core:show-help", function() { show('keyboard')});
|
||||||
|
|
||||||
|
addPane({
|
||||||
|
id:'view',
|
||||||
|
title: RED._("menu.label.view.view"),
|
||||||
|
get: createViewPane,
|
||||||
|
close: function() {
|
||||||
|
viewSettings.forEach(function(section) {
|
||||||
|
section.options.forEach(function(opt) {
|
||||||
|
var input = $("#user-settings-"+opt.setting);
|
||||||
|
if (opt.toggle) {
|
||||||
|
setSelected(opt.setting,input.prop('checked'));
|
||||||
|
} else {
|
||||||
|
setSelected(opt.setting,input.val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
var currentEditorSettings = RED.settings.get('editor') || {};
|
||||||
|
currentEditorSettings.view = currentEditorSettings.view || {};
|
||||||
|
var editorSettingsChanged = false;
|
||||||
|
viewSettings.forEach(function(section) {
|
||||||
|
section.options.forEach(function(opt) {
|
||||||
|
if (opt.oldSetting) {
|
||||||
|
var oldValue = RED.settings.get(opt.oldSetting);
|
||||||
|
if (oldValue !== undefined && oldValue !== null) {
|
||||||
|
currentEditorSettings.view[opt.setting] = oldValue;
|
||||||
|
editorSettingsChanged = true;
|
||||||
|
RED.settings.remove(opt.oldSetting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allSettings[opt.setting] = opt;
|
||||||
|
if (opt.onchange) {
|
||||||
|
var value = currentEditorSettings.view[opt.setting];
|
||||||
|
if ((value === null || value === undefined) && opt.hasOwnProperty('default')) {
|
||||||
|
value = opt.default;
|
||||||
|
currentEditorSettings.view[opt.setting] = value;
|
||||||
|
editorSettingsChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var callback = opt.onchange;
|
||||||
|
if (typeof callback === 'string') {
|
||||||
|
callback = RED.actions.get(callback);
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
callback.call(opt,value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (editorSettingsChanged) {
|
||||||
|
RED.settings.set('editor',currentEditorSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
init: init,
|
||||||
|
toggle: toggle,
|
||||||
|
show: show,
|
||||||
|
add: addPane
|
||||||
|
};
|
||||||
|
})();
|
||||||
899
editor/js/ui/utils.js
Normal file
@@ -0,0 +1,899 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
RED.utils = (function() {
|
||||||
|
|
||||||
|
function formatString(str) {
|
||||||
|
return str.replace(/\r?\n/g,"↵").replace(/\t/g,"→");
|
||||||
|
}
|
||||||
|
function sanitize(m) {
|
||||||
|
return m.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildMessageSummaryValue(value) {
|
||||||
|
var result;
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').text('array['+value.length+']');
|
||||||
|
} else if (value === null) {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-null">null</span>');
|
||||||
|
} else if (typeof value === 'object') {
|
||||||
|
if (value.hasOwnProperty('type') && value.type === 'Buffer' && value.hasOwnProperty('data')) {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').text('buffer['+value.length+']');
|
||||||
|
} else if (value.hasOwnProperty('type') && value.type === 'array' && value.hasOwnProperty('data')) {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').text('array['+value.length+']');
|
||||||
|
} else if (value.hasOwnProperty('type') && value.type === 'function') {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').text('function');
|
||||||
|
} else if (value.hasOwnProperty('type') && value.type === 'number') {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-number"></span>').text(value.data);
|
||||||
|
} else {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-meta">object</span>');
|
||||||
|
}
|
||||||
|
} else if (typeof value === 'string') {
|
||||||
|
var subvalue;
|
||||||
|
if (value.length > 30) {
|
||||||
|
subvalue = sanitize(value.substring(0,30))+"…";
|
||||||
|
} else {
|
||||||
|
subvalue = sanitize(value);
|
||||||
|
}
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-string"></span>').html('"'+formatString(subvalue)+'"');
|
||||||
|
} else if (typeof value === 'number') {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-number"></span>').text(""+value);
|
||||||
|
} else {
|
||||||
|
result = $('<span class="debug-message-object-value debug-message-type-other"></span>').text(""+value);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
function makeExpandable(el,onbuild,ontoggle,expand) {
|
||||||
|
el.addClass("debug-message-expandable");
|
||||||
|
el.prop('toggle',function() {
|
||||||
|
return function(state) {
|
||||||
|
var parent = el.parent();
|
||||||
|
if (parent.hasClass('collapsed')) {
|
||||||
|
if (state) {
|
||||||
|
if (onbuild && !parent.hasClass('built')) {
|
||||||
|
onbuild();
|
||||||
|
parent.addClass('built');
|
||||||
|
}
|
||||||
|
parent.removeClass('collapsed');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!state) {
|
||||||
|
parent.addClass('collapsed');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
el.click(function(e) {
|
||||||
|
var parent = $(this).parent();
|
||||||
|
var currentState = !parent.hasClass('collapsed');
|
||||||
|
if ($(this).prop('toggle')(!currentState)) {
|
||||||
|
if (ontoggle) {
|
||||||
|
ontoggle(!currentState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if (parent.hasClass('collapsed')) {
|
||||||
|
// if (onbuild && !parent.hasClass('built')) {
|
||||||
|
// onbuild();
|
||||||
|
// parent.addClass('built');
|
||||||
|
// }
|
||||||
|
// if (ontoggle) {
|
||||||
|
// ontoggle(true);
|
||||||
|
// }
|
||||||
|
// parent.removeClass('collapsed');
|
||||||
|
// } else {
|
||||||
|
// parent.addClass('collapsed');
|
||||||
|
// if (ontoggle) {
|
||||||
|
// ontoggle(false);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
if (expand) {
|
||||||
|
el.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var pinnedPaths = {};
|
||||||
|
var formattedPaths = {};
|
||||||
|
|
||||||
|
function addMessageControls(obj,sourceId,key,msg,rootPath,strippedKey) {
|
||||||
|
if (!pinnedPaths.hasOwnProperty(sourceId)) {
|
||||||
|
pinnedPaths[sourceId] = {}
|
||||||
|
}
|
||||||
|
var tools = $('<span class="debug-message-tools"></span>').appendTo(obj);
|
||||||
|
var copyTools = $('<span class="debug-message-tools-copy button-group"></span>').appendTo(tools);
|
||||||
|
if (!!key) {
|
||||||
|
var copyPath = $('<button class="editor-button editor-button-small"><i class="fa fa-terminal"></i></button>').appendTo(copyTools).click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
RED.clipboard.copyText(key,copyPath,"clipboard.copyMessagePath");
|
||||||
|
})
|
||||||
|
}
|
||||||
|
var copyPayload = $('<button class="editor-button editor-button-small"><i class="fa fa-clipboard"></i></button>').appendTo(copyTools).click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
RED.clipboard.copyText(msg,copyPayload,"clipboard.copyMessageValue");
|
||||||
|
})
|
||||||
|
if (strippedKey !== undefined && strippedKey !== '') {
|
||||||
|
var isPinned = pinnedPaths[sourceId].hasOwnProperty(strippedKey);
|
||||||
|
|
||||||
|
var pinPath = $('<button class="editor-button editor-button-small debug-message-tools-pin"><i class="fa fa-map-pin"></i></button>').appendTo(tools).click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
if (pinnedPaths[sourceId].hasOwnProperty(strippedKey)) {
|
||||||
|
delete pinnedPaths[sourceId][strippedKey];
|
||||||
|
$(this).removeClass("selected");
|
||||||
|
obj.removeClass("debug-message-row-pinned");
|
||||||
|
} else {
|
||||||
|
var rootedPath = "$"+(strippedKey[0] === '['?"":".")+strippedKey;
|
||||||
|
pinnedPaths[sourceId][strippedKey] = normalisePropertyExpression(rootedPath);
|
||||||
|
$(this).addClass("selected");
|
||||||
|
obj.addClass("debug-message-row-pinned");
|
||||||
|
}
|
||||||
|
}).toggleClass("selected",isPinned);
|
||||||
|
obj.toggleClass("debug-message-row-pinned",isPinned);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function checkExpanded(strippedKey,expandPaths,minRange,maxRange) {
|
||||||
|
if (expandPaths && expandPaths.length > 0) {
|
||||||
|
if (strippedKey === '' && minRange === undefined) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (var i=0;i<expandPaths.length;i++) {
|
||||||
|
var p = expandPaths[i];
|
||||||
|
if (p.indexOf(strippedKey) === 0 && (p[strippedKey.length] === "." || p[strippedKey.length] === "[") ) {
|
||||||
|
|
||||||
|
if (minRange !== undefined && p[strippedKey.length] === "[") {
|
||||||
|
var subkey = p.substring(strippedKey.length);
|
||||||
|
var m = (/\[(\d+)\]/.exec(subkey));
|
||||||
|
if (m) {
|
||||||
|
var index = parseInt(m[1]);
|
||||||
|
return minRange<=index && index<=maxRange;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatNumber(element,obj,sourceId,path,cycle,initialFormat) {
|
||||||
|
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path] && formattedPaths[sourceId][path]['number']) || initialFormat || "dec";
|
||||||
|
if (cycle) {
|
||||||
|
if (format === 'dec') {
|
||||||
|
if ((obj.toString().length===13) && (obj<=2147483647000)) {
|
||||||
|
format = 'dateMS';
|
||||||
|
} else if ((obj.toString().length===10) && (obj<=2147483647)) {
|
||||||
|
format = 'dateS';
|
||||||
|
} else {
|
||||||
|
format = 'hex'
|
||||||
|
}
|
||||||
|
} else if (format === 'dateMS' || format == 'dateS') {
|
||||||
|
format = 'hex';
|
||||||
|
} else {
|
||||||
|
format = 'dec';
|
||||||
|
}
|
||||||
|
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||||
|
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
|
||||||
|
formattedPaths[sourceId][path]['number'] = format;
|
||||||
|
} else if (initialFormat !== undefined){
|
||||||
|
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||||
|
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
|
||||||
|
formattedPaths[sourceId][path]['number'] = format;
|
||||||
|
}
|
||||||
|
if (format === 'dec') {
|
||||||
|
element.text(""+obj);
|
||||||
|
} else if (format === 'dateMS') {
|
||||||
|
element.text((new Date(obj)).toISOString());
|
||||||
|
} else if (format === 'dateS') {
|
||||||
|
element.text((new Date(obj*1000)).toISOString());
|
||||||
|
} else if (format === 'hex') {
|
||||||
|
element.text("0x"+(obj).toString(16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatBuffer(element,button,sourceId,path,cycle) {
|
||||||
|
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path] && formattedPaths[sourceId][path]['buffer']) || "raw";
|
||||||
|
if (cycle) {
|
||||||
|
if (format === 'raw') {
|
||||||
|
format = 'string';
|
||||||
|
} else {
|
||||||
|
format = 'raw';
|
||||||
|
}
|
||||||
|
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||||
|
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
|
||||||
|
formattedPaths[sourceId][path]['buffer'] = format;
|
||||||
|
}
|
||||||
|
if (format === 'raw') {
|
||||||
|
button.text('raw');
|
||||||
|
element.removeClass('debug-message-buffer-string').addClass('debug-message-buffer-raw');
|
||||||
|
} else if (format === 'string') {
|
||||||
|
button.text('string');
|
||||||
|
element.addClass('debug-message-buffer-string').removeClass('debug-message-buffer-raw');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildMessageElement(obj,options) {
|
||||||
|
options = options || {};
|
||||||
|
var key = options.key;
|
||||||
|
var typeHint = options.typeHint;
|
||||||
|
var hideKey = options.hideKey;
|
||||||
|
var path = options.path;
|
||||||
|
var sourceId = options.sourceId;
|
||||||
|
var rootPath = options.rootPath;
|
||||||
|
var expandPaths = options.expandPaths;
|
||||||
|
var ontoggle = options.ontoggle;
|
||||||
|
var exposeApi = options.exposeApi;
|
||||||
|
|
||||||
|
var subElements = {};
|
||||||
|
var i;
|
||||||
|
var e;
|
||||||
|
var entryObj;
|
||||||
|
var expandableHeader;
|
||||||
|
var header;
|
||||||
|
var headerHead;
|
||||||
|
var value;
|
||||||
|
var strippedKey;
|
||||||
|
if (path !== undefined && rootPath !== undefined) {
|
||||||
|
strippedKey = path.substring(rootPath.length+(path[rootPath.length]==="."?1:0));
|
||||||
|
}
|
||||||
|
var element = $('<span class="debug-message-element"></span>');
|
||||||
|
element.collapse = function() {
|
||||||
|
element.find(".debug-message-expandable").parent().addClass("collapsed");
|
||||||
|
}
|
||||||
|
header = $('<span class="debug-message-row"></span>').appendTo(element);
|
||||||
|
if (sourceId) {
|
||||||
|
addMessageControls(header,sourceId,path,obj,rootPath,strippedKey);
|
||||||
|
}
|
||||||
|
if (!key) {
|
||||||
|
element.addClass("debug-message-top-level");
|
||||||
|
if (sourceId) {
|
||||||
|
var pinned = pinnedPaths[sourceId];
|
||||||
|
expandPaths = [];
|
||||||
|
if (pinned) {
|
||||||
|
for (var pinnedPath in pinned) {
|
||||||
|
if (pinned.hasOwnProperty(pinnedPath)) {
|
||||||
|
try {
|
||||||
|
var res = getMessageProperty({$:obj},pinned[pinnedPath]);
|
||||||
|
if (res !== undefined) {
|
||||||
|
expandPaths.push(pinnedPath);
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expandPaths.sort();
|
||||||
|
}
|
||||||
|
element.clearPinned = function() {
|
||||||
|
element.find(".debug-message-row-pinned").removeClass("debug-message-row-pinned");
|
||||||
|
pinnedPaths[sourceId] = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!hideKey) {
|
||||||
|
$('<span class="debug-message-object-key"></span>').text(key).appendTo(header);
|
||||||
|
$('<span>: </span>').appendTo(header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entryObj = $('<span class="debug-message-object-value"></span>').appendTo(header);
|
||||||
|
|
||||||
|
var isArray = Array.isArray(obj);
|
||||||
|
var isArrayObject = false;
|
||||||
|
if (obj && typeof obj === 'object' && obj.hasOwnProperty('type') && obj.hasOwnProperty('data') && ((obj.__enc__ && obj.type === 'array') || obj.type === 'Buffer')) {
|
||||||
|
isArray = true;
|
||||||
|
isArrayObject = true;
|
||||||
|
}
|
||||||
|
if (obj === null || obj === undefined) {
|
||||||
|
$('<span class="debug-message-type-null">'+obj+'</span>').appendTo(entryObj);
|
||||||
|
} else if (obj.__enc__ && obj.type === 'number') {
|
||||||
|
e = $('<span class="debug-message-type-number debug-message-object-header"></span>').text(obj.data).appendTo(entryObj);
|
||||||
|
} else if (typeHint === "function" || (obj.__enc__ && obj.type === 'function')) {
|
||||||
|
e = $('<span class="debug-message-type-meta debug-message-object-header"></span>').text("function").appendTo(entryObj);
|
||||||
|
} else if (typeHint === "internal" || (obj.__enc__ && obj.type === 'internal')) {
|
||||||
|
e = $('<span class="debug-message-type-meta debug-message-object-header"></span>').text("[internal]").appendTo(entryObj);
|
||||||
|
} else if (typeof obj === 'string') {
|
||||||
|
if (/[\t\n\r]/.test(obj)) {
|
||||||
|
element.addClass('collapsed');
|
||||||
|
$('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header);
|
||||||
|
makeExpandable(header, function() {
|
||||||
|
$('<span class="debug-message-type-meta debug-message-object-type-header"></span>').text(typeHint||'string').appendTo(header);
|
||||||
|
var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element);
|
||||||
|
$('<pre class="debug-message-type-string"></pre>').text(obj).appendTo(row);
|
||||||
|
},function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey,expandPaths));
|
||||||
|
}
|
||||||
|
e = $('<span class="debug-message-type-string debug-message-object-header"></span>').html('"'+formatString(sanitize(obj))+'"').appendTo(entryObj);
|
||||||
|
if (/^#[0-9a-f]{6}$/i.test(obj)) {
|
||||||
|
$('<span class="debug-message-type-string-swatch"></span>').css('backgroundColor',obj).appendTo(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (typeof obj === 'number') {
|
||||||
|
e = $('<span class="debug-message-type-number"></span>').appendTo(entryObj);
|
||||||
|
|
||||||
|
if (Number.isInteger(obj) && (obj >= 0)) { // if it's a +ve integer
|
||||||
|
e.addClass("debug-message-type-number-toggle");
|
||||||
|
e.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
formatNumber($(this), obj, sourceId, path, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
formatNumber(e,obj,sourceId,path,false,typeHint==='hex'?'hex':undefined);
|
||||||
|
|
||||||
|
} else if (isArray) {
|
||||||
|
element.addClass('collapsed');
|
||||||
|
|
||||||
|
var originalLength = obj.length;
|
||||||
|
if (typeHint) {
|
||||||
|
var m = /\[(\d+)\]/.exec(typeHint);
|
||||||
|
if (m) {
|
||||||
|
originalLength = parseInt(m[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var data = obj;
|
||||||
|
var type = 'array';
|
||||||
|
if (isArrayObject) {
|
||||||
|
data = obj.data;
|
||||||
|
if (originalLength === undefined) {
|
||||||
|
originalLength = data.length;
|
||||||
|
}
|
||||||
|
if (data.__enc__) {
|
||||||
|
data = data.data;
|
||||||
|
}
|
||||||
|
type = obj.type.toLowerCase();
|
||||||
|
} else if (/buffer/.test(typeHint)) {
|
||||||
|
type = 'buffer';
|
||||||
|
}
|
||||||
|
var fullLength = data.length;
|
||||||
|
|
||||||
|
if (originalLength > 0) {
|
||||||
|
$('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header);
|
||||||
|
var arrayRows = $('<div class="debug-message-array-rows"></div>').appendTo(element);
|
||||||
|
element.addClass('debug-message-buffer-raw');
|
||||||
|
}
|
||||||
|
if (key) {
|
||||||
|
headerHead = $('<span class="debug-message-type-meta"></span>').text(typeHint||(type+'['+originalLength+']')).appendTo(entryObj);
|
||||||
|
} else {
|
||||||
|
headerHead = $('<span class="debug-message-object-header"></span>').appendTo(entryObj);
|
||||||
|
$('<span>[ </span>').appendTo(headerHead);
|
||||||
|
var arrayLength = Math.min(originalLength,10);
|
||||||
|
for (i=0;i<arrayLength;i++) {
|
||||||
|
buildMessageSummaryValue(data[i]).appendTo(headerHead);
|
||||||
|
if (i < arrayLength-1) {
|
||||||
|
$('<span>, </span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (originalLength > arrayLength) {
|
||||||
|
$('<span> …</span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
if (arrayLength === 0) {
|
||||||
|
$('<span class="debug-message-type-meta">empty</span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
$('<span> ]</span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
if (originalLength > 0) {
|
||||||
|
|
||||||
|
makeExpandable(header,function() {
|
||||||
|
if (!key) {
|
||||||
|
headerHead = $('<span class="debug-message-type-meta debug-message-object-type-header"></span>').text(typeHint||(type+'['+originalLength+']')).appendTo(header);
|
||||||
|
}
|
||||||
|
if (type === 'buffer') {
|
||||||
|
var stringRow = $('<div class="debug-message-string-rows"></div>').appendTo(element);
|
||||||
|
var sr = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(stringRow);
|
||||||
|
var stringEncoding = "";
|
||||||
|
try {
|
||||||
|
stringEncoding = String.fromCharCode.apply(null, new Uint16Array(data))
|
||||||
|
} catch(err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
$('<pre class="debug-message-type-string"></pre>').text(stringEncoding).appendTo(sr);
|
||||||
|
var bufferOpts = $('<span class="debug-message-buffer-opts"></span>').appendTo(headerHead);
|
||||||
|
var switchFormat = $('<a href="#"></a>').addClass('selected').text('raw').appendTo(bufferOpts).click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
formatBuffer(element,$(this),sourceId,path,true);
|
||||||
|
});
|
||||||
|
formatBuffer(element,switchFormat,sourceId,path,false);
|
||||||
|
|
||||||
|
}
|
||||||
|
var row;
|
||||||
|
if (fullLength <= 10) {
|
||||||
|
for (i=0;i<fullLength;i++) {
|
||||||
|
row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(arrayRows);
|
||||||
|
subElements[path+"["+i+"]"] = buildMessageElement(
|
||||||
|
data[i],
|
||||||
|
{
|
||||||
|
key: ""+i,
|
||||||
|
typeHint: type==='buffer'?'hex':false,
|
||||||
|
hideKey: false,
|
||||||
|
path: path+"["+i+"]",
|
||||||
|
sourceId: sourceId,
|
||||||
|
rootPath: rootPath,
|
||||||
|
expandPaths: expandPaths,
|
||||||
|
ontoggle: ontoggle,
|
||||||
|
exposeApi: exposeApi
|
||||||
|
}
|
||||||
|
).appendTo(row);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i=0;i<fullLength;i+=10) {
|
||||||
|
var minRange = i;
|
||||||
|
row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(arrayRows);
|
||||||
|
header = $('<span></span>').appendTo(row);
|
||||||
|
$('<i class="fa fa-caret-right debug-message-object-handle"></i> ').appendTo(header);
|
||||||
|
makeExpandable(header, (function() {
|
||||||
|
var min = minRange;
|
||||||
|
var max = Math.min(fullLength-1,(minRange+9));
|
||||||
|
var parent = row;
|
||||||
|
return function() {
|
||||||
|
for (var i=min;i<=max;i++) {
|
||||||
|
var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(parent);
|
||||||
|
subElements[path+"["+i+"]"] = buildMessageElement(
|
||||||
|
data[i],
|
||||||
|
{
|
||||||
|
key: ""+i,
|
||||||
|
typeHint: type==='buffer'?'hex':false,
|
||||||
|
hideKey: false,
|
||||||
|
path: path+"["+i+"]",
|
||||||
|
sourceId: sourceId,
|
||||||
|
rootPath: rootPath,
|
||||||
|
expandPaths: expandPaths,
|
||||||
|
ontoggle: ontoggle,
|
||||||
|
exposeApi: exposeApi
|
||||||
|
|
||||||
|
}
|
||||||
|
).appendTo(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})(),
|
||||||
|
(function() { var path = path+"["+i+"]"; return function(state) {if (ontoggle) { ontoggle(path,state);}}})(),
|
||||||
|
checkExpanded(strippedKey,expandPaths,minRange,Math.min(fullLength-1,(minRange+9))));
|
||||||
|
$('<span class="debug-message-object-key"></span>').html("["+minRange+" … "+Math.min(fullLength-1,(minRange+9))+"]").appendTo(header);
|
||||||
|
}
|
||||||
|
if (fullLength < originalLength) {
|
||||||
|
$('<div class="debug-message-object-entry collapsed"><span class="debug-message-object-key">['+fullLength+' … '+originalLength+']</span></div>').appendTo(arrayRows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(state) {if (ontoggle) { ontoggle(path,state);}},
|
||||||
|
checkExpanded(strippedKey,expandPaths));
|
||||||
|
}
|
||||||
|
} else if (typeof obj === 'object') {
|
||||||
|
element.addClass('collapsed');
|
||||||
|
var keys = Object.keys(obj);
|
||||||
|
if (key || keys.length > 0) {
|
||||||
|
$('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header);
|
||||||
|
makeExpandable(header, function() {
|
||||||
|
if (!key) {
|
||||||
|
$('<span class="debug-message-type-meta debug-message-object-type-header"></span>').text('object').appendTo(header);
|
||||||
|
}
|
||||||
|
for (i=0;i<keys.length;i++) {
|
||||||
|
var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element);
|
||||||
|
var newPath = path;
|
||||||
|
if (newPath !== undefined) {
|
||||||
|
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) {
|
||||||
|
newPath += (newPath.length > 0?".":"")+keys[i];
|
||||||
|
} else {
|
||||||
|
newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
subElements[newPath] = buildMessageElement(
|
||||||
|
obj[keys[i]],
|
||||||
|
{
|
||||||
|
key: keys[i],
|
||||||
|
typeHint: false,
|
||||||
|
hideKey: false,
|
||||||
|
path: newPath,
|
||||||
|
sourceId: sourceId,
|
||||||
|
rootPath: rootPath,
|
||||||
|
expandPaths: expandPaths,
|
||||||
|
ontoggle: ontoggle,
|
||||||
|
exposeApi: exposeApi
|
||||||
|
|
||||||
|
}
|
||||||
|
).appendTo(row);
|
||||||
|
}
|
||||||
|
if (keys.length === 0) {
|
||||||
|
$('<div class="debug-message-object-entry debug-message-type-meta collapsed"></div>').text("empty").appendTo(element);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(state) {if (ontoggle) { ontoggle(path,state);}},
|
||||||
|
checkExpanded(strippedKey,expandPaths));
|
||||||
|
}
|
||||||
|
if (key) {
|
||||||
|
$('<span class="debug-message-type-meta"></span>').text('object').appendTo(entryObj);
|
||||||
|
} else {
|
||||||
|
headerHead = $('<span class="debug-message-object-header"></span>').appendTo(entryObj);
|
||||||
|
$('<span>{ </span>').appendTo(headerHead);
|
||||||
|
var keysLength = Math.min(keys.length,5);
|
||||||
|
for (i=0;i<keysLength;i++) {
|
||||||
|
$('<span class="debug-message-object-key"></span>').text(keys[i]).appendTo(headerHead);
|
||||||
|
$('<span>: </span>').appendTo(headerHead);
|
||||||
|
buildMessageSummaryValue(obj[keys[i]]).appendTo(headerHead);
|
||||||
|
if (i < keysLength-1) {
|
||||||
|
$('<span>, </span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keys.length > keysLength) {
|
||||||
|
$('<span> …</span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
if (keysLength === 0) {
|
||||||
|
$('<span class="debug-message-type-meta">empty</span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
$('<span> }</span>').appendTo(headerHead);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('<span class="debug-message-type-other"></span>').text(""+obj).appendTo(entryObj);
|
||||||
|
}
|
||||||
|
if (exposeApi) {
|
||||||
|
element.prop('expand', function() { return function(targetPath, state) {
|
||||||
|
if (path === targetPath) {
|
||||||
|
if (header.prop('toggle')) {
|
||||||
|
header.prop('toggle')(state);
|
||||||
|
}
|
||||||
|
} else if (subElements[targetPath] && subElements[targetPath].prop('expand') ) {
|
||||||
|
subElements[targetPath].prop('expand')(targetPath,state);
|
||||||
|
} else {
|
||||||
|
for (var p in subElements) {
|
||||||
|
if (subElements.hasOwnProperty(p)) {
|
||||||
|
if (targetPath.indexOf(p) === 0) {
|
||||||
|
if (subElements[p].prop('expand') ) {
|
||||||
|
subElements[p].prop('expand')(targetPath,state);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalisePropertyExpression(str) {
|
||||||
|
// This must be kept in sync with validatePropertyExpression
|
||||||
|
// in editor/js/ui/utils.js
|
||||||
|
|
||||||
|
var length = str.length;
|
||||||
|
if (length === 0) {
|
||||||
|
throw new Error("Invalid property expression: zero-length");
|
||||||
|
}
|
||||||
|
var parts = [];
|
||||||
|
var start = 0;
|
||||||
|
var inString = false;
|
||||||
|
var inBox = false;
|
||||||
|
var quoteChar;
|
||||||
|
var v;
|
||||||
|
for (var i=0;i<length;i++) {
|
||||||
|
var c = str[i];
|
||||||
|
if (!inString) {
|
||||||
|
if (c === "'" || c === '"') {
|
||||||
|
if (i != start) {
|
||||||
|
throw new Error("Invalid property expression: unexpected "+c+" at position "+i);
|
||||||
|
}
|
||||||
|
inString = true;
|
||||||
|
quoteChar = c;
|
||||||
|
start = i+1;
|
||||||
|
} else if (c === '.') {
|
||||||
|
if (i===0) {
|
||||||
|
throw new Error("Invalid property expression: unexpected . at position 0");
|
||||||
|
}
|
||||||
|
if (start != i) {
|
||||||
|
v = str.substring(start,i);
|
||||||
|
if (/^\d+$/.test(v)) {
|
||||||
|
parts.push(parseInt(v));
|
||||||
|
} else {
|
||||||
|
parts.push(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i===length-1) {
|
||||||
|
throw new Error("Invalid property expression: unterminated expression");
|
||||||
|
}
|
||||||
|
// Next char is first char of an identifier: a-z 0-9 $ _
|
||||||
|
if (!/[a-z0-9\$\_]/i.test(str[i+1])) {
|
||||||
|
throw new Error("Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
|
||||||
|
}
|
||||||
|
start = i+1;
|
||||||
|
} else if (c === '[') {
|
||||||
|
if (i === 0) {
|
||||||
|
throw new Error("Invalid property expression: unexpected "+c+" at position "+i);
|
||||||
|
}
|
||||||
|
if (start != i) {
|
||||||
|
parts.push(str.substring(start,i));
|
||||||
|
}
|
||||||
|
if (i===length-1) {
|
||||||
|
throw new Error("Invalid property expression: unterminated expression");
|
||||||
|
}
|
||||||
|
// Next char is either a quote or a number
|
||||||
|
if (!/["'\d]/.test(str[i+1])) {
|
||||||
|
throw new Error("Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
|
||||||
|
}
|
||||||
|
start = i+1;
|
||||||
|
inBox = true;
|
||||||
|
} else if (c === ']') {
|
||||||
|
if (!inBox) {
|
||||||
|
throw new Error("Invalid property expression: unexpected "+c+" at position "+i);
|
||||||
|
}
|
||||||
|
if (start != i) {
|
||||||
|
v = str.substring(start,i);
|
||||||
|
if (/^\d+$/.test(v)) {
|
||||||
|
parts.push(parseInt(v));
|
||||||
|
} else {
|
||||||
|
throw new Error("Invalid property expression: unexpected array expression at position "+start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
start = i+1;
|
||||||
|
inBox = false;
|
||||||
|
} else if (c === ' ') {
|
||||||
|
throw new Error("Invalid property expression: unexpected ' ' at position "+i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (c === quoteChar) {
|
||||||
|
if (i-start === 0) {
|
||||||
|
throw new Error("Invalid property expression: zero-length string at position "+start);
|
||||||
|
}
|
||||||
|
parts.push(str.substring(start,i));
|
||||||
|
// If inBox, next char must be a ]. Otherwise it may be [ or .
|
||||||
|
if (inBox && !/\]/.test(str[i+1])) {
|
||||||
|
throw new Error("Invalid property expression: unexpected array expression at position "+start);
|
||||||
|
} else if (!inBox && i+1!==length && !/[\[\.]/.test(str[i+1])) {
|
||||||
|
throw new Error("Invalid property expression: unexpected "+str[i+1]+" expression at position "+(i+1));
|
||||||
|
}
|
||||||
|
start = i+1;
|
||||||
|
inString = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (inBox || inString) {
|
||||||
|
throw new Error("Invalid property expression: unterminated expression");
|
||||||
|
}
|
||||||
|
if (start < length) {
|
||||||
|
parts.push(str.substring(start));
|
||||||
|
}
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
function validatePropertyExpression(str) {
|
||||||
|
try {
|
||||||
|
var parts = normalisePropertyExpression(str);
|
||||||
|
return true;
|
||||||
|
} catch(err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMessageProperty(msg,expr) {
|
||||||
|
var result = null;
|
||||||
|
var msgPropParts;
|
||||||
|
|
||||||
|
if (typeof expr === 'string') {
|
||||||
|
if (expr.indexOf('msg.')===0) {
|
||||||
|
expr = expr.substring(4);
|
||||||
|
}
|
||||||
|
msgPropParts = normalisePropertyExpression(expr);
|
||||||
|
} else {
|
||||||
|
msgPropParts = expr;
|
||||||
|
}
|
||||||
|
var m;
|
||||||
|
msgPropParts.reduce(function(obj, key) {
|
||||||
|
result = (typeof obj[key] !== "undefined" ? obj[key] : undefined);
|
||||||
|
if (result === undefined && obj.hasOwnProperty('type') && obj.hasOwnProperty('data')&& obj.hasOwnProperty('length')) {
|
||||||
|
result = (typeof obj.data[key] !== "undefined" ? obj.data[key] : undefined);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}, msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function separateIconPath(icon) {
|
||||||
|
var result = {module: "", file: ""};
|
||||||
|
if (icon) {
|
||||||
|
var index = icon.indexOf('/');
|
||||||
|
if (index !== -1) {
|
||||||
|
result.module = icon.slice(0, index);
|
||||||
|
result.file = icon.slice(index + 1);
|
||||||
|
} else {
|
||||||
|
result.file = icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDefaultNodeIcon(def,node) {
|
||||||
|
var icon_url;
|
||||||
|
if (node && node.type === "subflow") {
|
||||||
|
icon_url = "node-red/subflow.png";
|
||||||
|
} else if (typeof def.icon === "function") {
|
||||||
|
try {
|
||||||
|
icon_url = def.icon.call(node);
|
||||||
|
} catch(err) {
|
||||||
|
console.log("Definition error: "+def.type+".icon",err);
|
||||||
|
icon_url = "arrow-in.png";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
icon_url = def.icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
var iconPath = separateIconPath(icon_url);
|
||||||
|
if (!iconPath.module) {
|
||||||
|
if (def.set) {
|
||||||
|
iconPath.module = def.set.module;
|
||||||
|
} else {
|
||||||
|
// Handle subflow instance nodes that don't have def.set
|
||||||
|
iconPath.module = "node-red";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iconPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isIconExists(iconPath) {
|
||||||
|
var iconSets = RED.nodes.getIconSets();
|
||||||
|
var iconFileList = iconSets[iconPath.module];
|
||||||
|
if (iconFileList && iconFileList.indexOf(iconPath.file) !== -1) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNodeIcon(def,node) {
|
||||||
|
if (def.category === 'config') {
|
||||||
|
return "icons/node-red/cog.png"
|
||||||
|
} else if (node && node.type === 'tab') {
|
||||||
|
return "icons/node-red/subflow.png"
|
||||||
|
} else if (node && node.type === 'unknown') {
|
||||||
|
return "icons/node-red/alert.png"
|
||||||
|
} else if (node && node.icon) {
|
||||||
|
var iconPath = separateIconPath(node.icon);
|
||||||
|
if (isIconExists(iconPath)) {
|
||||||
|
return "icons/" + node.icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var iconPath = getDefaultNodeIcon(def, node);
|
||||||
|
if (def.category === 'subflows') {
|
||||||
|
if (!isIconExists(iconPath)) {
|
||||||
|
return "icons/node-red/subflow.png";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "icons/"+iconPath.module+"/"+iconPath.file;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNodeLabel(node,defaultLabel) {
|
||||||
|
defaultLabel = defaultLabel||"";
|
||||||
|
var l;
|
||||||
|
if (node.type === 'tab') {
|
||||||
|
l = node.label || defaultLabel
|
||||||
|
} else {
|
||||||
|
l = node._def.label;
|
||||||
|
try {
|
||||||
|
l = (typeof l === "function" ? l.call(node) : l)||defaultLabel;
|
||||||
|
} catch(err) {
|
||||||
|
console.log("Definition error: "+node.type+".label",err);
|
||||||
|
l = defaultLabel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RED.text.bidi.enforceTextDirectionWithUCC(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodeColorCache = {};
|
||||||
|
function getNodeColor(type, def) {
|
||||||
|
var result = def.color;
|
||||||
|
var paletteTheme = RED.settings.theme('palette.theme') || [];
|
||||||
|
if (paletteTheme.length > 0) {
|
||||||
|
if (!nodeColorCache.hasOwnProperty(type)) {
|
||||||
|
nodeColorCache[type] = def.color;
|
||||||
|
var l = paletteTheme.length;
|
||||||
|
for (var i = 0; i < l; i++ ){
|
||||||
|
var themeRule = paletteTheme[i];
|
||||||
|
if (themeRule.hasOwnProperty('category')) {
|
||||||
|
if (!themeRule.hasOwnProperty('_category')) {
|
||||||
|
themeRule._category = new RegExp(themeRule.category);
|
||||||
|
}
|
||||||
|
if (!themeRule._category.test(def.category)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (themeRule.hasOwnProperty('type')) {
|
||||||
|
if (!themeRule.hasOwnProperty('_type')) {
|
||||||
|
themeRule._type = new RegExp(themeRule.type);
|
||||||
|
}
|
||||||
|
if (!themeRule._type.test(type)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeColorCache[type] = themeRule.color || def.color;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = nodeColorCache[type];
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return "#ddd";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addSpinnerOverlay(container,contain) {
|
||||||
|
var spinner = $('<div class="projects-dialog-spinner "><img src="red/images/spin.svg"/></div>').appendTo(container);
|
||||||
|
if (contain) {
|
||||||
|
spinner.addClass('projects-dialog-spinner-contain');
|
||||||
|
}
|
||||||
|
return spinner;
|
||||||
|
}
|
||||||
|
|
||||||
|
function decodeObject(payload,format) {
|
||||||
|
if ((format === 'number') && (payload === "NaN")) {
|
||||||
|
payload = Number.NaN;
|
||||||
|
} else if ((format === 'number') && (payload === "Infinity")) {
|
||||||
|
payload = Infinity;
|
||||||
|
} else if ((format === 'number') && (payload === "-Infinity")) {
|
||||||
|
payload = -Infinity;
|
||||||
|
} else if (format === 'Object' || /^array/.test(format) || format === 'boolean' || format === 'number' ) {
|
||||||
|
payload = JSON.parse(payload);
|
||||||
|
} else if (/error/i.test(format)) {
|
||||||
|
payload = JSON.parse(payload);
|
||||||
|
payload = (payload.name?payload.name+": ":"")+payload.message;
|
||||||
|
} else if (format === 'null') {
|
||||||
|
payload = null;
|
||||||
|
} else if (format === 'undefined') {
|
||||||
|
payload = undefined;
|
||||||
|
} else if (/^buffer/.test(format)) {
|
||||||
|
var buffer = payload;
|
||||||
|
payload = [];
|
||||||
|
for (var c = 0; c < buffer.length; c += 2) {
|
||||||
|
payload.push(parseInt(buffer.substr(c, 2), 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseContextKey(key) {
|
||||||
|
var parts = {};
|
||||||
|
var m = /^#:\((\S+?)\)::(.*)$/.exec(key);
|
||||||
|
if (m) {
|
||||||
|
parts.store = m[1];
|
||||||
|
parts.key = m[2];
|
||||||
|
} else {
|
||||||
|
parts.key = key;
|
||||||
|
if (RED.settings.context) {
|
||||||
|
parts.store = RED.settings.context.default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
createObjectElement: buildMessageElement,
|
||||||
|
getMessageProperty: getMessageProperty,
|
||||||
|
normalisePropertyExpression: normalisePropertyExpression,
|
||||||
|
validatePropertyExpression: validatePropertyExpression,
|
||||||
|
separateIconPath: separateIconPath,
|
||||||
|
getDefaultNodeIcon: getDefaultNodeIcon,
|
||||||
|
getNodeIcon: getNodeIcon,
|
||||||
|
getNodeLabel: getNodeLabel,
|
||||||
|
getNodeColor: getNodeColor,
|
||||||
|
addSpinnerOverlay: addSpinnerOverlay,
|
||||||
|
decodeObject: decodeObject,
|
||||||
|
parseContextKey: parseContextKey
|
||||||
|
}
|
||||||
|
})();
|
||||||
168
editor/js/ui/view-navigator.js
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2016 IBM Corp.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
RED.view.navigator = (function() {
|
||||||
|
|
||||||
|
var nav_scale = 25;
|
||||||
|
var nav_width = 5000/nav_scale;
|
||||||
|
var nav_height = 5000/nav_scale;
|
||||||
|
|
||||||
|
var navContainer;
|
||||||
|
var navBox;
|
||||||
|
var navBorder;
|
||||||
|
var navVis;
|
||||||
|
var scrollPos;
|
||||||
|
var scaleFactor;
|
||||||
|
var chartSize;
|
||||||
|
var dimensions;
|
||||||
|
var isDragging;
|
||||||
|
var isShowing = false;
|
||||||
|
|
||||||
|
function refreshNodes() {
|
||||||
|
if (!isShowing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var navNode = navVis.selectAll(".navnode").data(RED.view.getActiveNodes(),function(d){return d.id});
|
||||||
|
navNode.exit().remove();
|
||||||
|
navNode.enter().insert("rect")
|
||||||
|
.attr('class','navnode')
|
||||||
|
.attr("pointer-events", "none");
|
||||||
|
navNode.each(function(d) {
|
||||||
|
d3.select(this).attr("x",function(d) { return (d.x-d.w/2)/nav_scale })
|
||||||
|
.attr("y",function(d) { return (d.y-d.h/2)/nav_scale })
|
||||||
|
.attr("width",function(d) { return Math.max(9,d.w/nav_scale) })
|
||||||
|
.attr("height",function(d) { return Math.max(3,d.h/nav_scale) })
|
||||||
|
.attr("fill",function(d) { return RED.utils.getNodeColor(d.type,d._def);})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function onScroll() {
|
||||||
|
if (!isDragging) {
|
||||||
|
resizeNavBorder();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function resizeNavBorder() {
|
||||||
|
if (navBorder) {
|
||||||
|
scaleFactor = RED.view.scale();
|
||||||
|
chartSize = [ $("#chart").width(), $("#chart").height()];
|
||||||
|
scrollPos = [$("#chart").scrollLeft(),$("#chart").scrollTop()];
|
||||||
|
navBorder.attr('x',scrollPos[0]/nav_scale)
|
||||||
|
.attr('y',scrollPos[1]/nav_scale)
|
||||||
|
.attr('width',chartSize[0]/nav_scale/scaleFactor)
|
||||||
|
.attr('height',chartSize[1]/nav_scale/scaleFactor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function toggle() {
|
||||||
|
if (!isShowing) {
|
||||||
|
isShowing = true;
|
||||||
|
$("#btn-navigate").addClass("selected");
|
||||||
|
resizeNavBorder();
|
||||||
|
refreshNodes();
|
||||||
|
$("#chart").on("scroll",onScroll);
|
||||||
|
navContainer.fadeIn(200);
|
||||||
|
} else {
|
||||||
|
isShowing = false;
|
||||||
|
navContainer.fadeOut(100);
|
||||||
|
$("#chart").off("scroll",onScroll);
|
||||||
|
$("#btn-navigate").removeClass("selected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
|
||||||
|
$(window).resize(resizeNavBorder);
|
||||||
|
RED.events.on("sidebar:resize",resizeNavBorder);
|
||||||
|
RED.actions.add("core:toggle-navigator",toggle);
|
||||||
|
var hideTimeout;
|
||||||
|
|
||||||
|
navContainer = $('<div>').css({
|
||||||
|
"position":"absolute",
|
||||||
|
"bottom":$("#workspace-footer").height(),
|
||||||
|
"right":0,
|
||||||
|
zIndex: 1
|
||||||
|
}).appendTo("#workspace").hide();
|
||||||
|
|
||||||
|
navBox = d3.select(navContainer[0])
|
||||||
|
.append("svg:svg")
|
||||||
|
.attr("width", nav_width)
|
||||||
|
.attr("height", nav_height)
|
||||||
|
.attr("pointer-events", "all")
|
||||||
|
.style({
|
||||||
|
position: "absolute",
|
||||||
|
bottom: 0,
|
||||||
|
right:0,
|
||||||
|
zIndex: 101,
|
||||||
|
"border-left": "1px solid #ccc",
|
||||||
|
"border-top": "1px solid #ccc",
|
||||||
|
background: "rgba(245,245,245,0.5)",
|
||||||
|
"box-shadow": "-1px 0 3px rgba(0,0,0,0.1)"
|
||||||
|
});
|
||||||
|
|
||||||
|
navBox.append("rect").attr("x",0).attr("y",0).attr("width",nav_width).attr("height",nav_height).style({
|
||||||
|
fill:"none",
|
||||||
|
stroke:"none",
|
||||||
|
pointerEvents:"all"
|
||||||
|
}).on("mousedown", function() {
|
||||||
|
// Update these in case they have changed
|
||||||
|
scaleFactor = RED.view.scale();
|
||||||
|
chartSize = [ $("#chart").width(), $("#chart").height()];
|
||||||
|
dimensions = [chartSize[0]/nav_scale/scaleFactor, chartSize[1]/nav_scale/scaleFactor];
|
||||||
|
var newX = Math.max(0,Math.min(d3.event.offsetX+dimensions[0]/2,nav_width)-dimensions[0]);
|
||||||
|
var newY = Math.max(0,Math.min(d3.event.offsetY+dimensions[1]/2,nav_height)-dimensions[1]);
|
||||||
|
navBorder.attr('x',newX).attr('y',newY);
|
||||||
|
isDragging = true;
|
||||||
|
$("#chart").scrollLeft(newX*nav_scale*scaleFactor);
|
||||||
|
$("#chart").scrollTop(newY*nav_scale*scaleFactor);
|
||||||
|
}).on("mousemove", function() {
|
||||||
|
if (!isDragging) { return }
|
||||||
|
if (d3.event.buttons === 0) {
|
||||||
|
isDragging = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var newX = Math.max(0,Math.min(d3.event.offsetX+dimensions[0]/2,nav_width)-dimensions[0]);
|
||||||
|
var newY = Math.max(0,Math.min(d3.event.offsetY+dimensions[1]/2,nav_height)-dimensions[1]);
|
||||||
|
navBorder.attr('x',newX).attr('y',newY);
|
||||||
|
$("#chart").scrollLeft(newX*nav_scale*scaleFactor);
|
||||||
|
$("#chart").scrollTop(newY*nav_scale*scaleFactor);
|
||||||
|
}).on("mouseup", function() {
|
||||||
|
isDragging = false;
|
||||||
|
})
|
||||||
|
|
||||||
|
navBorder = navBox.append("rect")
|
||||||
|
.attr("stroke-dasharray","5,5")
|
||||||
|
.attr("pointer-events", "none")
|
||||||
|
.style({
|
||||||
|
stroke: "#999",
|
||||||
|
strokeWidth: 1,
|
||||||
|
fill: "white",
|
||||||
|
});
|
||||||
|
|
||||||
|
navVis = navBox.append("svg:g")
|
||||||
|
|
||||||
|
|
||||||
|
$("#btn-navigate").click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
toggle();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
refresh: refreshNodes,
|
||||||
|
resize: resizeNavBorder,
|
||||||
|
toggle: toggle
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
||||||
1135
editor/js/ui/view.js
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -28,9 +28,9 @@ RED.workspaces = (function() {
|
|||||||
var tabId = RED.nodes.id();
|
var tabId = RED.nodes.id();
|
||||||
do {
|
do {
|
||||||
workspaceIndex += 1;
|
workspaceIndex += 1;
|
||||||
} while($("#workspace-tabs a[title='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0);
|
} while ($("#workspace-tabs a[title='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0);
|
||||||
|
|
||||||
ws = {type:"tab",id:tabId,label:RED._('workspace.defaultName',{number:workspaceIndex})};
|
ws = {type:"tab",id:tabId,disabled: false,info:"",label:RED._('workspace.defaultName',{number:workspaceIndex})};
|
||||||
RED.nodes.addWorkspace(ws);
|
RED.nodes.addWorkspace(ws);
|
||||||
workspace_tabs.addTab(ws);
|
workspace_tabs.addTab(ws);
|
||||||
workspace_tabs.activateTab(tabId);
|
workspace_tabs.activateTab(tabId);
|
||||||
@@ -39,10 +39,11 @@ RED.workspaces = (function() {
|
|||||||
RED.nodes.dirty(true);
|
RED.nodes.dirty(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RED.view.focus();
|
||||||
return ws;
|
return ws;
|
||||||
}
|
}
|
||||||
function deleteWorkspace(ws) {
|
function deleteWorkspace(ws) {
|
||||||
if (workspace_tabs.count() == 1) {
|
if (workspaceTabCount === 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeWorkspace(ws);
|
removeWorkspace(ws);
|
||||||
@@ -58,12 +59,13 @@ RED.workspaces = (function() {
|
|||||||
function showRenameWorkspaceDialog(id) {
|
function showRenameWorkspaceDialog(id) {
|
||||||
var workspace = RED.nodes.workspace(id);
|
var workspace = RED.nodes.workspace(id);
|
||||||
RED.view.state(RED.state.EDITING);
|
RED.view.state(RED.state.EDITING);
|
||||||
|
var tabflowEditor;
|
||||||
var trayOptions = {
|
var trayOptions = {
|
||||||
title: RED._("workspace.editFlow",{name:workspace.label}),
|
title: RED._("workspace.editFlow",{name:workspace.label}),
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
id: "node-dialog-delete",
|
id: "node-dialog-delete",
|
||||||
class: 'leftButton'+((workspace_tabs.count() == 1)?" disabled":""),
|
class: 'leftButton'+((workspaceTabCount === 1)?" disabled":""),
|
||||||
text: RED._("common.label.delete"), //'<i class="fa fa-trash"></i>',
|
text: RED._("common.label.delete"), //'<i class="fa fa-trash"></i>',
|
||||||
click: function() {
|
click: function() {
|
||||||
deleteWorkspace(workspace);
|
deleteWorkspace(workspace);
|
||||||
@@ -83,10 +85,30 @@ RED.workspaces = (function() {
|
|||||||
text: RED._("common.label.done"),
|
text: RED._("common.label.done"),
|
||||||
click: function() {
|
click: function() {
|
||||||
var label = $( "#node-input-name" ).val();
|
var label = $( "#node-input-name" ).val();
|
||||||
|
var changed = false;
|
||||||
|
var changes = {};
|
||||||
if (workspace.label != label) {
|
if (workspace.label != label) {
|
||||||
var changes = {
|
changes.label = workspace.label;
|
||||||
label:workspace.label
|
changed = true;
|
||||||
}
|
workspace.label = label;
|
||||||
|
workspace_tabs.renameTab(workspace.id,label);
|
||||||
|
}
|
||||||
|
var disabled = $("#node-input-disabled").prop("checked");
|
||||||
|
if (workspace.disabled !== disabled) {
|
||||||
|
changes.disabled = workspace.disabled;
|
||||||
|
changed = true;
|
||||||
|
workspace.disabled = disabled;
|
||||||
|
}
|
||||||
|
var info = tabflowEditor.getValue();
|
||||||
|
if (workspace.info !== info) {
|
||||||
|
changes.info = workspace.info;
|
||||||
|
changed = true;
|
||||||
|
workspace.info = info;
|
||||||
|
}
|
||||||
|
$("#red-ui-tab-"+(workspace.id.replace(".","-"))).toggleClass('workspace-disabled',workspace.disabled);
|
||||||
|
// $("#workspace").toggleClass("workspace-disabled",workspace.disabled);
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
var historyEvent = {
|
var historyEvent = {
|
||||||
t: "edit",
|
t: "edit",
|
||||||
changes:changes,
|
changes:changes,
|
||||||
@@ -95,14 +117,29 @@ RED.workspaces = (function() {
|
|||||||
}
|
}
|
||||||
workspace.changed = true;
|
workspace.changed = true;
|
||||||
RED.history.push(historyEvent);
|
RED.history.push(historyEvent);
|
||||||
workspace_tabs.renameTab(workspace.id,label);
|
|
||||||
RED.nodes.dirty(true);
|
RED.nodes.dirty(true);
|
||||||
RED.sidebar.config.refresh();
|
RED.sidebar.config.refresh();
|
||||||
|
var selection = RED.view.selection();
|
||||||
|
if (!selection.nodes && !selection.links) {
|
||||||
|
RED.sidebar.info.refresh(workspace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RED.tray.close();
|
RED.tray.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
|
||||||
|
var editorRow = $("#dialog-form>div.node-text-editor-row");
|
||||||
|
var height = $("#dialog-form").height();
|
||||||
|
for (var i=0; i<rows.size(); i++) {
|
||||||
|
height -= $(rows[i]).outerHeight(true);
|
||||||
|
}
|
||||||
|
height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom")));
|
||||||
|
height -= 28;
|
||||||
|
$(".node-text-editor").css("height",height+"px");
|
||||||
|
tabflowEditor.resize();
|
||||||
|
},
|
||||||
open: function(tray) {
|
open: function(tray) {
|
||||||
var trayBody = tray.find('.editor-tray-body');
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
var dialogForm = $('<form id="dialog-form" class="form-horizontal"></form>').appendTo(trayBody);
|
var dialogForm = $('<form id="dialog-form" class="form-horizontal"></form>').appendTo(trayBody);
|
||||||
@@ -110,16 +147,66 @@ RED.workspaces = (function() {
|
|||||||
'<label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>'+
|
'<label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>'+
|
||||||
'<input type="text" id="node-input-name">'+
|
'<input type="text" id="node-input-name">'+
|
||||||
'</div>').appendTo(dialogForm);
|
'</div>').appendTo(dialogForm);
|
||||||
|
|
||||||
|
$('<div class="form-row">'+
|
||||||
|
'<label for="node-input-disabled-btn" data-i18n="editor:workspace.status"></label>'+
|
||||||
|
'<button id="node-input-disabled-btn" class="editor-button"><i class="fa fa-toggle-on"></i> <span id="node-input-disabled-label"></span></button> '+
|
||||||
|
'<input type="checkbox" id="node-input-disabled" style="display: none;"/>'+
|
||||||
|
'</div>').appendTo(dialogForm);
|
||||||
|
|
||||||
|
$('<div class="form-row node-text-editor-row">'+
|
||||||
|
'<label for="node-input-info" data-i18n="editor:workspace.info" style="width:300px;"></label>'+
|
||||||
|
'<div style="height:250px;" class="node-text-editor" id="node-input-info"></div>'+
|
||||||
|
'</div>').appendTo(dialogForm);
|
||||||
|
tabflowEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-info',
|
||||||
|
mode: 'ace/mode/markdown',
|
||||||
|
value: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
$('<div class="form-tips" data-i18n="editor:workspace.tip"></div>').appendTo(dialogForm);
|
||||||
|
|
||||||
|
dialogForm.find('#node-input-disabled-btn').on("click",function(e) {
|
||||||
|
var i = $(this).find("i");
|
||||||
|
if (i.hasClass('fa-toggle-off')) {
|
||||||
|
i.addClass('fa-toggle-on');
|
||||||
|
i.removeClass('fa-toggle-off');
|
||||||
|
$("#node-input-disabled").prop("checked",false);
|
||||||
|
$("#node-input-disabled-label").text(RED._("editor:workspace.enabled"));
|
||||||
|
} else {
|
||||||
|
i.addClass('fa-toggle-off');
|
||||||
|
i.removeClass('fa-toggle-on');
|
||||||
|
$("#node-input-disabled").prop("checked",true);
|
||||||
|
$("#node-input-disabled-label").text(RED._("editor:workspace.disabled"));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (workspace.hasOwnProperty("disabled")) {
|
||||||
|
$("#node-input-disabled").prop("checked",workspace.disabled);
|
||||||
|
if (workspace.disabled) {
|
||||||
|
dialogForm.find("#node-input-disabled-btn i").removeClass('fa-toggle-on').addClass('fa-toggle-off');
|
||||||
|
$("#node-input-disabled-label").text(RED._("editor:workspace.disabled"));
|
||||||
|
} else {
|
||||||
|
$("#node-input-disabled-label").text(RED._("editor:workspace.enabled"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
workspace.disabled = false;
|
||||||
|
$("#node-input-disabled-label").text(RED._("editor:workspace.enabled"));
|
||||||
|
}
|
||||||
|
|
||||||
$('<input type="text" style="display: none;" />').prependTo(dialogForm);
|
$('<input type="text" style="display: none;" />').prependTo(dialogForm);
|
||||||
dialogForm.submit(function(e) { e.preventDefault();});
|
dialogForm.submit(function(e) { e.preventDefault();});
|
||||||
$("#node-input-name").val(workspace.label);
|
$("#node-input-name").val(workspace.label);
|
||||||
RED.text.bidi.prepareInput($("#node-input-name"))
|
RED.text.bidi.prepareInput($("#node-input-name"));
|
||||||
|
tabflowEditor.getSession().setValue(workspace.info || "", -1);
|
||||||
dialogForm.i18n();
|
dialogForm.i18n();
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function() {
|
||||||
if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
|
if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
|
||||||
RED.view.state(RED.state.DEFAULT);
|
RED.view.state(RED.state.DEFAULT);
|
||||||
}
|
}
|
||||||
|
RED.sidebar.info.refresh(workspace);
|
||||||
|
tabflowEditor.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RED.tray.show(trayOptions);
|
RED.tray.show(trayOptions);
|
||||||
@@ -127,7 +214,8 @@ RED.workspaces = (function() {
|
|||||||
|
|
||||||
|
|
||||||
var workspace_tabs;
|
var workspace_tabs;
|
||||||
function createWorkspaceTabs(){
|
var workspaceTabCount = 0;
|
||||||
|
function createWorkspaceTabs() {
|
||||||
workspace_tabs = RED.tabs.create({
|
workspace_tabs = RED.tabs.create({
|
||||||
id: "workspace-tabs",
|
id: "workspace-tabs",
|
||||||
onchange: function(tab) {
|
onchange: function(tab) {
|
||||||
@@ -136,9 +224,14 @@ RED.workspaces = (function() {
|
|||||||
}
|
}
|
||||||
activeWorkspace = tab.id;
|
activeWorkspace = tab.id;
|
||||||
event.workspace = activeWorkspace;
|
event.workspace = activeWorkspace;
|
||||||
|
// $("#workspace").toggleClass("workspace-disabled",tab.disabled);
|
||||||
RED.events.emit("workspace:change",event);
|
RED.events.emit("workspace:change",event);
|
||||||
window.location.hash = 'flow/'+tab.id;
|
window.location.hash = 'flow/'+tab.id;
|
||||||
RED.sidebar.config.refresh();
|
RED.sidebar.config.refresh();
|
||||||
|
RED.view.focus();
|
||||||
|
},
|
||||||
|
onclick: function(tab) {
|
||||||
|
RED.view.focus();
|
||||||
},
|
},
|
||||||
ondblclick: function(tab) {
|
ondblclick: function(tab) {
|
||||||
if (tab.type != "subflow") {
|
if (tab.type != "subflow") {
|
||||||
@@ -148,10 +241,26 @@ RED.workspaces = (function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onadd: function(tab) {
|
onadd: function(tab) {
|
||||||
RED.menu.setDisabled("menu-item-workspace-delete",workspace_tabs.count() == 1);
|
if (tab.type === "tab") {
|
||||||
|
workspaceTabCount++;
|
||||||
|
}
|
||||||
|
$('<span class="workspace-disabled-icon"><i class="fa fa-ban"></i> </span>').prependTo("#red-ui-tab-"+(tab.id.replace(".","-"))+" .red-ui-tab-label");
|
||||||
|
if (tab.disabled) {
|
||||||
|
$("#red-ui-tab-"+(tab.id.replace(".","-"))).addClass('workspace-disabled');
|
||||||
|
}
|
||||||
|
RED.menu.setDisabled("menu-item-workspace-delete",workspaceTabCount <= 1);
|
||||||
|
if (workspaceTabCount === 1) {
|
||||||
|
showWorkspace();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onremove: function(tab) {
|
onremove: function(tab) {
|
||||||
RED.menu.setDisabled("menu-item-workspace-delete",workspace_tabs.count() == 1);
|
if (tab.type === "tab") {
|
||||||
|
workspaceTabCount--;
|
||||||
|
}
|
||||||
|
RED.menu.setDisabled("menu-item-workspace-delete",workspaceTabCount <= 1);
|
||||||
|
if (workspaceTabCount === 0) {
|
||||||
|
hideWorkspace();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onreorder: function(oldOrder, newOrder) {
|
onreorder: function(oldOrder, newOrder) {
|
||||||
RED.history.push({t:'reorder',order:oldOrder,dirty:RED.nodes.dirty()});
|
RED.history.push({t:'reorder',order:oldOrder,dirty:RED.nodes.dirty()});
|
||||||
@@ -164,12 +273,26 @@ RED.workspaces = (function() {
|
|||||||
addWorkspace();
|
addWorkspace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
workspaceTabCount = 0;
|
||||||
|
}
|
||||||
|
function showWorkspace() {
|
||||||
|
$("#workspace .red-ui-tabs").show()
|
||||||
|
$("#chart").show()
|
||||||
|
$("#workspace-footer").children().show()
|
||||||
|
}
|
||||||
|
function hideWorkspace() {
|
||||||
|
$("#workspace .red-ui-tabs").hide()
|
||||||
|
$("#chart").hide()
|
||||||
|
$("#workspace-footer").children().hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
createWorkspaceTabs();
|
createWorkspaceTabs();
|
||||||
RED.events.on("sidebar:resize",workspace_tabs.resize);
|
RED.events.on("sidebar:resize",workspace_tabs.resize);
|
||||||
|
|
||||||
|
RED.actions.add("core:show-next-tab",workspace_tabs.nextTab);
|
||||||
|
RED.actions.add("core:show-previous-tab",workspace_tabs.previousTab);
|
||||||
|
|
||||||
RED.menu.setAction('menu-item-workspace-delete',function() {
|
RED.menu.setAction('menu-item-workspace-delete',function() {
|
||||||
deleteWorkspace(RED.nodes.workspace(activeWorkspace));
|
deleteWorkspace(RED.nodes.workspace(activeWorkspace));
|
||||||
});
|
});
|
||||||
@@ -177,6 +300,16 @@ RED.workspaces = (function() {
|
|||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
workspace_tabs.resize();
|
workspace_tabs.resize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RED.actions.add("core:add-flow",addWorkspace);
|
||||||
|
RED.actions.add("core:edit-flow",editWorkspace);
|
||||||
|
RED.actions.add("core:remove-flow",removeWorkspace);
|
||||||
|
|
||||||
|
hideWorkspace();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editWorkspace(id) {
|
||||||
|
showRenameWorkspaceDialog(id||activeWorkspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeWorkspace(ws) {
|
function removeWorkspace(ws) {
|
||||||
@@ -187,6 +320,9 @@ RED.workspaces = (function() {
|
|||||||
workspace_tabs.removeTab(ws.id);
|
workspace_tabs.removeTab(ws.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ws.id === activeWorkspace) {
|
||||||
|
activeWorkspace = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWorkspaceOrder(order) {
|
function setWorkspaceOrder(order) {
|
||||||
@@ -201,14 +337,12 @@ RED.workspaces = (function() {
|
|||||||
add: addWorkspace,
|
add: addWorkspace,
|
||||||
remove: removeWorkspace,
|
remove: removeWorkspace,
|
||||||
order: setWorkspaceOrder,
|
order: setWorkspaceOrder,
|
||||||
edit: function(id) {
|
edit: editWorkspace,
|
||||||
showRenameWorkspaceDialog(id||activeWorkspace);
|
|
||||||
},
|
|
||||||
contains: function(id) {
|
contains: function(id) {
|
||||||
return workspace_tabs.contains(id);
|
return workspace_tabs.contains(id);
|
||||||
},
|
},
|
||||||
count: function() {
|
count: function() {
|
||||||
return workspace_tabs.count();
|
return workspaceTabCount;
|
||||||
},
|
},
|
||||||
active: function() {
|
active: function() {
|
||||||
return activeWorkspace
|
return activeWorkspace
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2014, 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -32,7 +32,7 @@ RED.user = (function() {
|
|||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
dialogClass: "ui-dialog-no-close",
|
dialogClass: "ui-dialog-no-close",
|
||||||
modal: true,
|
modal: true,
|
||||||
closeOnEscape: false,
|
closeOnEscape: !!opts.cancelable,
|
||||||
width: 600,
|
width: 600,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
draggable: false
|
draggable: false
|
||||||
@@ -43,18 +43,14 @@ RED.user = (function() {
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: "auth/login",
|
url: "auth/login",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.type == "credentials") {
|
var i=0;
|
||||||
var i=0;
|
|
||||||
|
if (data.type == "credentials") {
|
||||||
|
|
||||||
if (data.image) {
|
|
||||||
$("#node-dialog-login-image").attr("src",data.image);
|
|
||||||
} else {
|
|
||||||
$("#node-dialog-login-image").attr("src","red/images/node-red-256.png");
|
|
||||||
}
|
|
||||||
for (;i<data.prompts.length;i++) {
|
for (;i<data.prompts.length;i++) {
|
||||||
var field = data.prompts[i];
|
var field = data.prompts[i];
|
||||||
var row = $("<div/>",{id:"rrr"+i,class:"form-row"});
|
var row = $("<div/>",{class:"form-row"});
|
||||||
$('<label for="node-dialog-login-'+field.id+'">'+field.label+':</label><br/>').appendTo(row);
|
$('<label for="node-dialog-login-'+field.id+'">'+RED._(field.label)+':</label><br/>').appendTo(row);
|
||||||
var input = $('<input style="width: 100%" id="node-dialog-login-'+field.id+'" type="'+field.type+'" tabIndex="'+(i+1)+'"/>').appendTo(row);
|
var input = $('<input style="width: 100%" id="node-dialog-login-'+field.id+'" type="'+field.type+'" tabIndex="'+(i+1)+'"/>').appendTo(row);
|
||||||
|
|
||||||
if (i<data.prompts.length-1) {
|
if (i<data.prompts.length-1) {
|
||||||
@@ -112,26 +108,72 @@ RED.user = (function() {
|
|||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
if (opts.cancelable) {
|
|
||||||
$("#node-dialog-login-cancel").button().click(function( event ) {
|
} else if (data.type == "strategy") {
|
||||||
$("#node-dialog-login").dialog('destroy').remove();
|
i = 0;
|
||||||
|
for (;i<data.prompts.length;i++) {
|
||||||
|
var field = data.prompts[i];
|
||||||
|
var row = $("<div/>",{class:"form-row",style:"text-align: center"}).appendTo("#node-dialog-login-fields");
|
||||||
|
|
||||||
|
var loginButton = $('<a href="#"></a>',{style: "padding: 10px"}).appendTo(row).click(function() {
|
||||||
|
document.location = field.url;
|
||||||
});
|
});
|
||||||
|
if (field.image) {
|
||||||
|
$("<img>",{src:field.image}).appendTo(loginButton);
|
||||||
|
} else if (field.label) {
|
||||||
|
var label = $('<span></span>').text(field.label);
|
||||||
|
if (field.icon) {
|
||||||
|
$('<i></i>',{class: "fa fa-2x "+field.icon, style:"vertical-align: middle"}).appendTo(loginButton);
|
||||||
|
label.css({
|
||||||
|
"verticalAlign":"middle",
|
||||||
|
"marginLeft":"8px"
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
label.appendTo(loginButton);
|
||||||
|
}
|
||||||
|
loginButton.button();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
dialog.dialog("open");
|
if (opts.cancelable) {
|
||||||
|
$("#node-dialog-login-cancel").button().click(function( event ) {
|
||||||
|
$("#node-dialog-login").dialog('destroy').remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var loginImageSrc = data.image || "red/images/node-red-256.png";
|
||||||
|
|
||||||
|
$("#node-dialog-login-image").load(function() {
|
||||||
|
dialog.dialog("open");
|
||||||
|
}).attr("src",loginImageSrc);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
|
var tokens = RED.settings.get("auth-tokens");
|
||||||
|
var token = tokens?tokens.access_token:"";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "auth/revoke",
|
url: "auth/revoke",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: {token:RED.settings.get("auth-tokens").access_token},
|
data: {token:token}
|
||||||
success: function() {
|
}).done(function(data,textStatus,xhr) {
|
||||||
RED.settings.remove("auth-tokens");
|
RED.settings.remove("auth-tokens");
|
||||||
|
if (data && data.redirect) {
|
||||||
|
document.location.href = data.redirect;
|
||||||
|
} else {
|
||||||
document.location.reload(true);
|
document.location.reload(true);
|
||||||
}
|
}
|
||||||
|
}).fail(function(jqXHR,textStatus,errorThrown) {
|
||||||
|
if (jqXHR.status === 401) {
|
||||||
|
document.location.reload(true);
|
||||||
|
} else {
|
||||||
|
console.log(textStatus);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,6 +188,7 @@ RED.user = (function() {
|
|||||||
RED.settings.load(function() {
|
RED.settings.load(function() {
|
||||||
RED.notify(RED._("user.loggedInAs",{name:RED.settings.user.username}),"success");
|
RED.notify(RED._("user.loggedInAs",{name:RED.settings.user.username}),"success");
|
||||||
updateUserMenu();
|
updateUserMenu();
|
||||||
|
RED.events.emit("login",RED.settings.user.username);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -170,8 +213,15 @@ RED.user = (function() {
|
|||||||
if (RED.settings.user) {
|
if (RED.settings.user) {
|
||||||
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
|
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
|
||||||
|
|
||||||
$('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"><i class="fa fa-user"></i></a></li>')
|
var userMenu = $('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"></a></li>')
|
||||||
.prependTo(".header-toolbar");
|
.prependTo(".header-toolbar");
|
||||||
|
if (RED.settings.user.image) {
|
||||||
|
$('<span class="user-profile"></span>').css({
|
||||||
|
backgroundImage: "url("+RED.settings.user.image+")",
|
||||||
|
}).appendTo(userMenu.find("a"));
|
||||||
|
} else {
|
||||||
|
$('<i class="fa fa-user"></i>').appendTo(userMenu.find("a"));
|
||||||
|
}
|
||||||
|
|
||||||
RED.menu.init({id:"btn-usermenu",
|
RED.menu.init({id:"btn-usermenu",
|
||||||
options: []
|
options: []
|
||||||
@@ -181,10 +231,66 @@ RED.user = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var readRE = /^((.+)\.)?read$/
|
||||||
|
var writeRE = /^((.+)\.)?write$/
|
||||||
|
|
||||||
|
function hasPermission(permission) {
|
||||||
|
if (permission === "") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!RED.settings.user) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return checkPermission(RED.settings.user.permissions||"",permission);
|
||||||
|
}
|
||||||
|
function checkPermission(userScope,permission) {
|
||||||
|
if (permission === "") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var i;
|
||||||
|
|
||||||
|
if (Array.isArray(permission)) {
|
||||||
|
// Multiple permissions requested - check each one
|
||||||
|
for (i=0;i<permission.length;i++) {
|
||||||
|
if (!checkPermission(userScope,permission[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// All permissions check out
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(userScope)) {
|
||||||
|
if (userScope.length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (i=0;i<userScope.length;i++) {
|
||||||
|
if (checkPermission(userScope[i],permission)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userScope === "*" || userScope === permission) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userScope === "read" || userScope === "*.read") {
|
||||||
|
return readRE.test(permission);
|
||||||
|
} else if (userScope === "write" || userScope === "*.write") {
|
||||||
|
return writeRE.test(permission);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
login: login,
|
login: login,
|
||||||
logout: logout
|
logout: logout,
|
||||||
|
hasPermission: hasPermission
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,6 +14,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
RED.validators = {
|
RED.validators = {
|
||||||
number: function(){return function(v) { return v!=='' && !isNaN(v);}},
|
number: function(blankAllowed){return function(v) { return (blankAllowed&&(v===''||v===undefined)) || (v!=='' && !isNaN(v));}},
|
||||||
regex: function(re){return function(v) { return re.test(v);}}
|
regex: function(re){return function(v) { return re.test(v);}},
|
||||||
|
typedInput: function(ptypeName,isConfig) { return function(v) {
|
||||||
|
var ptype = $("#node-"+(isConfig?"config-":"")+"input-"+ptypeName).val() || this[ptypeName];
|
||||||
|
if (ptype === 'json') {
|
||||||
|
try {
|
||||||
|
JSON.parse(v);
|
||||||
|
return true;
|
||||||
|
} catch(err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (ptype === 'msg' || ptype === 'flow' || ptype === 'global' ) {
|
||||||
|
return RED.utils.validatePropertyExpression(v);
|
||||||
|
} else if (ptype === 'num') {
|
||||||
|
return /^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/.test(v);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}}
|
||||||
};
|
};
|
||||||
|
|||||||
8
editor/sass/ace.scss
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.ace_gutter {
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
}
|
||||||
|
.ace_scroller {
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
6
editor/sass/bootstrap.scss
vendored
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -19,3 +19,7 @@
|
|||||||
div.btn-group, a.btn {
|
div.btn-group, a.btn {
|
||||||
@include disable-selection;
|
@include disable-selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-menu>li>a {
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -58,7 +58,7 @@ $workspace-button-color-focus-outline: rgba(85,150,230,0.2);
|
|||||||
|
|
||||||
$typedInput-button-background: #efefef;
|
$typedInput-button-background: #efefef;
|
||||||
$typedInput-button-background-hover: #ddd;
|
$typedInput-button-background-hover: #ddd;
|
||||||
$typedInput-button-background-active: #e3e3e3;
|
$typedInput-button-background-active: #ddd;
|
||||||
|
|
||||||
$editor-button-color-primary: #eee;
|
$editor-button-color-primary: #eee;
|
||||||
$editor-button-background-primary: #AD1625;
|
$editor-button-background-primary: #AD1625;
|
||||||
@@ -66,4 +66,4 @@ $editor-button-background-primary-hover: #6E0A1E;
|
|||||||
$editor-button-color: #999;
|
$editor-button-color: #999;
|
||||||
$editor-button-background: #fff;
|
$editor-button-background: #fff;
|
||||||
|
|
||||||
$shade-color: rgba(200,200,200,0.5);
|
$shade-color: rgba(160,160,160,0.5);
|
||||||
|
|||||||
262
editor/sass/debug.scss
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
.debug-window {
|
||||||
|
padding:0;
|
||||||
|
margin:0;
|
||||||
|
background: #fff;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
.debug-window .debug-message-payload {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.debug-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 43px;
|
||||||
|
bottom: 0px;
|
||||||
|
left:0px;
|
||||||
|
right: 0px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
.debug-filter-box {
|
||||||
|
position:absolute;
|
||||||
|
top: 42px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
z-index: 20;
|
||||||
|
background: #f9f9f9;
|
||||||
|
padding: 10px;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
.debug-filter-row {
|
||||||
|
.red-ui-nodeList {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.debug-message {
|
||||||
|
position: relative;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
border-left: 8px solid #eee;
|
||||||
|
border-right: 8px solid #eee;
|
||||||
|
padding: 2px;
|
||||||
|
&>.debug-message-meta .debug-message-tools {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.debug-message-hover {
|
||||||
|
border-right-color: #999;
|
||||||
|
&>.debug-message-meta .debug-message-tools {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.debug-message-row {
|
||||||
|
.debug-message-tools-pin {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&.debug-message-row-pinned .debug-message-tools-pin {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
&>.debug-message-tools {
|
||||||
|
.debug-message-tools-copy {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.debug-message-tools-pin {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.debug-message-meta .debug-message-tools {
|
||||||
|
.editor-button-small {
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.debug-message-tools {
|
||||||
|
.button-group:not(:last-child) {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
.editor-button-small {
|
||||||
|
height: 16px;
|
||||||
|
line-height: 14px;
|
||||||
|
font-size: 8px;
|
||||||
|
border-radius: 1px;
|
||||||
|
padding: 0 3px;
|
||||||
|
min-width: 18px;
|
||||||
|
i.fa-terminal {
|
||||||
|
// terminal icon is a bit thin, so darken its color for better contrast
|
||||||
|
color: darken($editor-button-color, 30%) !important;
|
||||||
|
}
|
||||||
|
&.selected {
|
||||||
|
color: darken($workspace-button-color-selected, 10%) !important;
|
||||||
|
background: darken($workspace-button-background-active,10%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.debug-message-meta {
|
||||||
|
background: #fff;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #707070;
|
||||||
|
}
|
||||||
|
.debug-message-date {
|
||||||
|
padding: 1px 5px 1px 1px;
|
||||||
|
}
|
||||||
|
.debug-message-topic {
|
||||||
|
display: block;
|
||||||
|
color: #a66;
|
||||||
|
}
|
||||||
|
.debug-message-name {
|
||||||
|
padding: 1px 5px;
|
||||||
|
color: #707070;
|
||||||
|
}
|
||||||
|
.debug-message-tools {
|
||||||
|
position: absolute;
|
||||||
|
top: 3px;
|
||||||
|
right: 1px;
|
||||||
|
.debug-message-tools-copy {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.debug-message-payload {
|
||||||
|
display: block;
|
||||||
|
padding: 2px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.debug-message-level-log {
|
||||||
|
border-left-color: #eee;
|
||||||
|
border-right-color: #eee;
|
||||||
|
}
|
||||||
|
.debug-message-level-30 {
|
||||||
|
border-left-color: #ffdf9d;
|
||||||
|
border-right-color: #ffdf9d;
|
||||||
|
}
|
||||||
|
.debug-message-level-20 {
|
||||||
|
border-left-color: #f99;
|
||||||
|
border-right-color: #f99;
|
||||||
|
}
|
||||||
|
.debug-message-object-entry {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
.debug-message-element {
|
||||||
|
color: #333;
|
||||||
|
font-family: Menlo, monospace;
|
||||||
|
font-size: 13px !important;
|
||||||
|
line-height: 1.3em;
|
||||||
|
}
|
||||||
|
.debug-message-object-key {
|
||||||
|
color: #792e90;
|
||||||
|
}
|
||||||
|
.debug-message-object-value {
|
||||||
|
|
||||||
|
}
|
||||||
|
.debug-message-object-handle {
|
||||||
|
color: #666;
|
||||||
|
font-size: 1em;
|
||||||
|
width: 1em;
|
||||||
|
text-align: center;
|
||||||
|
transition: transform 0.1s ease-in-out;
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
.debug-message-element:not(.debug-message-top-level)>.debug-message-expandable>.debug-message-object-handle {
|
||||||
|
margin-left: -1em;
|
||||||
|
}
|
||||||
|
.debug-message-object-entry>.debug-message-expandable>.debug-message-object-handle {
|
||||||
|
margin-left: -1em;
|
||||||
|
}
|
||||||
|
.debug-message-object-entry.collapsed>span>.debug-message-object-handle {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
.debug-message-element.collapsed>span>.debug-message-object-handle {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
.debug-message-object-entry.collapsed > .debug-message-object-entry {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.debug-message-element.collapsed .debug-message-object-entry {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.debug-message-element:not(.collapsed)>.debug-message-expandable>.debug-message-object-value>.debug-message-object-header {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.debug-message-element.collapsed .debug-message-buffer-opts {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.debug-message-element.collapsed .debug-message-object-type-header {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.debug-message-object-entry pre {
|
||||||
|
font-family: Menlo, monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.2em;
|
||||||
|
margin: 0 0 0 -1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.debug-message-type-other { color: #2033d6; }
|
||||||
|
.debug-message-type-string { color: #b72828; }
|
||||||
|
.debug-message-type-null { color: #666; font-style: italic;}
|
||||||
|
.debug-message-type-meta { color: #666; font-style: italic;}
|
||||||
|
.debug-message-type-number { color: #2033d6; };
|
||||||
|
.debug-message-type-number-toggle { cursor: pointer;}
|
||||||
|
|
||||||
|
.debug-message-row {
|
||||||
|
display: block;
|
||||||
|
padding: 4px 2px 2px;
|
||||||
|
position: relative;
|
||||||
|
&.debug-message-row-pinned {
|
||||||
|
background: #f6f6f6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.debug-message-expandable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.debug-message-expandable:hover .debug-message-object-handle {
|
||||||
|
color: #b72828 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.debug-message-buffer-opts a {
|
||||||
|
font-size: 9px;
|
||||||
|
color: #bbb;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 2px 5px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
.debug-message-buffer-opts a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #999;
|
||||||
|
border: 1px solid #999;
|
||||||
|
background: #f3f3f3;
|
||||||
|
}
|
||||||
|
.debug-message-buffer-raw > .debug-message-string-rows {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.debug-message-buffer-string > .debug-message-array-rows {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.debug-message-type-string-swatch {
|
||||||
|
display: inline-block;
|
||||||
|
width: 1.1em;
|
||||||
|
height: 0.9em;
|
||||||
|
vertical-align: middle;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin: 0 4px;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,36 +15,81 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#node-dialog-view-diff {
|
.node-dialog-view-diff-panel {
|
||||||
height: 600px;
|
padding: 5px;
|
||||||
|
padding-top: 30px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.red-ui-editableList-container {
|
.red-ui-editableList-container {
|
||||||
border-radius:1px;
|
border-radius:1px;
|
||||||
padding:0;
|
padding:0;
|
||||||
|
background: #f9f9f9;
|
||||||
}
|
}
|
||||||
ol {
|
.node-dialog-view-diff-diff {
|
||||||
position: absolute;
|
|
||||||
top:10px;
|
|
||||||
bottom:10px;
|
|
||||||
left:10px;
|
|
||||||
right:10px;
|
|
||||||
li {
|
li {
|
||||||
|
background: #f9f9f9;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
border: none;
|
border: none;
|
||||||
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.red-ui-editableList-item-content {
|
.red-ui-editableList-item-content {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
// padding-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.node-diff-container {
|
||||||
|
position: absolute;
|
||||||
|
top: 40px;
|
||||||
|
right:0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-dialog-view-diff-headers {
|
||||||
|
position: absolute;
|
||||||
|
left:232px;
|
||||||
|
right:12px;
|
||||||
|
top: 5px;
|
||||||
|
height: 25px;
|
||||||
|
div {
|
||||||
|
height: 25px;
|
||||||
|
display: inline-block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-top: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 50%;
|
||||||
|
background: #f9f9f9;
|
||||||
|
text-align: center;
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
border-color:$secondary-border-color;
|
||||||
|
border-left: 1px solid $secondary-border-color;
|
||||||
|
}
|
||||||
|
div:last-child {
|
||||||
|
border-right: 1px solid $secondary-border-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-diff-toolbar {
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #666;
|
||||||
|
text-align: right;
|
||||||
|
padding: 8px 10px;
|
||||||
|
background: #f3f3f3;
|
||||||
|
border-bottom: 1px solid $secondary-border-color;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.node-diff-tab {
|
.node-diff-tab {
|
||||||
border: 1px solid $secondary-border-color;
|
background: #fff;
|
||||||
border-radius: 3px;
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
&.collapsed {
|
&.collapsed {
|
||||||
.node-diff-tab-title > .node-diff-chevron {
|
.node-diff-tab-title .node-diff-chevron {
|
||||||
transform: rotate(-90deg);
|
transform: rotate(-90deg);
|
||||||
}
|
}
|
||||||
.node-diff-node-entry {
|
.node-diff-node-entry {
|
||||||
@@ -53,19 +98,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.node-diff-tab-stats {
|
.node-diff-tab-stats {
|
||||||
position: absolute;
|
font-size: 0.9em;
|
||||||
left: 50%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.node-diff-chevron {
|
.node-diff-chevron {
|
||||||
|
display: inline-block;
|
||||||
width: 15px;
|
width: 15px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 3px 5px 3px 5px;
|
margin-left: 3px;
|
||||||
transition: transform 0.1s ease-in-out;
|
transition: transform 0.1s ease-in-out;
|
||||||
|
|
||||||
}
|
}
|
||||||
.node-diff-node-entry {
|
.node-diff-node-entry {
|
||||||
padding: 0 0 0 5px;
|
margin-left: 20px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
}
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
border-bottom: 1px solid $secondary-border-color;
|
border-bottom: 1px solid $secondary-border-color;
|
||||||
}
|
}
|
||||||
@@ -78,25 +128,86 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&:not(.collapsed) {
|
||||||
|
.node-diff-node-entry-cell:not(:first-child) {
|
||||||
|
//display: none;
|
||||||
|
}
|
||||||
|
.node-diff-node-entry-cell:first-child {
|
||||||
|
//width: 100%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
width: 100%;
|
table-layout:fixed;
|
||||||
table-layout:fixed;
|
width: calc(100% - 20px);
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
col:first-child {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
col:not(:first-child) {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
td, th {
|
td, th {
|
||||||
border: 1px solid $secondary-border-color;
|
border-top: 1px solid #f3f3f3;
|
||||||
padding: 3px 5px;
|
border-left: 1px solid $secondary-border-color;
|
||||||
|
&:first-child {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
padding: 0 0 0 3px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
vertical-align: top;
|
||||||
|
&:first-child td {
|
||||||
|
white-space:nowrap;
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
td:nth-child(1) {
|
td {
|
||||||
width: 150px;
|
.node-diff-status {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
td:not(:first-child) {
|
tr:not(.node-diff-property-header) {
|
||||||
width: calc(50% - 150px);
|
.node-diff-status {
|
||||||
|
width: 12px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.node-diff-three-way {
|
||||||
|
.node-diff-node-entry-cell {
|
||||||
|
width: calc((100% - 220px) / 2);
|
||||||
|
&:first-child {
|
||||||
|
width: 220px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
col:not(:first-child) {
|
||||||
|
width:50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-diff-node-entry {
|
||||||
|
.node-diff-node-entry-cell {
|
||||||
|
width: calc((100% + 20px - 220px) / 2);
|
||||||
|
&:first-child {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.node-diff-column {
|
.node-diff-column {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
height:100%;
|
height:100%;
|
||||||
@@ -108,18 +219,32 @@
|
|||||||
border-right: 1px solid $secondary-border-color
|
border-right: 1px solid $secondary-border-color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.node-diff-tab-title {
|
|
||||||
padding: 3px 3px 3px 0;
|
|
||||||
background: #f6f6f6;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.node-diff-tab-title {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
// background: #f6f6f6;
|
||||||
|
&:hover {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-tab-title-meta {
|
||||||
|
vertical-align: middle;
|
||||||
|
display: inline-block;
|
||||||
|
padding-top: 2px;
|
||||||
|
}
|
||||||
|
.node-diff-node-entry-header {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
.node-diff-node-entry-node {
|
.node-diff-node-entry-node {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
width: 24px;
|
width: 18px;
|
||||||
height: 20px;
|
height: 15px;
|
||||||
background: #ddd;
|
background: #ddd;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
border: 1px solid #999;
|
border: 1px solid #999;
|
||||||
@@ -128,25 +253,96 @@
|
|||||||
background-size: contain;
|
background-size: contain;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.palette-icon {
|
.palette_icon {
|
||||||
width: 16px;
|
background-position: 49% 50%;
|
||||||
|
width: 15px;
|
||||||
}
|
}
|
||||||
.palette_icon_container {
|
.palette_icon_container {
|
||||||
width: 24px;
|
width: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-tab-empty {
|
||||||
|
.node-diff-chevron i {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.node-diff-tab-title {
|
||||||
|
cursor: default;
|
||||||
|
&:hover {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-deleted {
|
||||||
|
//background: #fadddd;
|
||||||
|
cursor: default !important;
|
||||||
|
.node-diff-status {
|
||||||
|
color: #f80000;
|
||||||
|
}
|
||||||
|
.node-diff-node-entry-node {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
.node-diff-node-description {
|
||||||
|
opacity: 0.5;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-added {
|
||||||
|
//background: #eefaee;
|
||||||
|
cursor: default !important;
|
||||||
|
.node-diff-status {
|
||||||
|
color: #009900;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-moved {
|
||||||
|
//background: #eefaee;
|
||||||
|
.node-diff-status {
|
||||||
|
color: #3f81b3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-diff-node-changed {
|
||||||
|
//background: #fff2ca;
|
||||||
|
.node-diff-status {
|
||||||
|
color: #f89406;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-unchanged {
|
||||||
|
//background: #fff2ca;
|
||||||
|
.node-diff-status {
|
||||||
|
color: #bbb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-conflict {
|
||||||
|
.node-diff-status {
|
||||||
|
color: #9b45ce;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.node-diff-node-entry-title {
|
.node-diff-node-entry-title {
|
||||||
cursor: pointer;
|
display: inline-block;
|
||||||
|
.node-diff-status {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.node-diff-node-entry-properties {
|
.node-diff-node-entry-properties {
|
||||||
margin-left: 30px;
|
margin: 0;
|
||||||
margin-right: 8px;
|
|
||||||
margin-bottom:8px;
|
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
.node-diff-status {
|
||||||
|
display: inline-block;
|
||||||
|
height: 20px;
|
||||||
|
margin-left: 5px;
|
||||||
|
vertical-align: top;
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.node-diff-element {
|
||||||
|
display: inline-block;
|
||||||
|
width: calc(100% - 20px);
|
||||||
|
}
|
||||||
|
|
||||||
.node-diff-node-description {
|
.node-diff-node-description {
|
||||||
color: $form-text-color;
|
color: $form-text-color;
|
||||||
margin-left: 5px;
|
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -156,10 +352,325 @@
|
|||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.node-diff-node-meta {
|
||||||
|
float: right;
|
||||||
|
//font-size: 0.9em;
|
||||||
|
color: #999;
|
||||||
|
margin-top: 7px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.node-diff-count { color: #999}
|
.node-diff-count { color: #999}
|
||||||
.node-diff-added { color: #009900}
|
.node-diff-added { color: #009900}
|
||||||
.node-diff-deleted { color: #f80000}
|
.node-diff-deleted { color: #f80000}
|
||||||
.node-diff-changed { color: #f89406}
|
.node-diff-changed { color: #f89406}
|
||||||
|
.node-diff-unchanged { color: #bbb}
|
||||||
.node-diff-conflicted { color: purple}
|
.node-diff-conflicted { color: purple}
|
||||||
|
|
||||||
|
|
||||||
|
.node-diff-node-entry-cell {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: calc( (100% - 20px) / 2);
|
||||||
|
height: 32px;
|
||||||
|
border-left: 1px solid $secondary-border-color;
|
||||||
|
padding-top: 2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.node-diff-empty {
|
||||||
|
background: #f3f3f3;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
20deg,
|
||||||
|
#fff, #fff 5px,
|
||||||
|
#f6f6f6 5px,
|
||||||
|
#f6f6f6 10px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
.node-diff-node-entry-cell:first-child {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
.node-diff-property-cell-label {
|
||||||
|
margin-left: 20px;
|
||||||
|
vertical-align: top;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-left: 8px;
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
.node-diff-property-wires {
|
||||||
|
display: inline-block;
|
||||||
|
.node-diff-node-entry-node {
|
||||||
|
width: 18px;
|
||||||
|
height: 15px;
|
||||||
|
}
|
||||||
|
.palette_icon_container {
|
||||||
|
width: 18px;
|
||||||
|
}
|
||||||
|
.palette_icon {
|
||||||
|
width: 15px;
|
||||||
|
}
|
||||||
|
ul,li,ol {
|
||||||
|
background: none !important;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
vertical-align: middle;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
list-style-type: none !important;
|
||||||
|
}
|
||||||
|
ol {
|
||||||
|
font-size: 0.9em;
|
||||||
|
margin: 0;
|
||||||
|
& > span {
|
||||||
|
vertical-align: middle;
|
||||||
|
display: inline-block;
|
||||||
|
width: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
& > li:not(:last-child) {
|
||||||
|
border-bottom: 1px solid #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.node-diff-node-props .node-diff-node-entry-cell:first-child {
|
||||||
|
padding: 6px 0px;
|
||||||
|
span:not(.node-diff-chevron) {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.node-diff-property-cell {
|
||||||
|
// vertical-align: top;
|
||||||
|
// display:inline-block;
|
||||||
|
//
|
||||||
|
// box-sizing: border-box;
|
||||||
|
// padding: 1px 5px;
|
||||||
|
//min-height: 30px;
|
||||||
|
|
||||||
|
&.node-diff-node-changed {
|
||||||
|
background: #fff2e1 !important;
|
||||||
|
}
|
||||||
|
&.node-diff-node-conflict {
|
||||||
|
background: #ffdad4 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-diff-selectbox {
|
||||||
|
position: absolute;
|
||||||
|
top:0;
|
||||||
|
right:0;
|
||||||
|
bottom:0;
|
||||||
|
width: 35px;
|
||||||
|
text-align: center;
|
||||||
|
border-left: 1px solid #eee;
|
||||||
|
margin:0;
|
||||||
|
input {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-diff-node-entry-conflict.node-diff-select-remote {
|
||||||
|
.node-diff-node-remote {
|
||||||
|
background: #e7ffe3;
|
||||||
|
label {
|
||||||
|
border-left-color: #b8daad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-local {
|
||||||
|
background: #ffe1e1;
|
||||||
|
label {
|
||||||
|
border-left-color: #e4bcbc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-entry-conflict.node-diff-select-local {
|
||||||
|
.node-diff-node-local {
|
||||||
|
background: #e7ffe3;
|
||||||
|
label {
|
||||||
|
border-left-color: #b8daad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-diff-node-remote {
|
||||||
|
background: #ffe1e1;
|
||||||
|
label {
|
||||||
|
border-left-color: #e4bcbc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ul.node-dialog-configm-deploy-list {
|
||||||
|
font-size: 0.9em;
|
||||||
|
width: 400px;
|
||||||
|
margin: 10px auto;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-dialog-confirm-conflict-row {
|
||||||
|
img {
|
||||||
|
vertical-align:middle;
|
||||||
|
height: 30px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
i {
|
||||||
|
vertical-align:middle;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 30px;
|
||||||
|
width: 30px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
vertical-align: middle;
|
||||||
|
width: calc(100% - 60px);
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#node-diff-toolbar-resolved-conflicts .node-diff-status {
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
.node-diff-text-diff-button {
|
||||||
|
float: right;
|
||||||
|
margin: 2px 3px;
|
||||||
|
line-height: 14px;
|
||||||
|
height: 16px;
|
||||||
|
|
||||||
|
}
|
||||||
|
.node-text-diff {
|
||||||
|
height: 100%;
|
||||||
|
overflow-y:auto;
|
||||||
|
|
||||||
|
table.node-text-diff-content {
|
||||||
|
margin: 10px;
|
||||||
|
border: 1px solid $secondary-border-color;
|
||||||
|
border-radius: 3px;
|
||||||
|
table-layout: fixed;
|
||||||
|
width: calc(100% - 20px);
|
||||||
|
td {
|
||||||
|
vertical-align: top;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
td.lineno {
|
||||||
|
font-family: monospace;
|
||||||
|
text-align: right;
|
||||||
|
color: #aaa;
|
||||||
|
background: #f6f6f6;
|
||||||
|
padding: 1px 5px;
|
||||||
|
}
|
||||||
|
td.lineno:nth-child(3) {
|
||||||
|
border-left: 1px solid $secondary-border-color;
|
||||||
|
}
|
||||||
|
td.linetext {
|
||||||
|
font-family: monospace;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
padding: 1px 5px;
|
||||||
|
span.prefix {
|
||||||
|
width: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
td.blank {
|
||||||
|
background: #f6f6f6;
|
||||||
|
}
|
||||||
|
td.added {
|
||||||
|
background: #eefaee;
|
||||||
|
}
|
||||||
|
td.removed {
|
||||||
|
background: #fadddd;
|
||||||
|
}
|
||||||
|
tr.mergeHeader td {
|
||||||
|
color: #800080;
|
||||||
|
background: #e5f9ff;
|
||||||
|
height: 26px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
tr.mergeHeader-separator td {
|
||||||
|
color: #800080;
|
||||||
|
background: darken(#e5f9ff, 10%);
|
||||||
|
height: 0px;
|
||||||
|
}
|
||||||
|
tr.mergeHeader-ours td {
|
||||||
|
border-top: 2px solid darken(#e5f9ff, 10%);
|
||||||
|
}
|
||||||
|
tr.mergeHeader-theirs td {
|
||||||
|
border-bottom: 2px solid darken(#e5f9ff, 10%);
|
||||||
|
}
|
||||||
|
td.unchanged {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
tr.unchanged {
|
||||||
|
background: #fefefe;
|
||||||
|
}
|
||||||
|
tr.start-block {
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
tr.end-block {
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
tr.node-text-diff-file-header td {
|
||||||
|
.filename {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
background: #f3f3f3;
|
||||||
|
padding: 5px 10px 5px 0;
|
||||||
|
color: #333;
|
||||||
|
cursor: pointer;
|
||||||
|
i.node-diff-chevron {
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tr.node-text-diff-file-header.collapsed {
|
||||||
|
td i.node-diff-chevron {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tr.node-text-diff-commit-header td {
|
||||||
|
background: #f3f3f3;
|
||||||
|
padding: 5px 10px;
|
||||||
|
color: #333;
|
||||||
|
h3 {
|
||||||
|
font-size: 1.4em;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.commit-summary {
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
padding-top: 5px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
.commit-body {
|
||||||
|
margin-bottom:15px;
|
||||||
|
white-space: pre;
|
||||||
|
line-height: 1.2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.node-text-diff-header > td:not(.flow-diff) {
|
||||||
|
font-family: monospace;
|
||||||
|
padding: 5px 10px;
|
||||||
|
text-align: left;
|
||||||
|
color: #666;
|
||||||
|
background: #ffd;
|
||||||
|
height: 30px;
|
||||||
|
vertical-align: middle;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
tr.node-text-diff-expand td {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: #ffc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: none;
|
display: none;
|
||||||
|
z-index:100;
|
||||||
}
|
}
|
||||||
#dropTarget div {
|
#dropTarget div {
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
@@ -34,4 +35,3 @@
|
|||||||
#dropTarget div i {
|
#dropTarget div i {
|
||||||
font-size: 80px;
|
font-size: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -46,7 +46,16 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.editor-tray-body {
|
.editor-tray-body {
|
||||||
margin: 20px;
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0.1px; // prevent margin collapsing
|
||||||
|
.dialog-form,#dialog-form, #node-config-dialog-edit-form {
|
||||||
|
margin: 20px;
|
||||||
|
height: calc(100% - 40px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.editor-tray-content {
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.editor-tray-header {
|
.editor-tray-header {
|
||||||
@include disable-selection;
|
@include disable-selection;
|
||||||
@@ -65,6 +74,13 @@
|
|||||||
.editor-tray-footer {
|
.editor-tray-footer {
|
||||||
@include component-footer;
|
@include component-footer;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
@include editor-button;
|
||||||
|
padding: 3px 7px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-tray-toolbar {
|
.editor-tray-toolbar {
|
||||||
@@ -72,48 +88,9 @@
|
|||||||
padding: 6px;
|
padding: 6px;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@include workspace-button;
|
@include editor-button;
|
||||||
font-size: 14px;
|
&.toggle {
|
||||||
padding: 6px 14px;
|
@include workspace-button-toggle;
|
||||||
margin-right: 8px;
|
|
||||||
color: $editor-button-color !important;
|
|
||||||
background: $editor-button-background;
|
|
||||||
|
|
||||||
&.primary {
|
|
||||||
border-color: $editor-button-background-primary;
|
|
||||||
color: $editor-button-color-primary !important;
|
|
||||||
background: $editor-button-background-primary;
|
|
||||||
&.disabled, &.ui-state-disabled {
|
|
||||||
background: none;
|
|
||||||
color: $editor-button-color !important;
|
|
||||||
border-color: $form-input-border-color;
|
|
||||||
}
|
|
||||||
&:not(.disabled):not(.ui-button-disabled):hover {
|
|
||||||
border-color: $editor-button-background-primary-hover;
|
|
||||||
background: $editor-button-background-primary-hover;
|
|
||||||
color: $editor-button-color-primary !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:not(.disabled):hover {
|
|
||||||
//color: $editor-button-color;
|
|
||||||
}
|
|
||||||
&.disabled {
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
&.disabled:focus {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
&.leftButton {
|
|
||||||
float: left;
|
|
||||||
margin-top: 1px;
|
|
||||||
}
|
|
||||||
&:not(.leftButton):not(:last-child) {
|
|
||||||
margin-right: 16px;
|
|
||||||
}
|
|
||||||
&.ui-state-disabled {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,6 +132,11 @@
|
|||||||
cursor: col-resize;
|
cursor: col-resize;
|
||||||
border-left: 1px solid $primary-border-color;
|
border-left: 1px solid $primary-border-color;
|
||||||
box-shadow: -1px 0 6px rgba(0,0,0,0.1);
|
box-shadow: -1px 0 6px rgba(0,0,0,0.1);
|
||||||
|
|
||||||
|
&.editor-tray-resize-maximised {
|
||||||
|
background: $background-color;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.editor-tray-resize-button {
|
.editor-tray-resize-button {
|
||||||
@include workspace-button;
|
@include workspace-button;
|
||||||
@@ -168,12 +150,7 @@
|
|||||||
color: $workspace-button-color;
|
color: $workspace-button-color;
|
||||||
}
|
}
|
||||||
#palette-shade, #editor-shade, #header-shade, #sidebar-shade {
|
#palette-shade, #editor-shade, #header-shade, #sidebar-shade {
|
||||||
position: absolute;
|
@include shade;
|
||||||
top:0;
|
|
||||||
bottom:0;
|
|
||||||
left:0;
|
|
||||||
right:0;
|
|
||||||
background: $shade-color;
|
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
#sidebar-shade {
|
#sidebar-shade {
|
||||||
@@ -181,10 +158,12 @@
|
|||||||
top: -1px;
|
top: -1px;
|
||||||
bottom: -1px;
|
bottom: -1px;
|
||||||
}
|
}
|
||||||
|
#full-shade {
|
||||||
|
@include shade;
|
||||||
|
z-index: 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-form,#dialog-form, #node-config-dialog-edit-form {
|
||||||
.dialog-form,#dialog-form, #dialog-config-form {
|
|
||||||
margin: 0;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,12 +199,16 @@
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-warning {
|
||||||
|
border-color: #d6615f;
|
||||||
|
}
|
||||||
|
|
||||||
.node-text-editor {
|
.node-text-editor {
|
||||||
border:1px solid #ccc;
|
border:1px solid #ccc;
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
font-family: monospace !important;
|
font-family: Menlo, Consolas, 'DejaVu Sans Mono', Courier, monospace !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-button {
|
.editor-button {
|
||||||
@@ -233,8 +216,10 @@
|
|||||||
height: 34px;
|
height: 34px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
border-radius: 4px;
|
border-radius: 2px;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
&.toggle {
|
&.toggle {
|
||||||
@include workspace-button-toggle;
|
@include workspace-button-toggle;
|
||||||
}
|
}
|
||||||
@@ -243,23 +228,13 @@
|
|||||||
|
|
||||||
.editor-button-small {
|
.editor-button-small {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
min-width: 20px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-form {
|
|
||||||
.button-group {
|
|
||||||
.editor-button {
|
|
||||||
&:first-child {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#node-config-dialog-scope-container {
|
#node-config-dialog-scope-container {
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
float: right;
|
float: right;
|
||||||
@@ -287,3 +262,155 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
}
|
}
|
||||||
|
.node-input-expression-editor #dialog-form {
|
||||||
|
margin: 0;
|
||||||
|
height: 100%;
|
||||||
|
.red-ui-panel {
|
||||||
|
&:first-child {
|
||||||
|
padding: 20px 20px 0;
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-input-expression-tab-content {
|
||||||
|
position: relative;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#node-input-expression-help {
|
||||||
|
position: absolute;
|
||||||
|
top: 35px;
|
||||||
|
left:0;
|
||||||
|
right: 0;
|
||||||
|
bottom:0;
|
||||||
|
padding: 0 20px;
|
||||||
|
overflow: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
#node-input-expression-panel-info {
|
||||||
|
& > .form-row {
|
||||||
|
margin: 0;
|
||||||
|
& > div:first-child {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-input-expression-legacy, .node-input-buffer-type {
|
||||||
|
font-size: 0.8em;
|
||||||
|
float: left;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid white;
|
||||||
|
padding: 2px 5px;
|
||||||
|
border-radius: 2px;
|
||||||
|
&:hover {
|
||||||
|
border-color: $form-input-border-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-input-buffer-type {
|
||||||
|
float: none;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clipboard-hidden {
|
||||||
|
position: absolute;
|
||||||
|
top: -3000px;
|
||||||
|
}
|
||||||
|
.node-label-form-row {
|
||||||
|
margin: 5px 0;
|
||||||
|
label {
|
||||||
|
margin-right: 20px;
|
||||||
|
text-align: right;
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
width: calc(100% - 100px);
|
||||||
|
}
|
||||||
|
#node-settings-icon-module {
|
||||||
|
width: calc(55% - 50px);
|
||||||
|
}
|
||||||
|
#node-settings-icon-file {
|
||||||
|
width: calc(45% - 55px);
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.node-label-form-none {
|
||||||
|
span {
|
||||||
|
padding-left: 50px;
|
||||||
|
width: 100px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace_read-only {
|
||||||
|
background: #eee !important;
|
||||||
|
.ace_cursor {
|
||||||
|
color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#node-settings-icon {
|
||||||
|
margin-left: 10px;
|
||||||
|
width: calc(100% - 163px);
|
||||||
|
}
|
||||||
|
.red-ui-icon-picker {
|
||||||
|
position: absolute;
|
||||||
|
border: 1px solid $primary-border-color;
|
||||||
|
box-shadow: 0 1px 6px -3px black;
|
||||||
|
background: white;
|
||||||
|
z-Index: 21;
|
||||||
|
display: none;
|
||||||
|
select {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 3px;
|
||||||
|
width: calc(100% - 6px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.red-ui-icon-list {
|
||||||
|
width: 308px;
|
||||||
|
height: 200px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
line-height: 0px;
|
||||||
|
}
|
||||||
|
.red-ui-icon-list-icon {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 2px;
|
||||||
|
padding: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
&:hover {
|
||||||
|
background: lighten($node-selected-color,20%);
|
||||||
|
}
|
||||||
|
&.selected {
|
||||||
|
background: lighten($node-selected-color,20%);
|
||||||
|
.red-ui-search-result-node {
|
||||||
|
border-color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.red-ui-icon-list-module {
|
||||||
|
background: $palette-header-background;
|
||||||
|
font-size: 0.9em;
|
||||||
|
padding: 3px;
|
||||||
|
color: #666;
|
||||||
|
clear: both;
|
||||||
|
i {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.red-ui-icon-meta {
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
span {
|
||||||
|
padding: 4px;
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
float: right;
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -170,6 +170,11 @@
|
|||||||
stroke-dasharray:8, 3;
|
stroke-dasharray:8, 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.node_quickadd * {
|
||||||
|
stroke-dasharray: 12,3;
|
||||||
|
}
|
||||||
|
|
||||||
.node_status_label {
|
.node_status_label {
|
||||||
@include disable-selection;
|
@include disable-selection;
|
||||||
stroke-width: 0;
|
stroke-width: 0;
|
||||||
@@ -183,6 +188,13 @@
|
|||||||
stroke: $port-selected-color;
|
stroke: $port-selected-color;
|
||||||
fill: $port-selected-color;
|
fill: $port-selected-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.port_quick_link {
|
||||||
|
stroke: $port-selected-color;
|
||||||
|
fill: $port-selected-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.subflowport {
|
.subflowport {
|
||||||
stroke-dasharray: 5,5;
|
stroke-dasharray: 5,5;
|
||||||
fill: #eee;
|
fill: #eee;
|
||||||
@@ -236,7 +248,7 @@
|
|||||||
|
|
||||||
.link_outline {
|
.link_outline {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
stroke-width: 4;
|
stroke-width: 5;
|
||||||
cursor: crosshair;
|
cursor: crosshair;
|
||||||
fill: none;
|
fill: none;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
@@ -260,3 +272,25 @@ g.link_unknown path.link_line {
|
|||||||
stroke-width: 2;
|
stroke-width: 2;
|
||||||
stroke-dasharray: 10, 4;
|
stroke-dasharray: 10, 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes port_tooltip_fadeIn { from { opacity:0; } to { opacity:1; } }
|
||||||
|
|
||||||
|
.port_tooltip {
|
||||||
|
opacity:0;
|
||||||
|
animation: 0.1s ease-in 0s 1 normal forwards port_tooltip_fadeIn;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
path {
|
||||||
|
fill: white;
|
||||||
|
stroke: #999;
|
||||||
|
stroke-width: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.port_tooltip_label {
|
||||||
|
stroke-width: 0;
|
||||||
|
fill: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
pointer-events: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
@include disable-selection;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -501,6 +501,11 @@ textarea.span1,
|
|||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label.disabled {
|
||||||
|
color: #bbb !important;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
input[disabled],
|
input[disabled],
|
||||||
select[disabled],
|
select[disabled],
|
||||||
textarea[disabled],
|
textarea[disabled],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -279,3 +279,13 @@ span.logo {
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#btn-usermenu .user-profile {
|
||||||
|
background-position: center center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
display: inline-block;
|
||||||
|
width: 40px;
|
||||||
|
height: 35px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -79,6 +79,7 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 6px 14px;
|
padding: 6px 14px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
|
border-radius: 2px;
|
||||||
color: $editor-button-color;
|
color: $editor-button-color;
|
||||||
background: $editor-button-background;
|
background: $editor-button-background;
|
||||||
|
|
||||||
@@ -142,3 +143,10 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.ui-widget-overlay {
|
||||||
|
@include shade;
|
||||||
|
z-index: 100;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,18 +16,112 @@
|
|||||||
|
|
||||||
#keyboard-help-dialog {
|
#keyboard-help-dialog {
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
|
padding-top: 10px;
|
||||||
|
|
||||||
}
|
}
|
||||||
.keyboard-shortcuts {
|
|
||||||
padding: 10px;
|
#user-settings-tab-keyboard .red-ui-editableList-container {
|
||||||
|
border-radius: 0;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
.keyboard-shortcuts td {
|
|
||||||
padding: 7px 5px;
|
|
||||||
margin-bottom: 10px;
|
.keyboard-shortcut-entry.keyboard-shortcut-list-header {
|
||||||
white-space: pre;
|
padding:0 5px 0 5px;
|
||||||
|
div {
|
||||||
|
color: #666 !important;
|
||||||
|
}
|
||||||
|
.red-ui-searchBox-container {
|
||||||
|
width: calc(100% - 20px);
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-scope {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.keyboard-shortcuts td:first-child {
|
|
||||||
|
.keyboard-shortcut-list-header {
|
||||||
|
border-bottom: 1px solid $primary-border-color;
|
||||||
|
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-list {
|
||||||
|
position: absolute;
|
||||||
|
top:30px;
|
||||||
|
left:10px;
|
||||||
|
right:10px;
|
||||||
|
bottom:10px;
|
||||||
|
li {
|
||||||
|
padding: 0;
|
||||||
|
.red-ui-editableList-item-content {
|
||||||
|
padding: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li:hover {
|
||||||
|
background: #f6f6f6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry {
|
||||||
|
div {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
// white-space: nowrap;
|
||||||
|
|
||||||
|
select {
|
||||||
|
margin: 0;
|
||||||
|
width: calc(100% - 30px);
|
||||||
|
font-size: 0.9em;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-key {
|
||||||
|
width:160px;
|
||||||
|
vertical-align: middle;
|
||||||
|
input {
|
||||||
|
margin:0;
|
||||||
|
width: calc(100% - 5px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-text {
|
||||||
|
vertical-align: middle;
|
||||||
|
width: calc(100% - 160px - 100px - 10px);
|
||||||
|
overflow: hidden;
|
||||||
|
i {
|
||||||
|
color: #ccc;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-scope {
|
||||||
|
width:100px;
|
||||||
|
color: #999;
|
||||||
|
vertical-align: middle;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding-right: 10px;
|
}
|
||||||
|
.keyboard-shortcut-entry:not(.keyboard-shortcut-list-header) {
|
||||||
|
.keyboard-shortcut-entry-scope {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-unassigned {
|
||||||
|
color: #999;
|
||||||
|
.keyboard-shortcut-entry-key {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-expanded {
|
||||||
|
.keyboard-shortcut-entry-key {
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-text {
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-entry-scope {
|
||||||
|
width: 110px;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.keyboard-shortcut-edit {
|
||||||
}
|
}
|
||||||
.help-key {
|
.help-key {
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
@@ -37,4 +131,6 @@
|
|||||||
font-family: Courier, monospace;
|
font-family: Courier, monospace;
|
||||||
box-shadow: #999 1px 1px 1px;
|
box-shadow: #999 1px 1px 1px;
|
||||||
}
|
}
|
||||||
|
.help-key-block {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -48,30 +48,30 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
|
|
||||||
&.disabled {
|
&.disabled, &:disabled {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
color: $workspace-button-color-disabled !important;
|
color: $workspace-button-color-disabled !important;
|
||||||
}
|
}
|
||||||
&:hover, &:focus {
|
&:hover, &:focus {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
&:not(.disabled):hover {
|
&:not(.disabled):not(:disabled):hover, {
|
||||||
color: $workspace-button-color-hover !important;
|
color: $workspace-button-color-hover !important;
|
||||||
background: $workspace-button-background-hover;
|
background: $workspace-button-background-hover;
|
||||||
}
|
}
|
||||||
&:not(.disabled):focus {
|
&:not(.disabled):not(:disabled):focus {
|
||||||
color: $workspace-button-color-focus !important;
|
color: $workspace-button-color-focus !important;
|
||||||
}
|
}
|
||||||
&:not(.disabled):active {
|
&:not(.disabled):not(:disabled):active {
|
||||||
color: $workspace-button-color-active !important;
|
color: $workspace-button-color-active !important;
|
||||||
background: $workspace-button-background-active;
|
background: $workspace-button-background-active;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
&.selected:not(.disabled) {
|
// &.selected:not(.disabled):not(:disabled) {
|
||||||
color: $workspace-button-color-selected !important;
|
// color: $workspace-button-color-selected !important;
|
||||||
background: $workspace-button-background-active;
|
// background: $workspace-button-background-active;
|
||||||
cursor: default;
|
// background: #9f9;
|
||||||
}
|
// }
|
||||||
.button-group &:not(:first-child) {
|
.button-group &:not(:first-child) {
|
||||||
border-left: none;
|
border-left: none;
|
||||||
border-top-left-radius: 0;
|
border-top-left-radius: 0;
|
||||||
@@ -81,28 +81,119 @@
|
|||||||
border-top-right-radius: 0;
|
border-top-right-radius: 0;
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
}
|
}
|
||||||
|
.button-group-vertical & {
|
||||||
|
display: block;
|
||||||
|
min-width: 22px;
|
||||||
|
}
|
||||||
|
.button-group-vertical &:not(:first-child) {
|
||||||
|
border-top: none;
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
}
|
||||||
|
.button-group-vertical &:not(:last-child) {
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-row &:not(:first-child) {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: 1px solid $workspace-button-color-focus-outline;
|
outline: 1px solid $workspace-button-color-focus-outline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.primary {
|
||||||
|
border-color: $editor-button-background-primary;
|
||||||
|
color: $editor-button-color-primary !important;
|
||||||
|
background: $editor-button-background-primary;
|
||||||
|
&.disabled, &.ui-state-disabled {
|
||||||
|
background: none;
|
||||||
|
color: $editor-button-color !important;
|
||||||
|
border-color: $form-input-border-color;
|
||||||
|
}
|
||||||
|
&:not(.disabled):not(.ui-button-disabled):hover {
|
||||||
|
border-color: $editor-button-background-primary-hover;
|
||||||
|
background: $editor-button-background-primary-hover;
|
||||||
|
color: $editor-button-color-primary !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.button-group-vertical {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.button-group:not(:last-child) {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@mixin workspace-button-toggle {
|
@mixin workspace-button-toggle {
|
||||||
@include workspace-button;
|
@include workspace-button;
|
||||||
color: $workspace-button-toggle-color !important;
|
color: $workspace-button-toggle-color !important;
|
||||||
background:$workspace-button-background-active;
|
background:$workspace-button-background-active;
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
&.selected:not(.disabled) {
|
|
||||||
|
&.selected:not(.disabled):not(:disabled) {
|
||||||
color: $workspace-button-toggle-color-selected !important;
|
color: $workspace-button-toggle-color-selected !important;
|
||||||
background: $workspace-button-background;
|
background: $workspace-button-background;
|
||||||
border-bottom-width: 2px;
|
border-bottom-width: 2px;
|
||||||
border-bottom-color: $form-input-border-selected-color;
|
border-bottom-color: $form-input-border-selected-color;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
&:not(.single) {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&.disabled {
|
&.disabled,&:disabled {
|
||||||
color: $workspace-button-toggle-color-disabled !important;
|
color: $workspace-button-toggle-color-disabled !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@mixin editor-button {
|
||||||
|
@include workspace-button;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 6px 14px;
|
||||||
|
margin-right: 8px;
|
||||||
|
color: $editor-button-color !important;
|
||||||
|
background: $editor-button-background;
|
||||||
|
|
||||||
|
// &.primary {
|
||||||
|
// border-color: $editor-button-background-primary;
|
||||||
|
// color: $editor-button-color-primary !important;
|
||||||
|
// background: $editor-button-background-primary;
|
||||||
|
// &.disabled, &.ui-state-disabled {
|
||||||
|
// background: none;
|
||||||
|
// color: $editor-button-color !important;
|
||||||
|
// border-color: $form-input-border-color;
|
||||||
|
// }
|
||||||
|
// &:not(.disabled):not(.ui-button-disabled):hover {
|
||||||
|
// border-color: $editor-button-background-primary-hover;
|
||||||
|
// background: $editor-button-background-primary-hover;
|
||||||
|
// color: $editor-button-color-primary !important;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
&:not(.disabled):hover {
|
||||||
|
//color: $editor-button-color;
|
||||||
|
}
|
||||||
|
&.disabled {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
&.disabled:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
&.leftButton {
|
||||||
|
float: left;
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
&:not(.leftButton):not(:last-child) {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
&.ui-state-disabled {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@mixin component-footer {
|
@mixin component-footer {
|
||||||
border-top: 1px solid $primary-border-color;
|
border-top: 1px solid $primary-border-color;
|
||||||
@@ -115,6 +206,12 @@
|
|||||||
height: 25px;
|
height: 25px;
|
||||||
line-height: 23px;
|
line-height: 23px;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
.button-group:not(:last-child) {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin component-footer-button {
|
@mixin component-footer-button {
|
||||||
@@ -128,9 +225,33 @@
|
|||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@mixin component-footer-button-toggle {
|
||||||
|
@include workspace-button-toggle;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 17px;
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
&.text-button {
|
||||||
|
width: auto;
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@mixin component-shadow {
|
@mixin component-shadow {
|
||||||
border: 1px solid $secondary-border-color;
|
border: 1px solid $secondary-border-color;
|
||||||
box-shadow: 1px 1px 4px rgba(0,0,0,0.2);
|
box-shadow: 1px 1px 4px rgba(0,0,0,0.2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin shade {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
background: $shade-color;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
.component-shade {
|
||||||
|
@include shade
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#notifications {
|
#notifications {
|
||||||
z-index: 10000;
|
z-index: 100;
|
||||||
width: 500px;
|
width: 500px;
|
||||||
margin-left: -250px;
|
margin-left: -250px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@@ -32,6 +32,11 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
border: 1px solid #325C80;
|
border: 1px solid #325C80;
|
||||||
border-left-width: 16px;
|
border-left-width: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.notification p:first-child {
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
.notification a {
|
.notification a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,13 +14,16 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#user-settings-tab-palette {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#palette-editor {
|
#palette-editor {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
display: none;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 25px;
|
bottom: 0;
|
||||||
left:0;
|
left:0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
@@ -46,12 +49,17 @@
|
|||||||
.palette-module-version {
|
.palette-module-version {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
|
.palette-module-errors .fa-warning {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
ul.palette-module-error-list li {
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.red-ui-editableList-item-content {
|
.red-ui-editableList-item-content {
|
||||||
padding: 12px 8px;
|
padding: 12px 16px;
|
||||||
}
|
}
|
||||||
&:last-child {
|
&:last-child {
|
||||||
// border-bottom: 1px solid $primary-border-color;
|
// border-bottom: 1px solid $primary-border-color;
|
||||||
@@ -61,7 +69,7 @@
|
|||||||
}
|
}
|
||||||
.palette-editor-tab {
|
.palette-editor-tab {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:115px;
|
top:35px;
|
||||||
left:0;
|
left:0;
|
||||||
right:0;
|
right:0;
|
||||||
bottom:0
|
bottom:0
|
||||||
@@ -72,58 +80,10 @@
|
|||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
border-bottom: 1px solid $primary-border-color;
|
border-bottom: 1px solid $primary-border-color;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
||||||
.button-group {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.palette-module-button-group {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
a {
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.palette-module-shade {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom:0;
|
|
||||||
left:0;
|
|
||||||
right:0;
|
|
||||||
background: $shade-color;
|
|
||||||
text-align: center;
|
|
||||||
padding-top: 20px;
|
|
||||||
}
|
|
||||||
#palette-module-install-shade {
|
|
||||||
padding-top: 80px;
|
|
||||||
}
|
}
|
||||||
.palette-module-shade-status {
|
.palette-module-shade-status {
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.palette-module-meta {
|
|
||||||
color: #666;
|
|
||||||
position: relative;
|
|
||||||
&.disabled {
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fa {
|
|
||||||
width: 15px;
|
|
||||||
text-align: center;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.palette-module-name {
|
|
||||||
white-space: nowrap;
|
|
||||||
@include enable-selection;
|
|
||||||
}
|
|
||||||
.palette-module-version, .palette-module-updated, .palette-module-link {
|
|
||||||
font-style:italic;
|
|
||||||
font-size: 0.8em;
|
|
||||||
@include enable-selection;
|
|
||||||
}
|
|
||||||
.palette-module-updated {
|
.palette-module-updated {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
@@ -230,3 +190,62 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.palette-module-meta {
|
||||||
|
color: #666;
|
||||||
|
position: relative;
|
||||||
|
&.disabled {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa {
|
||||||
|
width: 15px;
|
||||||
|
text-align: center;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.palette-module-name {
|
||||||
|
white-space: nowrap;
|
||||||
|
@include enable-selection;
|
||||||
|
}
|
||||||
|
.palette-module-version, .palette-module-updated, .palette-module-link {
|
||||||
|
font-style:italic;
|
||||||
|
font-size: 0.8em;
|
||||||
|
@include enable-selection;
|
||||||
|
}
|
||||||
|
.palette-module-section {
|
||||||
|
padding:0 !important;
|
||||||
|
background: #f9f9f9 !important;
|
||||||
|
font-size: 0.9em;
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
}
|
||||||
|
.palette-module-button-group {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
a {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.palette-module-meta .fa-warning {
|
||||||
|
color: #AD1625;
|
||||||
|
}
|
||||||
|
ul.palette-module-error-list {
|
||||||
|
display: inline-block;
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.9em;
|
||||||
|
li {
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.palette-module-shade {
|
||||||
|
@include shade;
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
#palette-module-install-shade {
|
||||||
|
padding-top: 80px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -90,13 +90,14 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 9px;
|
padding: 9px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
padding-left: 30px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
user-select: none;
|
||||||
text-overflow: ellipsis;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.palette-header i {
|
.palette-header > i {
|
||||||
margin: 3px 10px 3px 3px;
|
position: absolute;
|
||||||
|
left: 11px;
|
||||||
|
top: 12px;
|
||||||
-webkit-transition: all 0.2s ease-in-out;
|
-webkit-transition: all 0.2s ease-in-out;
|
||||||
-moz-transition: all 0.2s ease-in-out;
|
-moz-transition: all 0.2s ease-in-out;
|
||||||
-o-transition: all 0.2s ease-in-out;
|
-o-transition: all 0.2s ease-in-out;
|
||||||
@@ -114,16 +115,18 @@
|
|||||||
}
|
}
|
||||||
.palette_label {
|
.palette_label {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
margin: 4px 0 4px 28px;
|
margin: 4px 0 4px 32px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@include disable-selection;
|
||||||
}
|
}
|
||||||
.palette_label_right {
|
.palette_label_right {
|
||||||
margin: 4px 28px 4px 0;
|
margin: 4px 32px 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.palette_node {
|
.palette_node {
|
||||||
|
display: block;
|
||||||
cursor:move;
|
cursor:move;
|
||||||
background: #ddd;
|
background: #ddd;
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
@@ -185,3 +188,22 @@
|
|||||||
background-size: contain;
|
background-size: contain;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.palette_node_small {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
width: 18px;
|
||||||
|
height: 15px;
|
||||||
|
margin: 3px 0px;
|
||||||
|
vertical-align: middle;
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
|
.palette_icon_container {
|
||||||
|
width: 18px;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.palette_icon {
|
||||||
|
margin-left: -1px;
|
||||||
|
width: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
40
editor/sass/panels.scss
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
.red-ui-panels {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
// border: 1px solid red;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.red-ui-panels-separator {
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
border-bottom: 1px solid $secondary-border-color;
|
||||||
|
height: 7px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
cursor: ns-resize;
|
||||||
|
background: $background-color url(images/grip.png) no-repeat 50% 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.red-ui-panel {
|
||||||
|
overflow: auto;
|
||||||
|
height: calc(50% - 4px);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,39 +15,110 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
.red-ui-popover {
|
.red-ui-popover {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 300px;
|
width: auto;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
height: auto;
|
height: auto;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
||||||
z-index: 1000;
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 1.4em;
|
|
||||||
@include component-shadow;
|
|
||||||
}
|
|
||||||
.red-ui-popover:after, .red-ui-popover:before {
|
|
||||||
right: 100%;
|
|
||||||
top: 50%;
|
|
||||||
border: solid transparent;
|
|
||||||
content: " ";
|
|
||||||
height: 0;
|
|
||||||
width: 0;
|
|
||||||
position: absolute;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.red-ui-popover:after {
|
z-index: 1000;
|
||||||
border-color: rgba(136, 183, 213, 0);
|
font-size: 14px;
|
||||||
border-right-color: #fff;
|
line-height: 1.4em;
|
||||||
border-width: 10px;
|
@include component-shadow;
|
||||||
margin-top: -10px;
|
}
|
||||||
}
|
|
||||||
.red-ui-popover:before {
|
.red-ui-popover:after, .red-ui-popover:before {
|
||||||
border-color: rgba(194, 225, 245, 0);
|
border: solid transparent;
|
||||||
border-right-color: $primary-border-color;
|
content: " ";
|
||||||
border-width: 11px;
|
height: 0;
|
||||||
margin-top: -11px;
|
width: 0;
|
||||||
}
|
position: absolute;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.red-ui-popover.red-ui-popover-right:after, .red-ui-popover.red-ui-popover-right:before {
|
||||||
|
top: 50%;
|
||||||
|
right: 100%;
|
||||||
|
}
|
||||||
|
.red-ui-popover.red-ui-popover-left:after, .red-ui-popover.red-ui-popover-left:before {
|
||||||
|
top: 50%;
|
||||||
|
left: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red-ui-popover.red-ui-popover-bottom:after, .red-ui-popover.red-ui-popover-bottom:before {
|
||||||
|
bottom: 100%;
|
||||||
|
left: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red-ui-popover.red-ui-popover-right:after {
|
||||||
|
border-color: rgba(136, 183, 213, 0);
|
||||||
|
border-right-color: #fff;
|
||||||
|
border-width: 10px;
|
||||||
|
margin-top: -10px;
|
||||||
|
}
|
||||||
|
.red-ui-popover.red-ui-popover-right:before {
|
||||||
|
border-color: rgba(194, 225, 245, 0);
|
||||||
|
border-right-color: $primary-border-color;
|
||||||
|
border-width: 11px;
|
||||||
|
margin-top: -11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red-ui-popover.red-ui-popover-left:after {
|
||||||
|
border-color: rgba(136, 183, 213, 0);
|
||||||
|
border-left-color: #fff;
|
||||||
|
border-width: 10px;
|
||||||
|
margin-top: -10px;
|
||||||
|
}
|
||||||
|
.red-ui-popover.red-ui-popover-left:before {
|
||||||
|
border-color: rgba(194, 225, 245, 0);
|
||||||
|
border-left-color: $primary-border-color;
|
||||||
|
border-width: 11px;
|
||||||
|
margin-top: -11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.red-ui-popover.red-ui-popover-bottom:after {
|
||||||
|
border-color: rgba(136, 183, 213, 0);
|
||||||
|
border-bottom-color: #fff;
|
||||||
|
border-width: 10px;
|
||||||
|
margin-left: -10px;
|
||||||
|
}
|
||||||
|
.red-ui-popover.red-ui-popover-bottom:before {
|
||||||
|
border-color: rgba(194, 225, 245, 0);
|
||||||
|
border-bottom-color: $primary-border-color;
|
||||||
|
border-width: 11px;
|
||||||
|
margin-left: -11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.red-ui-popover-size-small {
|
||||||
|
font-size: 11px;
|
||||||
|
padding: 5px;
|
||||||
|
|
||||||
|
&.red-ui-popover-right:after {
|
||||||
|
border-width: 5px;
|
||||||
|
margin-top: -5px;
|
||||||
|
}
|
||||||
|
&.red-ui-popover-right:before {
|
||||||
|
border-width: 6px;
|
||||||
|
margin-top: -6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.red-ui-popover-left:after {
|
||||||
|
border-width: 5px;
|
||||||
|
margin-top: -5px;
|
||||||
|
}
|
||||||
|
&.red-ui-popover-left:before {
|
||||||
|
border-width: 6px;
|
||||||
|
margin-top: -6px;
|
||||||
|
}
|
||||||
|
&.red-ui-popover-bottom:after {
|
||||||
|
border-width: 5px;
|
||||||
|
margin-left: -5px;
|
||||||
|
}
|
||||||
|
&.red-ui-popover-bottom:before {
|
||||||
|
border-width: 6px;
|
||||||
|
margin-left: -6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
875
editor/sass/projects.scss
Normal file
@@ -0,0 +1,875 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
#projects-dialog {
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#project-settings-tab-settings {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-shade {
|
||||||
|
background: #f3f3f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.projects-edit-form form {
|
||||||
|
margin: 0;
|
||||||
|
.form-row {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
label {
|
||||||
|
color: #555;
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
&.projects-edit-form-inline-label {
|
||||||
|
font-weight: normal;
|
||||||
|
color: inherit;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
input[type=text], input[type=password],textarea {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
input[type=checkbox], input[type=radio] {
|
||||||
|
width: auto;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.projects-edit-form-sublabel {
|
||||||
|
color: #999;
|
||||||
|
text-align: right;
|
||||||
|
margin-bottom: -15px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
.project-settings-tab-pane {
|
||||||
|
& * .projects-edit-form-sublabel {
|
||||||
|
margin-right: 50px;
|
||||||
|
margin-top: -10px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-spinner {
|
||||||
|
position: absolute;
|
||||||
|
top: 1px;
|
||||||
|
bottom: 1px;
|
||||||
|
left: 1px;
|
||||||
|
right: 1px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px;
|
||||||
|
background: white;
|
||||||
|
&:before {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
height: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: -0.25em;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
&.projects-dialog-spinner-sidebar {
|
||||||
|
background: white;
|
||||||
|
padding:0;
|
||||||
|
img {
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.projects-version-control-spinner-sidebar {
|
||||||
|
background: white;
|
||||||
|
padding:0;
|
||||||
|
img {
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.projects-dialog-spinner-contain {
|
||||||
|
padding: 0;
|
||||||
|
img {
|
||||||
|
width: auto;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.projects-dialog-screen-start {
|
||||||
|
.projects-dialog-screen-start-hero {
|
||||||
|
// background: url(https://nodered.org/images/title-wave.png) no-repeat 0% 100% #8f0000;
|
||||||
|
// background-size: contain;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 2em;
|
||||||
|
padding: 10px;
|
||||||
|
min-height: 60px;
|
||||||
|
color: #555;
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
color: #f0f0f0;
|
||||||
|
font-size: 2em;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-screen-start-body {
|
||||||
|
min-height: 400px;
|
||||||
|
line-height: 1.6em;
|
||||||
|
p {
|
||||||
|
font-size: 1.1em;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
p:first-child {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button.editor-button {
|
||||||
|
width: calc(50% - 80px);
|
||||||
|
margin: 20px;
|
||||||
|
height: auto;
|
||||||
|
line-height: 2em;
|
||||||
|
padding: 10px;
|
||||||
|
border-color: #aaa;
|
||||||
|
i {
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
&:hover i {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.button-group {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-screen-create {
|
||||||
|
min-height: 500px;
|
||||||
|
button.projects-dialog-screen-create-type {
|
||||||
|
height: auto;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.button-group {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.projects-dialog-screen-secret {
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-container {
|
||||||
|
border: 1px solid $secondary-border-color;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-inner-container {
|
||||||
|
height: 300px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
position:relative;
|
||||||
|
.red-ui-editableList-border {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list {
|
||||||
|
li {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-entry {
|
||||||
|
padding: 12px 0;
|
||||||
|
border-left: 3px solid #fff;
|
||||||
|
border-right: 3px solid #fff;
|
||||||
|
&.projects-list-entry-current {
|
||||||
|
&:not(.selectable) {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
i {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.selectable {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
// border-left-color: #aaa;
|
||||||
|
// border-right-color: #aaa;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-entry-icon {
|
||||||
|
i {
|
||||||
|
color: #ccc;
|
||||||
|
font-size: 2em;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.selected {
|
||||||
|
background: #efefef;
|
||||||
|
border-left-color:#999;
|
||||||
|
border-right-color:#999;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-entry-icon {
|
||||||
|
margin: 0 10px 0 5px;
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-entry-name {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-entry-current {
|
||||||
|
float: right;
|
||||||
|
margin-right: 20px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
color: #999;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
.projects-dialog-project-list-entry-tools {
|
||||||
|
position: absolute;
|
||||||
|
top: 16px;
|
||||||
|
right: 30px;
|
||||||
|
display: none;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
.projects-dialog-project-list-entry-tools {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-screen-create-type.editor-button.toggle.selected:not(.disabled):not(:disabled) {
|
||||||
|
background: #fff !important;
|
||||||
|
color: #666 !important;
|
||||||
|
}
|
||||||
|
.projects-dialog-screen-input-status {
|
||||||
|
text-align: right;
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
right: 8px;
|
||||||
|
width: 70px;
|
||||||
|
height: 30px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-version-control {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-stack-info {
|
||||||
|
height: 100px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-bottom: 1px solid $secondary-border-color;
|
||||||
|
color: #333;
|
||||||
|
i {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-version-control-stack {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.palette-category {
|
||||||
|
&:not(.palette-category-expanded) button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#project-settings-tab-deps {
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.red-ui-editableList-border {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.red-ui-editableList-item-content {
|
||||||
|
padding: 0px 6px;
|
||||||
|
}
|
||||||
|
.palette-module-header {
|
||||||
|
padding: 6px 4px;
|
||||||
|
}
|
||||||
|
.palette-module-button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.palette-module-unused {
|
||||||
|
& > * {
|
||||||
|
color: #bbb;
|
||||||
|
}
|
||||||
|
// border: 1px dashed #bbb;
|
||||||
|
}
|
||||||
|
.palette-module-unknown {
|
||||||
|
border: 1px dashed #aaa;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
.palette-module-not-installed {
|
||||||
|
border: 1px dashed #b07575;
|
||||||
|
background: #fee;
|
||||||
|
i.fa-warning {
|
||||||
|
color: #b07575; //#b72828;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.project-settings-tab-pane {
|
||||||
|
position: absolute;
|
||||||
|
top:0;
|
||||||
|
left:0;
|
||||||
|
right:0;
|
||||||
|
bottom:0;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 8px 20px 20px;
|
||||||
|
}
|
||||||
|
.sidebar-version-control {
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
background: #f9f9f9;
|
||||||
|
padding: 0;
|
||||||
|
li {
|
||||||
|
padding:0;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.red-ui-editableList-border {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-version-control-change-container {
|
||||||
|
position: relative;
|
||||||
|
height: 50%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
transition: height 0.2s ease-in-out;
|
||||||
|
&:first-child {
|
||||||
|
// border-bottom: 1px solid $primary-border-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-version-control-merging {
|
||||||
|
.sidebar-version-control-change-container {
|
||||||
|
height: 33%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-version-control-slide-box {
|
||||||
|
position:absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left:0;
|
||||||
|
right:0;
|
||||||
|
height:0;
|
||||||
|
transition: height 0.2s ease-in-out;
|
||||||
|
background: #f6f6f6;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
&.sidebar-version-control-slide-box-top {
|
||||||
|
z-index: 4;
|
||||||
|
top: 0px;
|
||||||
|
left: auto;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 280px;
|
||||||
|
border-left: 1px solid $primary-border-color;
|
||||||
|
border-right: 1px solid $primary-border-color;
|
||||||
|
border-bottom: 1px solid $primary-border-color;
|
||||||
|
box-shadow: 1px 1px 4px rgba(0,0,0,0.2);
|
||||||
|
|
||||||
|
color: #666;
|
||||||
|
background: #f6f6f6;
|
||||||
|
padding: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
}
|
||||||
|
&.sidebar-version-control-slide-box-bottom {
|
||||||
|
bottom: 0px;
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 110px;
|
||||||
|
margin: 10px;
|
||||||
|
width: calc(100% - 20px);
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 1px;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.projects-branch-list {
|
||||||
|
position: relative;
|
||||||
|
.red-ui-searchBox-container {
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
border-left: 1px solid $secondary-border-color;
|
||||||
|
border-right: 1px solid $secondary-border-color;
|
||||||
|
border-top-left-radius: 2px;
|
||||||
|
border-top-right-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.red-ui-editableList {
|
||||||
|
border: 1px solid $secondary-border-color;
|
||||||
|
border-bottom-left-radius: 2px;
|
||||||
|
border-bottom-right-radius: 2px;
|
||||||
|
& > .red-ui-editableList-border {
|
||||||
|
border-radius: 0;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
padding: 0;
|
||||||
|
li {
|
||||||
|
padding: 0;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.uneditable-input .projects-branch-list {
|
||||||
|
.red-ui-editableList {
|
||||||
|
border-left: none;
|
||||||
|
border-bottom: none;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.red-ui-searchBox-container {
|
||||||
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-version-control-slide-box-header {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-version-control-slide-box-toolbar {
|
||||||
|
padding: 0 20px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-branch-list-entry {
|
||||||
|
padding: 5px 8px;
|
||||||
|
color: #666;
|
||||||
|
cursor: pointer;
|
||||||
|
&.selected {
|
||||||
|
border-left-color:#999;
|
||||||
|
border-right-color:#999;
|
||||||
|
}
|
||||||
|
border-left: 2px solid #fff;
|
||||||
|
border-right: 2px solid #fff;
|
||||||
|
margin: 0 1px;
|
||||||
|
i { width: 16px; text-align: center}
|
||||||
|
&.input-error {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
&:not(.input-error):hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
border-left-color:#999;
|
||||||
|
border-right-color:#999;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
span.current {
|
||||||
|
float: right;
|
||||||
|
font-size: 0.8em;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-version-control-change-entry {
|
||||||
|
height: 20px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
position: relative;
|
||||||
|
white-space: nowrap;
|
||||||
|
span {
|
||||||
|
margin: 0 6px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: currentColor;
|
||||||
|
&.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-version-control-change-entry-tools {
|
||||||
|
position: absolute;
|
||||||
|
top: 4px;
|
||||||
|
right: 4px;
|
||||||
|
display: none;
|
||||||
|
button {
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.sidebar-version-control-change-entry-tools {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.node-info-none {
|
||||||
|
text-align: center;
|
||||||
|
background: #fefefe;
|
||||||
|
white-space: normal;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-version-control-commit-entry {
|
||||||
|
min-height: 20px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
position: relative;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-more {
|
||||||
|
color: #999;
|
||||||
|
text-align: center;
|
||||||
|
padding: 10px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-sha {
|
||||||
|
float: right;
|
||||||
|
font-family: monospace;
|
||||||
|
color: #c38888;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 0.85em;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-subject {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-refs {
|
||||||
|
min-height: 22px;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-ref {
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 0.7em;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 2px 5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-date {
|
||||||
|
color: #999;
|
||||||
|
font-size: 0.85em;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-user {
|
||||||
|
float: right;
|
||||||
|
color: #999;
|
||||||
|
font-size: 0.85em;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-commit-head {
|
||||||
|
}
|
||||||
|
.sidebar-version-control-change-header {
|
||||||
|
color: #666;
|
||||||
|
background: #f6f6f6;
|
||||||
|
padding: 4px 10px;
|
||||||
|
height: 30px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
border-bottom: 1px solid $secondary-border-color;
|
||||||
|
i {
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-version-control-repo-toolbar {
|
||||||
|
color: #666;
|
||||||
|
background: #f6f6f6;
|
||||||
|
padding: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-version-control-repo-count {
|
||||||
|
margin-right: 8px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-repo-action {
|
||||||
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.sidebar-version-control-repo-sub-action {
|
||||||
|
width: calc(50% - 5px);
|
||||||
|
margin-right: 5px;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-file-listing-container > .red-ui-editableList > .red-ui-editableList-border {
|
||||||
|
border-radius: 0;
|
||||||
|
border: none;
|
||||||
|
border-top: 1px solid $secondary-border-color;
|
||||||
|
|
||||||
|
}
|
||||||
|
.red-ui-editableList-container .projects-dialog-file-list {
|
||||||
|
.red-ui-editableList-border {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
padding: 0 !important;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-file-list-entry {
|
||||||
|
padding: 3px 0;
|
||||||
|
border-left: 2px solid #fff;
|
||||||
|
border-right: 2px solid #fff;
|
||||||
|
&.projects-list-entry-current {
|
||||||
|
&:not(.selectable) {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
i {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.selectable {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
border-left-color:#999;
|
||||||
|
border-right-color:#999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.unselectable {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: #999;
|
||||||
|
width: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
&.selected {
|
||||||
|
background: #efefef;
|
||||||
|
border-left-color:#999;
|
||||||
|
border-right-color:#999;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
.projects-dialog-file-list-entry-folder {
|
||||||
|
margin: 0 10px 0 0px;
|
||||||
|
|
||||||
|
.fa-angle-right {
|
||||||
|
color: #333;
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-file-list-entry-file {
|
||||||
|
margin: 0 10px 0 20px;
|
||||||
|
}
|
||||||
|
.projects-dialog-file-list-entry-name {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
&.expanded .fa-angle-right {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-file-list-entry-file-type-git { color: #999 }
|
||||||
|
|
||||||
|
.projects-dialog-remote-list {
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
padding: 0;
|
||||||
|
li {
|
||||||
|
padding: 0;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.projects-dialog-sshkey-list {
|
||||||
|
li {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
&.projects-dialog-sshkey-list-small {
|
||||||
|
.projects-dialog-sshkey-list-entry {
|
||||||
|
padding: 6px 0;
|
||||||
|
i {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-sshkey-list-entry-name {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
.projects-dialog-sshkey-list-entry-current {
|
||||||
|
margin-right: 10px;
|
||||||
|
padding-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
.projects-dialog-sshkey-list {
|
||||||
|
li:last-child {
|
||||||
|
border-bottom: 0px none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-sshkey-list-entry {
|
||||||
|
padding: 12px 0;
|
||||||
|
border-left: 3px solid #fff;
|
||||||
|
border-right: 3px solid #fff;
|
||||||
|
&.sshkey-list-entry-current {
|
||||||
|
&:not(.selectable) {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
i {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.selectable {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
border-left-color: #aaa;
|
||||||
|
border-right-color: #aaa;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i {
|
||||||
|
color: #ccc;
|
||||||
|
font-size: 2em;
|
||||||
|
|
||||||
|
}
|
||||||
|
&.selected {
|
||||||
|
background: #efefef;
|
||||||
|
border-left-color:#999;
|
||||||
|
border-right-color:#999;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
.projects-dialog-sshkey-list-entry-icon {
|
||||||
|
margin: 0 10px 0 5px;
|
||||||
|
}
|
||||||
|
.projects-dialog-sshkey-list-entry-name {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
.projects-dialog-sshkey-list-entry-current {
|
||||||
|
float: right;
|
||||||
|
margin-right: 20px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
color: #999;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
.projects-dialog-sshkey-list-button-remove {
|
||||||
|
position: absolute;
|
||||||
|
right: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
div.projects-dialog-ssh-public-key {
|
||||||
|
position: relative;
|
||||||
|
padding: 15px 20px 0;
|
||||||
|
pre {
|
||||||
|
position: relative;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
&:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.projects-dialog-ssh-key-list {
|
||||||
|
li {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
.projects-dialog-ssh-key-header {
|
||||||
|
padding: 10px 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: #f3f3f3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.projects-dialog-list {
|
||||||
|
position: relative;
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
padding: 1px;
|
||||||
|
background: #f6f6f6;
|
||||||
|
li:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.projects-dialog-list-entry {
|
||||||
|
&.red-ui-search-empty {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.entry-icon {
|
||||||
|
text-align: center;
|
||||||
|
min-width: 30px;
|
||||||
|
vertical-align: top;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
.entry-name {
|
||||||
|
min-width: 250px;
|
||||||
|
}
|
||||||
|
&.current .entry-name {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.entry-detail {
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entry-remote-name {
|
||||||
|
min-width: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.entry-tools {
|
||||||
|
float: right;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.projects-dialog-list-dialog {
|
||||||
|
position: relative;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid $secondary-border-color;
|
||||||
|
.projects-edit-form-sublabel {
|
||||||
|
margin-top: -8px !important;
|
||||||
|
display: block !important;
|
||||||
|
width: auto !important;
|
||||||
|
}
|
||||||
|
&:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.projects-dialog-list-dialog-header {
|
||||||
|
font-weight: bold;
|
||||||
|
background: #f3f3f3;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
padding: 5px 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -29,6 +29,77 @@
|
|||||||
ol {
|
ol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.red-ui-type-search-shade {
|
||||||
|
@include shade;
|
||||||
|
z-index: 20;
|
||||||
|
position: fixed;
|
||||||
|
background: rgba(255,255,255,0.05);
|
||||||
|
}
|
||||||
|
.red-ui-type-search {
|
||||||
|
box-shadow: 0 1px 6px -3px black;
|
||||||
|
background: none;
|
||||||
|
width: 300px;
|
||||||
|
margin-left: 0px;
|
||||||
|
//height: 75px;
|
||||||
|
border: none;
|
||||||
|
.red-ui-search-container {
|
||||||
|
border-top-left-radius: 5px;
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
border: 1px dashed #aaa;
|
||||||
|
border-bottom: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.red-ui-search-results-container {
|
||||||
|
display: none;
|
||||||
|
height: 150px;
|
||||||
|
.red-ui-editableList-container {
|
||||||
|
border: 1px dashed #aaa;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.red-ui-search-result {
|
||||||
|
padding: 2px 2px 2px 5px;
|
||||||
|
font-size: 13px;
|
||||||
|
border-left-width: 3px;
|
||||||
|
border-right-width: 3px;
|
||||||
|
}
|
||||||
|
.red-ui-search-result-separator {
|
||||||
|
border-bottom: 3px solid #ddd;
|
||||||
|
}
|
||||||
|
.red-ui-search-result-node {
|
||||||
|
position: relative;
|
||||||
|
width: 18px;
|
||||||
|
height: 15px;
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
.red-ui-search-result-node-port {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid #999;
|
||||||
|
width: 6px;
|
||||||
|
height: 7px;
|
||||||
|
top:4px;
|
||||||
|
left:-4px;
|
||||||
|
background: #eee;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.red-ui-search-result-node-output{
|
||||||
|
left: 16px;
|
||||||
|
}
|
||||||
|
.palette_icon_container {
|
||||||
|
width: 18px;
|
||||||
|
}
|
||||||
|
.palette_icon {
|
||||||
|
width: 15px;
|
||||||
|
}
|
||||||
|
.red-ui-search-result-description {
|
||||||
|
margin-left:28px;
|
||||||
|
}
|
||||||
|
.red-ui-search-result-node-label {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.red-ui-search-container {
|
.red-ui-search-container {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
border-bottom: 1px solid $secondary-border-color;
|
border-bottom: 1px solid $secondary-border-color;
|
||||||
@@ -37,19 +108,21 @@
|
|||||||
position:relative;
|
position:relative;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
background: $background-color;
|
background: #f9f9f9;
|
||||||
|
|
||||||
.red-ui-editableList-container {
|
.red-ui-editableList-container {
|
||||||
background: white;
|
background: white;
|
||||||
border-radius: 2px;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: $background-color;
|
background: #f9f9f9;
|
||||||
li {
|
li {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
&.selected {
|
||||||
&.selected .red-ui-search-result {
|
background: #efefef;
|
||||||
border-color: $primary-border-color;
|
.red-ui-search-result {
|
||||||
|
border-left-color:#999;
|
||||||
|
border-right-color:#999;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,11 +131,19 @@
|
|||||||
display: block;
|
display: block;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: $form-text-color;
|
color: $form-text-color;
|
||||||
border: 2px solid white;
|
border-left: 3px solid #fff;
|
||||||
|
border-right: 3px solid #fff;
|
||||||
&:hover {
|
&:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
border-color: $primary-border-color;
|
|
||||||
color: $form-text-color;
|
color: $form-text-color;
|
||||||
|
background: #efefef;
|
||||||
|
border-left-color:#efefef;
|
||||||
|
border-right-color:#efefef;
|
||||||
|
}
|
||||||
|
&:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
clear: both;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +159,11 @@
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
.palette_icon_container {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.red-ui-search-result-description {
|
.red-ui-search-result-description {
|
||||||
margin-left: 40px;
|
margin-left: 40px;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -71,6 +71,7 @@
|
|||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
background: #f3f3f3;
|
background: #f3f3f3;
|
||||||
border-bottom: 1px solid $secondary-border-color;
|
border-bottom: 1px solid $secondary-border-color;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-footer {
|
#sidebar-footer {
|
||||||
@@ -80,6 +81,9 @@
|
|||||||
.sidebar-footer-button {
|
.sidebar-footer-button {
|
||||||
@include component-footer-button;
|
@include component-footer-button;
|
||||||
}
|
}
|
||||||
|
.sidebar-footer-button-toggle {
|
||||||
|
@include component-footer-button-toggle;
|
||||||
|
}
|
||||||
.sidebar-header-button {
|
.sidebar-header-button {
|
||||||
@include workspace-button;
|
@include workspace-button;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@@ -97,10 +101,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-shade {
|
.sidebar-shade {
|
||||||
position: absolute;
|
@include shade;
|
||||||
top:0;
|
|
||||||
bottom:0;
|
|
||||||
left:0;
|
|
||||||
right:0;
|
|
||||||
background: $shade-color;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013, 2015 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
@import "jquery";
|
@import "jquery";
|
||||||
@import "bootstrap";
|
@import "bootstrap";
|
||||||
|
@import "ace";
|
||||||
|
|
||||||
@import "dropdownMenu";
|
@import "dropdownMenu";
|
||||||
|
|
||||||
@@ -36,23 +37,33 @@
|
|||||||
@import "library";
|
@import "library";
|
||||||
@import "search";
|
@import "search";
|
||||||
|
|
||||||
|
@import "panels";
|
||||||
@import "tabs";
|
@import "tabs";
|
||||||
@import "tab-config";
|
@import "tab-config";
|
||||||
|
@import "tab-context";
|
||||||
@import "tab-info";
|
@import "tab-info";
|
||||||
@import "popover";
|
@import "popover";
|
||||||
@import "flow";
|
@import "flow";
|
||||||
@import "palette-editor";
|
@import "palette-editor";
|
||||||
@import "diff";
|
@import "diff";
|
||||||
|
|
||||||
|
@import "userSettings";
|
||||||
|
|
||||||
|
@import "projects";
|
||||||
|
|
||||||
|
|
||||||
@import "ui/common/editableList";
|
@import "ui/common/editableList";
|
||||||
@import "ui/common/searchBox";
|
@import "ui/common/searchBox";
|
||||||
@import "ui/common/typedInput";
|
@import "ui/common/typedInput";
|
||||||
|
@import "ui/common/nodeList";
|
||||||
|
@import "ui/common/checkboxSet";
|
||||||
|
@import "ui/common/stack";
|
||||||
|
|
||||||
@import "dragdrop";
|
@import "dragdrop";
|
||||||
|
|
||||||
@import "keyboard";
|
@import "keyboard";
|
||||||
|
|
||||||
|
@import "debug";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@@ -119,3 +130,7 @@ pre code {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015, 2016 IBM Corp.
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -25,6 +25,22 @@
|
|||||||
.config-node-list {
|
.config-node-list {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
|
||||||
|
.palette_label {
|
||||||
|
margin-left: 8px;
|
||||||
|
line-height: 24px;
|
||||||
|
text-align: left;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.palette_icon_container {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 30px;
|
||||||
|
background-color: #e8e8e8;
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.config_node {
|
.config_node {
|
||||||
width: 160px;
|
width: 160px;
|
||||||
@@ -32,22 +48,6 @@
|
|||||||
background: #f3f3f3;
|
background: #f3f3f3;
|
||||||
color: #666;
|
color: #666;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
.palette_label {
|
|
||||||
margin-left: 8px;
|
|
||||||
line-height: 24px;
|
|
||||||
text-align: left;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.palette_icon_container {
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 30px;
|
|
||||||
background-color: #e8e8e8;
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.config_node_type {
|
.config_node_type {
|
||||||
color: #999;
|
color: #999;
|
||||||
|
|||||||
54
editor/sass/tab-context.scss
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
.sidebar-context-stack {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
overflow-y: scroll;
|
||||||
|
|
||||||
|
.palette-category {
|
||||||
|
&:not(.palette-category-expanded) button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-context-property {
|
||||||
|
position: relative;
|
||||||
|
.debug-message-tools {
|
||||||
|
right: 0px;
|
||||||
|
margin-right: 5px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&:hover .debug-message-tools {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-context-updated {
|
||||||
|
text-align: right;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #bbb;
|
||||||
|
padding: 1px 3px;
|
||||||
|
}
|
||||||
|
.sidebar-context-property-storename {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.8em;
|
||||||
|
font-style: italic;
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||