mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
491 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
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 | ||
|
|
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 | ||
|
|
8916f6f829 | ||
|
|
215c8fd261 | ||
|
|
061cc908a7 | ||
|
|
18a519f9ed | ||
|
|
7970c9dbe5 | ||
|
|
5ca0c066e2 | ||
|
|
563728c7b8 | ||
|
|
31a72b6562 | ||
|
|
d3dfbc3034 | ||
|
|
f143a6ba08 | ||
|
|
28a65923b6 | ||
|
|
4ca3df77b3 | ||
|
|
4cbe264869 | ||
|
|
b6b65b6bf7 | ||
|
|
e7cc42a927 | ||
|
|
bba3ca8cc0 | ||
|
|
8423e2d245 | ||
|
|
fc263718a1 | ||
|
|
c3a99cf5a4 | ||
|
|
f6820ec615 | ||
|
|
226ad3fe22 | ||
|
|
a9b17e930c | ||
|
|
932ea7ba8f | ||
|
|
c720d78c39 | ||
|
|
8d21e441a0 | ||
|
|
16ecb1a9cb | ||
|
|
f68acca427 | ||
|
|
671d7e2beb | ||
|
|
52fc497412 | ||
|
|
2084ad318f | ||
|
|
b530c1a43d | ||
|
|
f2797a4153 | ||
|
|
659c326f89 | ||
|
|
534b07d120 | ||
|
|
de64fc8b8d | ||
|
|
1e234fcb73 | ||
|
|
fa9a7e725b | ||
|
|
95b2675f03 | ||
|
|
564902b886 | ||
|
|
071a04595a | ||
|
|
eaa4b76ede | ||
|
|
74a1713e99 | ||
|
|
5f5aa0b2f7 | ||
|
|
eef59fd40e | ||
|
|
361ff315e9 | ||
|
|
eeea8e530e | ||
|
|
8d5286703f | ||
|
|
74f2180fa4 | ||
|
|
d042169f2e | ||
|
|
1fd87bf664 | ||
|
|
eeaff6b553 | ||
|
|
6efd048fd6 | ||
|
|
6e9e694f66 | ||
|
|
44a0f1b505 | ||
|
|
9790211891 | ||
|
|
be18cc9f2d | ||
|
|
8caee09ea4 | ||
|
|
26f5305593 | ||
|
|
d33029027f | ||
|
|
339aaaec57 | ||
|
|
db2425c473 | ||
|
|
18731f6055 | ||
|
|
34f1f7a31d | ||
|
|
7ef153756b | ||
|
|
bf90509526 | ||
|
|
d853eca489 | ||
|
|
869ae01da9 | ||
|
|
d63996eea1 | ||
|
|
9bbc8eda9d | ||
|
|
9cc1b03c56 | ||
|
|
b1ab26e3ad | ||
|
|
96820418b5 | ||
|
|
385d9f16e9 | ||
|
|
d56fce37dd | ||
|
|
aef2c9e5cf | ||
|
|
89a05c580f | ||
|
|
b85e562980 | ||
|
|
a0e6628757 | ||
|
|
60a41524f0 | ||
|
|
6042395b81 | ||
|
|
8a5db8ce4b | ||
|
|
196d6e79e2 | ||
|
|
91f16215e5 | ||
|
|
9c675a7847 | ||
|
|
f9e09e87d6 | ||
|
|
73574d6293 | ||
|
|
0a5a42b32a | ||
|
|
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 | ||
|
|
9a4ff5cb43 | ||
|
|
f66c91e18e | ||
|
|
a235745be7 |
@@ -2,6 +2,9 @@
|
||||
"asi": true, // allow missing semicolons
|
||||
"curly": true, // require braces
|
||||
"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
|
||||
"immed": true, // require immediate functions to be wrapped in ( )
|
||||
"nonbsp": true, // warn on unexpected whitespace breaking chars
|
||||
@@ -9,6 +12,8 @@
|
||||
//"unused": true, // Check for unused functions and variables
|
||||
"loopfunc": true, // allow functions to be defined in loops
|
||||
//"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
|
||||
"proto": true // allow setting of __proto__ in node < v0.12
|
||||
"proto": true, // allow setting of __proto__ in node < v0.12,
|
||||
"esversion": 6 // allow es6
|
||||
}
|
||||
|
||||
@@ -9,14 +9,11 @@ addons:
|
||||
packages:
|
||||
- g++-4.8
|
||||
- gcc-4.8
|
||||
matrix:
|
||||
allow_failures:
|
||||
- node_js: "7"
|
||||
node_js:
|
||||
- "8"
|
||||
- "7"
|
||||
- "6"
|
||||
- "4"
|
||||
- "0.10"
|
||||
script:
|
||||
- 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
|
||||
before_script:
|
||||
|
||||
390
CHANGELOG.md
390
CHANGELOG.md
@@ -1,3 +1,393 @@
|
||||
#### 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
|
||||
|
||||
- Tcpgetfix: Another small check (#1070)
|
||||
- TCPGet: Ensure done() is called only once (#1068)
|
||||
- Allow $ and _ at start of property identifiers Fixes #1063
|
||||
- TCPGet: Separated the node.connected property for each instance (#1062)
|
||||
- Corrected 'overide' typo in XML node help (#1061)
|
||||
- TCPGet: Last property check (hopefully) (#1059)
|
||||
- Add additional safety checks to avoid acting on non-existent objects (#1057)
|
||||
- add --title for process name to command line options
|
||||
- add indicator for fire once on inject node
|
||||
- reimplement $(env var) replace to share common code.
|
||||
- Fix error message for missing node html file, and add test.
|
||||
- Let credentials also use $(...) substitutions from ENV
|
||||
- Rename insecureRedirect to requireHttps
|
||||
- Add setting to cause insecure redirect (#1054)
|
||||
- Palette editor fixes (#1033)
|
||||
- Close comms on stopServer in test helper (#1020)
|
||||
- Tcpgetfix (#1050)
|
||||
- TCPget: Store incoming messages alongside the client object to keep reference
|
||||
- Merge remote-tracking branch 'upstream/master' into tcpgetfix
|
||||
- TCPget can now handle concurrent sessions (#1042)
|
||||
- Better scope handling
|
||||
- Add security checks
|
||||
- small change to udp httpadmin
|
||||
- Fix comparison to "" in tcpin
|
||||
- Change scope of clients object
|
||||
- Works when connection is left open
|
||||
- First release of multi connection tcpget
|
||||
- Fix node.error() not printing when passed false (#1037)
|
||||
- fix test for CSV array input
|
||||
- different test for Pi (rather than use serial port name)
|
||||
- Fix missing 0 handling for css node with array input
|
||||
|
||||
|
||||
#### 0.15.2: Maintenance Release
|
||||
|
||||
- Revert bidi changes to nodes and hide menu option until fixed Fixes #1024
|
||||
|
||||
@@ -38,21 +38,13 @@ If you want to raise a pull-request with a new feature, or a refactoring
|
||||
of existing code, it may well get rejected if you haven't discussed it on
|
||||
the [mailing list](https://groups.google.com/forum/#!forum/node-red) first.
|
||||
|
||||
### 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
|
||||
here: https://cla.js.foundation/node-red/node-red.
|
||||
|
||||
In order for us to accept pull-requests, the contributor must first complete
|
||||
a Contributor License Agreement (CLA). This clarifies the intellectual
|
||||
property license granted with any contribution. It is for your protection as a
|
||||
Contributor as well as the protection of IBM and its customers; it does not
|
||||
change your rights to use your own Contributions for any other purpose.
|
||||
If you raise a pull-request without having signed the CLA, you will be prompted
|
||||
to do so automatically.
|
||||
|
||||
You can download the CLAs here:
|
||||
|
||||
- [individual](http://nodered.org/cla/node-red-cla-individual.pdf)
|
||||
- [corporate](http://nodered.org/cla/node-red-cla-corporate.pdf)
|
||||
|
||||
If you are an IBMer, please contact us directly as the contribution process is
|
||||
slightly different.
|
||||
|
||||
### Coding standards
|
||||
|
||||
|
||||
139
Gruntfile.js
139
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,6 +41,17 @@ module.exports = function(grunt) {
|
||||
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
||||
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
||||
},
|
||||
mocha_istanbul: {
|
||||
options: {
|
||||
globals: ['expect'],
|
||||
timeout: 3000,
|
||||
ignoreLeaks: false,
|
||||
ui: 'bdd',
|
||||
reportFormats: ['lcov'],
|
||||
print: 'both'
|
||||
},
|
||||
coverage: { src: ['test/**/*_spec.js'] }
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc:true
|
||||
@@ -98,7 +109,7 @@ module.exports = function(grunt) {
|
||||
src: [
|
||||
// Ensure editor source files are concatenated in
|
||||
// the right order
|
||||
"editor/js/main.js",
|
||||
"editor/js/red.js",
|
||||
"editor/js/events.js",
|
||||
"editor/js/i18n.js",
|
||||
"editor/js/settings.js",
|
||||
@@ -110,13 +121,19 @@ module.exports = function(grunt) {
|
||||
"editor/js/nodes.js",
|
||||
"editor/js/history.js",
|
||||
"editor/js/validators.js",
|
||||
"editor/js/ui/utils.js",
|
||||
"editor/js/ui/common/editableList.js",
|
||||
"editor/js/ui/common/checkboxSet.js",
|
||||
"editor/js/ui/common/menu.js",
|
||||
"editor/js/ui/common/panels.js",
|
||||
"editor/js/ui/common/popover.js",
|
||||
"editor/js/ui/common/searchBox.js",
|
||||
"editor/js/ui/common/tabs.js",
|
||||
"editor/js/ui/common/stack.js",
|
||||
"editor/js/ui/common/typedInput.js",
|
||||
"editor/js/ui/actions.js",
|
||||
"editor/js/ui/deploy.js",
|
||||
"editor/js/ui/diff.js",
|
||||
"editor/js/ui/keyboard.js",
|
||||
"editor/js/ui/workspaces.js",
|
||||
"editor/js/ui/view.js",
|
||||
@@ -131,7 +148,9 @@ module.exports = function(grunt) {
|
||||
"editor/js/ui/library.js",
|
||||
"editor/js/ui/notifications.js",
|
||||
"editor/js/ui/search.js",
|
||||
"editor/js/ui/typeSearch.js",
|
||||
"editor/js/ui/subflow.js",
|
||||
"editor/js/ui/userSettings.js",
|
||||
"editor/js/ui/touch/radialMenu.js"
|
||||
],
|
||||
dest: "public/red/red.js"
|
||||
@@ -150,6 +169,14 @@ module.exports = function(grunt) {
|
||||
"public/vendor/vendor.css": [
|
||||
// TODO: resolve relative resource paths in
|
||||
// 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 +184,10 @@ module.exports = function(grunt) {
|
||||
uglify: {
|
||||
build: {
|
||||
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 +213,18 @@ module.exports = function(grunt) {
|
||||
'red/api/locales/en-US/editor.json',
|
||||
'red/runtime/locales/en-US/runtime.json'
|
||||
]
|
||||
},
|
||||
keymaps: {
|
||||
src: [
|
||||
'editor/js/keymap.json'
|
||||
]
|
||||
}
|
||||
},
|
||||
attachCopyright: {
|
||||
js: {
|
||||
src: [
|
||||
'public/red/red.min.js'
|
||||
'public/red/red.min.js',
|
||||
'public/red/main.min.js'
|
||||
]
|
||||
},
|
||||
css: {
|
||||
@@ -218,7 +254,7 @@ module.exports = function(grunt) {
|
||||
files: [
|
||||
'editor/js/**/*.js'
|
||||
],
|
||||
tasks: ['concat','uglify','attachCopyright:js']
|
||||
tasks: ['copy:build','concat','uglify','attachCopyright:js']
|
||||
},
|
||||
sass: {
|
||||
files: [
|
||||
@@ -234,6 +270,12 @@ module.exports = function(grunt) {
|
||||
],
|
||||
tasks: ['jsonlint:messages']
|
||||
},
|
||||
keymaps: {
|
||||
files: [
|
||||
'editor/js/keymap.json'
|
||||
],
|
||||
tasks: ['jsonlint:keymaps','copy:build']
|
||||
},
|
||||
misc: {
|
||||
files: [
|
||||
'CHANGELOG.md'
|
||||
@@ -267,40 +309,49 @@ module.exports = function(grunt) {
|
||||
|
||||
copy: {
|
||||
build: {
|
||||
files:[{
|
||||
cwd: 'editor/images',
|
||||
src: '**',
|
||||
expand: true,
|
||||
dest: 'public/red/images/'
|
||||
},
|
||||
{
|
||||
cwd: 'editor/vendor',
|
||||
src: [
|
||||
'ace/**',
|
||||
//'bootstrap/css/**',
|
||||
'bootstrap/img/**',
|
||||
'jquery/css/**',
|
||||
'font-awesome/**'
|
||||
],
|
||||
expand: true,
|
||||
dest: 'public/vendor/'
|
||||
},
|
||||
{
|
||||
cwd: 'editor/icons',
|
||||
src: '**',
|
||||
expand: true,
|
||||
dest: 'public/icons/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
src: ['editor/index.html','editor/favicon.ico'],
|
||||
dest: 'public/',
|
||||
flatten: true
|
||||
},
|
||||
{
|
||||
src: 'CHANGELOG.md',
|
||||
dest: 'public/red/about'
|
||||
}
|
||||
files:[
|
||||
{
|
||||
src: 'editor/js/main.js',
|
||||
dest: 'public/red/main.js'
|
||||
},
|
||||
{
|
||||
src: 'editor/js/keymap.json',
|
||||
dest: 'public/red/keymap.json'
|
||||
},
|
||||
{
|
||||
cwd: 'editor/images',
|
||||
src: '**',
|
||||
expand: true,
|
||||
dest: 'public/red/images/'
|
||||
},
|
||||
{
|
||||
cwd: 'editor/vendor',
|
||||
src: [
|
||||
'ace/**',
|
||||
//'bootstrap/css/**',
|
||||
'bootstrap/img/**',
|
||||
'jquery/css/**',
|
||||
'font-awesome/**'
|
||||
],
|
||||
expand: true,
|
||||
dest: 'public/vendor/'
|
||||
},
|
||||
{
|
||||
cwd: 'editor/icons',
|
||||
src: '**',
|
||||
expand: true,
|
||||
dest: 'public/icons/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
src: ['editor/index.html','editor/favicon.ico'],
|
||||
dest: 'public/',
|
||||
flatten: true
|
||||
},
|
||||
{
|
||||
src: 'CHANGELOG.md',
|
||||
dest: 'public/red/about'
|
||||
}
|
||||
]
|
||||
},
|
||||
release: {
|
||||
@@ -361,11 +412,12 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-chmod');
|
||||
grunt.loadNpmTasks('grunt-jsonlint');
|
||||
grunt.loadNpmTasks('grunt-mocha-istanbul');
|
||||
|
||||
grunt.registerMultiTask('attachCopyright', function() {
|
||||
var files = this.data.src;
|
||||
var copyright = "/**\n"+
|
||||
" * Copyright 2013, 2015 IBM Corp.\n"+
|
||||
" * Copyright JS Foundation and other contributors, http://js.foundation\n"+
|
||||
" *\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"+
|
||||
@@ -381,7 +433,7 @@ module.exports = function(grunt) {
|
||||
" **/\n";
|
||||
|
||||
if (files) {
|
||||
for (var i=0;i<files.length;i++) {
|
||||
for (var i=0; i<files.length; i++) {
|
||||
var file = files[i];
|
||||
if (!grunt.file.exists(file)) {
|
||||
grunt.log.warn('File '+ file + ' not found');
|
||||
@@ -426,7 +478,7 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.registerTask('build',
|
||||
'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',
|
||||
'Developer mode: run node-red, watch for source changes and build/restart',
|
||||
@@ -436,4 +488,7 @@ module.exports = function(grunt) {
|
||||
'Create distribution zip file',
|
||||
['build','clean:release','copy:release','chmod:release','compress:release']);
|
||||
|
||||
grunt.registerTask('coverage',
|
||||
'Run Istanbul code test coverage task',
|
||||
['build','mocha_istanbul']);
|
||||
};
|
||||
|
||||
1
LICENSE
1
LICENSE
@@ -1,3 +1,4 @@
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
|
||||
@@ -60,13 +60,15 @@ This project adheres to the [Contributor Covenant 1.4](http://contributor-covena
|
||||
|
||||
## 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)
|
||||
* 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 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
|
||||
#
|
||||
# Copyright 2015 IBM Corp.
|
||||
# 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.
|
||||
|
||||
BIN
editor/icons/parser-yaml.png
Normal file
BIN
editor/icons/parser-yaml.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 423 B |
BIN
editor/images/typedInput/bin.png
Normal file
BIN
editor/images/typedInput/bin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 638 B |
BIN
editor/images/typedInput/expr.png
Normal file
BIN
editor/images/typedInput/expr.png
Normal file
Binary file not shown.
|
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");
|
||||
* 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");
|
||||
* 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,289 @@
|
||||
RED.history = (function() {
|
||||
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[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.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 {
|
||||
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 {
|
||||
//TODO: this function is a placeholder until there is a 'save' event that can be listened to
|
||||
markAllDirty: function() {
|
||||
@@ -34,260 +317,7 @@ RED.history = (function() {
|
||||
},
|
||||
pop: function() {
|
||||
var ev = undo_history.pop();
|
||||
var i;
|
||||
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();
|
||||
}
|
||||
undoEvent(ev);
|
||||
},
|
||||
peek: function() {
|
||||
return undo_history[undo_history.length-1];
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,11 +19,11 @@ RED.i18n = (function() {
|
||||
return {
|
||||
init: function(done) {
|
||||
i18n.init({
|
||||
resGetPath: 'locales/__ns__',
|
||||
resGetPath: 'locales/__ns__?lng=__lng__',
|
||||
dynamicLoad: false,
|
||||
load:'current',
|
||||
ns: {
|
||||
namespaces: ["editor","node-red"],
|
||||
namespaces: ["editor","node-red","jsonata","infotips"],
|
||||
defaultNs: "editor"
|
||||
},
|
||||
fallbackLng: ['en-US'],
|
||||
@@ -38,6 +38,31 @@ RED.i18n = (function() {
|
||||
},
|
||||
loadCatalog: function(namespace,done) {
|
||||
i18n.loadNamespace(namespace,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();
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
39
editor/js/keymap.json
Normal file
39
editor/js/keymap.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"*": {
|
||||
"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-e": "core:show-export-dialog",
|
||||
"ctrl-i": "core:show-import-dialog",
|
||||
"ctrl-space": "core:toggle-sidebar",
|
||||
"ctrl-,": "core:show-user-settings"
|
||||
},
|
||||
"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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,8 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
var RED = (function() {
|
||||
|
||||
(function() {
|
||||
|
||||
function loadNodeList() {
|
||||
$.ajax({
|
||||
@@ -25,23 +24,7 @@ var RED = (function() {
|
||||
url: 'nodes',
|
||||
success: function(data) {
|
||||
RED.nodes.setNodeList(data);
|
||||
|
||||
var nsCount = 0;
|
||||
for (var i=0;i<data.length;i++) {
|
||||
var ns = data[i];
|
||||
if (ns.module != "node-red") {
|
||||
nsCount++;
|
||||
RED.i18n.loadCatalog(ns.id, function() {
|
||||
nsCount--;
|
||||
if (nsCount === 0) {
|
||||
loadNodes();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (nsCount === 0) {
|
||||
loadNodes();
|
||||
}
|
||||
RED.i18n.loadNodeCatalogs(loadNodes);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -80,29 +63,48 @@ var RED = (function() {
|
||||
if (/^#flow\/.+$/.test(currentHash)) {
|
||||
RED.workspaces.show(currentHash.substring(6));
|
||||
}
|
||||
|
||||
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 (msg.text) {
|
||||
var text = RED._(msg.text,{default:msg.text});
|
||||
if (!persistentNotifications.hasOwnProperty(notificationId)) {
|
||||
persistentNotifications[notificationId] = RED.notify(text,msg.type,msg.timeout === undefined,msg.timeout);
|
||||
} else {
|
||||
persistentNotifications[notificationId].update(text,msg.timeout);
|
||||
}
|
||||
} 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")) {
|
||||
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
||||
if (msg.text[0] !== ".") {
|
||||
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
||||
}
|
||||
}
|
||||
node.status = msg;
|
||||
if (statusEnabled) {
|
||||
node.dirty = true;
|
||||
RED.view.redraw();
|
||||
}
|
||||
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];
|
||||
msg.forEach(function(m) {
|
||||
var id = m.id;
|
||||
RED.nodes.addNodeSet(m);
|
||||
addedTypes = addedTypes.concat(m.types);
|
||||
@@ -111,7 +113,7 @@ var RED = (function() {
|
||||
$("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");
|
||||
@@ -146,6 +148,9 @@ var RED = (function() {
|
||||
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();
|
||||
@@ -165,20 +170,13 @@ var RED = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
var statusEnabled = false;
|
||||
function toggleStatus(state) {
|
||||
statusEnabled = state;
|
||||
RED.view.status(statusEnabled);
|
||||
}
|
||||
|
||||
function loadEditor() {
|
||||
|
||||
var menuOptions = [];
|
||||
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-snap-grid",label:RED._("menu.label.view.snapGrid"),toggle:true,onselect:RED.view.toggleSnapGrid},
|
||||
{id:"menu-item-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:toggleStatus, selected: true},
|
||||
null,
|
||||
// {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",setting:"view-snap-grid",label:RED._("menu.label.view.snapGrid"),toggle:true,onselect:"core:toggle-snap-grid"},
|
||||
// {id:"menu-item-status",setting:"node-show-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:"core:toggle-status", selected: true},
|
||||
//null,
|
||||
// {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-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("ltr")}}},
|
||||
@@ -186,66 +184,78 @@ 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")}}}
|
||||
// ]},
|
||||
// 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({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:[]}
|
||||
]});
|
||||
menuOptions.push({id:"menu-item-export",label:RED._("menu.label.export"),disabled:true,options:[
|
||||
{id:"menu-item-export-clipboard",label:RED._("menu.label.clipboard"),disabled:true,onselect:RED.clipboard.export},
|
||||
{id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:RED.library.export}
|
||||
{id:"menu-item-export-clipboard",label:RED._("menu.label.clipboard"),disabled:true,onselect:"core:show-export-dialog"},
|
||||
{id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:"core:library-export"}
|
||||
]});
|
||||
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({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:[
|
||||
{id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:RED.workspaces.add},
|
||||
{id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:RED.workspaces.edit},
|
||||
{id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:RED.workspaces.remove}
|
||||
{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:"core:edit-flow"},
|
||||
{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: [
|
||||
{id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:RED.subflow.createSubflow},
|
||||
{id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:RED.subflow.convertToSubflow},
|
||||
{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:"core:convert-to-subflow"},
|
||||
]});
|
||||
menuOptions.push(null);
|
||||
if (RED.settings.theme('palette.editable') !== false) {
|
||||
RED.palette.editor.init();
|
||||
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:RED.palette.editor.show});
|
||||
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:"core:manage-palette"});
|
||||
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.userSettings"),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",
|
||||
label: RED.settings.theme("menu.menu-item-help.label","Node-RED website"),
|
||||
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.library.init();
|
||||
RED.keyboard.init();
|
||||
RED.palette.init();
|
||||
if (RED.settings.theme('palette.editable') !== false) {
|
||||
RED.palette.editor.init();
|
||||
}
|
||||
|
||||
RED.sidebar.init();
|
||||
RED.subflow.init();
|
||||
RED.workspaces.init();
|
||||
RED.clipboard.init();
|
||||
RED.search.init();
|
||||
RED.view.init();
|
||||
RED.editor.init();
|
||||
RED.diff.init();
|
||||
|
||||
RED.menu.init({id:"btn-sidemenu",options: menuOptions});
|
||||
|
||||
RED.deploy.init(RED.settings.theme("deployButton",null));
|
||||
|
||||
RED.keyboard.add("workspace", /* ? */ 191,{shift:true},function() {RED.keyboard.showHelp();d3.event.preventDefault();});
|
||||
RED.actions.add("core:show-about", showAbout);
|
||||
|
||||
RED.comms.connect();
|
||||
|
||||
$("#main-container").show();
|
||||
$(".header-toolbar").show();
|
||||
|
||||
|
||||
loadNodeList();
|
||||
}
|
||||
|
||||
@@ -261,8 +271,4 @@ var RED = (function() {
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,21 +24,13 @@ RED.nodes = (function() {
|
||||
var workspacesOrder =[];
|
||||
var subflows = {};
|
||||
var loadedFlowVersion = null;
|
||||
var pending = {
|
||||
deleted: {},
|
||||
added: {}
|
||||
};
|
||||
|
||||
var initialLoad;
|
||||
|
||||
var dirty = false;
|
||||
|
||||
function setDirty(d) {
|
||||
dirty = d;
|
||||
if (!d) {
|
||||
pending = {
|
||||
deleted: {},
|
||||
added: {}
|
||||
};
|
||||
}
|
||||
RED.events.emit("nodes:change",{dirty:dirty});
|
||||
}
|
||||
|
||||
@@ -50,6 +42,10 @@ RED.nodes = (function() {
|
||||
var nodeDefinitions = {};
|
||||
|
||||
var exports = {
|
||||
setModulePendingUpdated: function(module,version) {
|
||||
moduleList[module].pending_version = version;
|
||||
RED.events.emit("registry:module-updated",{module:module,version:version});
|
||||
},
|
||||
getModule: function(module) {
|
||||
return moduleList[module];
|
||||
},
|
||||
@@ -62,6 +58,9 @@ RED.nodes = (function() {
|
||||
getNodeList: function() {
|
||||
return nodeList;
|
||||
},
|
||||
getNodeTypes: function() {
|
||||
return Object.keys(nodeDefinitions);
|
||||
},
|
||||
setNodeList: function(list) {
|
||||
nodeList = [];
|
||||
for(var i=0;i<list.length;i++) {
|
||||
@@ -83,6 +82,9 @@ RED.nodes = (function() {
|
||||
local:ns.local,
|
||||
sets:{}
|
||||
};
|
||||
if (ns.pending_version) {
|
||||
moduleList[ns.module].pending_version = ns.pending_version;
|
||||
}
|
||||
moduleList[ns.module].sets[ns.name] = ns;
|
||||
RED.events.emit("registry:node-set-added",ns);
|
||||
},
|
||||
@@ -120,6 +122,7 @@ RED.nodes = (function() {
|
||||
},
|
||||
registerNodeType: function(nt,def) {
|
||||
nodeDefinitions[nt] = def;
|
||||
def.type = nt;
|
||||
if (def.category != "subflows") {
|
||||
def.set = nodeSets[typeToId[nt]];
|
||||
nodeSets[typeToId[nt]].added = true;
|
||||
@@ -133,10 +136,15 @@ RED.nodes = (function() {
|
||||
}
|
||||
def["_"] = function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
var original = args[0];
|
||||
if (args[0].indexOf(":") === -1) {
|
||||
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
|
||||
@@ -165,11 +173,14 @@ RED.nodes = (function() {
|
||||
function addNode(n) {
|
||||
if (n.type.indexOf("subflow") !== 0) {
|
||||
n["_"] = n._def._;
|
||||
} else {
|
||||
n["_"] = RED._;
|
||||
}
|
||||
if (n._def.category == "config") {
|
||||
configNodes[n.id] = n;
|
||||
} else {
|
||||
n.ports = [];
|
||||
if (n.wires && (n.wires.length > n.outputs)) { n.outputs = n.wires.length; }
|
||||
if (n.outputs) {
|
||||
for (var i=0;i<n.outputs;i++) {
|
||||
n.ports.push(i);
|
||||
@@ -186,8 +197,6 @@ RED.nodes = (function() {
|
||||
}
|
||||
nodes.push(n);
|
||||
}
|
||||
delete pending.deleted[n.id];
|
||||
pending.added[n.id] = true;
|
||||
RED.events.emit('nodes:add',n);
|
||||
}
|
||||
function addLink(l) {
|
||||
@@ -253,12 +262,6 @@ RED.nodes = (function() {
|
||||
if (node && node._def.onremove) {
|
||||
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};
|
||||
}
|
||||
|
||||
@@ -271,11 +274,11 @@ RED.nodes = (function() {
|
||||
|
||||
function addWorkspace(ws) {
|
||||
workspaces[ws.id] = ws;
|
||||
pending.added[ws.id] = true;
|
||||
delete pending.deleted[ws.id];
|
||||
ws._def = {
|
||||
defaults: {
|
||||
label: {value:""}
|
||||
label: {value:""},
|
||||
disabled: {value: false},
|
||||
info: {value: ""}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -310,8 +313,6 @@ RED.nodes = (function() {
|
||||
var result = removeNode(removedNodes[n].id);
|
||||
removedLinks = removedLinks.concat(result.links);
|
||||
}
|
||||
pending.deleted[id] = true;
|
||||
delete pending.added[id]
|
||||
return {nodes:removedNodes,links:removedLinks};
|
||||
}
|
||||
|
||||
@@ -332,17 +333,7 @@ RED.nodes = (function() {
|
||||
});
|
||||
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;
|
||||
delete pending.deleted[sf.id];
|
||||
pending.added[sf.id] = true;
|
||||
RED.nodes.registerType("subflow:"+sf.id, {
|
||||
defaults:{name:{value:""}},
|
||||
info: sf.info,
|
||||
@@ -354,20 +345,19 @@ RED.nodes = (function() {
|
||||
label: function() { return this.name||RED.nodes.subflow(sf.id).name },
|
||||
labelStyle: function() { return this.name?"node_label_italic":""; },
|
||||
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:{
|
||||
module: "node-red"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
sf._def = RED.nodes.getType("subflow:"+sf.id);
|
||||
}
|
||||
function getSubflow(id) {
|
||||
return subflows[id];
|
||||
}
|
||||
function removeSubflow(sf) {
|
||||
delete subflows[sf.id];
|
||||
delete pending.added[sf.id];
|
||||
pending.deleted[sf.id] = true;
|
||||
registry.removeNodeType("subflow:"+sf.id);
|
||||
}
|
||||
|
||||
@@ -438,6 +428,7 @@ RED.nodes = (function() {
|
||||
node.id = n.id;
|
||||
node.type = n.type;
|
||||
node.z = n.z;
|
||||
|
||||
if (node.type == "unknown") {
|
||||
for (var p in n._orig) {
|
||||
if (n._orig.hasOwnProperty(p)) {
|
||||
@@ -485,6 +476,13 @@ RED.nodes = (function() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@@ -522,16 +520,23 @@ RED.nodes = (function() {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
return node;
|
||||
}
|
||||
/**
|
||||
* Converts the current node selection to an exportable JSON Object
|
||||
**/
|
||||
function createExportableNodeSet(set) {
|
||||
function createExportableNodeSet(set, exportedSubflows, exportedConfigNodes) {
|
||||
var nns = [];
|
||||
var exportedConfigNodes = {};
|
||||
var exportedSubflows = {};
|
||||
exportedConfigNodes = exportedConfigNodes || {};
|
||||
exportedSubflows = exportedSubflows || {};
|
||||
for (var n=0;n<set.length;n++) {
|
||||
var node = set[n];
|
||||
if (node.type.substring(0,8) == "subflow:") {
|
||||
@@ -545,7 +550,7 @@ RED.nodes = (function() {
|
||||
subflowSet.push(n);
|
||||
}
|
||||
});
|
||||
var exportableSubflow = createExportableNodeSet(subflowSet);
|
||||
var exportableSubflow = createExportableNodeSet(subflowSet, exportedSubflows, exportedConfigNodes);
|
||||
nns = exportableSubflow.concat(nns);
|
||||
}
|
||||
}
|
||||
@@ -694,6 +699,9 @@ RED.nodes = (function() {
|
||||
if (!$.isArray(newNodes)) {
|
||||
newNodes = [newNodes];
|
||||
}
|
||||
if (!initialLoad) {
|
||||
initialLoad = JSON.parse(JSON.stringify(newNodes));
|
||||
}
|
||||
var unknownTypes = [];
|
||||
for (i=0;i<newNodes.length;i++) {
|
||||
n = newNodes[i];
|
||||
@@ -719,17 +727,19 @@ RED.nodes = (function() {
|
||||
}
|
||||
|
||||
var activeWorkspace = RED.workspaces.active();
|
||||
//TODO: check the z of the subflow instance and check _that_ if it exists
|
||||
var activeSubflow = getSubflow(activeWorkspace);
|
||||
if (activeSubflow) {
|
||||
for (i=0;i<newNodes.length;i++) {
|
||||
var m = /^subflow:(.+)$/.exec(newNodes[i].type);
|
||||
if (m) {
|
||||
var subflowId = m[1];
|
||||
for (i=0;i<newNodes.length;i++) {
|
||||
var m = /^subflow:(.+)$/.exec(newNodes[i].type);
|
||||
if (m) {
|
||||
var subflowId = m[1];
|
||||
var parent = getSubflow(newNodes[i].z || activeWorkspace);
|
||||
if (parent) {
|
||||
var err;
|
||||
if (subflowId === activeSubflow.id) {
|
||||
if (subflowId === parent.id) {
|
||||
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"));
|
||||
}
|
||||
if (err) {
|
||||
@@ -895,7 +905,17 @@ RED.nodes = (function() {
|
||||
if (n.type !== "workspace" && n.type !== "tab" && n.type !== "subflow") {
|
||||
def = registry.getNodeType(n.type);
|
||||
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,
|
||||
changed:false,
|
||||
_config:{}
|
||||
};
|
||||
if (createNewIds) {
|
||||
if (subflow_blacklist[n.z]) {
|
||||
continue;
|
||||
@@ -1011,7 +1031,6 @@ RED.nodes = (function() {
|
||||
"link out":"links"
|
||||
}
|
||||
|
||||
|
||||
// Remap all wires and config node references
|
||||
for (i=0;i<new_nodes.length;i++) {
|
||||
n = new_nodes[i];
|
||||
@@ -1019,10 +1038,14 @@ RED.nodes = (function() {
|
||||
for (var w1=0;w1<n.wires.length;w1++) {
|
||||
var wires = (n.wires[w1] instanceof Array)?n.wires[w1]:[n.wires[w1]];
|
||||
for (var w2=0;w2<wires.length;w2++) {
|
||||
if (wires[w2] in node_map) {
|
||||
var link = {source:n,sourcePort:w1,target:node_map[wires[w2]]};
|
||||
addLink(link);
|
||||
new_links.push(link);
|
||||
if (node_map.hasOwnProperty(wires[w2])) {
|
||||
if (n.z === node_map[wires[w2]].z) {
|
||||
var link = {source:n,sourcePort:w1,target:node_map[wires[w2]]};
|
||||
addLink(link);
|
||||
new_links.push(link);
|
||||
} else {
|
||||
console.log("Warning: dropping link that crosses tabs:",n.id,"->",node_map[wires[w2]].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1161,6 +1184,38 @@ 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;
|
||||
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
RED.palette.refresh();
|
||||
RED.workspaces.refresh();
|
||||
RED.sidebar.config.refresh();
|
||||
|
||||
// var node_defs = {};
|
||||
// var nodes = [];
|
||||
// var configNodes = {};
|
||||
// var links = [];
|
||||
// var defaultWorkspace;
|
||||
// var workspaces = {};
|
||||
// var workspacesOrder =[];
|
||||
// var subflows = {};
|
||||
// var loadedFlowVersion = null;
|
||||
}
|
||||
|
||||
return {
|
||||
registry:registry,
|
||||
setNodeList: registry.setNodeList,
|
||||
@@ -1177,6 +1232,7 @@ RED.nodes = (function() {
|
||||
|
||||
add: addNode,
|
||||
remove: removeNode,
|
||||
clear: clear,
|
||||
|
||||
addLink: addLink,
|
||||
removeLink: removeLink,
|
||||
@@ -1225,14 +1281,19 @@ RED.nodes = (function() {
|
||||
node: getNode,
|
||||
|
||||
version: flowVersion,
|
||||
originalFlow: function(flow) {
|
||||
if (flow === undefined) {
|
||||
return initialLoad;
|
||||
} else {
|
||||
initialLoad = flow;
|
||||
}
|
||||
},
|
||||
|
||||
filterNodes: filterNodes,
|
||||
filterLinks: filterLinks,
|
||||
|
||||
import: importNodes,
|
||||
|
||||
pending: function() { return pending },
|
||||
|
||||
getAllFlowNodes: getAllFlowNodes,
|
||||
createExportableNodeSet: createExportableNodeSet,
|
||||
createCompleteNodeSet: createCompleteNodeSet,
|
||||
|
||||
16
editor/js/red.js
Normal file
16
editor/js/red.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
var RED = {};
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -102,7 +102,7 @@ RED.settings = (function () {
|
||||
url: 'settings',
|
||||
success: function (data) {
|
||||
setProperties(data);
|
||||
if (RED.settings.user && RED.settings.user.anonymous) {
|
||||
if (!RED.settings.user || RED.settings.user.anonymous) {
|
||||
RED.settings.remove("auth-tokens");
|
||||
}
|
||||
console.log("Node-RED: " + data.version);
|
||||
|
||||
@@ -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");
|
||||
* 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
35
editor/js/ui/actions.js
Normal file
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ RED.clipboard = (function() {
|
||||
var dialogContainer;
|
||||
var exportNodesDialog;
|
||||
var importNodesDialog;
|
||||
var disabled = false;
|
||||
|
||||
function setupDialogs() {
|
||||
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() {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
dialogContainer.empty();
|
||||
dialogContainer.append($(importNodesDialog));
|
||||
dialogContainer.i18n();
|
||||
@@ -153,13 +157,19 @@ RED.clipboard = (function() {
|
||||
}
|
||||
|
||||
function exportNodes() {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
dialogContainer.empty();
|
||||
dialogContainer.append($(exportNodesDialog));
|
||||
dialogContainer.i18n();
|
||||
var format = RED.settings.flowFilePretty ? "export-format-full" : "export-format-mini";
|
||||
|
||||
$("#export-format-group > a").click(function(evt) {
|
||||
evt.preventDefault();
|
||||
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
||||
$("#clipboard-export").focus();
|
||||
return;
|
||||
}
|
||||
$(this).parent().children().removeClass('selected');
|
||||
@@ -169,18 +179,21 @@ RED.clipboard = (function() {
|
||||
if (flow.length > 0) {
|
||||
var nodes = JSON.parse(flow);
|
||||
|
||||
var format = $(this).attr('id');
|
||||
format = $(this).attr('id');
|
||||
if (format === 'export-format-full') {
|
||||
flow = JSON.stringify(nodes,null,4);
|
||||
} else {
|
||||
flow = JSON.stringify(nodes);
|
||||
}
|
||||
$("#clipboard-export").val(flow);
|
||||
$("#clipboard-export").focus();
|
||||
}
|
||||
});
|
||||
|
||||
$("#export-range-group > a").click(function(evt) {
|
||||
evt.preventDefault();
|
||||
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
||||
$("#clipboard-export").focus();
|
||||
return;
|
||||
}
|
||||
$(this).parent().children().removeClass('selected');
|
||||
@@ -201,7 +214,7 @@ RED.clipboard = (function() {
|
||||
nodes = RED.nodes.createCompleteNodeSet(false);
|
||||
}
|
||||
if (nodes !== null) {
|
||||
if (RED.settings.flowFilePretty) {
|
||||
if (format === "export-format-full") {
|
||||
flow = JSON.stringify(nodes,null,4);
|
||||
} else {
|
||||
flow = JSON.stringify(nodes);
|
||||
@@ -213,6 +226,7 @@ RED.clipboard = (function() {
|
||||
$("#export-copy").addClass('disabled');
|
||||
}
|
||||
$("#clipboard-export").val(flow);
|
||||
$("#clipboard-export").focus();
|
||||
})
|
||||
|
||||
$("#clipboard-dialog-ok").hide();
|
||||
@@ -226,7 +240,7 @@ RED.clipboard = (function() {
|
||||
$("#export-range-selected").addClass('disabled').removeClass('selected');
|
||||
$("#export-range-flow").click();
|
||||
}
|
||||
if (RED.settings.flowFilePretty) {
|
||||
if (format === "export-format-full") {
|
||||
$("#export-format-full").click();
|
||||
} else {
|
||||
$("#export-format-mini").click();
|
||||
@@ -242,27 +256,58 @@ RED.clipboard = (function() {
|
||||
});
|
||||
dialog.dialog("option","title",RED._("clipboard.exportNodes")).dialog( "open" );
|
||||
|
||||
setTimeout(function() {
|
||||
$("#clipboard-export").focus();
|
||||
if (!document.queryCommandEnabled("copy")) {
|
||||
$("#clipboard-dialog-cancel").hide();
|
||||
$("#clipboard-dialog-close").show();
|
||||
} else {
|
||||
$("#clipboard-dialog-cancel").show();
|
||||
$("#clipboard-dialog-copy").show();
|
||||
}
|
||||
|
||||
},0);
|
||||
$("#clipboard-export").focus();
|
||||
if (!document.queryCommandSupported("copy")) {
|
||||
$("#clipboard-dialog-cancel").hide();
|
||||
$("#clipboard-dialog-close").show();
|
||||
} else {
|
||||
$("#clipboard-dialog-cancel").show();
|
||||
$("#clipboard-dialog-copy").show();
|
||||
}
|
||||
}
|
||||
|
||||
function hideDropTarget() {
|
||||
$("#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.__encoded__ && value.hasOwnProperty('data') && value.hasOwnProperty('length')) {
|
||||
truncated = value.data.length !== value.length;
|
||||
return value.data;
|
||||
}
|
||||
}
|
||||
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 {
|
||||
init: function() {
|
||||
setupDialogs();
|
||||
|
||||
$('<input type="text" id="clipboard-hidden">').appendTo("body");
|
||||
|
||||
RED.events.on("view:selection-changed",function(selection) {
|
||||
if (!selection.nodes) {
|
||||
RED.menu.setDisabled("menu-item-export",true);
|
||||
@@ -274,18 +319,30 @@ RED.clipboard = (function() {
|
||||
RED.menu.setDisabled("menu-item-export-library",false);
|
||||
}
|
||||
});
|
||||
RED.keyboard.add("workspace", /* e */ 69,{ctrl:true},function(){exportNodes();d3.event.preventDefault();});
|
||||
RED.keyboard.add("workspace", /* i */ 73,{ctrl:true},function(){importNodes();d3.event.preventDefault();});
|
||||
|
||||
RED.actions.add("core:show-export-dialog",exportNodes);
|
||||
RED.actions.add("core:show-import-dialog",importNodes);
|
||||
|
||||
|
||||
RED.events.on("editor:open",function() { disabled = true; });
|
||||
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.events.on("type-search:open",function() { disabled = true; });
|
||||
RED.events.on("type-search:close",function() { disabled = false; });
|
||||
|
||||
|
||||
$('#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'});
|
||||
RED.keyboard.add("*", /* ESCAPE */ 27,hideDropTarget);
|
||||
RED.keyboard.add("*", "escape" ,hideDropTarget);
|
||||
}
|
||||
});
|
||||
|
||||
$('#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();
|
||||
}
|
||||
})
|
||||
@@ -293,15 +350,30 @@ RED.clipboard = (function() {
|
||||
hideDropTarget();
|
||||
})
|
||||
.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();
|
||||
data = data.substring(data.indexOf('['),data.lastIndexOf(']')+1);
|
||||
RED.view.importNodes(data);
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
},
|
||||
import: importNodes,
|
||||
export: exportNodes
|
||||
export: exportNodes,
|
||||
copyText: copyText
|
||||
}
|
||||
})();
|
||||
|
||||
131
editor/js/ui/common/checkboxSet.js
Normal file
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");
|
||||
* 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
|
||||
* - addItem : function(row,index,itemData) - when an item is added
|
||||
* - 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:
|
||||
* - addItem(itemData)
|
||||
* - removeItem(itemData)
|
||||
@@ -34,6 +37,9 @@
|
||||
* - height(height)
|
||||
* - items()
|
||||
* - empty()
|
||||
* - filter(filter)
|
||||
* - sort(sort)
|
||||
* - length()
|
||||
*/
|
||||
$.widget( "nodered.editableList", {
|
||||
_create: function() {
|
||||
@@ -44,9 +50,19 @@
|
||||
this.uiContainer = this.element
|
||||
.wrap( "<div>" )
|
||||
.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');
|
||||
if (this.options.class) {
|
||||
this.topContainer.addClass(this.options.class);
|
||||
}
|
||||
|
||||
if (this.options.addButton !== false) {
|
||||
var addLabel;
|
||||
@@ -80,6 +96,11 @@
|
||||
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.uiHeight = this.element.height();
|
||||
@@ -164,7 +185,7 @@
|
||||
var that = this;
|
||||
var count = 0;
|
||||
if (!this.activeFilter) {
|
||||
this.element.children().show();
|
||||
return this.element.children().show();
|
||||
}
|
||||
var items = this.items();
|
||||
items.each(function (i,el) {
|
||||
@@ -234,7 +255,8 @@
|
||||
var deleteButton = $('<a/>',{href:"#",class:"red-ui-editableList-item-remove editor-button editor-button-small"}).appendTo(li);
|
||||
$('<i/>',{class:"fa fa-remove"}).appendTo(deleteButton);
|
||||
li.addClass("red-ui-editableList-item-removable");
|
||||
deleteButton.click(function() {
|
||||
deleteButton.click(function(evt) {
|
||||
evt.preventDefault();
|
||||
var data = row.data('data');
|
||||
li.addClass("red-ui-editableList-item-deleting")
|
||||
li.fadeOut(300, function() {
|
||||
@@ -266,6 +288,11 @@
|
||||
},0);
|
||||
}
|
||||
},
|
||||
addItems: function(items) {
|
||||
for (var i=0; i<items.length;i++) {
|
||||
this.addItem(items[i]);
|
||||
}
|
||||
},
|
||||
removeItem: function(data) {
|
||||
var items = this.element.children().filter(function(f) {
|
||||
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");
|
||||
* 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
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
|
||||
|
||||
RED.menu = (function() {
|
||||
|
||||
var menuItems = {};
|
||||
@@ -31,20 +28,30 @@ RED.menu = (function() {
|
||||
}
|
||||
|
||||
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) {
|
||||
link.addClass("active");
|
||||
opt.onselect.call(opt, true);
|
||||
triggerAction(opt.id,true);
|
||||
} else if (savedStateActive === false) {
|
||||
link.removeClass("active");
|
||||
opt.onselect.call(opt, false);
|
||||
triggerAction(opt.id,false);
|
||||
} else if (opt.hasOwnProperty("selected")) {
|
||||
if (opt.selected) {
|
||||
link.addClass("active");
|
||||
} else {
|
||||
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;
|
||||
|
||||
if (opt.onselect) {
|
||||
link.click(function() {
|
||||
link.click(function(e) {
|
||||
e.preventDefault();
|
||||
if ($(this).parent().hasClass("disabled")) {
|
||||
return;
|
||||
}
|
||||
@@ -107,10 +115,12 @@ RED.menu = (function() {
|
||||
setSelected(opt.id, !selected);
|
||||
}
|
||||
} else {
|
||||
opt.onselect.call(opt);
|
||||
triggerAction(opt.id);
|
||||
}
|
||||
});
|
||||
setInitialState();
|
||||
if (opt.toggle) {
|
||||
setInitialState();
|
||||
}
|
||||
} else if (opt.href) {
|
||||
link.attr("target","_blank").attr("href",opt.href);
|
||||
} else if (!opt.options) {
|
||||
@@ -141,15 +151,13 @@ RED.menu = (function() {
|
||||
}
|
||||
function createMenu(options) {
|
||||
|
||||
var button = $("#"+options.id);
|
||||
var menuParent = $("#"+options.id);
|
||||
|
||||
//button.click(function(event) {
|
||||
// $("#"+options.id+"-submenu").show();
|
||||
// event.preventDefault();
|
||||
//});
|
||||
var topMenu = $("<ul/>",{id:options.id+"-submenu", class:"dropdown-menu pull-right"});
|
||||
|
||||
|
||||
var topMenu = $("<ul/>",{id:options.id+"-submenu", class:"dropdown-menu pull-right"}).insertAfter(button);
|
||||
if (menuParent.length === 1) {
|
||||
topMenu.insertAfter(menuParent);
|
||||
}
|
||||
|
||||
var lastAddedSeparator = false;
|
||||
for (var i=0;i<options.options.length;i++) {
|
||||
@@ -162,20 +170,27 @@ RED.menu = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return topMenu;
|
||||
}
|
||||
|
||||
function isSavedStateActive(id) {
|
||||
return RED.settings.get("menu-" + id);
|
||||
function triggerAction(id, args) {
|
||||
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) {
|
||||
return $("#" + id).hasClass("active");
|
||||
}
|
||||
|
||||
function setSavedState(id, state) {
|
||||
RED.settings.set("menu-" + id, state);
|
||||
}
|
||||
|
||||
function setSelected(id,state) {
|
||||
if (isSelected(id) == state) {
|
||||
return;
|
||||
@@ -187,9 +202,13 @@ RED.menu = (function() {
|
||||
$("#"+id).removeClass("active");
|
||||
}
|
||||
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) {
|
||||
@@ -231,16 +250,6 @@ RED.menu = (function() {
|
||||
var opt = menuItems[id];
|
||||
if (opt) {
|
||||
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,
|
||||
setSelected: setSelected,
|
||||
isSelected: isSelected,
|
||||
toggleSelected: toggleSelected,
|
||||
setDisabled: setDisabled,
|
||||
addItem: addItem,
|
||||
removeItem: removeItem,
|
||||
|
||||
81
editor/js/ui/common/panels.js
Normal file
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,26 +15,61 @@
|
||||
**/
|
||||
|
||||
RED.popover = (function() {
|
||||
|
||||
|
||||
var deltaSizes = {
|
||||
"default": {
|
||||
top: 10,
|
||||
leftRight: 17,
|
||||
leftLeft: 25
|
||||
},
|
||||
"small": {
|
||||
top: 5,
|
||||
leftRight: 8,
|
||||
leftLeft: 16
|
||||
}
|
||||
}
|
||||
function createPopover(options) {
|
||||
var target = options.target;
|
||||
|
||||
var direction = options.direction || "right";
|
||||
var trigger = options.trigger;
|
||||
var content = options.content;
|
||||
var delay = options.delay;
|
||||
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 active;
|
||||
var div;
|
||||
|
||||
var openPopup = function() {
|
||||
if (active) {
|
||||
div = $('<div class="red-ui-popover"></div>').html(content).appendTo("body");
|
||||
div = $('<div class="red-ui-popover red-ui-popover-'+direction+'"></div>').appendTo("body");
|
||||
if (size !== "default") {
|
||||
div.addClass("red-ui-popover-size-"+size);
|
||||
}
|
||||
if (typeof content === 'function') {
|
||||
content.call(res).appendTo(div);
|
||||
} else {
|
||||
div.html(content);
|
||||
}
|
||||
if (width !== "auto") {
|
||||
div.width(width);
|
||||
}
|
||||
|
||||
|
||||
var targetPos = target.offset();
|
||||
var targetWidth = target.width();
|
||||
var targetHeight = target.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.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});
|
||||
}
|
||||
|
||||
div.fadeIn("fast");
|
||||
}
|
||||
@@ -50,24 +85,45 @@ RED.popover = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
target.on('mouseenter',function(e) {
|
||||
clearTimeout(timer);
|
||||
active = true;
|
||||
timer = setTimeout(openPopup,delay.show);
|
||||
});
|
||||
target.on('mouseleave', function(e) {
|
||||
if (timer) {
|
||||
if (trigger === 'hover') {
|
||||
|
||||
target.on('mouseenter',function(e) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
active = false;
|
||||
setTimeout(closePopup,delay.hide);
|
||||
});
|
||||
active = true;
|
||||
timer = setTimeout(openPopup,delay.show);
|
||||
});
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
var res = {
|
||||
setContent: function(_content) {
|
||||
content = _content;
|
||||
},
|
||||
open: function () {
|
||||
active = true;
|
||||
openPopup();
|
||||
},
|
||||
close: function () {
|
||||
active = false;
|
||||
closePopup();
|
||||
}
|
||||
}
|
||||
target.data('popover',res);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,6 +91,9 @@
|
||||
} else {
|
||||
this.resultCount.text(val).show();
|
||||
}
|
||||
},
|
||||
change: function() {
|
||||
this._trigger("change");
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
119
editor/js/ui/common/stack.js
Normal file
119
editor/js/ui/common/stack.js
Normal file
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
var entries = [];
|
||||
|
||||
var visible = true;
|
||||
|
||||
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.content = $('<div></div>').appendTo(entry.container);
|
||||
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) {
|
||||
icon.addClass("expanded");
|
||||
} else {
|
||||
entry.content.hide();
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
icon.addClass("expanded");
|
||||
entry.content.slideDown(200);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
entry.collapse = function() {
|
||||
if (entry.isExpanded()) {
|
||||
icon.removeClass("expanded");
|
||||
entry.content.slideUp(200);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
entry.isExpanded = function() {
|
||||
return icon.hasClass("expanded");
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,10 +22,13 @@ RED.tabs = (function() {
|
||||
var currentTabWidth;
|
||||
var currentActiveTabWidth = 0;
|
||||
|
||||
var ul = $("#"+options.id);
|
||||
var ul = options.element || $("#"+options.id);
|
||||
var wrapper = ul.wrap( "<div>" ).parent();
|
||||
var scrollContainer = ul.wrap( "<div>" ).parent();
|
||||
wrapper.addClass("red-ui-tabs");
|
||||
if (options.vertical) {
|
||||
wrapper.addClass("red-ui-tabs-vertical");
|
||||
}
|
||||
if (options.addButton && typeof options.addButton === 'function') {
|
||||
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);
|
||||
@@ -73,6 +76,9 @@ RED.tabs = (function() {
|
||||
ul.children().addClass("red-ui-tab");
|
||||
|
||||
function onTabClick() {
|
||||
if (options.onclick) {
|
||||
options.onclick(tabs[$(this).attr('href').slice(1)]);
|
||||
}
|
||||
activateTab($(this));
|
||||
return false;
|
||||
}
|
||||
@@ -105,6 +111,9 @@ RED.tabs = (function() {
|
||||
if (typeof link === "string") {
|
||||
link = ul.find("a[href='#"+link+"']");
|
||||
}
|
||||
if (link.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (!link.parent().hasClass("active")) {
|
||||
ul.children().removeClass("active");
|
||||
ul.children().css({"transition": "width 100ms"});
|
||||
@@ -126,8 +135,23 @@ RED.tabs = (function() {
|
||||
},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() {
|
||||
if (options.vertical) {
|
||||
return;
|
||||
}
|
||||
var tabs = ul.find("li.red-ui-tab");
|
||||
var width = wrapper.width();
|
||||
var tabCount = tabs.size();
|
||||
@@ -197,6 +221,7 @@ RED.tabs = (function() {
|
||||
addTab: function(tab) {
|
||||
tabs[tab.id] = tab;
|
||||
var li = $("<li/>",{class:"red-ui-tab"}).appendTo(ul);
|
||||
li.attr('id',"red-ui-tab-"+(tab.id.replace(".","-")));
|
||||
li.data("tabId",tab.id);
|
||||
var link = $("<a/>",{href:"#"+tab.id, class:"red-ui-tab-label"}).appendTo(li);
|
||||
if (tab.icon) {
|
||||
@@ -212,6 +237,7 @@ RED.tabs = (function() {
|
||||
closeLink.append('<i class="fa fa-times" />');
|
||||
|
||||
closeLink.on("click",function(event) {
|
||||
event.preventDefault();
|
||||
removeTab(tab.id);
|
||||
});
|
||||
}
|
||||
@@ -303,6 +329,8 @@ RED.tabs = (function() {
|
||||
},
|
||||
removeTab: removeTab,
|
||||
activateTab: activateTab,
|
||||
nextTab: activateNextTab,
|
||||
previousTab: activatePreviousTab,
|
||||
resize: updateTabWidths,
|
||||
count: function() {
|
||||
return ul.find("li.red-ui-tab").size();
|
||||
@@ -314,7 +342,7 @@ RED.tabs = (function() {
|
||||
tabs[id].label = label;
|
||||
var tab = ul.find("a[href='#"+id+"']");
|
||||
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();
|
||||
},
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,87 +14,69 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
(function($) {
|
||||
function validateExpression(str) {
|
||||
var length = str.length;
|
||||
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 (!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;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
var allOptions = {
|
||||
msg: {value:"msg",label:"msg.",validate:validateExpression},
|
||||
flow: {value:"flow",label:"flow.",validate:validateExpression},
|
||||
global: {value:"global",label:"global.",validate:validateExpression},
|
||||
msg: {value:"msg",label:"msg.",validate:RED.utils.validatePropertyExpression},
|
||||
flow: {value:"flow",label:"flow.",validate:RED.utils.validatePropertyExpression},
|
||||
global: {value:"global",label:"global.",validate:RED.utils.validatePropertyExpression},
|
||||
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]+)?$/},
|
||||
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"},
|
||||
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);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
var nlsd = false;
|
||||
|
||||
@@ -117,7 +99,7 @@
|
||||
this.uiSelect = this.elementDiv.wrap( "<div>" ).parent();
|
||||
var attrStyle = this.element.attr('style');
|
||||
var m;
|
||||
if ((m = /width\s*:\s*(\d+%)/i.exec(attrStyle)) !== null) {
|
||||
if ((m = /width\s*:\s*(\d+(%|px))/i.exec(attrStyle)) !== null) {
|
||||
this.element.css('width','100%');
|
||||
this.uiSelect.width(m[1]);
|
||||
this.uiWidth = null;
|
||||
@@ -133,7 +115,7 @@
|
||||
|
||||
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);
|
||||
this.selectLabel = $('<span></span>').appendTo(this.selectTrigger);
|
||||
|
||||
@@ -160,32 +142,72 @@
|
||||
})
|
||||
this.selectTrigger.click(function(event) {
|
||||
event.preventDefault();
|
||||
if (that.typeList.length > 1) {
|
||||
that._showMenu(that.menu,that.selectTrigger);
|
||||
} else {
|
||||
that.element.focus();
|
||||
}
|
||||
that._showTypeMenu();
|
||||
});
|
||||
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'
|
||||
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.optionSelectLabel = $('<span></span>').prependTo(this.optionSelectTrigger);
|
||||
this.optionSelectTrigger = $('<button tabindex="0" class="red-ui-typedInput-option-trigger" style="display:inline-block"><span class="red-ui-typedInput-option-caret"><i class="fa fa-sort-desc"></i></span></button>').appendTo(this.uiSelect);
|
||||
this.optionSelectLabel = $('<span class="red-ui-typedInput-option-label"></span>').prependTo(this.optionSelectTrigger);
|
||||
this.optionSelectTrigger.click(function(event) {
|
||||
event.preventDefault();
|
||||
if (that.optionMenu) {
|
||||
that.optionMenu.css({
|
||||
minWidth:that.optionSelectLabel.width()
|
||||
});
|
||||
|
||||
that._showMenu(that.optionMenu,that.optionSelectLabel)
|
||||
that._showOptionSelectMenu();
|
||||
}).on('keydown', function(evt) {
|
||||
if (evt.keyCode === 40) {
|
||||
// Down
|
||||
that._showOptionSelectMenu();
|
||||
}
|
||||
}).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="fa fa-ellipsis-h"></i></button>').appendTo(this.uiSelect);
|
||||
|
||||
|
||||
this.type(this.options.default||this.typeList[0].value);
|
||||
},
|
||||
_showTypeMenu: function() {
|
||||
if (this.typeList.length > 1) {
|
||||
this._showMenu(this.menu,this.selectTrigger);
|
||||
this.menu.find("[value='"+this.propertyType+"']").focus();
|
||||
} else {
|
||||
this.element.focus();
|
||||
}
|
||||
},
|
||||
_showOptionSelectMenu: function() {
|
||||
if (this.optionMenu) {
|
||||
this.optionMenu.css({
|
||||
minWidth:this.optionSelectLabel.width()
|
||||
});
|
||||
|
||||
this._showMenu(this.optionMenu,this.optionSelectLabel);
|
||||
var selectedOption = this.optionMenu.find("[value='"+this.value()+"']");
|
||||
if (selectedOption.length === 0) {
|
||||
selectedOption = this.optionMenu.children(":first");
|
||||
}
|
||||
selectedOption.focus();
|
||||
|
||||
}
|
||||
},
|
||||
_hideMenu: function(menu) {
|
||||
$(document).off("mousedown.close-property-select");
|
||||
menu.hide();
|
||||
this.element.focus();
|
||||
if (this.elementDiv.is(":visible")) {
|
||||
this.element.focus();
|
||||
} else if (this.optionSelectTrigger.is(":visible")){
|
||||
this.optionSelectTrigger.focus();
|
||||
} else {
|
||||
this.selectTrigger.focus();
|
||||
}
|
||||
},
|
||||
_createMenu: function(opts,callback) {
|
||||
var that = this;
|
||||
@@ -194,7 +216,7 @@
|
||||
if (typeof opt === 'string') {
|
||||
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) {
|
||||
op.text(opt.label);
|
||||
}
|
||||
@@ -214,6 +236,21 @@
|
||||
display: "none",
|
||||
});
|
||||
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;
|
||||
|
||||
},
|
||||
@@ -267,13 +304,18 @@
|
||||
this.uiSelect.width(this.uiWidth);
|
||||
}
|
||||
if (this.typeMap[this.propertyType] && this.typeMap[this.propertyType].hasValue === false) {
|
||||
this.selectTrigger.css('width',"100%");
|
||||
this.selectTrigger.addClass("red-ui-typedInput-full-width");
|
||||
} else {
|
||||
this.selectTrigger.width('auto');
|
||||
this.selectTrigger.removeClass("red-ui-typedInput-full-width");
|
||||
var labelWidth = this._getLabelWidth(this.selectTrigger);
|
||||
this.elementDiv.css('left',labelWidth+"px");
|
||||
if (this.optionExpandButton.is(":visible")) {
|
||||
this.elementDiv.css('right',"22px");
|
||||
} else {
|
||||
this.elementDiv.css('right','0');
|
||||
}
|
||||
if (this.optionSelectTrigger) {
|
||||
this.optionSelectTrigger.css('left',(labelWidth+5)+"px");
|
||||
this.optionSelectTrigger.css({'left':(labelWidth)+"px",'width':'calc( 100% - '+labelWidth+'px )'});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -341,6 +383,9 @@
|
||||
this.selectLabel.text(opt.label);
|
||||
}
|
||||
if (opt.options) {
|
||||
if (this.optionExpandButton) {
|
||||
this.optionExpandButton.hide();
|
||||
}
|
||||
if (this.optionSelectTrigger) {
|
||||
this.optionSelectTrigger.show();
|
||||
this.elementDiv.hide();
|
||||
@@ -374,6 +419,16 @@
|
||||
}
|
||||
this.elementDiv.show();
|
||||
}
|
||||
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.element.trigger('change',this.propertyType,this.value());
|
||||
}
|
||||
if (image) {
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,13 +30,15 @@ RED.deploy = (function() {
|
||||
|
||||
var deploymentType = "full";
|
||||
|
||||
var deployInflight = false;
|
||||
|
||||
var currentDiff = null;
|
||||
|
||||
function changeDeploymentType(type) {
|
||||
deploymentType = type;
|
||||
$("#btn-deploy-icon").attr("src",deploymentTypes[type].img);
|
||||
}
|
||||
|
||||
var currentDiff = null;
|
||||
|
||||
/**
|
||||
* options:
|
||||
* type: "default" - Button with drop-down options - no further customisation available
|
||||
@@ -88,7 +90,12 @@ RED.deploy = (function() {
|
||||
'</span></li>').prependTo(".header-toolbar");
|
||||
}
|
||||
|
||||
$('#btn-deploy').click(function() { save(); });
|
||||
$('#btn-deploy').click(function(event) {
|
||||
event.preventDefault();
|
||||
save();
|
||||
});
|
||||
|
||||
RED.actions.add("core:deploy-flows",save);
|
||||
|
||||
$( "#node-dialog-confirm-deploy" ).dialog({
|
||||
title: RED._('deploy.confirm.button.confirm'),
|
||||
@@ -98,21 +105,33 @@ RED.deploy = (function() {
|
||||
height: "auto",
|
||||
buttons: [
|
||||
{
|
||||
text: RED._("deploy.confirm.button.cancel"),
|
||||
text: RED._("common.label.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" );
|
||||
// }
|
||||
// },
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-review",
|
||||
text: RED._("deploy.confirm.button.review"),
|
||||
class: "primary disabled",
|
||||
click: function() {
|
||||
if (!$("#node-dialog-confirm-deploy-review").hasClass('disabled')) {
|
||||
RED.diff.showRemoteDiff();
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-merge",
|
||||
text: RED._("deploy.confirm.button.merge"),
|
||||
class: "primary disabled",
|
||||
click: function() {
|
||||
RED.diff.mergeDiff(currentDiff);
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-deploy",
|
||||
text: RED._("deploy.confirm.button.confirm"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
@@ -121,7 +140,16 @@ RED.deploy = (function() {
|
||||
if (ignoreChecked) {
|
||||
ignoreDeployWarnings[$( "#node-dialog-confirm-deploy-type" ).val()] = true;
|
||||
}
|
||||
save(true,$( "#node-dialog-confirm-deploy-type" ).val() === "conflict");
|
||||
save(true,/conflict/.test($("#node-dialog-confirm-deploy-type" ).val()));
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-overwrite",
|
||||
text: RED._("deploy.confirm.button.overwrite"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
save(true,/conflict/.test($("#node-dialog-confirm-deploy-type" ).val()));
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
@@ -135,11 +163,43 @@ RED.deploy = (function() {
|
||||
'</div>');
|
||||
},
|
||||
open: function() {
|
||||
if ($( "#node-dialog-confirm-deploy-type" ).val() === "conflict") {
|
||||
// $("#node-dialog-confirm-deploy-review").show();
|
||||
var deployType = $("#node-dialog-confirm-deploy-type" ).val();
|
||||
if (/conflict/.test(deployType)) {
|
||||
$( "#node-dialog-confirm-deploy" ).dialog('option','title', RED._('deploy.confirm.button.review'));
|
||||
$("#node-dialog-confirm-deploy-deploy").hide();
|
||||
$("#node-dialog-confirm-deploy-review").addClass('disabled').show();
|
||||
$("#node-dialog-confirm-deploy-merge").addClass('disabled').show();
|
||||
$("#node-dialog-confirm-deploy-overwrite").toggle(deployType === "deploy-conflict");
|
||||
currentDiff = null;
|
||||
$("#node-dialog-confirm-deploy-conflict-checking").show();
|
||||
$("#node-dialog-confirm-deploy-conflict-auto-merge").hide();
|
||||
$("#node-dialog-confirm-deploy-conflict-manual-merge").hide();
|
||||
|
||||
var now = Date.now();
|
||||
RED.diff.getRemoteDiff(function(diff) {
|
||||
var ellapsed = Math.max(1000 - (Date.now()-now), 0);
|
||||
currentDiff = diff;
|
||||
setTimeout(function() {
|
||||
$("#node-dialog-confirm-deploy-conflict-checking").hide();
|
||||
var d = Object.keys(diff.conflicts);
|
||||
if (d.length === 0) {
|
||||
$("#node-dialog-confirm-deploy-conflict-auto-merge").show();
|
||||
$("#node-dialog-confirm-deploy-merge").removeClass('disabled')
|
||||
} else {
|
||||
$("#node-dialog-confirm-deploy-conflict-manual-merge").show();
|
||||
}
|
||||
$("#node-dialog-confirm-deploy-review").removeClass('disabled')
|
||||
},ellapsed);
|
||||
})
|
||||
|
||||
|
||||
$("#node-dialog-confirm-deploy-hide").parent().hide();
|
||||
} else {
|
||||
// $("#node-dialog-confirm-deploy-review").hide();
|
||||
$( "#node-dialog-confirm-deploy" ).dialog('option','title', RED._('deploy.confirm.button.confirm'));
|
||||
$("#node-dialog-confirm-deploy-deploy").show();
|
||||
$("#node-dialog-confirm-deploy-overwrite").hide();
|
||||
$("#node-dialog-confirm-deploy-review").hide();
|
||||
$("#node-dialog-confirm-deploy-merge").hide();
|
||||
$("#node-dialog-confirm-deploy-hide").parent().show();
|
||||
}
|
||||
}
|
||||
@@ -157,198 +217,33 @@ RED.deploy = (function() {
|
||||
}
|
||||
});
|
||||
|
||||
// $("#node-dialog-view-diff").dialog({
|
||||
// title: RED._('deploy.confirm.button.review'),
|
||||
// modal: true,
|
||||
// autoOpen: false,
|
||||
// buttons: [
|
||||
// {
|
||||
// text: RED._("deploy.confirm.button.cancel"),
|
||||
// click: function() {
|
||||
// $( this ).dialog( "close" );
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// text: RED._("deploy.confirm.button.merge"),
|
||||
// class: "primary",
|
||||
// click: function() {
|
||||
// $( this ).dialog( "close" );
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
// open: function() {
|
||||
// $(this).dialog({width:Math.min($(window).width(),900),height:Math.min($(window).height(),600)});
|
||||
// }
|
||||
// });
|
||||
|
||||
// $("#node-dialog-view-diff-diff").editableList({
|
||||
// addButton: false,
|
||||
// scrollOnAdd: false,
|
||||
// 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;
|
||||
var activeNotifyMessage;
|
||||
RED.comms.subscribe("notification/runtime-deploy",function(topic,msg) {
|
||||
if (!activeNotifyMessage) {
|
||||
var currentRev = RED.nodes.version();
|
||||
if (currentRev === null || deployInflight || currentRev === msg.revision) {
|
||||
return;
|
||||
}
|
||||
var message = $('<div>'+RED._('deploy.confirm.backgroundUpdate')+
|
||||
'<br><br><div class="ui-dialog-buttonset">'+
|
||||
'<button>'+RED._('deploy.confirm.button.ignore')+'</button>'+
|
||||
'<button class="primary">'+RED._('deploy.confirm.button.review')+'</button>'+
|
||||
'</div></div>');
|
||||
$(message.find('button')[0]).click(function(evt) {
|
||||
evt.preventDefault();
|
||||
activeNotifyMessage.close();
|
||||
activeNotifyMessage = null;
|
||||
})
|
||||
$(message.find('button')[1]).click(function(evt) {
|
||||
evt.preventDefault();
|
||||
activeNotifyMessage.close();
|
||||
var nns = RED.nodes.createCompleteNodeSet();
|
||||
resolveConflict(nns,false);
|
||||
activeNotifyMessage = null;
|
||||
})
|
||||
activeNotifyMessage = RED.notify(message,null,true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getNodeInfo(node) {
|
||||
@@ -362,18 +257,7 @@ RED.deploy = (function() {
|
||||
tabLabel = tab.label;
|
||||
}
|
||||
}
|
||||
var label = "";
|
||||
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;
|
||||
var label = RED.utils.getNodeLabel(node,node.id);
|
||||
return {tab:tabLabel,type:node.type,label:label};
|
||||
}
|
||||
function sortNodeInfo(A,B) {
|
||||
@@ -386,152 +270,15 @@ RED.deploy = (function() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function resolveConflict(currentNodes) {
|
||||
function resolveConflict(currentNodes, activeDeploy) {
|
||||
$( "#node-dialog-confirm-deploy-config" ).hide();
|
||||
$( "#node-dialog-confirm-deploy-unknown" ).hide();
|
||||
$( "#node-dialog-confirm-deploy-unused" ).hide();
|
||||
$( "#node-dialog-confirm-deploy-conflict" ).show();
|
||||
$( "#node-dialog-confirm-deploy-type" ).val("conflict");
|
||||
$( "#node-dialog-confirm-deploy-type" ).val(activeDeploy?"deploy-conflict":"background-conflict");
|
||||
$( "#node-dialog-confirm-deploy" ).dialog( "open" );
|
||||
|
||||
// $("#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; "/>'));
|
||||
// $("#node-dialog-confirm-deploy-review .ui-button-text").css("opacity",0.4);
|
||||
// $("#node-dialog-confirm-deploy-review").attr("disabled",true).addClass("disabled");
|
||||
// $.ajax({
|
||||
// headers: {
|
||||
// "Accept":"application/json",
|
||||
// },
|
||||
// cache: false,
|
||||
// url: 'flows',
|
||||
// success: function(nodes) {
|
||||
// var newNodes = nodes.flows;
|
||||
// var newRevision = nodes.rev;
|
||||
// generateDiff(currentNodes,newNodes);
|
||||
// $("#node-dialog-confirm-deploy-review").attr("disabled",false).removeClass("disabled");
|
||||
// $("#node-dialog-confirm-deploy-review img").remove();
|
||||
// $("#node-dialog-confirm-deploy-review .ui-button-text").css("opacity",1);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 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) {
|
||||
if (!$("#btn-deploy").hasClass("disabled")) {
|
||||
if (!skipValidation) {
|
||||
@@ -613,6 +360,7 @@ RED.deploy = (function() {
|
||||
data.rev = RED.nodes.version();
|
||||
}
|
||||
|
||||
deployInflight = true;
|
||||
$.ajax({
|
||||
url:"flows",
|
||||
type: "POST",
|
||||
@@ -624,6 +372,7 @@ RED.deploy = (function() {
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
RED.nodes.dirty(false);
|
||||
RED.nodes.version(data.rev);
|
||||
RED.nodes.originalFlow(nns);
|
||||
if (hasUnusedConfig) {
|
||||
RED.notify(
|
||||
'<p>'+RED._("deploy.successfulDeploy")+'</p>'+
|
||||
@@ -659,13 +408,14 @@ RED.deploy = (function() {
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||
} else if (xhr.status === 409) {
|
||||
resolveConflict(nns);
|
||||
resolveConflict(nns, true);
|
||||
} else if (xhr.responseText) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error");
|
||||
} else {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("deploy.errors.noResponse")}),"error");
|
||||
}
|
||||
}).always(function() {
|
||||
deployInflight = false;
|
||||
var delta = Math.max(0,300-(Date.now()-startTime));
|
||||
setTimeout(function() {
|
||||
$(".deploy-button-content").css('opacity',1);
|
||||
|
||||
1271
editor/js/ui/diff.js
Normal file
1271
editor/js/ui/diff.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,10 +15,138 @@
|
||||
**/
|
||||
RED.keyboard = (function() {
|
||||
|
||||
var isMac = /Mac/i.test(window.navigator.platform);
|
||||
|
||||
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 init() {
|
||||
var userKeymap = RED.settings.get('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: '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) {
|
||||
var slot = handlers;
|
||||
var slot = partialState||handlers;
|
||||
if (evt.ctrlKey || evt.metaKey) {
|
||||
slot = slot.ctrl;
|
||||
}
|
||||
@@ -28,9 +156,21 @@ RED.keyboard = (function() {
|
||||
if (slot && evt.altKey) {
|
||||
slot = slot.alt;
|
||||
}
|
||||
if (slot && slot[evt.keyCode]) {
|
||||
var handler = slot[evt.keyCode];
|
||||
if (handler.scope && handler.scope !== "*") {
|
||||
var keyCode = firefoxKeyCodeMap[evt.keyCode] || evt.keyCode;
|
||||
if (slot && slot[keyCode]) {
|
||||
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;
|
||||
while (target.nodeName !== 'BODY' && target.id !== handler.scope) {
|
||||
target = target.parentElement;
|
||||
@@ -39,121 +179,351 @@ RED.keyboard = (function() {
|
||||
handler = null;
|
||||
}
|
||||
}
|
||||
partialState = null;
|
||||
return handler;
|
||||
} else if (partialState) {
|
||||
partialState = null;
|
||||
return resolveKeyEvent(evt);
|
||||
}
|
||||
}
|
||||
d3.select(window).on("keydown",function() {
|
||||
if (metaKeyCodes[d3.event.keyCode]) {
|
||||
return;
|
||||
}
|
||||
var handler = resolveKeyEvent(d3.event);
|
||||
if (handler && handler.ondown) {
|
||||
handler.ondown();
|
||||
}
|
||||
});
|
||||
d3.select(window).on("keyup",function() {
|
||||
var handler = resolveKeyEvent(d3.event);
|
||||
if (handler && handler.onup) {
|
||||
handler.onup();
|
||||
if (typeof handler.ondown === "string") {
|
||||
RED.actions.invoke(handler.ondown);
|
||||
} else {
|
||||
handler.ondown();
|
||||
}
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
function addHandler(scope,key,modifiers,ondown,onup) {
|
||||
function addHandler(scope,key,modifiers,ondown) {
|
||||
var mod = modifiers;
|
||||
var cbdown = ondown;
|
||||
var cbup = onup;
|
||||
if (typeof modifiers == "function") {
|
||||
if (typeof modifiers == "function" || typeof modifiers === "string") {
|
||||
mod = {};
|
||||
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;
|
||||
if (mod.ctrl) {
|
||||
slot.ctrl = slot.ctrl||{};
|
||||
slot = slot.ctrl;
|
||||
for (i=0;i<keys.length;i++) {
|
||||
key = keys[i][0];
|
||||
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.shift = slot.shift||{};
|
||||
slot = slot.shift;
|
||||
}
|
||||
if (mod.alt) {
|
||||
slot.alt = slot.alt||{};
|
||||
slot = slot.alt;
|
||||
}
|
||||
slot[key] = {scope: scope, ondown:cbdown, onup:cbup};
|
||||
slot.scope = scope;
|
||||
slot.ondown = cbdown;
|
||||
}
|
||||
|
||||
function removeHandler(key,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;
|
||||
if (mod.ctrl) {
|
||||
slot = slot.ctrl;
|
||||
for (i=0;i<keys.length;i++) {
|
||||
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) {
|
||||
slot = slot.shift;
|
||||
if (typeof slot.ondown === "string") {
|
||||
if (typeof modifiers === 'boolean' && modifiers) {
|
||||
actionToKeyMap[slot.ondown] = {user: modifiers}
|
||||
} else {
|
||||
delete actionToKeyMap[slot.ondown];
|
||||
}
|
||||
}
|
||||
if (slot && mod.alt) {
|
||||
slot = slot.alt;
|
||||
delete slot.scope;
|
||||
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) {
|
||||
delete slot[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
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="*">global</option><option value="workspace">workspace</option></select>').appendTo(scope);
|
||||
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') || {};
|
||||
delete userKeymap[object.id];
|
||||
RED.settings.set('keymap',userKeymap);
|
||||
|
||||
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 showKeyboardHelp() {
|
||||
if (!RED.settings.theme("menu.menu-item-keyboard-shortcuts",true)) {
|
||||
return;
|
||||
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);
|
||||
}
|
||||
var userKeymap = RED.settings.get('keymap') || {};
|
||||
userKeymap[object.id] = RED.keyboard.getShortcut(object.id);
|
||||
RED.settings.set('keymap',userKeymap);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;">'+
|
||||
'<table class="keyboard-shortcuts">'+
|
||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">a</span></td><td>'+RED._("keyboard.selectAll")+'</td></tr>'+
|
||||
'<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>'+
|
||||
'<tr><td> </td><td></td></tr>'+
|
||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">i</span></td><td>'+RED._("keyboard.importNode")+'</td></tr>'+
|
||||
'<tr><td><span class="help-key">Ctrl/⌘</span> + <span class="help-key">e</span></td><td>'+RED._("keyboard.exportNode")+'</td></tr>'+
|
||||
'<tr><td> </td><td></td></tr>'+
|
||||
'<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>'+
|
||||
'<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>'+
|
||||
'</table>'+
|
||||
'</div>'+
|
||||
'<div style="vertical-align: top;display:inline-block; box-sizing: border-box; width:50%; padding: 10px;">'+
|
||||
'<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
|
||||
});
|
||||
}
|
||||
|
||||
function buildShortcutRow(container,object) {
|
||||
var item = $('<div class="keyboard-shortcut-entry">').appendTo(container);
|
||||
container.data('data',object);
|
||||
|
||||
var text = object.id.replace(/(^.+:([a-z]))|(-([a-z]))/g,function() {
|
||||
if (arguments[5] === 0) {
|
||||
return arguments[2].toUpperCase();
|
||||
} else {
|
||||
return " "+arguments[4].toUpperCase();
|
||||
}
|
||||
});
|
||||
var label = $('<div>').addClass("keyboard-shortcut-entry-text").text(text).appendTo(item);
|
||||
|
||||
var user = $('<i class="fa fa-user"></i>').prependTo(label);
|
||||
|
||||
if (!object.user) {
|
||||
user.css("opacity",0);
|
||||
}
|
||||
|
||||
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" placeholder="filter actions"></div>'+
|
||||
'<div class="keyboard-shortcut-entry-key">shortcut</div>'+
|
||||
'<div class="keyboard-shortcut-entry-scope">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 {
|
||||
init: init,
|
||||
add: addHandler,
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -110,7 +110,7 @@ RED.library = (function() {
|
||||
function buildFileList(root,data) {
|
||||
var ul = document.createElement("ul");
|
||||
var li;
|
||||
for (var i=0;i<data.length;i++) {
|
||||
for (var i=0; i<data.length; i++) {
|
||||
var v = data[i];
|
||||
if (typeof v === "string") {
|
||||
// directory
|
||||
@@ -157,7 +157,7 @@ RED.library = (function() {
|
||||
return ul;
|
||||
}
|
||||
|
||||
$('#node-input-name').css("width","60%").after(
|
||||
$('#node-input-name').css("width","66%").after(
|
||||
'<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>'+
|
||||
'<ul class="dropdown-menu pull-right" role="menu">'+
|
||||
@@ -166,8 +166,6 @@ RED.library = (function() {
|
||||
'</ul></div>'
|
||||
);
|
||||
|
||||
|
||||
|
||||
$('#node-input-'+options.type+'-menu-open-library').click(function(e) {
|
||||
$("#node-select-library").children().remove();
|
||||
var bc = $("#node-dialog-library-breadcrumbs");
|
||||
@@ -264,7 +262,7 @@ RED.library = (function() {
|
||||
class: "primary",
|
||||
click: function() {
|
||||
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];
|
||||
$("#node-input-"+field).val(selectedLibraryItem[field]);
|
||||
}
|
||||
@@ -327,7 +325,7 @@ RED.library = (function() {
|
||||
}
|
||||
var queryArgs = [];
|
||||
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];
|
||||
if (field == "name") {
|
||||
data.name = name;
|
||||
@@ -410,6 +408,9 @@ RED.library = (function() {
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
|
||||
RED.actions.add("core:library-export",exportFlow);
|
||||
|
||||
RED.events.on("view:selection-changed",function(selection) {
|
||||
if (!selection.nodes) {
|
||||
RED.menu.setDisabled("menu-item-export",true);
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,7 +36,11 @@ RED.notify = (function() {
|
||||
n.className = "notification notification-"+type;
|
||||
}
|
||||
n.style.display = "none";
|
||||
n.innerHTML = msg;
|
||||
if (typeof msg === "string") {
|
||||
n.innerHTML = msg;
|
||||
} else {
|
||||
$(n).append(msg);
|
||||
}
|
||||
$("#notifications").append(n);
|
||||
$(n).slideDown(300);
|
||||
n.close = (function() {
|
||||
@@ -51,11 +55,21 @@ RED.notify = (function() {
|
||||
|
||||
n.update = (function() {
|
||||
var nn = n;
|
||||
return function(msg) {
|
||||
nn.innerHTML = msg;
|
||||
return function(msg,timeout) {
|
||||
if (typeof msg === "string") {
|
||||
nn.innerHTML = msg;
|
||||
} else {
|
||||
$(nn).empty().append(msg);
|
||||
}
|
||||
if (timeout !== undefined && timeout > 0) {
|
||||
window.clearTimeout(nn.timeoutid);
|
||||
nn.timeoutid = window.setTimeout(nn.close,timeout);
|
||||
} else {
|
||||
window.clearTimeout(nn.timeoutid);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
if (!fixed) {
|
||||
$(n).click((function() {
|
||||
var nn = n;
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,17 @@ RED.palette.editor = (function() {
|
||||
var eventTimers = {};
|
||||
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) {
|
||||
var delta = Date.now() - start;
|
||||
if (delta < 300) {
|
||||
@@ -64,14 +75,21 @@ RED.palette.editor = (function() {
|
||||
});
|
||||
})
|
||||
}
|
||||
function installNodeModule(id,shade,callback) {
|
||||
function installNodeModule(id,version,shade,callback) {
|
||||
var requestBody = {
|
||||
module: id
|
||||
};
|
||||
if (callback === undefined) {
|
||||
callback = shade;
|
||||
shade = version;
|
||||
} else {
|
||||
requestBody.version = version;
|
||||
}
|
||||
shade.show();
|
||||
$.ajax({
|
||||
url:"nodes",
|
||||
type: "POST",
|
||||
data: JSON.stringify({
|
||||
module: id
|
||||
}),
|
||||
data: JSON.stringify(requestBody),
|
||||
contentType: "application/json; charset=utf-8"
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
shade.hide();
|
||||
@@ -189,10 +207,7 @@ RED.palette.editor = (function() {
|
||||
}
|
||||
}
|
||||
nodeEntries[module].index = index.join(",").toLowerCase();
|
||||
|
||||
nodeList.editableList('addItem', nodeEntries[module]);
|
||||
//console.log(nodeList.editableList('items'));
|
||||
|
||||
} else {
|
||||
var moduleInfo = nodeEntries[module].info;
|
||||
var nodeEntry = nodeEntries[module].elements;
|
||||
@@ -255,7 +270,9 @@ RED.palette.editor = (function() {
|
||||
nodeEntry.removeButton.hide();
|
||||
} else {
|
||||
nodeEntry.enableButton.removeClass('disabled');
|
||||
nodeEntry.removeButton.show();
|
||||
if (moduleInfo.local) {
|
||||
nodeEntry.removeButton.css('display', 'inline-block');
|
||||
}
|
||||
if (activeTypeCount === 0) {
|
||||
nodeEntry.enableButton.html(RED._('palette.editor.enableall'));
|
||||
} else {
|
||||
@@ -264,61 +281,21 @@ RED.palette.editor = (function() {
|
||||
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
||||
}
|
||||
}
|
||||
|
||||
nodeEntry.updateButton.hide();
|
||||
// if (loadedIndex.hasOwnProperty(module)) {
|
||||
// if (moduleInfo.version !== loadedIndex[module].version) {
|
||||
// nodeEntry.updateButton.show();
|
||||
// nodeEntry.updateButton.html(RED._('palette.editor.update',{version:loadedIndex[module].version}));
|
||||
// } else {
|
||||
// nodeEntry.updateButton.hide();
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// nodeEntry.updateButton.hide();
|
||||
// }
|
||||
if (moduleInfo.pending_version) {
|
||||
nodeEntry.versionSpan.html(moduleInfo.version+' <i class="fa fa-long-arrow-right"></i> '+moduleInfo.pending_version).appendTo(nodeEntry.metaRow)
|
||||
nodeEntry.updateButton.html(RED._('palette.editor.updated')).addClass('disabled').show();
|
||||
} else if (loadedIndex.hasOwnProperty(module)) {
|
||||
if (semVerCompare(loadedIndex[module].version,moduleInfo.version) === 1) {
|
||||
nodeEntry.updateButton.show();
|
||||
nodeEntry.updateButton.html(RED._('palette.editor.update',{version:loadedIndex[module].version}));
|
||||
} else {
|
||||
nodeEntry.updateButton.hide();
|
||||
}
|
||||
} else {
|
||||
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) {
|
||||
@@ -336,36 +313,45 @@ RED.palette.editor = (function() {
|
||||
var catalogueCount;
|
||||
var catalogueLoadStatus = [];
|
||||
var catalogueLoadStart;
|
||||
var catalogueLoadErrors = false;
|
||||
|
||||
var activeSort = sortModulesAZ;
|
||||
|
||||
function handleCatalogResponse(catalog,index,v) {
|
||||
catalogueLoadStatus.push(v);
|
||||
if (v.modules) {
|
||||
v.modules.forEach(function(m) {
|
||||
loadedIndex[m.id] = m;
|
||||
m.index = [m.id];
|
||||
if (m.keywords) {
|
||||
m.index = m.index.concat(m.keywords);
|
||||
}
|
||||
if (m.updated_at) {
|
||||
m.timestamp = new Date(m.updated_at).getTime();
|
||||
} else {
|
||||
m.timestamp = 0;
|
||||
}
|
||||
m.index = m.index.join(",").toLowerCase();
|
||||
})
|
||||
loadedList = loadedList.concat(v.modules);
|
||||
function handleCatalogResponse(err,catalog,index,v) {
|
||||
catalogueLoadStatus.push(err||v);
|
||||
if (!err) {
|
||||
if (v.modules) {
|
||||
v.modules.forEach(function(m) {
|
||||
loadedIndex[m.id] = m;
|
||||
m.index = [m.id];
|
||||
if (m.keywords) {
|
||||
m.index = m.index.concat(m.keywords);
|
||||
}
|
||||
if (m.updated_at) {
|
||||
m.timestamp = new Date(m.updated_at).getTime();
|
||||
} else {
|
||||
m.timestamp = 0;
|
||||
}
|
||||
m.index = m.index.join(",").toLowerCase();
|
||||
})
|
||||
loadedList = loadedList.concat(v.modules);
|
||||
}
|
||||
searchInput.searchBox('count',loadedList.length);
|
||||
} else {
|
||||
catalogueLoadErrors = true;
|
||||
}
|
||||
searchInput.searchBox('count',loadedList.length);
|
||||
if (catalogueCount > 1) {
|
||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>"+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);
|
||||
setTimeout(function() {
|
||||
$("#palette-module-install-shade").hide();
|
||||
},Math.max(delta,0));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,19 +360,29 @@ RED.palette.editor = (function() {
|
||||
loadedList = [];
|
||||
loadedIndex = {};
|
||||
packageList.editableList('empty');
|
||||
|
||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading'));
|
||||
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
||||
catalogueLoadStatus = [];
|
||||
catalogueLoadErrors = false;
|
||||
catalogueCount = catalogues.length;
|
||||
if (catalogues.length > 1) {
|
||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>0/"+catalogues.length);
|
||||
}
|
||||
$("#palette-module-install-shade").show();
|
||||
catalogueLoadStart = Date.now();
|
||||
var handled = 0;
|
||||
catalogues.forEach(function(catalog,index) {
|
||||
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
||||
handleCatalogResponse(catalog,index,v);
|
||||
handleCatalogResponse(null,catalog,index,v);
|
||||
refreshNodeModuleList();
|
||||
}).fail(function(jqxhr, textStatus, error) {
|
||||
handleCatalogResponse(jqxhr,catalog,index);
|
||||
}).always(function() {
|
||||
handled++;
|
||||
if (handled === catalogueCount) {
|
||||
searchInput.searchBox('change');
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
@@ -394,6 +390,11 @@ RED.palette.editor = (function() {
|
||||
|
||||
function refreshFilteredItems() {
|
||||
packageList.editableList('empty');
|
||||
var currentFilter = searchInput.searchBox('value').trim();
|
||||
if (currentFilter === ""){
|
||||
packageList.editableList('addItem',{count:loadedList.length})
|
||||
return;
|
||||
}
|
||||
filteredList.sort(activeSort);
|
||||
for (var i=0;i<Math.min(10,filteredList.length);i++) {
|
||||
packageList.editableList('addItem',filteredList[i]);
|
||||
@@ -413,22 +414,123 @@ RED.palette.editor = (function() {
|
||||
return -1 * (A.info.timestamp-B.info.timestamp);
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
if (RED.settings.theme('palette.editable') === false) {
|
||||
return;
|
||||
}
|
||||
createSettingsPane();
|
||||
|
||||
RED.events.on("editor:open",function() { disabled = true; });
|
||||
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.userSettings.add({
|
||||
id:'palette',
|
||||
title: 'Palette',
|
||||
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.html(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.html(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({
|
||||
id:"palette-editor-tabs",
|
||||
element: settingsPane.find('#palette-editor-tabs'),
|
||||
onchange:function(tab) {
|
||||
$("#palette-editor .palette-editor-tab").hide();
|
||||
content.find(".palette-editor-tab").hide();
|
||||
tab.content.show();
|
||||
if (filterInput) {
|
||||
filterInput.searchBox('value',"");
|
||||
@@ -450,17 +552,7 @@ RED.palette.editor = (function() {
|
||||
});
|
||||
|
||||
|
||||
$("#editor-shade").click(function() {
|
||||
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");
|
||||
var modulesTab = $('<div>',{class:"palette-editor-tab"}).appendTo(content);
|
||||
|
||||
editorTabs.addTab({
|
||||
id: 'nodes',
|
||||
@@ -499,25 +591,54 @@ RED.palette.editor = (function() {
|
||||
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);
|
||||
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>').html(entry.version).appendTo(metaRow);
|
||||
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 setCount = $('<span>').appendTo(setButton);
|
||||
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);
|
||||
updateButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
|
||||
updateButton.click(function(evt) {
|
||||
evt.preventDefault();
|
||||
if ($(this).hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
$("#palette-module-install-confirm").data('module',entry.name);
|
||||
$("#palette-module-install-confirm").data('version',loadedIndex[entry.name].version);
|
||||
$("#palette-module-install-confirm").data('shade',shade);
|
||||
|
||||
$("#palette-module-install-confirm-body").html(entry.local?
|
||||
RED._("palette.editor.confirm.update.body"):
|
||||
RED._("palette.editor.confirm.cannotUpdate.body")
|
||||
);
|
||||
$(".palette-module-install-confirm-button-install").hide();
|
||||
$(".palette-module-install-confirm-button-remove").hide();
|
||||
if (entry.local) {
|
||||
$(".palette-module-install-confirm-button-update").show();
|
||||
} else {
|
||||
$(".palette-module-install-confirm-button-update").hide();
|
||||
}
|
||||
$("#palette-module-install-confirm")
|
||||
.dialog('option', 'title',RED._("palette.editor.confirm.update.title"))
|
||||
.dialog('open');
|
||||
})
|
||||
|
||||
|
||||
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.remove')).appendTo(buttonGroup);
|
||||
removeButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
|
||||
removeButton.click(function(evt) {
|
||||
evt.preventDefault();
|
||||
shade.show();
|
||||
removeNodeModule(entry.name, function(xhr) {
|
||||
console.log(xhr);
|
||||
})
|
||||
|
||||
$("#palette-module-install-confirm").data('module',entry.name);
|
||||
$("#palette-module-install-confirm").data('shade',shade);
|
||||
$("#palette-module-install-confirm-body").html(RED._("palette.editor.confirm.remove.body"));
|
||||
$(".palette-module-install-confirm-button-install").hide();
|
||||
$(".palette-module-install-confirm-button-remove").show();
|
||||
$(".palette-module-install-confirm-button-update").hide();
|
||||
$("#palette-module-install-confirm")
|
||||
.dialog('option', 'title', RED._("palette.editor.confirm.remove.title"))
|
||||
.dialog('open');
|
||||
})
|
||||
if (!entry.local) {
|
||||
removeButton.hide();
|
||||
@@ -534,6 +655,7 @@ RED.palette.editor = (function() {
|
||||
setCount: setCount,
|
||||
container: container,
|
||||
shade: shade,
|
||||
versionSpan: versionSpan,
|
||||
sets: {}
|
||||
}
|
||||
setButton.click(function(evt) {
|
||||
@@ -568,8 +690,13 @@ RED.palette.editor = (function() {
|
||||
if (object.setUseCount[setName] === 0) {
|
||||
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
||||
shade.show();
|
||||
changeNodeState(set.id,!currentSet.enabled,shade,function(xhr){
|
||||
console.log(xhr)
|
||||
var newState = !currentSet.enabled
|
||||
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}));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -584,7 +711,11 @@ RED.palette.editor = (function() {
|
||||
evt.preventDefault();
|
||||
if (object.totalUseCount === 0) {
|
||||
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}));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -597,7 +728,7 @@ RED.palette.editor = (function() {
|
||||
|
||||
|
||||
|
||||
var installTab = $('<div>',{class:"palette-editor-tab hide"}).appendTo("#palette-editor");
|
||||
var installTab = $('<div>',{class:"palette-editor-tab hide"}).appendTo(content);
|
||||
|
||||
editorTabs.addTab({
|
||||
id: 'install',
|
||||
@@ -613,7 +744,7 @@ RED.palette.editor = (function() {
|
||||
.searchBox({
|
||||
delay: 300,
|
||||
change: function() {
|
||||
var searchTerm = $(this).val().toLowerCase();
|
||||
var searchTerm = $(this).val().trim().toLowerCase();
|
||||
if (searchTerm.length > 0) {
|
||||
filteredList = loadedList.filter(function(m) {
|
||||
return (m.index.indexOf(searchTerm) > -1);
|
||||
@@ -623,13 +754,15 @@ RED.palette.editor = (function() {
|
||||
} else {
|
||||
searchInput.searchBox('count',loadedList.length);
|
||||
packageList.editableList('empty');
|
||||
packageList.editableList('addItem',{count:loadedList.length});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('<span>').html(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 sortRecent = $('<a href="#" class="sidebar-header-button-toggle" data-i18n="palette.editor.sortRecent"></a>').appendTo(sortGroup);
|
||||
|
||||
@@ -666,138 +799,158 @@ RED.palette.editor = (function() {
|
||||
})
|
||||
|
||||
packageList = $('<ol>',{style:"position: absolute;top: 78px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
|
||||
addButton: false,
|
||||
scrollOnAdd: false,
|
||||
addItem: function(container,i,object) {
|
||||
addButton: false,
|
||||
scrollOnAdd: false,
|
||||
addItem: function(container,i,object) {
|
||||
if (object.count) {
|
||||
$('<div>',{class:"red-ui-search-empty"}).html(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>').html(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"}).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);
|
||||
|
||||
if (object.more) {
|
||||
container.addClass('palette-module-more');
|
||||
var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container);
|
||||
var moreLink = $('<a href="#"></a>').html(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"}).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);
|
||||
$('<span class="palette-module-version"><i class="fa fa-tag"></i> '+entry.version+'</span>').appendTo(metaRow);
|
||||
$('<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);
|
||||
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
||||
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')) {
|
||||
$("#palette-module-install-confirm").data('module',entry.id);
|
||||
$("#palette-module-install-confirm").data('version',entry.version);
|
||||
$("#palette-module-install-confirm").data('url',entry.url);
|
||||
$("#palette-module-install-confirm").data('shade',shade);
|
||||
$("#palette-module-install-confirm-body").html(RED._("palette.editor.confirm.install.body"));
|
||||
$(".palette-module-install-confirm-button-install").show();
|
||||
$(".palette-module-install-confirm-button-remove").hide();
|
||||
$(".palette-module-install-confirm-button-update").hide();
|
||||
$("#palette-module-install-confirm")
|
||||
.dialog('option', 'title', RED._("palette.editor.confirm.install.title"))
|
||||
.dialog('open');
|
||||
}
|
||||
})
|
||||
if (nodeEntries.hasOwnProperty(entry.id)) {
|
||||
installButton.addClass('disabled');
|
||||
installButton.html(RED._('palette.editor.installed'));
|
||||
}
|
||||
|
||||
var metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
||||
$('<span class="palette-module-version"><i class="fa fa-tag"></i> '+entry.version+'</span>').appendTo(metaRow);
|
||||
$('<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);
|
||||
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
||||
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;
|
||||
object.elements = {
|
||||
installButton:installButton
|
||||
}
|
||||
} else {
|
||||
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container);
|
||||
}
|
||||
}
|
||||
});
|
||||
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) {
|
||||
filteredList[i].elements.installButton.show();
|
||||
break;
|
||||
}
|
||||
|
||||
$('<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);
|
||||
|
||||
$('<div id="palette-module-install-confirm" class="hide"><form class="form-horizontal"><div id="palette-module-install-confirm-body" class="node-dialog-confirm-row"></div></form></div>').appendTo(document.body);
|
||||
$("#palette-module-install-confirm").dialog({
|
||||
title: RED._('palette.editor.confirm.title'),
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 550,
|
||||
height: "auto",
|
||||
buttons: [
|
||||
{
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.review"),
|
||||
class: "primary palette-module-install-confirm-button-install",
|
||||
click: function() {
|
||||
var url = $(this).data('url');
|
||||
window.open(url);
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.install"),
|
||||
class: "primary palette-module-install-confirm-button-install",
|
||||
click: function() {
|
||||
var id = $(this).data('module');
|
||||
var version = $(this).data('version');
|
||||
var shade = $(this).data('shade');
|
||||
installNodeModule(id,version,shade,function(xhr) {
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.installFailed',{module: id,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
});
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.remove"),
|
||||
class: "primary palette-module-install-confirm-button-remove",
|
||||
click: function() {
|
||||
var id = $(this).data('module');
|
||||
var shade = $(this).data('shade');
|
||||
shade.show();
|
||||
removeNodeModule(id, function(xhr) {
|
||||
shade.hide();
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.removeFailed',{module: id,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.update"),
|
||||
class: "primary palette-module-install-confirm-button-update",
|
||||
click: function() {
|
||||
var id = $(this).data('module');
|
||||
var version = $(this).data('version');
|
||||
var shade = $(this).data('shade');
|
||||
shade.show();
|
||||
installNodeModule(id,version,shade,function(xhr) {
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.updateFailed',{module: id,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
});
|
||||
$( this ).dialog( "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);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
show: showPaletteEditor
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,7 @@ RED.palette = (function() {
|
||||
var categoryContainers = {};
|
||||
|
||||
function createCategoryContainer(category, label){
|
||||
label = label || category.replace("_", " ");
|
||||
label = (label || category).replace(/_/g, " ");
|
||||
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 class="palette-content" id="palette-base-category-'+category+'">'+
|
||||
@@ -101,7 +101,7 @@ RED.palette = (function() {
|
||||
if (label != type) {
|
||||
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) {
|
||||
return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0)
|
||||
}).slice(0,2);
|
||||
@@ -127,7 +127,7 @@ RED.palette = (function() {
|
||||
}
|
||||
if (exclusion.indexOf(def.category)===-1) {
|
||||
|
||||
var category = def.category.replace(" ","_");
|
||||
var category = def.category.replace(/ /g,"_");
|
||||
var rootCategory = category.split("-")[0];
|
||||
|
||||
var d = document.createElement("div");
|
||||
@@ -149,14 +149,9 @@ RED.palette = (function() {
|
||||
|
||||
|
||||
if (def.icon) {
|
||||
var icon_url = "arrow-in.png";
|
||||
try {
|
||||
icon_url = (typeof def.icon === "function" ? def.icon.call({}) : def.icon);
|
||||
} catch(err) {
|
||||
console.log("Definition error: "+nt+".icon",err);
|
||||
}
|
||||
var icon_url = RED.utils.getNodeIcon(def);
|
||||
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;
|
||||
@@ -190,11 +185,14 @@ RED.palette = (function() {
|
||||
$("#palette-"+category).append(d);
|
||||
d.onmousedown = function(e) { e.preventDefault(); };
|
||||
|
||||
RED.popover.create({
|
||||
var popover = RED.popover.create({
|
||||
target:$(d),
|
||||
trigger: "hover",
|
||||
width: "300px",
|
||||
content: "hi",
|
||||
delay: { show: 750, hide: 50 }
|
||||
});
|
||||
$(d).data('popover',popover);
|
||||
|
||||
// $(d).popover({
|
||||
// title:d.type,
|
||||
@@ -210,10 +208,9 @@ RED.palette = (function() {
|
||||
if (nt.indexOf("subflow:") === 0) {
|
||||
helpText = marked(RED.nodes.subflow(nt.substring(8)).info||"");
|
||||
} else {
|
||||
helpText = $("script[data-help-name$='"+d.type+"']").html()||"";
|
||||
helpText = $("script[data-help-name='"+d.type+"']").html()||"";
|
||||
}
|
||||
var help = '<div class="node-help">'+helpText+"</div>";
|
||||
RED.sidebar.info.set(help);
|
||||
RED.sidebar.info.set(helpText);
|
||||
});
|
||||
var chart = $("#chart");
|
||||
var chartOffset = chart.offset();
|
||||
@@ -236,7 +233,7 @@ RED.palette = (function() {
|
||||
// it here makes me sad
|
||||
//console.log(ui.helper.position());
|
||||
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();
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,24 +27,19 @@ RED.search = (function() {
|
||||
var results = [];
|
||||
|
||||
function indexNode(n) {
|
||||
var l = "";
|
||||
if (n._def && n._def.label) {
|
||||
l = n._def.label;
|
||||
try {
|
||||
l = (typeof l === "function" ? l.call(n) : l);
|
||||
if (l) {
|
||||
l = (""+l).toLowerCase();
|
||||
index[l] = index[l] || {};
|
||||
index[l][n.id] = {node:n,label:l}
|
||||
}
|
||||
} catch(err) {
|
||||
console.log("Definition error: "+n.type+".label",err);
|
||||
}
|
||||
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||"";
|
||||
|
||||
|
||||
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++) {
|
||||
if (n.hasOwnProperty(properties[i])) {
|
||||
var v = n[properties[i]];
|
||||
@@ -186,25 +181,14 @@ RED.search = (function() {
|
||||
|
||||
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div);
|
||||
var colour = def.color;
|
||||
var icon_url = "arrow-in.png";
|
||||
var icon_url = RED.utils.getNodeIcon(def,node);
|
||||
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 {
|
||||
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);
|
||||
|
||||
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);
|
||||
if (node.z) {
|
||||
@@ -238,8 +222,11 @@ RED.search = (function() {
|
||||
}
|
||||
|
||||
function show() {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
if (!visible) {
|
||||
RED.keyboard.add("*",/* ESCAPE */ 27,function(){hide();d3.event.preventDefault();});
|
||||
RED.keyboard.add("*","escape",function(){hide()});
|
||||
$("#header-shade").show();
|
||||
$("#editor-shade").show();
|
||||
$("#palette-shade").show();
|
||||
@@ -249,7 +236,7 @@ RED.search = (function() {
|
||||
if (dialog === null) {
|
||||
createDialog();
|
||||
}
|
||||
dialog.slideDown();
|
||||
dialog.slideDown(300);
|
||||
RED.events.emit("search:open");
|
||||
visible = true;
|
||||
}
|
||||
@@ -257,7 +244,7 @@ RED.search = (function() {
|
||||
}
|
||||
function hide() {
|
||||
if (visible) {
|
||||
RED.keyboard.remove(/* ESCAPE */ 27);
|
||||
RED.keyboard.remove("escape");
|
||||
visible = false;
|
||||
$("#header-shade").hide();
|
||||
$("#editor-shade").hide();
|
||||
@@ -274,11 +261,12 @@ RED.search = (function() {
|
||||
}
|
||||
|
||||
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:close",function() { disabled = false; });
|
||||
RED.events.on("palette-editor:open",function() { disabled = true; });
|
||||
RED.events.on("palette-editor:close",function() { disabled = false; });
|
||||
RED.events.on("type-search:open",function() { disabled = true; });
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -202,12 +202,18 @@ RED.sidebar = (function() {
|
||||
}
|
||||
|
||||
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();
|
||||
RED.sidebar.info.init();
|
||||
RED.sidebar.config.init();
|
||||
// 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 {
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,5 +22,6 @@ RED.state = {
|
||||
EDITING: 5,
|
||||
EXPORT: 6,
|
||||
IMPORT: 7,
|
||||
IMPORT_DRAGGING: 8
|
||||
IMPORT_DRAGGING: 8,
|
||||
QUICK_JOINING: 9
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -306,50 +306,13 @@ RED.subflow = (function() {
|
||||
|
||||
$("#workspace-subflow-delete").click(function(event) {
|
||||
event.preventDefault();
|
||||
var removedNodes = [];
|
||||
var removedLinks = [];
|
||||
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);
|
||||
@@ -362,7 +325,48 @@ RED.subflow = (function() {
|
||||
$("#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() {
|
||||
RED.events.on("workspace:change",function(event) {
|
||||
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() {
|
||||
@@ -617,6 +623,7 @@ RED.subflow = (function() {
|
||||
init: init,
|
||||
createSubflow: createSubflow,
|
||||
convertToSubflow: convertToSubflow,
|
||||
removeSubflow: removeSubflow,
|
||||
refresh: refresh,
|
||||
removeInput: removeSubflowInput,
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -113,7 +113,7 @@ RED.sidebar.config = (function() {
|
||||
if (showUnusedOnly) {
|
||||
var hiddenCount = nodes.length;
|
||||
nodes = nodes.filter(function(n) {
|
||||
return n.users.length === 0;
|
||||
return n._def.hasUsers!==false && n.users.length === 0;
|
||||
})
|
||||
hiddenCount = hiddenCount - nodes.length;
|
||||
if (hiddenCount > 0) {
|
||||
@@ -131,19 +131,7 @@ RED.sidebar.config = (function() {
|
||||
} else {
|
||||
var currentType = "";
|
||||
nodes.forEach(function(node) {
|
||||
var label = "";
|
||||
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;
|
||||
var label = RED.utils.getNodeLabel(node,node.id);
|
||||
if (node.type != currentType) {
|
||||
$('<li class="config_node_type">'+node.type+'</li>').appendTo(list);
|
||||
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);
|
||||
$('<div class="palette_label"></div>').text(label).appendTo(entry);
|
||||
|
||||
var iconContainer = $('<div/>',{class:"palette_icon_container palette_icon_container_right"}).text(node.users.length).appendTo(entry);
|
||||
if (node.users.length === 0) {
|
||||
entry.addClass("config_node_unused");
|
||||
if (node._def.hasUsers !== false) {
|
||||
var iconContainer = $('<div/>',{class:"palette_icon_container palette_icon_container_right"}).text(node.users.length).appendTo(entry);
|
||||
if (node.users.length === 0) {
|
||||
entry.addClass("config_node_unused");
|
||||
}
|
||||
}
|
||||
entry.on('click',function(e) {
|
||||
RED.sidebar.info.refresh(node);
|
||||
@@ -236,10 +225,7 @@ RED.sidebar.config = (function() {
|
||||
visible: false,
|
||||
onchange: function() { refreshConfigNodeList(); }
|
||||
});
|
||||
|
||||
RED.menu.setAction('menu-item-config-nodes',function() {
|
||||
RED.sidebar.show('config');
|
||||
})
|
||||
RED.actions.add("core:show-config-tab",function() {RED.sidebar.show('config')});
|
||||
|
||||
$("#workspace-config-node-collapse-all").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,15 +26,57 @@ RED.sidebar.info = (function() {
|
||||
smartypants: false
|
||||
});
|
||||
|
||||
var content = document.createElement("div");
|
||||
content.style.paddingTop = "4px";
|
||||
content.style.paddingLeft = "4px";
|
||||
content.style.paddingRight = "4px";
|
||||
content.className = "sidebar-node-info"
|
||||
var content;
|
||||
var sections;
|
||||
var nodeSection;
|
||||
var infoSection;
|
||||
var tipBox;
|
||||
|
||||
var propertiesExpanded = false;
|
||||
var expandedSections = {
|
||||
"property": false
|
||||
};
|
||||
|
||||
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: "Node",
|
||||
collapsible: false
|
||||
});
|
||||
infoSection = sections.add({
|
||||
title: "Information",
|
||||
collapsible: false
|
||||
});
|
||||
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({
|
||||
id: "info",
|
||||
label: RED._("sidebar.info.label"),
|
||||
@@ -42,6 +84,11 @@ RED.sidebar.info = (function() {
|
||||
content: content,
|
||||
enableOnEdit: true
|
||||
});
|
||||
if (tips.enabled()) {
|
||||
tips.start();
|
||||
} else {
|
||||
tips.stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,119 +113,250 @@ RED.sidebar.info = (function() {
|
||||
return value;
|
||||
}
|
||||
|
||||
function refresh(node) {
|
||||
var table = '<table class="node-info"><tbody>';
|
||||
table += '<tr class="blank"><td colspan="2">'+RED._("sidebar.info.node")+'</td></tr>';
|
||||
if (node.type != "subflow" && node.name) {
|
||||
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>";
|
||||
table += "<tr><td>"+RED._("sidebar.info.id")+"</td><td> "+node.id+"</td></tr>";
|
||||
|
||||
var m = /^subflow(:(.+))?$/.exec(node.type);
|
||||
var subflowNode;
|
||||
if (m) {
|
||||
if (m[2]) {
|
||||
subflowNode = RED.nodes.subflow(m[2]);
|
||||
} else {
|
||||
subflowNode = node;
|
||||
function addTargetToExternalLinks(el) {
|
||||
$(el).find("a").each(function(el) {
|
||||
var href = $(this).attr('href');
|
||||
if (/^https?:/.test(href)) {
|
||||
$(this).attr('target','_blank');
|
||||
}
|
||||
});
|
||||
return el;
|
||||
}
|
||||
function refresh(node) {
|
||||
sections.show();
|
||||
$(nodeSection.content).empty();
|
||||
$(infoSection.content).empty();
|
||||
|
||||
table += '<tr class="blank"><td colspan="2">'+RED._("sidebar.info.subflow")+'</td></tr>';
|
||||
var table = $('<table class="node-info"></table>');
|
||||
var tableBody = $('<tbody>').appendTo(table);
|
||||
var propRow;
|
||||
var subflowNode;
|
||||
if (node.type === "tab") {
|
||||
nodeSection.title.html("Flow");
|
||||
propRow = $('<tr class="node-info-node-row"><td>Name</td><td></td></tr>').appendTo(tableBody);
|
||||
$(propRow.children()[1]).html(' '+(node.label||""))
|
||||
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.id")+"</td><td></td></tr>").appendTo(tableBody);
|
||||
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
|
||||
propRow = $('<tr class="node-info-node-row"><td>Status</td><td></td></tr>').appendTo(tableBody);
|
||||
$(propRow.children()[1]).html((!!!node.disabled)?"Enabled":"Disabled")
|
||||
} else {
|
||||
nodeSection.title.html("Node");
|
||||
if (node.type !== "subflow" && node.name) {
|
||||
$('<tr class="node-info-node-row"><td>'+RED._("common.label.name")+'</td><td> <span class="bidiAware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'">'+node.name+'</span></td></tr>').appendTo(tableBody);
|
||||
}
|
||||
$('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.type")+"</td><td> "+node.type+"</td></tr>").appendTo(tableBody);
|
||||
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.id")+"</td><td></td></tr>").appendTo(tableBody);
|
||||
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
|
||||
|
||||
var userCount = 0;
|
||||
var subflowType = "subflow:"+subflowNode.id;
|
||||
RED.nodes.eachNode(function(n) {
|
||||
if (n.type === subflowType) {
|
||||
userCount++;
|
||||
}
|
||||
});
|
||||
table += '<tr><td>'+RED._("common.label.name")+'</td><td><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.name)+'">'+subflowNode.name+'</span></td></tr>';
|
||||
table += "<tr><td>"+RED._("sidebar.info.instances")+"</td><td>"+userCount+"</td></tr>";
|
||||
}
|
||||
var m = /^subflow(:(.+))?$/.exec(node.type);
|
||||
|
||||
if (!m && node.type != "subflow" && node.type != "comment") {
|
||||
if (node._def) {
|
||||
var count = 0;
|
||||
var defaults = node._def.defaults;
|
||||
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 = configNode._def.color;
|
||||
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"}).html(configLabel).appendTo(container);
|
||||
|
||||
nodeDiv.on('dblclick',function() {
|
||||
RED.editor.editConfig("", configNode.type, configNode.id);
|
||||
})
|
||||
|
||||
if (!m && node.type != "subflow" && node.type != "comment") {
|
||||
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>';
|
||||
if (node._def) {
|
||||
for (var n in node._def.defaults) {
|
||||
if (n != "name" && node._def.defaults.hasOwnProperty(n)) {
|
||||
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>';
|
||||
} else if (type === "string") {
|
||||
if (val.length === 0) {
|
||||
val = '<span style="font-style: italic; color: #ccc;">'+RED._("sidebar.info.blank")+'</span>';
|
||||
} else {
|
||||
if (val.length > 30) {
|
||||
val = val.substring(0,30)+" ...";
|
||||
}
|
||||
val = val.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||
} else {
|
||||
RED.utils.createObjectElement(val).appendTo(propRow.children()[1]);
|
||||
}
|
||||
} 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,">");
|
||||
}
|
||||
|
||||
table += '<tr class="node-info-property-row'+(propertiesExpanded?"":" hide")+'"><td>'+n+"</td><td>"+val+"</td></tr>";
|
||||
}
|
||||
if (count > 0) {
|
||||
$('<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">show more</span><span class="node-info-property-show-less">show less</span> <i class="fa fa-caret-down"></i></a></td></tr>').appendTo(tableBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m) {
|
||||
if (m[2]) {
|
||||
subflowNode = RED.nodes.subflow(m[2]);
|
||||
} else {
|
||||
subflowNode = node;
|
||||
}
|
||||
|
||||
$('<tr class="blank"><th colspan="2">'+RED._("sidebar.info.subflow")+'</th></tr>').appendTo(tableBody);
|
||||
|
||||
var userCount = 0;
|
||||
var subflowType = "subflow:"+subflowNode.id;
|
||||
RED.nodes.eachNode(function(n) {
|
||||
if (n.type === subflowType) {
|
||||
userCount++;
|
||||
}
|
||||
});
|
||||
$('<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);
|
||||
$('<tr class="node-info-subflow-row"><td>'+RED._("sidebar.info.instances")+"</td><td>"+userCount+'</td></tr>').appendTo(tableBody);
|
||||
}
|
||||
}
|
||||
table += "</tbody></table><hr/>";
|
||||
if (!subflowNode && node.type != "comment") {
|
||||
var helpText = $("script[data-help-name$='"+node.type+"']").html()||"";
|
||||
table += '<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(helpText)+'">'+helpText+'</span></div>';
|
||||
$(table).appendTo(nodeSection.content);
|
||||
|
||||
var infoText = "";
|
||||
|
||||
if (!subflowNode && node.type !== "comment" && node.type !== "tab") {
|
||||
var helpText = $("script[data-help-name='"+node.type+"']").html()||"";
|
||||
infoText = helpText;
|
||||
} else if (node.type === "tab") {
|
||||
infoText = marked(node.info||"");
|
||||
}
|
||||
|
||||
if (subflowNode) {
|
||||
table += '<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.info||"")+'">'+marked(subflowNode.info||"")+'</span></div>';
|
||||
infoText = infoText + marked(subflowNode.info||"");
|
||||
} 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>';
|
||||
// TODO: help
|
||||
infoText = infoText + marked(textInfo);
|
||||
}
|
||||
if (infoText) {
|
||||
setInfoText(infoText);
|
||||
}
|
||||
|
||||
$(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();
|
||||
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() {
|
||||
$(content).html("");
|
||||
sections.hide();
|
||||
//
|
||||
}
|
||||
|
||||
function set(html) {
|
||||
$(content).html(html);
|
||||
// tips.stop();
|
||||
sections.show();
|
||||
nodeSection.container.hide();
|
||||
$(infoSection.content).empty();
|
||||
setInfoText(html);
|
||||
$(".sidebar-node-info-stack").scrollTop(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
RED.events.on("view:selection-changed",function(selection) {
|
||||
if (selection.nodes) {
|
||||
if (selection.nodes.length == 1) {
|
||||
@@ -190,11 +368,18 @@ RED.sidebar.info = (function() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var subflow = RED.nodes.subflow(RED.workspaces.active());
|
||||
if (subflow) {
|
||||
refresh(subflow);
|
||||
var activeWS = RED.workspaces.active();
|
||||
|
||||
var flow = RED.nodes.workspace(activeWS) || RED.nodes.subflow(activeWS);
|
||||
if (flow) {
|
||||
refresh(flow);
|
||||
} else {
|
||||
clear();
|
||||
var workspace = RED.nodes.workspace(RED.workspaces.active());
|
||||
if (workspace && workspace.info) {
|
||||
refresh(workspace);
|
||||
} else {
|
||||
clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -202,7 +387,7 @@ RED.sidebar.info = (function() {
|
||||
return {
|
||||
init: init,
|
||||
show: show,
|
||||
refresh:refresh,
|
||||
refresh: refresh,
|
||||
clear: clear,
|
||||
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");
|
||||
* 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -104,90 +104,77 @@ RED.tray = (function() {
|
||||
}
|
||||
});
|
||||
|
||||
if (options.open) {
|
||||
options.open(el);
|
||||
}
|
||||
function finishBuild() {
|
||||
$("#header-shade").show();
|
||||
$("#editor-shade").show();
|
||||
$("#palette-shade").show();
|
||||
$(".sidebar-shade").show();
|
||||
|
||||
$("#header-shade").show();
|
||||
$("#editor-shade").show();
|
||||
$("#palette-shade").show();
|
||||
$(".sidebar-shade").show();
|
||||
tray.preferredWidth = Math.max(el.width(),500);
|
||||
body.css({"minWidth":tray.preferredWidth-40});
|
||||
|
||||
tray.preferredWidth = Math.max(el.width(),500);
|
||||
body.css({"minWidth":tray.preferredWidth-40});
|
||||
|
||||
if (options.width) {
|
||||
if (options.width > $("#editor-stack").position().left-8) {
|
||||
options.width = $("#editor-stack").position().left-8;
|
||||
if (options.width) {
|
||||
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();
|
||||
if (tray.width > $("#editor-stack").position().left-8) {
|
||||
tray.width = Math.max(0/*tray.preferredWidth*/,$("#editor-stack").position().left-8);
|
||||
el.width(tray.width);
|
||||
}
|
||||
tray.width = el.width();
|
||||
if (tray.width > $("#editor-stack").position().left-8) {
|
||||
tray.width = Math.max(0/*tray.preferredWidth*/,$("#editor-stack").position().left-8);
|
||||
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({
|
||||
right: -(el.width()+10)+"px",
|
||||
transition: "right 0.25s ease"
|
||||
});
|
||||
$("#workspace").scrollLeft(0);
|
||||
handleWindowResize();
|
||||
openingTray = true;
|
||||
setTimeout(function() {
|
||||
el.css({
|
||||
right: -(el.width()+10)+"px",
|
||||
transition: "right 0.25s ease"
|
||||
});
|
||||
$("#workspace").scrollLeft(0);
|
||||
handleWindowResize();
|
||||
openingTray = true;
|
||||
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() {
|
||||
// Delay resetting the flag, so we don't close prematurely
|
||||
openingTray = false;
|
||||
},200);
|
||||
},150);
|
||||
el.css({right:0});
|
||||
},0);
|
||||
|
||||
// growButton.click(function(e) {
|
||||
// e.preventDefault();
|
||||
// tray.lastWidth = tray.width;
|
||||
// tray.width = $("#editor-stack").position().left-8;
|
||||
// el.width(tray.width);
|
||||
// if (options.resize) {
|
||||
// options.resize({width:tray.width});
|
||||
// }
|
||||
// });
|
||||
// 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});
|
||||
// }
|
||||
// });
|
||||
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() {
|
||||
// Delay resetting the flag, so we don't close prematurely
|
||||
openingTray = false;
|
||||
},200);
|
||||
body.find(":focusable:first").focus();
|
||||
|
||||
},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() {
|
||||
if (stack.length > 0) {
|
||||
var tray = stack[stack.length-1];
|
||||
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) {
|
||||
tray.width = $("#editor-stack").position().left-8;
|
||||
tray.tray.width(tray.width);
|
||||
@@ -198,7 +185,7 @@ RED.tray = (function() {
|
||||
// tray.body.parent().width(tray.width);
|
||||
}
|
||||
if (tray.options.resize) {
|
||||
tray.options.resize({width:tray.width});
|
||||
tray.options.resize({width:tray.width, height:trayHeight});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
295
editor/js/ui/typeSearch.js
Normal file
295
editor/js/ui/typeSearch.js
Normal file
@@ -0,0 +1,295 @@
|
||||
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 typesUsed = {};
|
||||
|
||||
function search(val) {
|
||||
activeFilter = val.toLowerCase();
|
||||
var visible = searchResults.editableList('filter');
|
||||
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);
|
||||
},
|
||||
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 = def.color;
|
||||
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"}).html(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);
|
||||
}
|
||||
}
|
||||
function show(opts) {
|
||||
if (!visible) {
|
||||
RED.keyboard.add("*","escape",function(){hide()});
|
||||
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;
|
||||
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 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') {
|
||||
items.push({type:t,def: def, label:getTypeLabel(t,def)});
|
||||
}
|
||||
});
|
||||
items.sort(function(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;
|
||||
}
|
||||
})
|
||||
|
||||
var commonCount = 0;
|
||||
var item;
|
||||
for(i=0;i<common.length;i++) {
|
||||
item = {
|
||||
type: common[i],
|
||||
common: true,
|
||||
def: RED.nodes.getType(common[i])
|
||||
};
|
||||
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
|
||||
};
|
||||
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++) {
|
||||
searchResults.editableList('addItem', items[i]);
|
||||
}
|
||||
setTimeout(function() {
|
||||
selected = 0;
|
||||
searchResults.children(":first").addClass('selected');
|
||||
},100);
|
||||
}
|
||||
|
||||
return {
|
||||
show: show,
|
||||
hide: hide
|
||||
};
|
||||
|
||||
})();
|
||||
223
editor/js/ui/userSettings.js
Normal file
223
editor/js/ui/userSettings.js
Normal file
@@ -0,0 +1,223 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
settingsVisible = true;
|
||||
var tabContainer;
|
||||
|
||||
var trayOptions = {
|
||||
title: "User Settings",
|
||||
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: "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: "Nodes",
|
||||
options: [
|
||||
{setting:"view-node-status",oldSetting:"menu-menu-item-status",label:"menu.label.displayStatus",default: true, toggle:true,onchange:"core:toggle-status"}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "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>');
|
||||
|
||||
viewSettings.forEach(function(section) {
|
||||
$('<h3></h3>').text(section.title).appendTo(pane);
|
||||
section.options.forEach(function(opt) {
|
||||
var initialState = RED.settings.get(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];
|
||||
RED.settings.set(opt.setting,value);
|
||||
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 state = RED.settings.get(opt.setting);
|
||||
setSelected(id,!state);
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
RED.actions.add("core:show-user-settings",show);
|
||||
RED.actions.add("core:show-help", function() { show('keyboard')});
|
||||
|
||||
addPane({
|
||||
id:'view',
|
||||
title: '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());
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
viewSettings.forEach(function(section) {
|
||||
section.options.forEach(function(opt) {
|
||||
if (opt.oldSetting) {
|
||||
var oldValue = RED.settings.get(opt.oldSetting);
|
||||
if (oldValue !== undefined && oldValue !== null) {
|
||||
RED.settings.set(opt.setting,oldValue);
|
||||
RED.settings.remove(opt.oldSetting);
|
||||
}
|
||||
}
|
||||
allSettings[opt.setting] = opt;
|
||||
if (opt.onchange) {
|
||||
var value = RED.settings.get(opt.setting);
|
||||
if (value === null && opt.hasOwnProperty('default')) {
|
||||
value = opt.default;
|
||||
RED.settings.set(opt.setting,value);
|
||||
}
|
||||
|
||||
var callback = opt.onchange;
|
||||
if (typeof callback === 'string') {
|
||||
callback = RED.actions.get(callback);
|
||||
}
|
||||
if (callback) {
|
||||
callback.call(opt,value);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
return {
|
||||
init: init,
|
||||
toggle: toggle,
|
||||
show: show,
|
||||
add: addPane
|
||||
};
|
||||
})();
|
||||
621
editor/js/ui/utils.js
Normal file
621
editor/js/ui/utils.js
Normal file
@@ -0,0 +1,621 @@
|
||||
/**
|
||||
* 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>').html('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>').html('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>').html('array['+value.length+']');
|
||||
} 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 {
|
||||
result = $('<span class="debug-message-object-value debug-message-type-other"></span>').text(""+value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function makeExpandable(el,onexpand,expand) {
|
||||
el.addClass("debug-message-expandable");
|
||||
el.click(function(e) {
|
||||
var parent = $(this).parent();
|
||||
if (parent.hasClass('collapsed')) {
|
||||
if (onexpand && !parent.hasClass('built')) {
|
||||
onexpand();
|
||||
parent.addClass('built');
|
||||
}
|
||||
parent.removeClass('collapsed');
|
||||
} else {
|
||||
parent.addClass('collapsed');
|
||||
}
|
||||
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 !== '') {
|
||||
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]) || 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] = format;
|
||||
} else if (initialFormat !== undefined){
|
||||
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||
formattedPaths[sourceId][path] = 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]) || "raw";
|
||||
if (cycle) {
|
||||
if (format === 'raw') {
|
||||
format = 'string';
|
||||
} else {
|
||||
format = 'raw';
|
||||
}
|
||||
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||
formattedPaths[sourceId][path] = 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,key,typeHint,hideKey,path,sourceId,rootPath,expandPaths) {
|
||||
var i;
|
||||
var e;
|
||||
var entryObj;
|
||||
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.__encoded__ && 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 (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>').html(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);
|
||||
},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.__encoded__) {
|
||||
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>').html(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>').html(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').html('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);
|
||||
buildMessageElement(data[i],""+i,type==='buffer'?'hex':false,false,path+"["+i+"]",sourceId,rootPath,expandPaths).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);
|
||||
buildMessageElement(data[i],""+i,type==='buffer'?'hex':false,false,path+"["+i+"]",sourceId,rootPath,expandPaths).appendTo(row);
|
||||
}
|
||||
}
|
||||
})(),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);
|
||||
}
|
||||
}
|
||||
},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>').html('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 (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) {
|
||||
newPath += (newPath.length > 0?".":"")+keys[i];
|
||||
} else {
|
||||
newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]"
|
||||
}
|
||||
buildMessageElement(obj[keys[i]],keys[i],false,false,newPath,sourceId,rootPath,expandPaths).appendTo(row);
|
||||
}
|
||||
if (keys.length === 0) {
|
||||
$('<div class="debug-message-object-entry debug-message-type-meta collapsed"></div>').text("empty").appendTo(element);
|
||||
}
|
||||
},checkExpanded(strippedKey,expandPaths));
|
||||
}
|
||||
if (key) {
|
||||
$('<span class="debug-message-type-meta"></span>').html('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);
|
||||
}
|
||||
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 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"
|
||||
}
|
||||
var icon_url;
|
||||
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;
|
||||
}
|
||||
return "icons/"+def.set.module+"/"+icon_url;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return {
|
||||
createObjectElement: buildMessageElement,
|
||||
getMessageProperty: getMessageProperty,
|
||||
normalisePropertyExpression: normalisePropertyExpression,
|
||||
validatePropertyExpression: validatePropertyExpression,
|
||||
getNodeIcon: getNodeIcon,
|
||||
getNodeLabel: getNodeLabel,
|
||||
}
|
||||
})();
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ RED.workspaces = (function() {
|
||||
var tabId = RED.nodes.id();
|
||||
do {
|
||||
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})};
|
||||
RED.nodes.addWorkspace(ws);
|
||||
@@ -39,6 +39,7 @@ RED.workspaces = (function() {
|
||||
RED.nodes.dirty(true);
|
||||
}
|
||||
}
|
||||
RED.view.focus();
|
||||
return ws;
|
||||
}
|
||||
function deleteWorkspace(ws) {
|
||||
@@ -58,6 +59,7 @@ RED.workspaces = (function() {
|
||||
function showRenameWorkspaceDialog(id) {
|
||||
var workspace = RED.nodes.workspace(id);
|
||||
RED.view.state(RED.state.EDITING);
|
||||
var tabflowEditor;
|
||||
var trayOptions = {
|
||||
title: RED._("workspace.editFlow",{name:workspace.label}),
|
||||
buttons: [
|
||||
@@ -83,10 +85,30 @@ RED.workspaces = (function() {
|
||||
text: RED._("common.label.done"),
|
||||
click: function() {
|
||||
var label = $( "#node-input-name" ).val();
|
||||
var changed = false;
|
||||
var changes = {};
|
||||
if (workspace.label != label) {
|
||||
var changes = {
|
||||
label:workspace.label
|
||||
}
|
||||
changes.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 = {
|
||||
t: "edit",
|
||||
changes:changes,
|
||||
@@ -95,14 +117,29 @@ RED.workspaces = (function() {
|
||||
}
|
||||
workspace.changed = true;
|
||||
RED.history.push(historyEvent);
|
||||
workspace_tabs.renameTab(workspace.id,label);
|
||||
RED.nodes.dirty(true);
|
||||
RED.sidebar.config.refresh();
|
||||
var selection = RED.view.selection();
|
||||
if (!selection.nodes && !selection.links) {
|
||||
RED.sidebar.info.refresh(workspace);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
var trayBody = tray.find('.editor-tray-body');
|
||||
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>'+
|
||||
'<input type="text" id="node-input-name">'+
|
||||
'</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").html(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").html(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").html(RED._("editor:workspace.disabled"));
|
||||
} else {
|
||||
$("#node-input-disabled-label").html(RED._("editor:workspace.enabled"));
|
||||
}
|
||||
} else {
|
||||
workspace.disabled = false;
|
||||
$("#node-input-disabled-label").html(RED._("editor:workspace.enabled"));
|
||||
}
|
||||
|
||||
$('<input type="text" style="display: none;" />').prependTo(dialogForm);
|
||||
dialogForm.submit(function(e) { e.preventDefault();});
|
||||
$("#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();
|
||||
},
|
||||
close: function() {
|
||||
if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
|
||||
RED.view.state(RED.state.DEFAULT);
|
||||
}
|
||||
RED.sidebar.info.refresh(workspace);
|
||||
tabflowEditor.destroy();
|
||||
}
|
||||
}
|
||||
RED.tray.show(trayOptions);
|
||||
@@ -127,7 +214,7 @@ RED.workspaces = (function() {
|
||||
|
||||
|
||||
var workspace_tabs;
|
||||
function createWorkspaceTabs(){
|
||||
function createWorkspaceTabs() {
|
||||
workspace_tabs = RED.tabs.create({
|
||||
id: "workspace-tabs",
|
||||
onchange: function(tab) {
|
||||
@@ -136,9 +223,14 @@ RED.workspaces = (function() {
|
||||
}
|
||||
activeWorkspace = tab.id;
|
||||
event.workspace = activeWorkspace;
|
||||
// $("#workspace").toggleClass("workspace-disabled",tab.disabled);
|
||||
RED.events.emit("workspace:change",event);
|
||||
window.location.hash = 'flow/'+tab.id;
|
||||
RED.sidebar.config.refresh();
|
||||
RED.view.focus();
|
||||
},
|
||||
onclick: function(tab) {
|
||||
RED.view.focus();
|
||||
},
|
||||
ondblclick: function(tab) {
|
||||
if (tab.type != "subflow") {
|
||||
@@ -148,6 +240,10 @@ RED.workspaces = (function() {
|
||||
}
|
||||
},
|
||||
onadd: function(tab) {
|
||||
$('<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",workspace_tabs.count() == 1);
|
||||
},
|
||||
onremove: function(tab) {
|
||||
@@ -170,6 +266,9 @@ RED.workspaces = (function() {
|
||||
createWorkspaceTabs();
|
||||
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() {
|
||||
deleteWorkspace(RED.nodes.workspace(activeWorkspace));
|
||||
});
|
||||
@@ -177,6 +276,14 @@ RED.workspaces = (function() {
|
||||
$(window).resize(function() {
|
||||
workspace_tabs.resize();
|
||||
});
|
||||
|
||||
RED.actions.add("core:add-flow",addWorkspace);
|
||||
RED.actions.add("core:edit-flow",editWorkspace);
|
||||
RED.actions.add("core:remove-flow",removeWorkspace);
|
||||
}
|
||||
|
||||
function editWorkspace(id) {
|
||||
showRenameWorkspaceDialog(id||activeWorkspace);
|
||||
}
|
||||
|
||||
function removeWorkspace(ws) {
|
||||
@@ -201,9 +308,7 @@ RED.workspaces = (function() {
|
||||
add: addWorkspace,
|
||||
remove: removeWorkspace,
|
||||
order: setWorkspaceOrder,
|
||||
edit: function(id) {
|
||||
showRenameWorkspaceDialog(id||activeWorkspace);
|
||||
},
|
||||
edit: editWorkspace,
|
||||
contains: function(id) {
|
||||
return workspace_tabs.contains(id);
|
||||
},
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ RED.user = (function() {
|
||||
autoOpen: false,
|
||||
dialogClass: "ui-dialog-no-close",
|
||||
modal: true,
|
||||
closeOnEscape: false,
|
||||
closeOnEscape: !!opts.cancelable,
|
||||
width: 600,
|
||||
resizable: false,
|
||||
draggable: false
|
||||
@@ -43,17 +43,13 @@ RED.user = (function() {
|
||||
dataType: "json",
|
||||
url: "auth/login",
|
||||
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++) {
|
||||
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);
|
||||
var input = $('<input style="width: 100%" id="node-dialog-login-'+field.id+'" type="'+field.type+'" tabIndex="'+(i+1)+'"/>').appendTo(row);
|
||||
|
||||
@@ -112,26 +108,72 @@ RED.user = (function() {
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
if (opts.cancelable) {
|
||||
$("#node-dialog-login-cancel").button().click(function( event ) {
|
||||
$("#node-dialog-login").dialog('destroy').remove();
|
||||
|
||||
} else if (data.type == "strategy") {
|
||||
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() {
|
||||
var tokens = RED.settings.get("auth-tokens");
|
||||
var token = tokens?tokens.access_token:"";
|
||||
$.ajax({
|
||||
url: "auth/revoke",
|
||||
type: "POST",
|
||||
data: {token:RED.settings.get("auth-tokens").access_token},
|
||||
success: function() {
|
||||
RED.settings.remove("auth-tokens");
|
||||
data: {token:token}
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
RED.settings.remove("auth-tokens");
|
||||
if (data && data.redirect) {
|
||||
document.location.href = data.redirect;
|
||||
} else {
|
||||
document.location.reload(true);
|
||||
}
|
||||
}).fail(function(jqXHR,textStatus,errorThrown) {
|
||||
if (jqXHR.status === 401) {
|
||||
document.location.reload(true);
|
||||
} else {
|
||||
console.log(textStatus);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -170,8 +212,15 @@ RED.user = (function() {
|
||||
if (RED.settings.user) {
|
||||
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");
|
||||
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",
|
||||
options: []
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,6 +14,22 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
RED.validators = {
|
||||
number: function(){return function(v) { return v!=='' && !isNaN(v);}},
|
||||
regex: function(re){return function(v) { return re.test(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);}},
|
||||
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
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;
|
||||
}
|
||||
2
editor/sass/bootstrap.scss
vendored
2
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -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");
|
||||
* 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-hover: #ddd;
|
||||
$typedInput-button-background-active: #e3e3e3;
|
||||
$typedInput-button-background-active: #ddd;
|
||||
|
||||
$editor-button-color-primary: #eee;
|
||||
$editor-button-background-primary: #AD1625;
|
||||
|
||||
265
editor/sass/debug.scss
Normal file
265
editor/sass/debug.scss
Normal file
@@ -0,0 +1,265 @@
|
||||
/**
|
||||
* 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: 10px;
|
||||
color: #777;
|
||||
}
|
||||
.debug-message-date {
|
||||
padding: 1px 5px 1px 1px;
|
||||
}
|
||||
.debug-message-topic {
|
||||
display: block;
|
||||
color: #a66;
|
||||
}
|
||||
.debug-message-name {
|
||||
padding: 1px 5px;
|
||||
color: #777;
|
||||
}
|
||||
.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: 12px !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: 12px;
|
||||
line-height: 1.4em;
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,30 +21,67 @@
|
||||
.red-ui-editableList-container {
|
||||
border-radius:1px;
|
||||
padding:0;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
ol {
|
||||
#node-dialog-view-diff-diff {
|
||||
position: absolute;
|
||||
top:10px;
|
||||
top:80px;
|
||||
bottom:10px;
|
||||
left:10px;
|
||||
right:10px;
|
||||
li {
|
||||
background: #f9f9f9;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
}
|
||||
.red-ui-editableList-item-content {
|
||||
padding: 5px;
|
||||
// padding-bottom: 5px;
|
||||
}
|
||||
}
|
||||
#node-dialog-view-diff-headers {
|
||||
position: absolute;
|
||||
left:17px;
|
||||
right:32px;
|
||||
top: 55px;
|
||||
height: 25px;
|
||||
.node-diff-node-entry-cell:not(:first-child) {
|
||||
background: #f9f9f9;
|
||||
text-align: center;
|
||||
border-top: 1px solid $secondary-border-color;
|
||||
border-color:$secondary-border-color;
|
||||
}
|
||||
.node-diff-node-entry-cell:last-child {
|
||||
border-right: 1px solid $secondary-border-color;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.node-diff-toolbar {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
height: 43px;
|
||||
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 {
|
||||
border: 1px solid $secondary-border-color;
|
||||
border-radius: 3px;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 1px;
|
||||
overflow: hidden;
|
||||
|
||||
&.collapsed {
|
||||
.node-diff-tab-title > .node-diff-chevron {
|
||||
.node-diff-tab-title .node-diff-chevron {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.node-diff-node-entry {
|
||||
@@ -53,21 +90,26 @@
|
||||
}
|
||||
}
|
||||
.node-diff-tab-stats {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.node-diff-chevron {
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
text-align: center;
|
||||
margin: 3px 5px 3px 5px;
|
||||
margin-left: 3px;
|
||||
transition: transform 0.1s ease-in-out;
|
||||
|
||||
}
|
||||
.node-diff-node-entry {
|
||||
padding: 0 0 0 5px;
|
||||
margin-left: 20px;
|
||||
font-size: 0.9em;
|
||||
|
||||
&:first-child {
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1px solid $secondary-border-color;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
&.collapsed {
|
||||
@@ -78,25 +120,80 @@
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&:not(.collapsed) {
|
||||
.node-diff-node-entry-cell:not(:first-child) {
|
||||
//display: none;
|
||||
}
|
||||
.node-diff-node-entry-cell:first-child {
|
||||
//width: 100%
|
||||
}
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
table-layout:fixed;
|
||||
border-collapse: collapse;
|
||||
table-layout:fixed;
|
||||
|
||||
// Fix for table-layout: fixed on safari:
|
||||
max-width: none;
|
||||
width: auto;
|
||||
min-width: 100%;
|
||||
}
|
||||
td, th {
|
||||
border: 1px solid $secondary-border-color;
|
||||
padding: 3px 5px;
|
||||
padding: 0 0 0 3px;
|
||||
text-align: left;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
td:nth-child(1) {
|
||||
width: 150px;
|
||||
tr {
|
||||
vertical-align: top;
|
||||
&:first-child td {
|
||||
white-space:nowrap;
|
||||
overflow:hidden;
|
||||
}
|
||||
}
|
||||
td:first-child {
|
||||
width: 140px;
|
||||
}
|
||||
td:not(:first-child) {
|
||||
width: calc(50% - 150px);
|
||||
width: calc( 100% - 140px);
|
||||
}
|
||||
td {
|
||||
.node-diff-status {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
tr:not(.node-diff-property-header) {
|
||||
.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;
|
||||
}
|
||||
}
|
||||
td:not(:first-child) {
|
||||
width: calc( (100% - 140px) / 2);
|
||||
}
|
||||
|
||||
.node-diff-node-entry {
|
||||
.node-diff-node-entry-cell {
|
||||
width: calc((100% + 20px - 220px) / 2);
|
||||
&:first-child {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.node-diff-column {
|
||||
display:inline-block;
|
||||
height:100%;
|
||||
@@ -108,18 +205,26 @@
|
||||
border-right: 1px solid $secondary-border-color
|
||||
}
|
||||
}
|
||||
|
||||
.node-diff-tab-title {
|
||||
padding: 3px 3px 3px 0;
|
||||
background: #f6f6f6;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
// background: #f6f6f6;
|
||||
}
|
||||
.node-diff-tab-title-meta {
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.node-diff-node-entry-header {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.node-diff-node-entry-node {
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
margin: 5px;
|
||||
width: 24px;
|
||||
height: 20px;
|
||||
width: 18px;
|
||||
height: 15px;
|
||||
background: #ddd;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #999;
|
||||
@@ -128,25 +233,89 @@
|
||||
background-size: contain;
|
||||
position: relative;
|
||||
|
||||
.palette-icon {
|
||||
width: 16px;
|
||||
.palette_icon {
|
||||
background-position: 49% 50%;
|
||||
width: 15px;
|
||||
}
|
||||
.palette_icon_container {
|
||||
width: 24px;
|
||||
width: 18px;
|
||||
}
|
||||
}
|
||||
.node-diff-tab-empty {
|
||||
.node-diff-chevron i {
|
||||
display: none;
|
||||
}
|
||||
.node-diff-tab-title {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
.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 {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
.node-diff-status {
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
.node-diff-node-entry-properties {
|
||||
margin-left: 30px;
|
||||
margin-right: 8px;
|
||||
margin-bottom:8px;
|
||||
margin: 5px ;
|
||||
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-node-description {
|
||||
color: $form-text-color;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
padding-top: 5px;
|
||||
display: inline-block;
|
||||
@@ -156,10 +325,192 @@
|
||||
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-added { color: #009900}
|
||||
.node-diff-deleted { color: #f80000}
|
||||
.node-diff-changed { color: #f89406}
|
||||
.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 #eee;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#node-dialog-confirm-deploy {
|
||||
.node-dialog-confirm-row {
|
||||
text-align: left; padding-top: 10px;
|
||||
}
|
||||
ul {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: none;
|
||||
z-index:100;
|
||||
}
|
||||
#dropTarget div {
|
||||
display: table-cell;
|
||||
@@ -34,4 +35,3 @@
|
||||
#dropTarget div i {
|
||||
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");
|
||||
* 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,7 +46,16 @@
|
||||
overflow: auto;
|
||||
}
|
||||
.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 {
|
||||
@include disable-selection;
|
||||
@@ -65,6 +74,13 @@
|
||||
.editor-tray-footer {
|
||||
@include component-footer;
|
||||
height: 35px;
|
||||
|
||||
button {
|
||||
@include editor-button;
|
||||
padding: 3px 7px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.editor-tray-toolbar {
|
||||
@@ -72,48 +88,9 @@
|
||||
padding: 6px;
|
||||
|
||||
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;
|
||||
@include editor-button;
|
||||
&.toggle {
|
||||
@include workspace-button-toggle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,12 +145,7 @@
|
||||
color: $workspace-button-color;
|
||||
}
|
||||
#palette-shade, #editor-shade, #header-shade, #sidebar-shade {
|
||||
position: absolute;
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:0;
|
||||
right:0;
|
||||
background: $shade-color;
|
||||
@include shade;
|
||||
z-index: 2;
|
||||
}
|
||||
#sidebar-shade {
|
||||
@@ -183,8 +155,7 @@
|
||||
}
|
||||
|
||||
|
||||
.dialog-form,#dialog-form, #dialog-config-form {
|
||||
margin: 0;
|
||||
.dialog-form,#dialog-form, #node-config-dialog-edit-form {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -249,17 +220,6 @@
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.dialog-form {
|
||||
.button-group {
|
||||
.editor-button {
|
||||
&:first-child {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#node-config-dialog-scope-container {
|
||||
cursor: auto;
|
||||
float: right;
|
||||
@@ -287,3 +247,87 @@
|
||||
font-size: 12px;
|
||||
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-label-form-none {
|
||||
span {
|
||||
padding-left: 50px;
|
||||
width: 100px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.ace_read-only {
|
||||
background: #eee !important;
|
||||
.ace_cursor {
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -170,6 +170,11 @@
|
||||
stroke-dasharray:8, 3;
|
||||
}
|
||||
|
||||
|
||||
.node_quickadd * {
|
||||
stroke-dasharray: 12,3;
|
||||
}
|
||||
|
||||
.node_status_label {
|
||||
@include disable-selection;
|
||||
stroke-width: 0;
|
||||
@@ -183,6 +188,13 @@
|
||||
stroke: $port-selected-color;
|
||||
fill: $port-selected-color;
|
||||
}
|
||||
|
||||
.port_quick_link {
|
||||
stroke: $port-selected-color;
|
||||
fill: $port-selected-color;
|
||||
}
|
||||
|
||||
|
||||
.subflowport {
|
||||
stroke-dasharray: 5,5;
|
||||
fill: #eee;
|
||||
@@ -260,3 +272,25 @@ g.link_unknown path.link_line {
|
||||
stroke-width: 2;
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -279,3 +279,13 @@ span.logo {
|
||||
font-size: 16px;
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,18 +16,112 @@
|
||||
|
||||
#keyboard-help-dialog {
|
||||
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;
|
||||
white-space: pre;
|
||||
|
||||
|
||||
.keyboard-shortcut-entry.keyboard-shortcut-list-header {
|
||||
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;
|
||||
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 {
|
||||
border: 1px solid #ddd;
|
||||
@@ -37,4 +131,6 @@
|
||||
font-family: Courier, monospace;
|
||||
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");
|
||||
* 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,6 @@
|
||||
&.selected:not(.disabled) {
|
||||
color: $workspace-button-color-selected !important;
|
||||
background: $workspace-button-background-active;
|
||||
cursor: default;
|
||||
}
|
||||
.button-group &:not(:first-child) {
|
||||
border-left: none;
|
||||
@@ -81,11 +80,33 @@
|
||||
border-top-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;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: 1px solid $workspace-button-color-focus-outline;
|
||||
}
|
||||
}
|
||||
.button-group-vertical {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.button-group:not(:last-child) {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
@mixin workspace-button-toggle {
|
||||
@include workspace-button;
|
||||
color: $workspace-button-toggle-color !important;
|
||||
@@ -97,12 +118,57 @@
|
||||
border-bottom-width: 2px;
|
||||
border-bottom-color: $form-input-border-selected-color;
|
||||
margin-bottom: 0;
|
||||
cursor: default;
|
||||
}
|
||||
&.disabled {
|
||||
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 {
|
||||
border-top: 1px solid $primary-border-color;
|
||||
@@ -115,6 +181,12 @@
|
||||
height: 25px;
|
||||
line-height: 23px;
|
||||
padding: 0 10px;
|
||||
|
||||
|
||||
.button-group:not(:last-child) {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@mixin component-footer-button {
|
||||
@@ -128,9 +200,28 @@
|
||||
padding: 0 5px;
|
||||
}
|
||||
}
|
||||
@mixin component-footer-button-toggle {
|
||||
@include workspace-button-toggle;
|
||||
font-size: 11px;
|
||||
line-height: 17px;
|
||||
height: 18px;
|
||||
&.text-button {
|
||||
width: auto;
|
||||
padding: 0 5px;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin component-shadow {
|
||||
border: 1px solid $secondary-border-color;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@
|
||||
color: #666;
|
||||
border: 1px solid #325C80;
|
||||
border-left-width: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.notification a {
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,13 +14,16 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
#user-settings-tab-palette {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#palette-editor {
|
||||
text-align: left;
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0;
|
||||
bottom: 25px;
|
||||
bottom: 0;
|
||||
left:0;
|
||||
padding: 0;
|
||||
box-sizing:border-box;
|
||||
@@ -51,7 +54,7 @@
|
||||
|
||||
}
|
||||
.red-ui-editableList-item-content {
|
||||
padding: 12px 8px;
|
||||
padding: 12px 16px;
|
||||
}
|
||||
&:last-child {
|
||||
// border-bottom: 1px solid $primary-border-color;
|
||||
@@ -61,7 +64,7 @@
|
||||
}
|
||||
.palette-editor-tab {
|
||||
position:absolute;
|
||||
top:115px;
|
||||
top:35px;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0
|
||||
@@ -72,10 +75,6 @@
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid $primary-border-color;
|
||||
text-align: right;
|
||||
|
||||
.button-group {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.palette-module-button-group {
|
||||
position: absolute;
|
||||
@@ -86,12 +85,7 @@
|
||||
}
|
||||
}
|
||||
.palette-module-shade {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom:0;
|
||||
left:0;
|
||||
right:0;
|
||||
background: $shade-color;
|
||||
@include shade;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -114,16 +114,18 @@
|
||||
}
|
||||
.palette_label {
|
||||
font-size: 13px;
|
||||
margin: 4px 0 4px 28px;
|
||||
margin: 4px 0 4px 32px;
|
||||
line-height: 20px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
@include disable-selection;
|
||||
}
|
||||
.palette_label_right {
|
||||
margin: 4px 28px 4px 0;
|
||||
margin: 4px 32px 4px 0;
|
||||
}
|
||||
|
||||
.palette_node {
|
||||
display: block;
|
||||
cursor:move;
|
||||
background: #ddd;
|
||||
margin: 10px auto;
|
||||
@@ -185,3 +187,22 @@
|
||||
background-size: contain;
|
||||
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
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,39 +15,82 @@
|
||||
**/
|
||||
|
||||
|
||||
.red-ui-popover {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 300px;
|
||||
padding: 10px;
|
||||
height: auto;
|
||||
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 {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: auto;
|
||||
padding: 10px;
|
||||
height: auto;
|
||||
background: #fff;
|
||||
|
||||
.red-ui-popover:after {
|
||||
border-color: rgba(136, 183, 213, 0);
|
||||
border-right-color: #fff;
|
||||
border-width: 10px;
|
||||
margin-top: -10px;
|
||||
}
|
||||
.red-ui-popover:before {
|
||||
border-color: rgba(194, 225, 245, 0);
|
||||
border-right-color: $primary-border-color;
|
||||
border-width: 11px;
|
||||
margin-top: -11px;
|
||||
}
|
||||
z-index: 1000;
|
||||
font-size: 14px;
|
||||
line-height: 1.4em;
|
||||
@include component-shadow;
|
||||
}
|
||||
|
||||
.red-ui-popover:after, .red-ui-popover:before {
|
||||
top: 50%;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.red-ui-popover.red-ui-popover-right:after, .red-ui-popover.red-ui-popover-right:before {
|
||||
right: 100%;
|
||||
}
|
||||
.red-ui-popover.red-ui-popover-left:after, .red-ui-popover.red-ui-popover-left:before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
|
||||
.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-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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,77 @@
|
||||
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 {
|
||||
padding: 3px;
|
||||
border-bottom: 1px solid $secondary-border-color;
|
||||
@@ -37,19 +108,21 @@
|
||||
position:relative;
|
||||
height: 300px;
|
||||
padding: 5px;
|
||||
background: $background-color;
|
||||
background: #f9f9f9;
|
||||
|
||||
.red-ui-editableList-container {
|
||||
background: white;
|
||||
border-radius: 2px;
|
||||
padding: 0;
|
||||
background: $background-color;
|
||||
background: #f9f9f9;
|
||||
li {
|
||||
padding: 0;
|
||||
|
||||
&.selected .red-ui-search-result {
|
||||
border-color: $primary-border-color;
|
||||
&.selected {
|
||||
background: #efefef;
|
||||
.red-ui-search-result {
|
||||
border-left-color:#999;
|
||||
border-right-color:#999;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,11 +131,19 @@
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
color: $form-text-color;
|
||||
border: 2px solid white;
|
||||
border-left: 3px solid #fff;
|
||||
border-right: 3px solid #fff;
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
border-color: $primary-border-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-size: contain;
|
||||
position: relative;
|
||||
|
||||
.palette_icon_container {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
}
|
||||
.red-ui-search-result-description {
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -71,6 +71,7 @@
|
||||
padding: 8px 10px;
|
||||
background: #f3f3f3;
|
||||
border-bottom: 1px solid $secondary-border-color;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#sidebar-footer {
|
||||
@@ -80,6 +81,9 @@
|
||||
.sidebar-footer-button {
|
||||
@include component-footer-button;
|
||||
}
|
||||
.sidebar-footer-button-toggle {
|
||||
@include component-footer-button-toggle;
|
||||
}
|
||||
.sidebar-header-button {
|
||||
@include workspace-button;
|
||||
font-size: 13px;
|
||||
@@ -97,10 +101,5 @@
|
||||
}
|
||||
|
||||
.sidebar-shade {
|
||||
position: absolute;
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:0;
|
||||
right:0;
|
||||
background: $shade-color;
|
||||
@include shade;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
@import "jquery";
|
||||
@import "bootstrap";
|
||||
@import "ace";
|
||||
|
||||
@import "dropdownMenu";
|
||||
|
||||
@@ -36,6 +37,7 @@
|
||||
@import "library";
|
||||
@import "search";
|
||||
|
||||
@import "panels";
|
||||
@import "tabs";
|
||||
@import "tab-config";
|
||||
@import "tab-info";
|
||||
@@ -44,15 +46,20 @@
|
||||
@import "palette-editor";
|
||||
@import "diff";
|
||||
|
||||
@import "userSettings";
|
||||
|
||||
|
||||
@import "ui/common/editableList";
|
||||
@import "ui/common/searchBox";
|
||||
@import "ui/common/typedInput";
|
||||
@import "ui/common/nodeList";
|
||||
@import "ui/common/checkboxSet";
|
||||
|
||||
@import "dragdrop";
|
||||
|
||||
@import "keyboard";
|
||||
|
||||
@import "debug";
|
||||
|
||||
body {
|
||||
font-size: 14px;
|
||||
@@ -119,3 +126,7 @@ pre code {
|
||||
background-color: transparent;
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,22 @@
|
||||
.config-node-list {
|
||||
margin: 0;
|
||||
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 {
|
||||
width: 160px;
|
||||
@@ -32,22 +48,6 @@
|
||||
background: #f3f3f3;
|
||||
color: #666;
|
||||
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 {
|
||||
color: #999;
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,65 +19,248 @@
|
||||
}
|
||||
table.node-info {
|
||||
font-size: 14px;
|
||||
margin: 0px;
|
||||
width: 97%;
|
||||
margin: 0 0 10px;
|
||||
width: 100%;
|
||||
}
|
||||
table.node-info tr {
|
||||
border: 1px solid #ddd;
|
||||
table.node-info tr:not(.blank) {
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.node-info-property-expand {
|
||||
font-size: 0.8em;
|
||||
text-align: right;
|
||||
line-height: 0.9em;
|
||||
a {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
}
|
||||
table.node-info tr.blank {
|
||||
border: none;
|
||||
th {
|
||||
text-align: left;
|
||||
font-weight: 500;
|
||||
color: #444;
|
||||
padding: 6px 3px 3px;
|
||||
}
|
||||
>* {
|
||||
padding-top: 8px;
|
||||
border: none;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
display: block;
|
||||
color: #666;
|
||||
&:hover,&:focus {
|
||||
color: #666;
|
||||
text-decoration: none;
|
||||
}
|
||||
&:not(.expanded) {
|
||||
.node-info-property-show-more {
|
||||
display: inline;
|
||||
}
|
||||
.node-info-property-show-less {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
i {
|
||||
width: 10px;
|
||||
text-align: center;
|
||||
transition: transform 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
&.expanded {
|
||||
.node-info-property-show-more {
|
||||
display: none;
|
||||
}
|
||||
.node-info-property-show-less {
|
||||
display: inline;
|
||||
}
|
||||
i {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
&.node-info-info-row > td {
|
||||
padding-left: 5px;
|
||||
}
|
||||
}
|
||||
table.node-info tr.blank td {
|
||||
padding-top: 8px;
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
padding-left: 0px;
|
||||
}
|
||||
table.node-info td:first-child{
|
||||
color: #000;
|
||||
|
||||
table.node-info tr:not(.blank) td:first-child{
|
||||
color: #666;
|
||||
vertical-align: top;
|
||||
width: 90px;
|
||||
padding: 3px;
|
||||
padding: 3px 3px 3px 6px;
|
||||
border-right: 1px solid #ddd;
|
||||
}
|
||||
table.node-info td:last-child{
|
||||
padding-left: 5px;
|
||||
table.node-info tr:not(.blank) td:last-child{
|
||||
padding: 3px 3px 3px 6px;
|
||||
color: #666;
|
||||
}
|
||||
div.node-info {
|
||||
margin: 5px;
|
||||
}
|
||||
.node-info-property-header {
|
||||
color: #666;
|
||||
}
|
||||
.node-info-property-header:hover,
|
||||
.node-info-property-header:focus {
|
||||
color: #666;
|
||||
text-decoration: none;
|
||||
}
|
||||
.node-help {
|
||||
font-size: 14px;
|
||||
line-height: 1.5em;
|
||||
h1 {
|
||||
font-weight: normal;
|
||||
font-size: 23px;
|
||||
font-weight: 500;
|
||||
font-size: 1.296em;
|
||||
line-height: 1.3em;
|
||||
margin: 8px auto;
|
||||
}
|
||||
h2 {
|
||||
font-weight: normal;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
font-size: 1.215em;
|
||||
margin: 8px auto;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
h3 {
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
margin: 8px auto;
|
||||
font-weight: 500;
|
||||
font-size: 1.138em;
|
||||
margin: 7px auto 5px;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
h4,
|
||||
h5 {
|
||||
font-weight: normal;
|
||||
font-size: 14px;
|
||||
margin: 8px auto;
|
||||
font-weight: 500;
|
||||
font-size: 1.067em;
|
||||
line-height: 1.3em;
|
||||
margin: 8px auto 5px;
|
||||
}
|
||||
& > span > p:first-child {
|
||||
}
|
||||
dl.message-properties {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 2px;
|
||||
|
||||
margin: 5px auto 10px;
|
||||
&>dt {
|
||||
padding: 0px 3px 2px 3px;
|
||||
font-family: monospace;
|
||||
font-weight: normal;
|
||||
margin: 5px 3px 1px;
|
||||
color: #AD1625;
|
||||
white-space: nowrap;
|
||||
&.optional {
|
||||
font-style: italic;
|
||||
|
||||
}
|
||||
.property-type {
|
||||
font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
font-size: 11px;
|
||||
float: right;
|
||||
}
|
||||
&:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
&>dd {
|
||||
margin: 0px 8px 2px 13px;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
ol.node-ports {
|
||||
margin: 0;
|
||||
li {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 2px;
|
||||
list-style-position: inside;
|
||||
padding: 3px;
|
||||
margin-bottom: 5px;
|
||||
dl.message-properties {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.node-info-header {
|
||||
i {
|
||||
width: 10px;
|
||||
text-align: center;
|
||||
transition: transform 0.2s ease-in-out;
|
||||
margin-right: 4px;
|
||||
}
|
||||
color: #333;
|
||||
&:hover, &:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
&.expanded {
|
||||
i {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.sidebar-node-info-stack {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.node-info-tips {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom: 0;
|
||||
height: 150px;
|
||||
box-sizing: border-box;
|
||||
border-top: 1px solid $secondary-border-color;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.3);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.sidebar-node-info.show-tips {
|
||||
.sidebar-node-info-stack {
|
||||
bottom: 150px;
|
||||
}
|
||||
.node-info-tips {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.node-info-tips:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
margin-right: -0.25em; /* Adjusts for spacing */
|
||||
}
|
||||
|
||||
.node-info-tip {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
line-height: 1.9em;
|
||||
color : #bbb;
|
||||
@include disable-selection;
|
||||
cursor: default;
|
||||
}
|
||||
.node-info-tips-buttons {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 6px;
|
||||
a {
|
||||
color: #ddd !important;
|
||||
border-color: #d9d9d9 !important;
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.node-info-property-config-node {
|
||||
border: 1px solid #eee;
|
||||
border-radius: 4px;
|
||||
padding: 2px 4px 2px;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -113,6 +113,50 @@
|
||||
&.red-ui-tabs-add.red-ui-tabs-scrollable {
|
||||
padding-right: 59px;
|
||||
}
|
||||
|
||||
&.red-ui-tabs-vertical {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
border-right: 1px solid $primary-border-color;
|
||||
margin: 0;
|
||||
background: #f3f3f3;
|
||||
overflow: visible;
|
||||
|
||||
.red-ui-tabs-scroll-container {
|
||||
height: auto;
|
||||
overflow-x:visible;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
& ul {
|
||||
padding: 0;
|
||||
height: auto;
|
||||
border: none;
|
||||
width: calc(100% + 1px);
|
||||
li {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-right: 1px solid $primary-border-color;
|
||||
height: auto;
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid $secondary-border-color;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom: 1px solid $secondary-border-color;
|
||||
}
|
||||
|
||||
a.red-ui-tab-label {
|
||||
padding: 9px;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-right: 1px solid #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.red-ui-tab-button {
|
||||
position: absolute;
|
||||
|
||||
29
editor/sass/ui/common/checkboxSet.scss
Normal file
29
editor/sass/ui/common/checkboxSet.scss
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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-checkboxSet {
|
||||
width: 15px;
|
||||
display: inline-block;
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
input {
|
||||
display:none;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
color: #ddd;
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,59 +13,63 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
.red-ui-editableList-border {
|
||||
border: 1px solid $form-input-border-color;
|
||||
border-radius: 4px;
|
||||
.red-ui-editableList-header {
|
||||
border-bottom: 1px solid $form-input-border-color;
|
||||
padding: 2px 16px 2px 4px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
}
|
||||
.red-ui-editableList-container {
|
||||
padding: 5px;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
box-sizing: border-box;
|
||||
.red-ui-editableList-list {
|
||||
list-style-type:none;
|
||||
margin: 0;
|
||||
}
|
||||
.red-ui-editabelList-item-placeholder {
|
||||
border: 2px dashed $secondary-border-color !important;
|
||||
}
|
||||
li {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
margin:0;
|
||||
padding:8px 0px;
|
||||
border-bottom: 1px solid $secondary-border-color;
|
||||
min-height: 20px;
|
||||
.red-ui-editableList-item-handle {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 2px;
|
||||
margin-top: -7px;
|
||||
color: #eee;
|
||||
cursor: move;
|
||||
}
|
||||
.red-ui-editableList-item-remove {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0px;
|
||||
margin-top: -9px;
|
||||
}
|
||||
&.ui-sortable-helper {
|
||||
border-top: 1px solid $secondary-border-color;
|
||||
}
|
||||
//.red-ui-editableList-item-content { outline: 1px solid red}
|
||||
|
||||
&.red-ui-editableList-item-sortable .red-ui-editableList-item-content {
|
||||
margin-left: 22px;
|
||||
}
|
||||
&.red-ui-editableList-item-removable .red-ui-editableList-item-content {
|
||||
margin-right: 28px;
|
||||
}
|
||||
&.red-ui-editableList-item-deleting {
|
||||
background: #fee;
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-editableList-container {
|
||||
border: 1px solid $form-input-border-color;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
box-sizing: border-box;
|
||||
|
||||
.red-ui-editableList-list {
|
||||
list-style-type:none;
|
||||
margin: 0;
|
||||
}
|
||||
.red-ui-editabelList-item-placeholder {
|
||||
border: 2px dashed $secondary-border-color !important;
|
||||
}
|
||||
li {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
margin:0;
|
||||
padding:8px 0px;
|
||||
border-bottom: 1px solid $secondary-border-color;
|
||||
min-height: 20px;
|
||||
.red-ui-editableList-item-handle {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 2px;
|
||||
margin-top: -7px;
|
||||
color: #eee;
|
||||
cursor: move;
|
||||
}
|
||||
.red-ui-editableList-item-remove {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0px;
|
||||
margin-top: -9px;
|
||||
}
|
||||
&.ui-sortable-helper {
|
||||
border-top: 1px solid $secondary-border-color;
|
||||
}
|
||||
//.red-ui-editableList-item-content { outline: 1px solid red}
|
||||
|
||||
&.red-ui-editableList-item-sortable .red-ui-editableList-item-content {
|
||||
margin-left: 22px;
|
||||
}
|
||||
&.red-ui-editableList-item-removable .red-ui-editableList-item-content {
|
||||
margin-right: 28px;
|
||||
}
|
||||
&.red-ui-editableList-item-deleting {
|
||||
background: #fee;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
65
editor/sass/ui/common/nodeList.scss
Normal file
65
editor/sass/ui/common/nodeList.scss
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 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-nodeList {
|
||||
.red-ui-editableList-container {
|
||||
padding: 0;
|
||||
li {
|
||||
padding: 2px 5px;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
border: none;
|
||||
background: #fefefe;
|
||||
&:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
i.fa-angle-right {
|
||||
text-align: center;
|
||||
width: 15px;
|
||||
transition: transform 0.1s ease-in-out;
|
||||
}
|
||||
.expandable {
|
||||
cursor: pointer;
|
||||
}
|
||||
.expanded i.fa-angle-right {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.meta {
|
||||
float: right;
|
||||
input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.red-ui-editableList-item-content.disabled {
|
||||
color: #ccc;
|
||||
}
|
||||
&.red-ui-editableList-section-header {
|
||||
background: #f0f0f0;
|
||||
.red-ui-editableList-item-content.disabled {
|
||||
color: #bbb;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.red-ui-editableList-header {
|
||||
text-align: left;
|
||||
&>span:last-child {
|
||||
float: right;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 0 0 0 1px;
|
||||
padding: 0 0 0 3px;
|
||||
margin:0;
|
||||
height: 32px;
|
||||
border:none;
|
||||
@@ -49,7 +49,10 @@
|
||||
border-color: $form-input-focus-color !important;
|
||||
}
|
||||
|
||||
a {
|
||||
button {
|
||||
text-align: left;
|
||||
border: none;
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
@@ -66,6 +69,9 @@
|
||||
margin-right:4px;
|
||||
margin-top: 1px;
|
||||
vertical-align: middle;
|
||||
&.fa-ellipsis-h {
|
||||
top: -1px;
|
||||
}
|
||||
}
|
||||
&.disabled {
|
||||
cursor: default;
|
||||
@@ -82,44 +88,65 @@
|
||||
&:not(.disabled):hover {
|
||||
text-decoration: none;
|
||||
background: $typedInput-button-background-hover;
|
||||
|
||||
span {
|
||||
background: $typedInput-button-background-hover;
|
||||
}
|
||||
}
|
||||
&:focus {
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
box-shadow: inset 0 0 0 1px $form-input-focus-color;
|
||||
}
|
||||
&:not(.disabled):active {
|
||||
background: $typedInput-button-background-active;
|
||||
text-decoration: none;
|
||||
}
|
||||
&.red-ui-typedInput-full-width {
|
||||
width: 100%;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
a.red-ui-typedInput-option-trigger {
|
||||
button.red-ui-typedInput-option-expand {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
button.red-ui-typedInput-option-trigger {
|
||||
border-top-left-radius: 0px;
|
||||
border-bottom-left-radius: 0px;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
padding: 0 5px 0 0;
|
||||
padding: 0 0 0 0;
|
||||
position:absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
bottom:0;
|
||||
right:0;
|
||||
width: calc( 100% );
|
||||
|
||||
i {
|
||||
position:absolute;
|
||||
right: 4px;
|
||||
top: 7px;
|
||||
}
|
||||
span {
|
||||
.red-ui-typedInput-option-label {
|
||||
background:#fff;
|
||||
position:absolute;
|
||||
left:0;
|
||||
right:23px;
|
||||
top: 0;
|
||||
padding: 0 5px 0 5px;
|
||||
}
|
||||
.red-ui-typedInput-option-caret {
|
||||
top: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 17px;
|
||||
}
|
||||
&:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
&:focus .red-ui-typedInput-option-caret {
|
||||
box-shadow: inset 0 0 0 1px $form-input-focus-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
.red-ui-typedInput-options {
|
||||
@@ -139,12 +166,12 @@
|
||||
}
|
||||
&:focus {
|
||||
text-decoration: none;
|
||||
background: $typedInput-button-background-active;
|
||||
outline: none;
|
||||
}
|
||||
&:active {
|
||||
background: $typedInput-button-background-active;
|
||||
text-decoration: none;
|
||||
background: $typedInput-button-background-active;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
59
editor/sass/userSettings.scss
Normal file
59
editor/sass/userSettings.scss
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
#user-settings-tabs-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 120px;
|
||||
background: #f3f3f3;
|
||||
}
|
||||
#user-settings-tabs-content {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 120px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 0;
|
||||
h3:not(:first-child) {
|
||||
border-top: 1px solid $secondary-border-color;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 10px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
label {
|
||||
display: inline-block;
|
||||
min-width: 100px;
|
||||
input {
|
||||
vertical-align: top;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
}
|
||||
input {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
input[type='number'] {
|
||||
width: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
#user-settings-tab-view {
|
||||
padding: 8px 20px 20px;
|
||||
}
|
||||
.user-settings-row {
|
||||
padding: 5px 10px 2px;
|
||||
}
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,3 +51,32 @@
|
||||
#workspace-footer {
|
||||
@include component-footer;
|
||||
}
|
||||
|
||||
#workspace-tabs:not(.workspace-focussed) {
|
||||
opacity:0.8;
|
||||
li.red-ui-tab.active a {
|
||||
color:#666;
|
||||
}
|
||||
}
|
||||
.workspace-disabled-icon {
|
||||
display: none;
|
||||
}
|
||||
.workspace-disabled {
|
||||
&.red-ui-tab {
|
||||
border-top-style: dashed;
|
||||
border-left-style: dashed;
|
||||
border-right-style: dashed;
|
||||
|
||||
a {
|
||||
font-style: italic;
|
||||
color: #aaa !important;
|
||||
}
|
||||
&.active a {
|
||||
font-weight: normal;
|
||||
color: #999 !important;
|
||||
}
|
||||
.workspace-disabled-icon {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<!--
|
||||
Copyright 2013, 2016 IBM Corp.
|
||||
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.
|
||||
@@ -60,10 +60,6 @@
|
||||
<div id="palette-search" class="palette-search hide">
|
||||
<input type="text" data-i18n="[placeholder]palette.filter"></input>
|
||||
</div>
|
||||
<div id="palette-editor">
|
||||
<div class="editor-tray-header"><div class="editor-tray-titlebar"><ul class="editor-tray-breadcrumbs"><li data-i18n="palette.editor.title"></li></ul></div><div class="editor-tray-toolbar"><button id="palette-editor-close" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only primary" role="button" aria-disabled="false" data-i18n="common.label.done"></button></div></div>
|
||||
<ul id="palette-editor-tabs"></ul>
|
||||
</div>
|
||||
<div id="palette-container" class="palette-scroll hide"></div>
|
||||
<div id="palette-footer">
|
||||
<a class="palette-button" id="palette-collapse-all" href="#"><i class="fa fa-angle-double-up"></i></a>
|
||||
@@ -87,19 +83,28 @@
|
||||
|
||||
<div id="node-dialog-confirm-deploy" class="hide">
|
||||
<form class="form-horizontal">
|
||||
<div id="node-dialog-confirm-deploy-config" style="text-align: left; padding-top: 30px;" data-i18n="[prepend]deploy.confirm.improperlyConfigured;[append]deploy.confirm.confirm">
|
||||
<ul style="font-size: 0.9em; width: 400px; margin: 10px auto; text-align: left;" id="node-dialog-confirm-deploy-invalid-list"></ul>
|
||||
<div id="node-dialog-confirm-deploy-config" class="node-dialog-confirm-row" data-i18n="[prepend]deploy.confirm.improperlyConfigured;[append]deploy.confirm.confirm">
|
||||
<ul id="node-dialog-confirm-deploy-invalid-list"></ul>
|
||||
</div>
|
||||
<div id="node-dialog-confirm-deploy-unknown" style="text-align: left; padding-top: 10px;" data-i18n="[prepend]deploy.confirm.unknown;[append]deploy.confirm.confirm">
|
||||
<ul style="font-size: 0.9em; width: 400px; margin: 10px auto; text-align: left;" id="node-dialog-confirm-deploy-unknown-list"></ul>
|
||||
<div id="node-dialog-confirm-deploy-unknown" class="node-dialog-confirm-row" data-i18n="[prepend]deploy.confirm.unknown;[append]deploy.confirm.confirm">
|
||||
<ul id="node-dialog-confirm-deploy-unknown-list"></ul>
|
||||
</div>
|
||||
<div id="node-dialog-confirm-deploy-conflict" style="text-align: left; padding-top: 10px;" data-i18n="[prepend]deploy.confirm.conflict;[append]deploy.confirm.confirm">
|
||||
<div id="node-dialog-confirm-deploy-conflict" class="node-dialog-confirm-row">
|
||||
<div style="margin-left: 40px; margin-bottom: 10px;">
|
||||
<span data-i18n="deploy.confirm.conflict"></span>
|
||||
</div>
|
||||
<div id="node-dialog-confirm-deploy-conflict-checking" class="node-dialog-confirm-conflict-row">
|
||||
<img src="red/images/spin.svg"/><div data-i18n="deploy.confirm.conflictChecking"></div>
|
||||
</div>
|
||||
<div id="node-dialog-confirm-deploy-conflict-auto-merge" class="node-dialog-confirm-conflict-row">
|
||||
<i style="color: #3a3;" class="fa fa-check"></i><div data-i18n="deploy.confirm.conflictAutoMerge"></div>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="node-dialog-view-diff" class="hide">
|
||||
<ol id="node-dialog-view-diff-diff"></ol>
|
||||
</div>
|
||||
|
||||
<div id="node-dialog-library-save-confirm" class="hide">
|
||||
<form class="form-horizontal">
|
||||
@@ -147,10 +152,11 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="subflow-template">
|
||||
<div class="form-row">
|
||||
<i class="fa fa-tag"></i>
|
||||
<label for="subflow-input-name" data-i18n="common.label.name"></label><input type="text" id="subflow-input-name">
|
||||
</div>
|
||||
<div class="form-row" style="margin-bottom: 0px;">
|
||||
<label for="subflow-input-info" data-i18n="subflow.info"></label>
|
||||
<label for="subflow-input-info" data-i18n="editor:subflow.info"></label>
|
||||
<a href="https://help.github.com/articles/markdown-basics/" style="font-size: 0.8em; float: right;" data-i18n="[html]subflow.format"></a>
|
||||
</div>
|
||||
<div class="form-row node-text-editor-row">
|
||||
@@ -159,10 +165,74 @@
|
||||
<div class="form-row form-tips" id="subflow-dialog-user-count"></div>
|
||||
</script>
|
||||
|
||||
<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);" data-i18n="expressionEditor.data"></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>
|
||||
<script type="text/x-red" data-template-name="_json">
|
||||
<div class="form-row" style="margin-bottom: 3px; text-align: right;">
|
||||
<button id="node-input-expression-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>
|
||||
<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>
|
||||
|
||||
<script src="vendor/vendor.js"></script>
|
||||
<script src="vendor/jsonata/jsonata.min.js"></script>
|
||||
<script src="vendor/ace/ace.js"></script>
|
||||
<script src="vendor/ace/ext-language_tools.js"></script>
|
||||
<script src="{{ asset.red }}"></script>
|
||||
<script src="{{ asset.main }}"></script>
|
||||
{{# page.scripts }}
|
||||
<script src="{{.}}"></script>
|
||||
{{/ page.scripts }}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
0
editor/vendor/ace/LICENSE
vendored
Normal file → Executable file
0
editor/vendor/ace/LICENSE
vendored
Normal file → Executable file
7
editor/vendor/ace/ace.js
vendored
7
editor/vendor/ace/ace.js
vendored
File diff suppressed because one or more lines are too long
4
editor/vendor/ace/ext-language_tools.js
vendored
4
editor/vendor/ace/ext-language_tools.js
vendored
File diff suppressed because one or more lines are too long
4
editor/vendor/ace/ext-searchbox.js
vendored
4
editor/vendor/ace/ext-searchbox.js
vendored
File diff suppressed because one or more lines are too long
2
editor/vendor/ace/mode-css.js
vendored
Normal file → Executable file
2
editor/vendor/ace/mode-css.js
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
2
editor/vendor/ace/mode-handlebars.js
vendored
2
editor/vendor/ace/mode-handlebars.js
vendored
File diff suppressed because one or more lines are too long
2
editor/vendor/ace/mode-html.js
vendored
2
editor/vendor/ace/mode-html.js
vendored
File diff suppressed because one or more lines are too long
2
editor/vendor/ace/mode-javascript.js
vendored
2
editor/vendor/ace/mode-javascript.js
vendored
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user