cpee 2.1.51 → 2.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) 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/index.html +3 -0
  5. data/cockpit/js/details.js +5 -0
  6. data/cockpit/js/instance.js +253 -62
  7. data/cockpit/js/modifiers.js +8 -1
  8. data/cockpit/js/resources.js +16 -0
  9. data/cockpit/js/wfadaptor.js +3 -3
  10. data/cockpit/templates/Coopis 2010.xml +7 -1
  11. data/cockpit/themes/compact/rngs/call.rng +3 -1
  12. data/cockpit/themes/compact/rngs/callmanipulate.rng +3 -1
  13. data/cockpit/themes/compact/theme.js +1 -1
  14. data/cockpit/themes/control/rngs/call.rng +3 -1
  15. data/cockpit/themes/control/rngs/callmanipulate.rng +3 -1
  16. data/cockpit/themes/control/theme.js +1 -1
  17. data/cockpit/themes/dataflow/rngs/alternative.rng +25 -0
  18. data/cockpit/themes/dataflow/rngs/call.rng +228 -0
  19. data/cockpit/themes/dataflow/rngs/callmanipulate.rng +257 -0
  20. data/cockpit/themes/dataflow/rngs/choose.rng +14 -0
  21. data/cockpit/themes/dataflow/rngs/closed_loop.rng +62 -0
  22. data/cockpit/themes/dataflow/rngs/closed_loop_cancel.rng +5 -0
  23. data/cockpit/themes/dataflow/rngs/closed_loop_control.rng +31 -0
  24. data/cockpit/themes/dataflow/rngs/closed_loop_measuring.rng +12 -0
  25. data/cockpit/themes/dataflow/rngs/critical.rng +5 -0
  26. data/cockpit/themes/dataflow/rngs/escape.rng +1 -0
  27. data/cockpit/themes/dataflow/rngs/group.rng +3 -0
  28. data/cockpit/themes/dataflow/rngs/loop.rng +22 -0
  29. data/cockpit/themes/dataflow/rngs/manipulate.rng +9 -0
  30. data/cockpit/themes/dataflow/rngs/otherwise.rng +22 -0
  31. data/cockpit/themes/dataflow/rngs/parallel.rng +27 -0
  32. data/cockpit/themes/dataflow/rngs/parallel_branch.rng +2 -0
  33. data/cockpit/themes/dataflow/rngs/scripts.rng +23 -0
  34. data/cockpit/themes/dataflow/rngs/start.rng +121 -0
  35. data/cockpit/themes/dataflow/rngs/stop.rng +5 -0
  36. data/cockpit/themes/dataflow/rngs/terminate.rng +1 -0
  37. data/cockpit/themes/dataflow/symbols/alternative.svg +5 -0
  38. data/cockpit/themes/dataflow/symbols/arrow.svg +3 -0
  39. data/cockpit/themes/dataflow/symbols/call.svg +6 -0
  40. data/cockpit/themes/dataflow/symbols/call_sensor.svg +9 -0
  41. data/cockpit/themes/dataflow/symbols/callmanipulate.svg +8 -0
  42. data/cockpit/themes/dataflow/symbols/callmanipulate_sensor.svg +11 -0
  43. data/cockpit/themes/dataflow/symbols/choose.svg +5 -0
  44. data/cockpit/themes/dataflow/symbols/choose_exclusive.svg +5 -0
  45. data/cockpit/themes/dataflow/symbols/choose_inclusive.svg +4 -0
  46. data/cockpit/themes/dataflow/symbols/closed_loop.svg +5 -0
  47. data/cockpit/themes/dataflow/symbols/closed_loop_cancel.svg +5 -0
  48. data/cockpit/themes/dataflow/symbols/closed_loop_control.svg +5 -0
  49. data/cockpit/themes/dataflow/symbols/closed_loop_measuring.svg +6 -0
  50. data/cockpit/themes/dataflow/symbols/complex.svg +8 -0
  51. data/cockpit/themes/dataflow/symbols/critical.svg +4 -0
  52. data/cockpit/themes/dataflow/symbols/delete.svg +4 -0
  53. data/cockpit/themes/dataflow/symbols/end.svg +3 -0
  54. data/cockpit/themes/dataflow/symbols/escape.svg +5 -0
  55. data/cockpit/themes/dataflow/symbols/event_end.svg +3 -0
  56. data/cockpit/themes/dataflow/symbols/loop.svg +5 -0
  57. data/cockpit/themes/dataflow/symbols/manipulate.svg +4 -0
  58. data/cockpit/themes/dataflow/symbols/otherwise.svg +5 -0
  59. data/cockpit/themes/dataflow/symbols/parallel.svg +5 -0
  60. data/cockpit/themes/dataflow/symbols/parallel_branch.svg +5 -0
  61. data/cockpit/themes/dataflow/symbols/parallel_branch_compact.svg +4 -0
  62. data/cockpit/themes/dataflow/symbols/parallel_branch_event.svg +14 -0
  63. data/cockpit/themes/dataflow/symbols/parallel_branch_normal.svg +5 -0
  64. data/cockpit/themes/dataflow/symbols/parallel_eventbased_exclusive.svg +9 -0
  65. data/cockpit/themes/dataflow/symbols/parallel_eventbased_parallel.svg +8 -0
  66. data/cockpit/themes/dataflow/symbols/scripts.svg +4 -0
  67. data/cockpit/themes/dataflow/symbols/start.svg +3 -0
  68. data/cockpit/themes/dataflow/symbols/start_event.svg +5 -0
  69. data/cockpit/themes/dataflow/symbols/stop.svg +5 -0
  70. data/cockpit/themes/dataflow/symbols/terminate.svg +4 -0
  71. data/cockpit/themes/dataflow/symbols/test.svg +74 -0
  72. data/cockpit/themes/dataflow/theme.js +1556 -0
  73. data/cockpit/themes/default/rngs/call.rng +3 -1
  74. data/cockpit/themes/default/rngs/callmanipulate.rng +3 -1
  75. data/cockpit/themes/default/theme.js +1 -1
  76. data/cockpit/themes/extended/rngs/call.rng +3 -1
  77. data/cockpit/themes/extended/rngs/callmanipulate.rng +3 -1
  78. data/cockpit/themes/extended/theme.js +1 -1
  79. data/cockpit/themes/model/theme.js +1 -1
  80. data/cockpit/themes/packed/rngs/call.rng +3 -1
  81. data/cockpit/themes/packed/rngs/callmanipulate.rng +3 -1
  82. data/cockpit/themes/packed/theme.js +1 -1
  83. data/cockpit/themes/preset/rngs/call.rng +3 -1
  84. data/cockpit/themes/preset/rngs/callmanipulate.rng +3 -1
  85. data/cockpit/themes/preset/theme.js +1 -1
  86. data/cpee.gemspec +2 -2
  87. data/lib/cpee/message.rb +20 -8
  88. data/lib/cpee/persistence.rb +12 -0
  89. data/lib/properties.xml +1 -1
  90. data/server/executionhandlers/ruby/connection.rb +31 -4
  91. data/tools/cpee +32 -1
  92. metadata +62 -8
  93. data/server/routing/end.pid +0 -1
  94. data/server/routing/forward-events-00.pid +0 -1
  95. data/server/routing/forward-votes.pid +0 -1
  96. data/server/routing/persist.pid +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d9392ee2d94e307e588b467e9a435901f8d231d42f84ff326432444764be99
4
- data.tar.gz: d0f08d2fc5100b961f218e5c1890931d894bc9d3ed844e880ca187fffb3342d2
3
+ metadata.gz: abf105360b93a73b4be3fbceb75cc95f805fe947917d1a8da91a727a1bfce520
4
+ data.tar.gz: 7f7dbec843a239c9dfc97166aaddd3e6cd43ddc5d3fd10335a87d72ea6aeda1b
5
5
  SHA512:
6
- metadata.gz: 56677348739cd49fc763e867d9d6d464afa1183fe5220277bd2141410b46ddd065320ae4e11c8ed469a82107d57a3f0afc6148624d71c88f6ba1bf961bd9af9a
7
- data.tar.gz: 4bcf1ce059ae0839862910e620697907a045ac925ffd30c7212d7b8ff8819f9f6c6a2eb845365ab3c7887db9d0e6d567122b98ce77699d3a23fbbafa2c2ff790
6
+ metadata.gz: 60ff6635449e118df6f272a1c7d8e5f23637d30ea60e4d0c3b928d6dd63a896ddcadde07093029a64cb7050642da53311f6d80e360f1ed267c01153e3dfa4ad4
7
+ data.tar.gz: b8e5e91f5afdbab0e986c3bb0dc68bd468c86ee4d6633d1c8254cee9be8a4620f288968f558f0bb92e1fa0854ec9a760ec7744c14476148bf77fd939df42de1a
@@ -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: 1pt;
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/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
 
@@ -61,6 +63,9 @@ function do_main_work() { //{{{
61
63
  if (node[0].namespaceURI == nnew.attr('xmlns')) { // remove xmlns when it is the same as in the parent node
62
64
  nnew[0].removeAttribute('xmlns');
63
65
  }
66
+
67
+ parameters_changed
68
+
64
69
  node.replaceWith(nnew);
65
70
 
66
71
  var ttarget = manifestation.adaptor.illustrator.get_node_by_svg_id(svgid);
@@ -30,9 +30,11 @@ function global_init() {
30
30
  save['details'] = undefined;
31
31
  save['details_target'] = undefined;
32
32
  save['instance_pos'] = [];
33
+ save['modeltype'] = 'CPEE';
33
34
  save['modifiers'] = {};
34
35
  save['modifiers_active'] = {};
35
36
  save['modifiers_additional'] = {};
37
+ save['resources'] = undefined;
36
38
  node_state = {};
37
39
  }
38
40
 
@@ -260,14 +262,14 @@ function create_instance(base,name,load,exec) {// {{{
260
262
  }
261
263
  }// }}}
262
264
 
263
- function sse() { //{{{
265
+ async function sse() { //{{{
264
266
  var url = $('body').attr('current-instance');
265
267
  if (subscription) {
266
268
  es = new EventSource(url + "/notifications/subscriptions/" + subscription + "/sse/");
267
269
  es.onopen = function() {
268
270
  append_to_log("monitoring", "opened", "nice.");
269
271
  };
270
- es.onmessage = function(e) {
272
+ es.onmessage = async function(e) {
271
273
  data = JSON.parse(e.data);
272
274
  if (data['type'] == 'event') {
273
275
  switch(data['topic']) {
@@ -281,7 +283,12 @@ function sse() { //{{{
281
283
  monitor_instance_values("endpoints");
282
284
  break;
283
285
  case 'attributes':
284
- monitor_instance_values("attributes");
286
+ if (save['resources'] != data.content.values.resource) {
287
+ await monitor_instance_values("attributes");
288
+ monitor_instance_values("endpoints");
289
+ } else {
290
+ monitor_instance_values("attributes");
291
+ }
285
292
  if (save['graph_theme'] != data.content.values.theme) {
286
293
  monitor_graph_change(true);
287
294
  }
@@ -314,9 +321,9 @@ function sse() { //{{{
314
321
  // setTimeout(sse,10000);
315
322
  };
316
323
  }
324
+ await monitor_instance_values("attributes"); // attributes first, to catch the <resources> attribute which overrides current-resources
317
325
  monitor_instance_values("dataelements");
318
326
  monitor_instance_values("endpoints");
319
- monitor_instance_values("attributes");
320
327
  monitor_instance_dsl();
321
328
  monitor_instance_state();
322
329
  } //}}}
@@ -393,11 +400,37 @@ function monitor_instance(cin,rep,load,exec) {// {{{
393
400
  });
394
401
  }// }}}
395
402
 
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');
403
+ function get_resource(base, key, loc, cache) {
404
+ cache[key] = {};
405
+ let deferreds = [new $.Deferred(), new $.Deferred(), new $.Deferred()];
406
+ $.ajax({
407
+ url: base + 'endpoints/' + encodeURIComponent(loc) + "/symbol.svg",
408
+ success: function(res) {
409
+ cache[key]['symbol'] = res;
410
+ deferreds[0].resolve(true);
411
+ },
412
+ error: deferreds[0].resolve
413
+ })
414
+ $.ajax({
415
+ url: base + 'endpoints/' + encodeURIComponent(loc) + "/schema.rng",
416
+ success: function(res) {
417
+ cache[key]['schema'] = res;
418
+ deferreds[1].resolve(true);
419
+ },
420
+ error: deferreds[1].resolve
421
+ })
422
+ $.ajax({
423
+ url: base + 'endpoints/' + encodeURIComponent(loc) + "/properties.json",
424
+ success: function(res) {
425
+ cache[key]['properties'] = res;
426
+ deferreds[2].resolve(true);
427
+ },
428
+ error: deferreds[2].resolve
429
+ })
430
+ return deferreds;
431
+ }
400
432
 
433
+ function monitor_instance_values(type,vals) {// {{{
401
434
  if (type == "dataelements" && save['state'] == "running") {
402
435
  let de = save[type].save();
403
436
  Object.entries(vals).forEach(([key,value]) => {
@@ -420,7 +453,8 @@ function monitor_instance_values(type,vals) {// {{{
420
453
  });
421
454
  save[type].content(de);
422
455
  } else {
423
- $.ajax({
456
+ let url = $('body').attr('current-instance');
457
+ return $.ajax({
424
458
  type: "GET",
425
459
  url: url + "/properties/" + type + "/",
426
460
  success: function(res){
@@ -430,36 +464,12 @@ function monitor_instance_values(type,vals) {// {{{
430
464
  var tmp = {};
431
465
  $(res).find(" > endpoints > *").each(function(k,v) {
432
466
  save['endpoints_list'][v.localName] = v.lastChild.nodeValue;
467
+ let rep = $('body').attr('current-resources');
433
468
  $.ajax({
434
469
  url: rep + 'endpoints/' + encodeURIComponent($(v).text()),
435
470
  success: function() {
436
471
  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) {
472
+ $.when.apply($, get_resource(rep,v.tagName,$(v).text(),tmp)).then(function(x) {
463
473
  save['endpoints_cache'] = tmp;
464
474
  // when updating attributes clear the attributes, because they might change as well. New arguments are possible.
465
475
  $('#dat_details').empty();
@@ -467,8 +477,33 @@ function monitor_instance_values(type,vals) {// {{{
467
477
  });
468
478
  }
469
479
  });
480
+ if (save['resources']) {
481
+ let rep = save['resources'];
482
+ $.ajax({
483
+ url: rep + 'endpoints/' + encodeURIComponent(encodeURIComponent($(v).text())),
484
+ success: function() {
485
+ tmp[v.tagName] = {};
486
+ $.when.apply($, get_resource(rep,v.tagName,encodeURIComponent($(v).text()),tmp)).then(function(x) {
487
+ save['endpoints_cache'] = tmp;
488
+ // when updating attributes clear the attributes, because they might change as well. New arguments are possible.
489
+ $('#dat_details').empty();
490
+ adaptor_update();
491
+ });
492
+ }
493
+ });
494
+ }
470
495
  });
471
496
  } else if(type == "attributes") {
497
+ if ($(" > attributes > resources",res).length > 0) {
498
+ save['resources'] = $(" > attributes > resources",res).text();
499
+ } else {
500
+ save['resources'] = undefined;
501
+ }
502
+ if ($(" > attributes > modeltype",res).length > 0) {
503
+ save['modeltype'] = $(" > attributes > modeltype",res).text();
504
+ } else {
505
+ save['modeltype'] = undefined;
506
+ }
472
507
  if ($('#modifiers > div').length == 0) {
473
508
  modifiers_display().then(function(){ modifiers_select(); });
474
509
  } else {
@@ -519,7 +554,7 @@ function adaptor_init(url,theme,dslx) { //{{{
519
554
  save['graph_theme'] = theme;
520
555
  save['graph_adaptor'] = new WfAdaptor($('body').data('theme-base') + '/' + theme + '/theme.js',function(graphrealization){
521
556
  manifestation.endpoints = save.endpoints_list;
522
- graphrealization.draw_labels = function(max,labels,shift,striped) {
557
+ graphrealization.draw_labels = function(max,labels,dimensions,striped) {
523
558
  $('#graphcanvas').css('grid-row', '1/span ' + (max.row + 2));
524
559
  if (striped == true) {
525
560
  if (!$('#graphgrid').hasClass('striped')) {
@@ -529,10 +564,17 @@ function adaptor_init(url,theme,dslx) { //{{{
529
564
  $('#graphgrid').removeClass('striped');
530
565
  }
531
566
 
532
- $('#graphgrid .graphlabel, #graphgrid .graphempty, #graphgrid .graphlast').remove();
567
+ $('#graphgrid .graphlabel, #graphgrid .graphempty, #resources, #graphgrid .graphlast').remove();
533
568
  var tlabels = {};
534
569
  var tcolumns = [];
535
570
  var tcolumncount = {}
571
+ var thidden = [];
572
+
573
+ var tsvgs = {};
574
+ const mapPoints = new Map();
575
+ let iconsize = 14;
576
+ let iconshift = 7;
577
+
536
578
  _.each(labels,function(val){
537
579
  if (val.label != "") {
538
580
  tlabels[val.row] = [];
@@ -541,35 +583,143 @@ function adaptor_init(url,theme,dslx) { //{{{
541
583
  tcolumns.push(col.column);
542
584
  tcolumncount[col.column] = 0;
543
585
  }
586
+ if (!thidden.includes(col.column) && col.type == 'resource') {
587
+ thidden.push(col.column);
588
+ }
544
589
  if (col.value != undefined) {
590
+
591
+ // Start Peilei
592
+ if (col.type == "resource") {
593
+ let str = '';
594
+ for (const [k, v] of Object.entries(col.value)) {
595
+ var p = {};
596
+ p.AR = v;
597
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
598
+ if (!mapPoints.has(k)) {
599
+ p.y0 = p.y0 == undefined ? (dimensions.height_shift/2 + dimensions.height * val.row - 20) : p.y0;
600
+ p.ymax = (p.ymax == undefined) ? p.y0 : p.ymax; //(dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax ? dimensions.height_shift/2 + dimensions.height * val.row - 20 : p.ymax);
601
+ } else {
602
+ p.y0 = mapPoints.get(k).y0;
603
+ p.ymax = mapPoints.get(k).ymax; //(dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax ? dimensions.height_shift/2 + dimensions.height * val.row - 20 : p.ymax);
604
+ }
605
+ mapPoints.set(k, p);
606
+ }
607
+ var cx = iconshift*2;
608
+ str += '<g xmlns="http://www.w3.org/2000/svg">';
609
+
610
+ for (const [k, p] of mapPoints) {
611
+ let firstAssignFlag = 0;
612
+ p.x0 = p.xc = cx;
613
+
614
+ // Including Triangle
615
+ if (k in col.value) { // Define points for a triangle pointing to the right
616
+ if (p.AR == "Read") {
617
+ 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">';
618
+ if (p.yc == p.y0) {
619
+ firstAssignFlag = 1;
620
+ }
621
+ } else if (p.AR == "Assign") { // Define points for a triangle pointing to the left
622
+ 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">';
623
+ } else if (p.AR == "AssignRead") {
624
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
625
+ str += '<circle xmlns="http://www.w3.org/2000/svg" cx="' + cx + '" cy="' + p.yc + '" r="5" fill="blue" class="resource-point">';
626
+ }
627
+
628
+ if (dimensions.height_shift/2 + dimensions.height * val.row != p.y0) {
629
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
630
+ if (dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax) {
631
+ p.ymax = dimensions.height_shift/2 + dimensions.height * val.row - 20;
632
+ }
633
+ }
634
+
635
+ // Converted from <title>
636
+ str += '<text xmlns="http://www.w3.org/2000/svg">' + k + '</text>';
637
+
638
+ if (p.AR == "Read" || p.AR == "Assign") {
639
+ str += '</polygon>';
640
+ } else if (p.AR == "AssignRead") {
641
+ str += '</circle>';
642
+ }
643
+ }
644
+
645
+ if (firstAssignFlag == 1) {
646
+ // Additional logic and construction of another polygon for orange triangle pointing left
647
+ p.y0 -= dimensions.height;
648
+ str += '<polygon xmlns="http://www.w3.org/2000/svg" points="' + (cx + 5) + ',' + (dimensions.height_shift/2 + dimensions.height * (val.row - 1) - 20) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height * (val.row - 1) - 15) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height * (val.row - 1) - 25) + '" fill="orange" class="resource-point">' + '<text xmlns="http://www.w3.org/2000/svg">' + k + '</text></polygon>';
649
+ }
650
+ cx += iconsize;
651
+ }
652
+
653
+ for (const [k, p] of mapPoints) {
654
+ if(k in col.value) {
655
+ if (dimensions.height_shift/2+dimensions.height*val.row != p.y0) {
656
+ p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
657
+ if(dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax) {
658
+ p.ymax = dimensions.height_shift/2 + dimensions.height * val.row - 20;
659
+ }
660
+ }
661
+ }
662
+ }
663
+ str += '</g>';
664
+
665
+ tsvgs[val.row] = $X(str);
666
+ }
667
+
545
668
  tcolumncount[col.column] += 1;
546
669
  }
547
670
  tlabels[val.row][tcolumns.indexOf(col.column)] = { label: col.value, type: val.tname, id: val.element_id };
548
671
  });
549
672
  }
550
673
  });
674
+
551
675
  $('#graphgrid').css({
552
- 'grid-template-rows': (shift/2) + 'px repeat(' + max.row + ', 1fr) ' + (shift/2) + 'px',
676
+ 'grid-template-rows': (dimensions.height_shift/2) + 'px repeat(' + max.row + ', 1fr) ' + (dimensions.height_shift/2) + 'px',
553
677
  'grid-template-columns': 'max-content' + (tcolumns.length > 0 ? ' repeat(' + tcolumns.length.toString() + ',max-content)' : '') + ' auto'
554
678
  });
679
+
555
680
  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>');
681
+ for (var j = 0; j < tcolumns.length - 1; j++) {
682
+ if (thidden != tcolumns[j]) {
683
+ if (tlabels[i+1] != undefined && tlabels[i+1][j] != undefined && tlabels[i+1][j].label != undefined && tlabels[i+1][j].label != '') {
684
+ var col = tlabels[i+1][j];
685
+ 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>');
686
+ graphrealization.illustrator.draw.bind_event(ele, col.type, false);
565
687
  $('#graphgrid').append(ele);
688
+ } else {
689
+ if (tcolumncount[tcolumns[j]] != 0) {
690
+ 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>');
691
+ $('#graphgrid').append(ele);
692
+ }
566
693
  }
567
694
  }
568
695
  }
696
+
569
697
  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>');
698
+ 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
699
  $('#graphgrid').append(ele);
572
700
  }
701
+
702
+ if (Object.keys(tsvgs).length > 0) {
703
+ 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>');
704
+ dataflow.css('grid-row', '1/span ' + (max.row + 2));
705
+ dataflow.css('grid-column', tcolumns.indexOf(thidden.first) + 2);
706
+ dataflow.attr('height', $('#graphcanvas').attr('height'));
707
+ dataflow.attr('width', mapPoints.size * iconsize + iconshift * 2);
708
+
709
+ for (var i = 0; i < max.row; i++) { // Needs parenthesises below
710
+ 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>'));
711
+ 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>'));
712
+ }
713
+ for (const [k, p] of mapPoints) {
714
+ 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>'));
715
+ }
716
+ for (var i = 0; i < max.row; i++) {
717
+ dataflow.append($(tsvgs[i+1]));
718
+ }
719
+ $('#graphgrid').append(dataflow);
720
+
721
+ $('.resource-label').hide(); // Speech Bubble hide by default
722
+ }
573
723
  };
574
724
  graphrealization.set_svg_container($('#graphcanvas'));
575
725
  graphrealization.set_label_container($('#graphgrid'));
@@ -582,17 +732,50 @@ function adaptor_init(url,theme,dslx) { //{{{
582
732
  save['graph'].removeAttr('svg-subtype');
583
733
  save['graph'].removeAttr('svg-label');
584
734
  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
- });
735
+ if (save['modeltype'] != 'CPEE') {
736
+ $.ajax({
737
+ type: "PUT",
738
+ url: url + "/properties/attributes/modeltype/",
739
+ data: {'value': 'CPEE'},
740
+ error: report_failure
741
+ });
742
+ $.ajax({
743
+ type: "PUT",
744
+ url: url + "/properties/transformation/",
745
+ contentType: 'text/xml',
746
+ headers: {
747
+ 'Content-ID': 'transformation',
748
+ 'CPEE-Event-Source': myid
749
+ },
750
+ data: '<transformation xmlns="http://cpee.org/ns/properties/2.0"><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>',
751
+ success: function() {
752
+ $.ajax({
753
+ type: "PUT",
754
+ url: url + "/properties/description/",
755
+ contentType: 'text/xml',
756
+ headers: {
757
+ 'Content-ID': 'description',
758
+ 'CPEE-Event-Source': myid
759
+ },
760
+ data: g,
761
+ error: report_failure
762
+ });
763
+ },
764
+ error: report_failure
765
+ });
766
+ } else {
767
+ $.ajax({
768
+ type: "PUT",
769
+ url: url + "/properties/description/",
770
+ contentType: 'text/xml',
771
+ headers: {
772
+ 'Content-ID': 'description',
773
+ 'CPEE-Event-Source': myid
774
+ },
775
+ data: g,
776
+ error: report_failure
777
+ });
778
+ }
596
779
  adaptor_update();
597
780
  manifestation.events.click(svgid);
598
781
  format_instance_pos();
@@ -762,9 +945,17 @@ function monitor_instance_state_change(notification) { //{{{
762
945
  if (notification == "stopped") {
763
946
  monitor_instance_pos();
764
947
  }
765
- // if (notification == "running") {
766
- // format_visual_clear();
767
- // }
948
+ if (notification == "running") {
949
+ // // we cant do that, because the events might not be ordered. so jus remove all the blue ones.
950
+ // format_visual_clear();
951
+
952
+ for (const [key, ele] of Object.entries(node_state)) {
953
+ for (i=0; i<ele.passive; i++) {
954
+ format_visual_remove(key,'passive');
955
+ }
956
+ }
957
+ // save_blue_states has to be left alone, because we dont know the uuid
958
+ }
768
959
 
769
960
  var but = "";
770
961
  if (notification == "ready" || notification == "stopped") {
@@ -61,7 +61,9 @@ async function modifiers_display() {
61
61
  url: rep + 'modifiers/'
62
62
  }).then(async function(res) {
63
63
  let ipromises = [];
64
+ let iinserts = {};
64
65
  $('resource',res).each(function(_,r) {
66
+ iinserts[$(r).text()] = '';
65
67
  ipromises.push(
66
68
  $.ajax({
67
69
  url: rep + 'modifiers/' + $(r).text()
@@ -87,13 +89,18 @@ async function modifiers_display() {
87
89
  );
88
90
 
89
91
  });
90
- $(clone).insertBefore($('#modifiers template'));
92
+ iinserts[$(r).text()] = $(clone);
91
93
 
92
94
  await Promise.all(cpromises);
93
95
  })
94
96
  );
95
97
  });
96
98
  await Promise.all(ipromises);
99
+
100
+ // always insert in order
101
+ for (const [_, fragment] of Object.entries(iinserts)) {
102
+ fragment.insertBefore($('#modifiers template'));
103
+ }
97
104
  })
98
105
  );
99
106
  await Promise.all(promises);
@@ -0,0 +1,16 @@
1
+ $(document).ready(function() {
2
+ $('.resource-label').on('mouseover',()=>{
3
+ $('.resource-label').hide(); // Speech Bubble hide when over
4
+ });
5
+ $('#graphgrid').on('mouseover','#resources line.resource-line, #resources g polygon.resource-point',(data)=>{
6
+ const left = $('.resource-label').offset().left;
7
+ const pos = $(data.target).offset().left - 11;
8
+ if ($('.resource-label').is(":hidden") || left != pos) {
9
+ let labeltext = $('text',data.currentTarget).text();
10
+ $('.resource-label').text(labeltext);
11
+ $('.resource-label').css('left', pos);
12
+ $('.resource-label').css('top', data.originalEvent.clientY - 50);
13
+ $('.resource-label').show();
14
+ }
15
+ });
16
+ });
@@ -48,7 +48,7 @@ function WfAdaptor(theme_base,doit) { // Controller {{{
48
48
  } // }}}
49
49
  this.notify = function() { // public {{{
50
50
  } // }}}
51
- this.draw_labels = function(max,labels,height_shift,striped){ // public {{{
51
+ this.draw_labels = function(max,labels,dimensions,striped){ // public {{{
52
52
  } // }}}
53
53
  this.set_svg_container = function (container) { // {{{
54
54
  illustrator.set_svg_container(container); // TODO: shadowing the container element
@@ -376,9 +376,9 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
376
376
  }
377
377
  }
378
378
  if (illustrator.compact == false) {
379
- adaptor.draw_labels(graph.max,labels,illustrator.height_shift,illustrator.striped == true ? true : false);
379
+ adaptor.draw_labels(graph.max,labels,{ 'height': illustrator.height, 'height_shift': illustrator.height_shift },illustrator.striped == true ? true : false);
380
380
  } else {
381
- adaptor.draw_labels(graph.max,[],illustrator.height_shift,false);
381
+ adaptor.draw_labels(graph.max,[],{ 'height': illustrator.height, 'height_shift': illustrator.height_shift },false);
382
382
  }
383
383
  if (illustrator.compact == false) {
384
384
  if (labels.length > 0) {
@@ -134,8 +134,13 @@ data.costs += result.value('costs').to_f</finalize>
134
134
  <manipulate id="a3">data.persons -= 1</manipulate>
135
135
  </loop>
136
136
  </parallel>
137
- <choose mode="inclusive">
137
+ <choose mode="exclusive">
138
138
  <alternative condition="data.costs &gt; 700">
139
+ <_probability>
140
+ <_probability_min/>
141
+ <_probability_max/>
142
+ <_probability_avg/>
143
+ </_probability>
139
144
  <call id="a4" endpoint="approve">
140
145
  <parameters>
141
146
  <label>Approve Hotel</label>
@@ -173,6 +178,7 @@ data.costs += result.value('costs').to_f</finalize>
173
178
  </documentation>
174
179
  </call>
175
180
  </alternative>
181
+ <otherwise/>
176
182
  </choose>
177
183
  </description>
178
184
  </description>
@@ -3,7 +3,9 @@
3
3
  <data type="string" rngui:readonly="true"/>
4
4
  </attribute>
5
5
  <attribute name="endpoint" rngui:label="Endpoint">
6
- <data type="string"/>
6
+ <data type="string">
7
+ <param name="pattern">^[a-z_][a-zA-Z0-9_]*$</param>
8
+ </data>
7
9
  </attribute>
8
10
  <element name="parameters" rngui:header="Properties">
9
11
  <element name="label" rngui:label="Label">