cpee 2.1.51 → 2.1.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/css/resources.css +42 -0
  3. data/cockpit/css/ui.css +4 -0
  4. data/cockpit/edit.html +4 -1
  5. data/cockpit/index.html +3 -0
  6. data/cockpit/js/details.js +9 -14
  7. data/cockpit/js/edit.js +3 -0
  8. data/cockpit/js/instance.js +264 -64
  9. data/cockpit/js/modifiers.js +12 -15
  10. data/cockpit/js/parameters.js +4 -10
  11. data/cockpit/js/resources.js +16 -0
  12. data/cockpit/js/wfadaptor.js +3 -3
  13. data/cockpit/templates/Coopis 2010.xml +15 -2
  14. data/cockpit/templates/Worklist.xml +6 -7
  15. data/cockpit/themes/compact/rngs/call.rng +6 -4
  16. data/cockpit/themes/compact/rngs/callmanipulate.rng +6 -4
  17. data/cockpit/themes/compact/rngs/parallel.rng +2 -2
  18. data/cockpit/themes/compact/rngs/start.rng +3 -3
  19. data/cockpit/themes/compact/theme.js +11 -1
  20. data/cockpit/themes/control/rngs/call.rng +6 -4
  21. data/cockpit/themes/control/rngs/callmanipulate.rng +6 -4
  22. data/cockpit/themes/control/rngs/parallel.rng +2 -2
  23. data/cockpit/themes/control/rngs/start.rng +3 -3
  24. data/cockpit/themes/control/theme.js +11 -1
  25. data/cockpit/themes/dataflow/rngs/alternative.rng +25 -0
  26. data/cockpit/themes/dataflow/rngs/call.rng +228 -0
  27. data/cockpit/themes/dataflow/rngs/callmanipulate.rng +257 -0
  28. data/cockpit/themes/dataflow/rngs/choose.rng +14 -0
  29. data/cockpit/themes/dataflow/rngs/closed_loop.rng +62 -0
  30. data/cockpit/themes/dataflow/rngs/closed_loop_cancel.rng +5 -0
  31. data/cockpit/themes/dataflow/rngs/closed_loop_control.rng +31 -0
  32. data/cockpit/themes/dataflow/rngs/closed_loop_measuring.rng +12 -0
  33. data/cockpit/themes/dataflow/rngs/critical.rng +5 -0
  34. data/cockpit/themes/dataflow/rngs/escape.rng +1 -0
  35. data/cockpit/themes/dataflow/rngs/group.rng +3 -0
  36. data/cockpit/themes/dataflow/rngs/loop.rng +22 -0
  37. data/cockpit/themes/dataflow/rngs/manipulate.rng +9 -0
  38. data/cockpit/themes/dataflow/rngs/otherwise.rng +22 -0
  39. data/cockpit/themes/dataflow/rngs/parallel.rng +27 -0
  40. data/cockpit/themes/dataflow/rngs/parallel_branch.rng +2 -0
  41. data/cockpit/themes/dataflow/rngs/scripts.rng +23 -0
  42. data/cockpit/themes/dataflow/rngs/start.rng +121 -0
  43. data/cockpit/themes/dataflow/rngs/stop.rng +5 -0
  44. data/cockpit/themes/dataflow/rngs/terminate.rng +1 -0
  45. data/cockpit/themes/dataflow/symbols/alternative.svg +5 -0
  46. data/cockpit/themes/dataflow/symbols/arrow.svg +3 -0
  47. data/cockpit/themes/dataflow/symbols/call.svg +6 -0
  48. data/cockpit/themes/dataflow/symbols/call_sensor.svg +9 -0
  49. data/cockpit/themes/dataflow/symbols/callmanipulate.svg +8 -0
  50. data/cockpit/themes/dataflow/symbols/callmanipulate_sensor.svg +11 -0
  51. data/cockpit/themes/dataflow/symbols/choose.svg +5 -0
  52. data/cockpit/themes/dataflow/symbols/choose_exclusive.svg +5 -0
  53. data/cockpit/themes/dataflow/symbols/choose_inclusive.svg +4 -0
  54. data/cockpit/themes/dataflow/symbols/closed_loop.svg +5 -0
  55. data/cockpit/themes/dataflow/symbols/closed_loop_cancel.svg +5 -0
  56. data/cockpit/themes/dataflow/symbols/closed_loop_control.svg +5 -0
  57. data/cockpit/themes/dataflow/symbols/closed_loop_measuring.svg +6 -0
  58. data/cockpit/themes/dataflow/symbols/complex.svg +8 -0
  59. data/cockpit/themes/dataflow/symbols/critical.svg +4 -0
  60. data/cockpit/themes/dataflow/symbols/delete.svg +4 -0
  61. data/cockpit/themes/dataflow/symbols/end.svg +3 -0
  62. data/cockpit/themes/dataflow/symbols/escape.svg +5 -0
  63. data/cockpit/themes/dataflow/symbols/event_end.svg +3 -0
  64. data/cockpit/themes/dataflow/symbols/loop.svg +5 -0
  65. data/cockpit/themes/dataflow/symbols/manipulate.svg +4 -0
  66. data/cockpit/themes/dataflow/symbols/otherwise.svg +5 -0
  67. data/cockpit/themes/dataflow/symbols/parallel.svg +5 -0
  68. data/cockpit/themes/dataflow/symbols/parallel_branch.svg +5 -0
  69. data/cockpit/themes/dataflow/symbols/parallel_branch_compact.svg +4 -0
  70. data/cockpit/themes/dataflow/symbols/parallel_branch_event.svg +14 -0
  71. data/cockpit/themes/dataflow/symbols/parallel_branch_normal.svg +5 -0
  72. data/cockpit/themes/dataflow/symbols/parallel_eventbased_exclusive.svg +9 -0
  73. data/cockpit/themes/dataflow/symbols/parallel_eventbased_parallel.svg +8 -0
  74. data/cockpit/themes/dataflow/symbols/scripts.svg +4 -0
  75. data/cockpit/themes/dataflow/symbols/start.svg +3 -0
  76. data/cockpit/themes/dataflow/symbols/start_event.svg +5 -0
  77. data/cockpit/themes/dataflow/symbols/stop.svg +5 -0
  78. data/cockpit/themes/dataflow/symbols/terminate.svg +4 -0
  79. data/cockpit/themes/dataflow/theme.js +1566 -0
  80. data/cockpit/themes/default/rngs/call.rng +6 -4
  81. data/cockpit/themes/default/rngs/callmanipulate.rng +6 -4
  82. data/cockpit/themes/default/rngs/parallel.rng +2 -2
  83. data/cockpit/themes/default/rngs/start.rng +3 -3
  84. data/cockpit/themes/default/theme.js +12 -1
  85. data/cockpit/themes/extended/rngs/call.rng +6 -4
  86. data/cockpit/themes/extended/rngs/callmanipulate.rng +6 -4
  87. data/cockpit/themes/extended/rngs/parallel.rng +2 -2
  88. data/cockpit/themes/extended/rngs/start.rng +3 -3
  89. data/cockpit/themes/extended/theme.js +12 -1
  90. data/cockpit/themes/felix/rngs/alternative.rng +25 -0
  91. data/cockpit/themes/felix/rngs/call.rng +229 -0
  92. data/cockpit/themes/felix/rngs/callmanipulate.rng +259 -0
  93. data/cockpit/themes/felix/rngs/choose.rng +14 -0
  94. data/cockpit/themes/felix/rngs/closed_loop.rng +62 -0
  95. data/cockpit/themes/felix/rngs/closed_loop_cancel.rng +5 -0
  96. data/cockpit/themes/felix/rngs/closed_loop_control.rng +31 -0
  97. data/cockpit/themes/felix/rngs/closed_loop_measuring.rng +12 -0
  98. data/cockpit/themes/felix/rngs/critical.rng +5 -0
  99. data/cockpit/themes/felix/rngs/escape.rng +1 -0
  100. data/cockpit/themes/felix/rngs/group.rng +3 -0
  101. data/cockpit/themes/felix/rngs/loop.rng +22 -0
  102. data/cockpit/themes/felix/rngs/manipulate.rng +20 -0
  103. data/cockpit/themes/felix/rngs/otherwise.rng +22 -0
  104. data/cockpit/themes/felix/rngs/parallel.rng +27 -0
  105. data/cockpit/themes/felix/rngs/parallel_branch.rng +2 -0
  106. data/cockpit/themes/felix/rngs/scripts.rng +23 -0
  107. data/cockpit/themes/felix/rngs/start.rng +121 -0
  108. data/cockpit/themes/felix/rngs/stop.rng +5 -0
  109. data/cockpit/themes/felix/rngs/terminate.rng +1 -0
  110. data/cockpit/themes/felix/symbols/alternative.svg +5 -0
  111. data/cockpit/themes/felix/symbols/arrow.svg +3 -0
  112. data/cockpit/themes/felix/symbols/call.svg +6 -0
  113. data/cockpit/themes/felix/symbols/call_sensor.svg +9 -0
  114. data/cockpit/themes/felix/symbols/callmanipulate.svg +8 -0
  115. data/cockpit/themes/felix/symbols/callmanipulate_sensor.svg +11 -0
  116. data/cockpit/themes/felix/symbols/choose.svg +5 -0
  117. data/cockpit/themes/felix/symbols/choose_exclusive.svg +5 -0
  118. data/cockpit/themes/felix/symbols/choose_inclusive.svg +4 -0
  119. data/cockpit/themes/felix/symbols/closed_loop.svg +5 -0
  120. data/cockpit/themes/felix/symbols/closed_loop_cancel.svg +5 -0
  121. data/cockpit/themes/felix/symbols/closed_loop_control.svg +5 -0
  122. data/cockpit/themes/felix/symbols/closed_loop_measuring.svg +6 -0
  123. data/cockpit/themes/felix/symbols/complex.svg +8 -0
  124. data/cockpit/themes/felix/symbols/critical.svg +4 -0
  125. data/cockpit/themes/felix/symbols/delete.svg +4 -0
  126. data/cockpit/themes/felix/symbols/end.svg +3 -0
  127. data/cockpit/themes/felix/symbols/escape.svg +5 -0
  128. data/cockpit/themes/felix/symbols/event_end.svg +3 -0
  129. data/cockpit/themes/felix/symbols/loop.svg +5 -0
  130. data/cockpit/themes/felix/symbols/manipulate.svg +4 -0
  131. data/cockpit/themes/felix/symbols/otherwise.svg +5 -0
  132. data/cockpit/themes/felix/symbols/parallel.svg +5 -0
  133. data/cockpit/themes/felix/symbols/parallel_branch.svg +5 -0
  134. data/cockpit/themes/felix/symbols/parallel_branch_compact.svg +4 -0
  135. data/cockpit/themes/felix/symbols/parallel_branch_event.svg +14 -0
  136. data/cockpit/themes/felix/symbols/parallel_branch_normal.svg +5 -0
  137. data/cockpit/themes/felix/symbols/parallel_eventbased_exclusive.svg +9 -0
  138. data/cockpit/themes/felix/symbols/parallel_eventbased_parallel.svg +8 -0
  139. data/cockpit/themes/felix/symbols/scripts.svg +4 -0
  140. data/cockpit/themes/felix/symbols/start.svg +3 -0
  141. data/cockpit/themes/felix/symbols/start_event.svg +5 -0
  142. data/cockpit/themes/felix/symbols/stop.svg +5 -0
  143. data/cockpit/themes/felix/symbols/terminate.svg +4 -0
  144. data/cockpit/themes/felix/theme.js +1526 -0
  145. data/cockpit/themes/model/rngs/call.rng +10 -10
  146. data/cockpit/themes/model/rngs/callmanipulate.rng +10 -10
  147. data/cockpit/themes/model/theme.js +11 -1
  148. data/cockpit/themes/packed/rngs/call.rng +6 -4
  149. data/cockpit/themes/packed/rngs/callmanipulate.rng +6 -4
  150. data/cockpit/themes/packed/rngs/parallel.rng +2 -2
  151. data/cockpit/themes/packed/rngs/start.rng +3 -3
  152. data/cockpit/themes/packed/theme.js +11 -1
  153. data/cockpit/themes/preset/rngs/call.rng +6 -4
  154. data/cockpit/themes/preset/rngs/callmanipulate.rng +6 -4
  155. data/cockpit/themes/preset/rngs/parallel.rng +2 -2
  156. data/cockpit/themes/preset/rngs/start.rng +3 -3
  157. data/cockpit/themes/preset/theme.js +12 -1
  158. data/cpee.gemspec +2 -2
  159. data/lib/cpee/implementation.rb +1 -1
  160. data/lib/cpee/implementation_properties.rb +23 -13
  161. data/lib/cpee/message.rb +20 -8
  162. data/lib/cpee/persistence.rb +12 -0
  163. data/lib/properties/state.rng +0 -2
  164. data/lib/properties.xml +1 -2
  165. data/server/executionhandlers/ruby/connection.rb +49 -13
  166. data/server/executionhandlers/ruby/controller.rb +1 -1
  167. data/server/executionhandlers/ruby/dsl_to_dslx.xsl +71 -61
  168. data/server/resources/states.dot +0 -4
  169. data/server/resources/states.xml +0 -6
  170. data/tools/cpee +32 -1
  171. metadata +116 -21
  172. data/cockpit/css/replay.css +0 -55
  173. data/cockpit/js/replay.js +0 -40
  174. data/cockpit/replay.html +0 -53
  175. data/cockpit/themes/compact/symbols/test.svg +0 -74
  176. data/cockpit/themes/control/symbols/test.svg +0 -74
  177. data/cockpit/themes/default/symbols/test.svg +0 -74
  178. data/cockpit/themes/extended/symbols/test.svg +0 -74
  179. data/cockpit/themes/model/symbols/test.svg +0 -74
  180. data/cockpit/themes/packed/symbols/test.svg +0 -74
  181. data/cockpit/themes/preset/symbols/test.svg +0 -74
  182. data/server/executionhandlers/ruby/desc.xml +0 -107
  183. data/server/resources/test.pdf +0 -0
  184. data/server/routing/end.pid +0 -1
  185. data/server/routing/forward-events-00.pid +0 -1
  186. data/server/routing/forward-votes.pid +0 -1
  187. data/server/routing/persist.pid +0 -1
  188. data/server/server.conf +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d9392ee2d94e307e588b467e9a435901f8d231d42f84ff326432444764be99
4
- data.tar.gz: d0f08d2fc5100b961f218e5c1890931d894bc9d3ed844e880ca187fffb3342d2
3
+ metadata.gz: 895480af20ce6499a796ff2beb4985350038da28ed581a315ac9d04bc796e09b
4
+ data.tar.gz: e04fa030ef2aca658d5ca1a6880325429de767fac55d1f9f3831356b3fc30c0a
5
5
  SHA512:
6
- metadata.gz: 56677348739cd49fc763e867d9d6d464afa1183fe5220277bd2141410b46ddd065320ae4e11c8ed469a82107d57a3f0afc6148624d71c88f6ba1bf961bd9af9a
7
- data.tar.gz: 4bcf1ce059ae0839862910e620697907a045ac925ffd30c7212d7b8ff8819f9f6c6a2eb845365ab3c7887db9d0e6d567122b98ce77699d3a23fbbafa2c2ff790
6
+ metadata.gz: 77b2c6977626b081e38ba035b6129c710b89837bc102bc21e85aae4a894fb73eabd0e1dcd3a1a131e68603f4bdbfb634370790dc60b529770db26253666bac8a
7
+ data.tar.gz: bd4ca4ede0b5754385e8981e371dc0e10f0b3af2da5a4722566a50eeec75a8d80fa90bd474dc206c2dbaaa3b738db5ca749bc4568082a93ed73ae142fac798ca
@@ -0,0 +1,42 @@
1
+ resources {
2
+ border-left: 1pt solid var(--wfadaptor-border);
3
+ }
4
+ #resources line.resource-line:hover {
5
+ stroke: red;
6
+ }
7
+
8
+ .resource-label {
9
+ position: absolute;
10
+ padding-left: 0.5em;
11
+ padding-right: 0.5em;
12
+ min-width: 10ex;
13
+ height: 2em;
14
+ text-align: center;
15
+ line-height: 2em;
16
+ background-color: var(--wfadaptor-background);
17
+ border: 1pt solid var(--wfadaptor-border);
18
+ border-radius: 1em;
19
+ }
20
+
21
+ .resource-label:before {
22
+ content: ' ';
23
+ position: absolute;
24
+ width: 0;
25
+ height: 0;
26
+ left: 15px;
27
+ top: 2em;
28
+ border: 8.5px solid;
29
+ border-color: var(--wfadaptor-border) transparent transparent var(--wfadaptor-border);
30
+ }
31
+
32
+ .resource-label:after {
33
+ content: ' ';
34
+ position: absolute;
35
+ width: 0;
36
+ height: 0;
37
+ left: 16px;
38
+ top: 2em;
39
+ border: 7.5px solid;
40
+ border-color: var(--wfadaptor-background) transparent transparent var(--wfadaptor-background);
41
+ }
42
+
data/cockpit/css/ui.css CHANGED
@@ -41,6 +41,10 @@ body {
41
41
  #graphgrid.striped .graphlabel, #graphgrid.striped .graphempty {
42
42
  border-left: 1pt solid var(--wfadaptor-border);
43
43
  }
44
+ #graphgrid.striped #resources rect.border {
45
+ width: 0.8pt;
46
+ fill: var(--wfadaptor-border);
47
+ }
44
48
  #graphgrid.striped .graphlabel.even, #graphgrid.striped .graphempty.even, #graphgrid.striped .graphlast.even {
45
49
  background-color: #e9e9e9;
46
50
  }
data/cockpit/edit.html CHANGED
@@ -55,7 +55,9 @@
55
55
  <script type="text/javascript" src="js/parameters.js"></script>
56
56
  <script type="text/javascript" src="js/edit.js"></script>
57
57
  <script type="text/javascript" src="js/modifiers.js"></script>
58
+ <script type="text/javascript" src="js/resources.js"></script>
58
59
  <link rel="stylesheet" href="css/ui.css" type="text/css"/>
60
+ <link rel="stylesheet" href="css/resources.css" type="text/css"/>
59
61
  <link rel="stylesheet" href="/global_ui/uicpee.css" type="text/css"/>
60
62
  <style>
61
63
  /* has to be fucking inline, because firefox and chrome disagree how to handle filter urls */
@@ -242,8 +244,9 @@
242
244
  <ui-behind ><a style='display:none' target='_blank' id='current-track'>T</a><a style='display:none' target='_blank' id='current-graph'>G</a></ui-behind>
243
245
  </ui-tabbar>
244
246
  <ui-content>
245
- <ui-area data-belongs-to-tab="details" id='graphcolumn'>
247
+ <ui-area data-belongs-to-tab="details" id='graphcolumn' oncontextmenu='return false'>
246
248
  <div id='graphgrid'>
249
+ <div class="resource-label" style="display: none"></div>
247
250
  <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:x="http://www.w3.org/1999/xlink" id='graphcanvas' width='1' height='1'></svg>
248
251
  </div>
249
252
  </ui-area>
data/cockpit/index.html CHANGED
@@ -54,7 +54,9 @@
54
54
  <script type="text/javascript" src="js/details.js"></script>
55
55
  <script type="text/javascript" src="js/parameters.js"></script>
56
56
  <script type="text/javascript" src="js/modifiers.js"></script>
57
+ <script type="text/javascript" src="js/resources.js"></script>
57
58
  <link rel="stylesheet" href="css/ui.css" type="text/css"/>
59
+ <link rel="stylesheet" href="css/resources.css" type="text/css"/>
58
60
  <link rel="stylesheet" href="/global_ui/uicpee.css" type="text/css"/>
59
61
  <style>
60
62
  /* has to be fucking inline, because firefox and chrome disagree how to handle filter urls */
@@ -245,6 +247,7 @@
245
247
  <ui-content>
246
248
  <ui-area data-belongs-to-tab="details" id='graphcolumn' oncontextmenu='return false'>
247
249
  <div id='graphgrid'>
250
+ <div class="resource-label" style="display: none"></div>
248
251
  <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:x="http://www.w3.org/1999/xlink" id='graphcanvas' width='1' height='1'></svg>
249
252
  </div>
250
253
  </ui-area>
@@ -1,3 +1,5 @@
1
+ var details_updated = new Event("details:updated", {"bubbles":true, "cancelable":false});
2
+
1
3
  $(document).ready(function() {
2
4
  var timer;
3
5
 
@@ -5,20 +7,6 @@ $(document).ready(function() {
5
7
  clearTimeout(timer);
6
8
  timer = setTimeout(do_main_save, 5000);
7
9
  });
8
- $(document).on('change','#dat_details select',function(e){
9
- clearTimeout(timer);
10
- do_main_save();
11
- });
12
- $(document).on('blur','#dat_details input, #dat_details textarea, #dat_details [contenteditable]',function(e){
13
- clearTimeout(timer);
14
- do_main_save();
15
- });
16
- $(document).on('keypress','#dat_details input',function(e){
17
- if (e.keyCode == 13) {
18
- clearTimeout(timer);
19
- do_main_save();
20
- }
21
- });
22
10
  $(document).on('keypress','#dat_details [contenteditable]',function(e){
23
11
  if (e.keyCode == 13) {
24
12
  document.execCommand('insertLineBreak')
@@ -33,6 +21,10 @@ $(document).ready(function() {
33
21
  clearTimeout(timer);
34
22
  do_main_save();
35
23
  });
24
+ $(document).on('relaxngui_change', '#dat_details', function(e){
25
+ clearTimeout(timer);
26
+ do_main_save();
27
+ });
36
28
  });
37
29
 
38
30
  function do_main_save() { //{{{
@@ -61,6 +53,9 @@ function do_main_work() { //{{{
61
53
  if (node[0].namespaceURI == nnew.attr('xmlns')) { // remove xmlns when it is the same as in the parent node
62
54
  nnew[0].removeAttribute('xmlns');
63
55
  }
56
+
57
+ parameters_changed
58
+
64
59
  node.replaceWith(nnew);
65
60
 
66
61
  var ttarget = manifestation.adaptor.illustrator.get_node_by_svg_id(svgid);
data/cockpit/js/edit.js CHANGED
@@ -7,6 +7,9 @@ document.addEventListener('parameters:changed', function (e) {
7
7
  document.addEventListener('modifiers:changed', function (e) {
8
8
  $("button[name=save]").prop("disabled",false);
9
9
  }, false);
10
+ document.addEventListener('model:loaded', function (e) {
11
+ $("button[name=save]").prop("disabled",false);
12
+ }, false);
10
13
 
11
14
  function leading_zeros(dt) {
12
15
  return (dt < 10 ? '0' : '') + dt;
@@ -6,6 +6,7 @@ var loading = false;
6
6
  var subscription;
7
7
  var subscription_state = 'less';
8
8
  var graph_changed = new Event("graph:changed", {"bubbles":true, "cancelable":false});
9
+ var model_loaded = new Event("model:loaded", {"bubbles":true, "cancelable":false});
9
10
  var save = {};
10
11
  save['endpoints'] = undefined;
11
12
  save['dataelements'] = undefined;
@@ -30,9 +31,11 @@ function global_init() {
30
31
  save['details'] = undefined;
31
32
  save['details_target'] = undefined;
32
33
  save['instance_pos'] = [];
34
+ save['modeltype'] = 'CPEE';
33
35
  save['modifiers'] = {};
34
36
  save['modifiers_active'] = {};
35
37
  save['modifiers_additional'] = {};
38
+ save['resources'] = undefined;
36
39
  node_state = {};
37
40
  }
38
41
 
@@ -260,14 +263,14 @@ function create_instance(base,name,load,exec) {// {{{
260
263
  }
261
264
  }// }}}
262
265
 
263
- function sse() { //{{{
266
+ async function sse() { //{{{
264
267
  var url = $('body').attr('current-instance');
265
268
  if (subscription) {
266
269
  es = new EventSource(url + "/notifications/subscriptions/" + subscription + "/sse/");
267
270
  es.onopen = function() {
268
271
  append_to_log("monitoring", "opened", "nice.");
269
272
  };
270
- es.onmessage = function(e) {
273
+ es.onmessage = async function(e) {
271
274
  data = JSON.parse(e.data);
272
275
  if (data['type'] == 'event') {
273
276
  switch(data['topic']) {
@@ -281,7 +284,12 @@ function sse() { //{{{
281
284
  monitor_instance_values("endpoints");
282
285
  break;
283
286
  case 'attributes':
284
- monitor_instance_values("attributes");
287
+ if (save['resources'] != data.content.values.resource) {
288
+ await monitor_instance_values("attributes");
289
+ monitor_instance_values("endpoints");
290
+ } else {
291
+ monitor_instance_values("attributes");
292
+ }
285
293
  if (save['graph_theme'] != data.content.values.theme) {
286
294
  monitor_graph_change(true);
287
295
  }
@@ -314,9 +322,9 @@ function sse() { //{{{
314
322
  // setTimeout(sse,10000);
315
323
  };
316
324
  }
325
+ await monitor_instance_values("attributes"); // attributes first, to catch the <resources> attribute which overrides current-resources
317
326
  monitor_instance_values("dataelements");
318
327
  monitor_instance_values("endpoints");
319
- monitor_instance_values("attributes");
320
328
  monitor_instance_dsl();
321
329
  monitor_instance_state();
322
330
  } //}}}
@@ -393,11 +401,37 @@ function monitor_instance(cin,rep,load,exec) {// {{{
393
401
  });
394
402
  }// }}}
395
403
 
396
- function monitor_instance_values(type,vals) {// {{{
397
- var url = $('body').attr('current-instance');
398
- var rep = $('body').attr('current-resources');
399
- var bas = $('body').attr('current-base');
404
+ function get_resource(base, key, loc, cache) {
405
+ cache[key] = {};
406
+ let deferreds = [new $.Deferred(), new $.Deferred(), new $.Deferred()];
407
+ $.ajax({
408
+ url: base + 'endpoints/' + encodeURIComponent(loc) + "/symbol.svg",
409
+ success: function(res) {
410
+ cache[key]['symbol'] = res;
411
+ deferreds[0].resolve(true);
412
+ },
413
+ error: deferreds[0].resolve
414
+ })
415
+ $.ajax({
416
+ url: base + 'endpoints/' + encodeURIComponent(loc) + "/schema.rng",
417
+ success: function(res) {
418
+ cache[key]['schema'] = res;
419
+ deferreds[1].resolve(true);
420
+ },
421
+ error: deferreds[1].resolve
422
+ })
423
+ $.ajax({
424
+ url: base + 'endpoints/' + encodeURIComponent(loc) + "/properties.json",
425
+ success: function(res) {
426
+ cache[key]['properties'] = res;
427
+ deferreds[2].resolve(true);
428
+ },
429
+ error: deferreds[2].resolve
430
+ })
431
+ return deferreds;
432
+ }
400
433
 
434
+ function monitor_instance_values(type,vals) {// {{{
401
435
  if (type == "dataelements" && save['state'] == "running") {
402
436
  let de = save[type].save();
403
437
  Object.entries(vals).forEach(([key,value]) => {
@@ -420,7 +454,8 @@ function monitor_instance_values(type,vals) {// {{{
420
454
  });
421
455
  save[type].content(de);
422
456
  } else {
423
- $.ajax({
457
+ let url = $('body').attr('current-instance');
458
+ return $.ajax({
424
459
  type: "GET",
425
460
  url: url + "/properties/" + type + "/",
426
461
  success: function(res){
@@ -430,36 +465,12 @@ function monitor_instance_values(type,vals) {// {{{
430
465
  var tmp = {};
431
466
  $(res).find(" > endpoints > *").each(function(k,v) {
432
467
  save['endpoints_list'][v.localName] = v.lastChild.nodeValue;
468
+ let rep = $('body').attr('current-resources');
433
469
  $.ajax({
434
470
  url: rep + 'endpoints/' + encodeURIComponent($(v).text()),
435
471
  success: function() {
436
472
  tmp[v.tagName] = {};
437
- var deferreds = [new $.Deferred(), new $.Deferred(), new $.Deferred()];
438
- $.ajax({
439
- url: rep + 'endpoints/' + encodeURIComponent($(v).text()) + "/symbol.svg",
440
- success: function(res) {
441
- tmp[v.tagName]['symbol'] = res;
442
- deferreds[0].resolve(true);
443
- },
444
- error: deferreds[0].resolve
445
- })
446
- $.ajax({
447
- url: rep + 'endpoints/' + encodeURIComponent($(v).text()) + "/schema.rng",
448
- success: function(res) {
449
- tmp[v.tagName]['schema'] = res;
450
- deferreds[1].resolve(true);
451
- },
452
- error: deferreds[1].resolve
453
- })
454
- $.ajax({
455
- url: rep + 'endpoints/' + encodeURIComponent($(v).text()) + "/properties.json",
456
- success: function(res) {
457
- tmp[v.tagName]['properties'] = res;
458
- deferreds[2].resolve(true);
459
- },
460
- error: deferreds[2].resolve
461
- })
462
- $.when.apply($, deferreds).then(function(x) {
473
+ $.when.apply($, get_resource(rep,v.tagName,$(v).text(),tmp)).then(function(x) {
463
474
  save['endpoints_cache'] = tmp;
464
475
  // when updating attributes clear the attributes, because they might change as well. New arguments are possible.
465
476
  $('#dat_details').empty();
@@ -467,8 +478,33 @@ function monitor_instance_values(type,vals) {// {{{
467
478
  });
468
479
  }
469
480
  });
481
+ if (save['resources']) {
482
+ let rep = save['resources'];
483
+ $.ajax({
484
+ url: rep + 'endpoints/' + encodeURIComponent(encodeURIComponent($(v).text())),
485
+ success: function() {
486
+ tmp[v.tagName] = {};
487
+ $.when.apply($, get_resource(rep,v.tagName,encodeURIComponent($(v).text()),tmp)).then(function(x) {
488
+ save['endpoints_cache'] = tmp;
489
+ // when updating attributes clear the attributes, because they might change as well. New arguments are possible.
490
+ $('#dat_details').empty();
491
+ adaptor_update();
492
+ });
493
+ }
494
+ });
495
+ }
470
496
  });
471
497
  } else if(type == "attributes") {
498
+ if ($(" > attributes > resources",res).length > 0) {
499
+ save['resources'] = $(" > attributes > resources",res).text();
500
+ } else {
501
+ save['resources'] = undefined;
502
+ }
503
+ if ($(" > attributes > modeltype",res).length > 0) {
504
+ save['modeltype'] = $(" > attributes > modeltype",res).text();
505
+ } else {
506
+ save['modeltype'] = undefined;
507
+ }
472
508
  if ($('#modifiers > div').length == 0) {
473
509
  modifiers_display().then(function(){ modifiers_select(); });
474
510
  } else {
@@ -519,7 +555,7 @@ function adaptor_init(url,theme,dslx) { //{{{
519
555
  save['graph_theme'] = theme;
520
556
  save['graph_adaptor'] = new WfAdaptor($('body').data('theme-base') + '/' + theme + '/theme.js',function(graphrealization){
521
557
  manifestation.endpoints = save.endpoints_list;
522
- graphrealization.draw_labels = function(max,labels,shift,striped) {
558
+ graphrealization.draw_labels = function(max,labels,dimensions,striped) {
523
559
  $('#graphcanvas').css('grid-row', '1/span ' + (max.row + 2));
524
560
  if (striped == true) {
525
561
  if (!$('#graphgrid').hasClass('striped')) {
@@ -529,10 +565,17 @@ function adaptor_init(url,theme,dslx) { //{{{
529
565
  $('#graphgrid').removeClass('striped');
530
566
  }
531
567
 
532
- $('#graphgrid .graphlabel, #graphgrid .graphempty, #graphgrid .graphlast').remove();
568
+ $('#graphgrid .graphlabel, #graphgrid .graphempty, #resources, #graphgrid .graphlast').remove();
533
569
  var tlabels = {};
534
570
  var tcolumns = [];
535
571
  var tcolumncount = {}
572
+ var thidden = [];
573
+
574
+ var tsvgs = {};
575
+ const mapPoints = new Map();
576
+ let iconsize = 14;
577
+ let iconshift = 7;
578
+
536
579
  _.each(labels,function(val){
537
580
  if (val.label != "") {
538
581
  tlabels[val.row] = [];
@@ -541,35 +584,144 @@ function adaptor_init(url,theme,dslx) { //{{{
541
584
  tcolumns.push(col.column);
542
585
  tcolumncount[col.column] = 0;
543
586
  }
587
+ if (!thidden.includes(col.column) && col.type == 'resource') {
588
+ thidden.push(col.column);
589
+ }
544
590
  if (col.value != undefined) {
591
+
592
+ // Start Peilei
593
+ if (col.type == "resource") {
594
+ let str = '';
595
+ for (const [k, v] of Object.entries(col.value)) {
596
+ var p = {};
597
+ p.row = val.row;
598
+ p.AR = v;
599
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
600
+ if (!mapPoints.has(k)) {
601
+ p.y0 = p.y0 == undefined ? (dimensions.height_shift/2 + dimensions.height * val.row - 20) : p.y0;
602
+ p.ymax = (p.ymax == undefined) ? p.y0 : p.ymax;
603
+ } else {
604
+ p.y0 = mapPoints.get(k).y0;
605
+ p.ymax = mapPoints.get(k).ymax;
606
+ }
607
+ mapPoints.set(k, p);
608
+ }
609
+ var cx = iconshift*2;
610
+ str += '<g xmlns="http://www.w3.org/2000/svg">';
611
+
612
+ for (const [k, p] of mapPoints) {
613
+ let firstAssignFlag = 0;
614
+ p.x0 = p.xc = cx;
615
+
616
+ // Including Triangle
617
+ if (k in col.value) { // Define points for a triangle pointing to the right
618
+ if (p.AR == "Read") {
619
+ str += '<polygon xmlns="http://www.w3.org/2000/svg" points="' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height * val.row - 20) + ' ' + (cx + 5) + ',' + (dimensions.height_shift/2 + dimensions.height * val.row - 15) + ' ' + (cx + 5) + ',' + (dimensions.height_shift/2 + dimensions.height * val.row - 25) + '" fill="green" class="resource-point">';
620
+ if (p.yc == p.y0) {
621
+ firstAssignFlag = 1;
622
+ }
623
+ } else if (p.AR == "Assign") { // Define points for a triangle pointing to the left
624
+ str += '<polygon xmlns="http://www.w3.org/2000/svg" points="' + (cx + 5) + ',' + (dimensions.height_shift/2 + dimensions.height * val.row - 20) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height * val.row - 15) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height * val.row - 25) + '" fill="orange" class="resource-point">';
625
+ } else if (p.AR == "AssignRead") {
626
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
627
+ str += '<circle xmlns="http://www.w3.org/2000/svg" cx="' + cx + '" cy="' + p.yc + '" r="5" fill="blue" class="resource-point">';
628
+ }
629
+
630
+ if (dimensions.height_shift/2 + dimensions.height * val.row != p.y0) {
631
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
632
+ if (dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax) {
633
+ p.ymax = dimensions.height_shift/2 + dimensions.height * val.row - 20;
634
+ }
635
+ }
636
+
637
+ // Converted from <title>
638
+ str += '<text xmlns="http://www.w3.org/2000/svg">' + k + '</text>';
639
+
640
+ if (p.AR == "Read" || p.AR == "Assign") {
641
+ str += '</polygon>';
642
+ } else if (p.AR == "AssignRead") {
643
+ str += '</circle>';
644
+ }
645
+ }
646
+
647
+ if (firstAssignFlag == 1) {
648
+ // Additional logic and construction of another polygon for orange triangle pointing left
649
+ p.y0 -= ((p.row-1) * dimensions.height);
650
+ str += '<polygon xmlns="http://www.w3.org/2000/svg" points="' + (cx + 5) + ',' + (dimensions.height_shift/2 + dimensions.height - 20) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height - 15) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height - 25) + '" fill="orange" class="resource-point">' + '<text xmlns="http://www.w3.org/2000/svg">' + k + '</text></polygon>';
651
+ }
652
+ cx += iconsize;
653
+ }
654
+
655
+ for (const [k, p] of mapPoints) {
656
+ if(k in col.value) {
657
+ if (dimensions.height_shift/2+dimensions.height*val.row != p.y0) {
658
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
659
+ if(dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax) {
660
+ p.ymax = dimensions.height_shift/2 + dimensions.height * val.row - 20;
661
+ }
662
+ }
663
+ }
664
+ }
665
+ str += '</g>';
666
+
667
+ tsvgs[val.row] = $X(str);
668
+ }
669
+
545
670
  tcolumncount[col.column] += 1;
546
671
  }
547
672
  tlabels[val.row][tcolumns.indexOf(col.column)] = { label: col.value, type: val.tname, id: val.element_id };
548
673
  });
549
674
  }
550
675
  });
676
+
551
677
  $('#graphgrid').css({
552
- 'grid-template-rows': (shift/2) + 'px repeat(' + max.row + ', 1fr) ' + (shift/2) + 'px',
678
+ 'grid-template-rows': (dimensions.height_shift/2) + 'px repeat(' + max.row + ', 1fr) ' + (dimensions.height_shift/2) + 'px',
553
679
  'grid-template-columns': 'max-content' + (tcolumns.length > 0 ? ' repeat(' + tcolumns.length.toString() + ',max-content)' : '') + ' auto'
554
680
  });
681
+
555
682
  for (var i = 0; i < max.row; i++) {
556
- for (var j = 0; j < tcolumns.length; j++) {
557
- if (tlabels[i+1] != undefined && tlabels[i+1][j] != undefined && tlabels[i+1][j].label != undefined && tlabels[i+1][j].label != '') {
558
- var col = tlabels[i+1][j];
559
- var ele = $('<div element-row="' + i + '" class="graphlabel ' + (i % 2 == 0 ? 'odd' : 'even') + '" element-type="' + col.type + '" element-id="' + col.id + '" style="grid-column: ' + (j+2) + '; grid-row: ' + (i+2) + '"><span>' + col.label + '</span></div>');
560
- graphrealization.illustrator.draw.bind_event(ele, col.type, false);
561
- $('#graphgrid').append(ele);
562
- } else {
563
- if (tcolumncount[tcolumns[j]] != 0) {
564
- var ele = $('<div element-row="' + i + '" class="graphempty ' + (i % 2 == 0 ? 'odd' : 'even') + '" style="grid-column: ' + (j+2) + '; grid-row: ' + (i+2) + '; padding-bottom: ' + shift + 'px">&#032;</div>');
683
+ for (var j = 0; j < tcolumns.length - 1; j++) {
684
+ if (thidden != tcolumns[j]) {
685
+ if (tlabels[i+1] != undefined && tlabels[i+1][j] != undefined && tlabels[i+1][j].label != undefined && tlabels[i+1][j].label != '') {
686
+ var col = tlabels[i+1][j];
687
+ var ele = $('<div element-row="' + i + '" class="graphlabel ' + (i % 2 == 0 ? 'odd' : 'even') + '" element-type="' + col.type + '" element-id="' + col.id + '" style="grid-column: ' + (j+2) + '; grid-row: ' + (i+2) + '"><span>' + col.label + '</span></div>');
688
+ graphrealization.illustrator.draw.bind_event(ele, col.type, false);
565
689
  $('#graphgrid').append(ele);
690
+ } else {
691
+ if (tcolumncount[tcolumns[j]] != 0) {
692
+ var ele = $('<div element-row="' + i + '" class="graphempty ' + (i % 2 == 0 ? 'odd' : 'even') + '" style="grid-column: ' + (j+2) + '; grid-row: ' + (i+2) + '; padding-bottom: ' + dimensions.height_shift + 'px">&#032;</div>');
693
+ $('#graphgrid').append(ele);
694
+ }
566
695
  }
567
696
  }
568
697
  }
698
+
569
699
  var j = tcolumns.length;
570
- var ele = $('<div element-row="' + i + '" class="graphlast ' + (i % 2 == 0 ? 'odd' : 'even') + '" style="grid-column: ' + (j+2) + '; grid-row: ' + (i+2) + '; padding-bottom: ' + shift + 'px">&#032;</div>');
700
+ var ele = $('<div element-row="' + i + '" class="graphlast ' + (i % 2 == 0 ? 'odd' : 'even') + '" style="grid-column: ' + (j+2) + '; grid-row: ' + (i+2) + '; padding-bottom: ' + dimensions.height_shift + 'px">&#032;</div>');
571
701
  $('#graphgrid').append(ele);
572
702
  }
703
+
704
+ if (Object.keys(tsvgs).length > 0) {
705
+ let dataflow = $X('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:x="http://www.w3.org/1999/xlink" id="resources"></svg>');
706
+ dataflow.css('grid-row', '1/span ' + (max.row + 2));
707
+ dataflow.css('grid-column', tcolumns.indexOf(thidden.first) + 2);
708
+ dataflow.attr('height', $('#graphcanvas').attr('height'));
709
+ dataflow.attr('width', mapPoints.size * iconsize + iconshift * 2);
710
+
711
+ for (var i = 0; i < max.row; i++) { // Needs parenthesises below
712
+ dataflow.append($X('<rect xmlns="http://www.w3.org/2000/svg" class="stripe ' + (i % 2 == 0 ? 'even' : 'odd') + '" x="0" y="' + (dimensions.height * i + 5.2) + '" width="' + (mapPoints.size * iconsize + iconshift * 2) + '" height="' + dimensions.height + '"></rect>'));
713
+ dataflow.append($X('<rect xmlns="http://www.w3.org/2000/svg" class="border" x="0" y="' + (dimensions.height * i + 5.2) + '" height="' + dimensions.height + '"></rect>'));
714
+ }
715
+ for (const [k, p] of mapPoints) {
716
+ dataflow.append($X('<line xmlns="http://www.w3.org/2000/svg" x1="' + p.x0 + '" y1="' + p.y0 + '" x2="' + p.xc + '" y2="' + p.ymax + '" class="resource-line" stroke-opacity="0.1" stroke="orange" stroke-width="10" marker-end="url(#arrowhead)"><text>' + k + '</text></line>'));
717
+ }
718
+ for (var i = 0; i < max.row; i++) {
719
+ dataflow.append($(tsvgs[i+1]));
720
+ }
721
+ $('#graphgrid').append(dataflow);
722
+
723
+ $('.resource-label').hide(); // Speech Bubble hide by default
724
+ }
573
725
  };
574
726
  graphrealization.set_svg_container($('#graphcanvas'));
575
727
  graphrealization.set_label_container($('#graphgrid'));
@@ -582,17 +734,50 @@ function adaptor_init(url,theme,dslx) { //{{{
582
734
  save['graph'].removeAttr('svg-subtype');
583
735
  save['graph'].removeAttr('svg-label');
584
736
  document.dispatchEvent(graph_changed);
585
- $.ajax({
586
- type: "PUT",
587
- url: url + "/properties/description/",
588
- contentType: 'text/xml',
589
- headers: {
590
- 'Content-ID': 'description',
591
- 'CPEE-Event-Source': myid
592
- },
593
- data: g,
594
- error: report_failure
595
- });
737
+ if (save['modeltype'] != 'CPEE') {
738
+ $.ajax({
739
+ type: "PUT",
740
+ url: url + "/properties/attributes/modeltype/",
741
+ data: {'value': 'CPEE'},
742
+ error: report_failure
743
+ });
744
+ $.ajax({
745
+ type: "PUT",
746
+ url: url + "/properties/transformation/",
747
+ contentType: 'text/xml',
748
+ headers: {
749
+ 'Content-ID': 'transformation',
750
+ 'CPEE-Event-Source': myid
751
+ },
752
+ data: '<transformation xmlns="http://cpee.org/ns/properties/2.0"><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>',
753
+ success: function() {
754
+ $.ajax({
755
+ type: "PUT",
756
+ url: url + "/properties/description/",
757
+ contentType: 'text/xml',
758
+ headers: {
759
+ 'Content-ID': 'description',
760
+ 'CPEE-Event-Source': myid
761
+ },
762
+ data: g,
763
+ error: report_failure
764
+ });
765
+ },
766
+ error: report_failure
767
+ });
768
+ } else {
769
+ $.ajax({
770
+ type: "PUT",
771
+ url: url + "/properties/description/",
772
+ contentType: 'text/xml',
773
+ headers: {
774
+ 'Content-ID': 'description',
775
+ 'CPEE-Event-Source': myid
776
+ },
777
+ data: g,
778
+ error: report_failure
779
+ });
780
+ }
596
781
  adaptor_update();
597
782
  manifestation.events.click(svgid);
598
783
  format_instance_pos();
@@ -762,9 +947,17 @@ function monitor_instance_state_change(notification) { //{{{
762
947
  if (notification == "stopped") {
763
948
  monitor_instance_pos();
764
949
  }
765
- // if (notification == "running") {
766
- // format_visual_clear();
767
- // }
950
+ if (notification == "running") {
951
+ // // we cant do that, because the events might not be ordered. so jus remove all the blue ones.
952
+ // format_visual_clear();
953
+
954
+ for (const [key, ele] of Object.entries(node_state)) {
955
+ for (i=0; i<ele.passive; i++) {
956
+ format_visual_remove(key,'passive');
957
+ }
958
+ }
959
+ // save_blue_states has to be left alone, because we dont know the uuid
960
+ }
768
961
 
769
962
  var but = "";
770
963
  if (notification == "ready" || notification == "stopped") {
@@ -1017,6 +1210,8 @@ async function set_testset(testset,exec) {// {{{
1017
1210
 
1018
1211
  await Promise.all(promises);
1019
1212
 
1213
+ document.dispatchEvent(model_loaded);
1214
+
1020
1215
  $.ajax({
1021
1216
  type: "GET",
1022
1217
  url: url + "/properties/state/",
@@ -1033,7 +1228,9 @@ async function set_testset(testset,exec) {// {{{
1033
1228
  });
1034
1229
  }
1035
1230
  });
1036
- }// }}}
1231
+
1232
+
1233
+ }// }}}
1037
1234
 
1038
1235
  function load_testsetfile_after() { //{{{
1039
1236
  if (loading) return;
@@ -1153,7 +1350,10 @@ async function load_des(url,model) { //{{{
1153
1350
  'CPEE-Event-Source': myid
1154
1351
  },
1155
1352
  data: model,
1156
- error: report_failure
1353
+ error: report_failure,
1354
+ success: () => {
1355
+ document.dispatchEvent(model_loaded);
1356
+ }
1157
1357
  });
1158
1358
  } //}}}
1159
1359