cpee 2.1.0 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/config.json +1 -1
  3. data/cockpit/config.json.example +7 -0
  4. data/cockpit/css/ui.css +14 -7
  5. data/cockpit/edit.html +26 -23
  6. data/cockpit/index.html +25 -22
  7. data/cockpit/js/instance.js +209 -39
  8. data/cockpit/model.html +0 -8
  9. data/cockpit/templates/Coopis 2010.xml +12 -4
  10. data/cockpit/templates/Coopis 2010.xml.active +1 -0
  11. data/cockpit/templates/Coopis 2010.xml.active-uuid +1 -0
  12. data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +5 -1
  13. data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +5 -1
  14. data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +5 -1
  15. data/cockpit/templates/Track Test Local.xml +1 -1
  16. data/cockpit/templates/Track Test.xml +1 -1
  17. data/cockpit/templates/UR-VUE 2020 Manual Adjust.xml +1 -1
  18. data/cockpit/templates/UR-VUE 2020 Solution Baseline.xml +1 -1
  19. data/cockpit/templates/UR-VUE 2020 Solution NN.xml +1 -1
  20. data/cockpit/templates/UR-VUE 2020 Solution View.xml +1 -1
  21. data/cockpit/templates/UR-VUE 2020.xml +3 -1
  22. data/cockpit/templates/Worklist.xml +6 -1
  23. data/cockpit/themes/compact/rngs/call.rng +17 -8
  24. data/cockpit/themes/compact/rngs/callmanipulate.rng +18 -9
  25. data/cockpit/themes/compact/rngs/start.rng +9 -9
  26. data/cockpit/themes/compact/theme.js +1 -1
  27. data/cockpit/themes/control/rngs/call.rng +17 -8
  28. data/cockpit/themes/control/rngs/callmanipulate.rng +18 -9
  29. data/cockpit/themes/control/rngs/start.rng +9 -9
  30. data/cockpit/themes/default/rngs/call.rng +17 -8
  31. data/cockpit/themes/default/rngs/callmanipulate.rng +18 -9
  32. data/cockpit/themes/default/rngs/start.rng +9 -9
  33. data/cockpit/themes/extended/rngs/call.rng +17 -8
  34. data/cockpit/themes/extended/rngs/callmanipulate.rng +18 -9
  35. data/cockpit/themes/extended/rngs/start.rng +9 -9
  36. data/cockpit/themes/extended/theme.js +1 -1
  37. data/cockpit/themes/packed/rngs/call.rng +17 -8
  38. data/cockpit/themes/packed/rngs/callmanipulate.rng +18 -9
  39. data/cockpit/themes/packed/rngs/start.rng +9 -9
  40. data/cockpit/themes/packed/theme.js +1 -1
  41. data/cockpit/themes/preset/rngs/call.rng +17 -8
  42. data/cockpit/themes/preset/rngs/callmanipulate.rng +18 -9
  43. data/cockpit/themes/preset/rngs/start.rng +9 -9
  44. data/cpee.gemspec +2 -2
  45. data/lib/cpee/implementation_notifications.rb +5 -5
  46. data/lib/properties/executionhandler.rng +1 -1
  47. data/server/routing/end.pid +1 -0
  48. data/server/routing/forward-events.pid +1 -0
  49. data/server/routing/forward-votes.pid +1 -0
  50. data/server/routing/persist.pid +1 -0
  51. data/tools/cpee +7 -7
  52. metadata +12 -7
  53. data/cockpit/js_libs.zip +0 -0
  54. data/lib/instantiation.xml +0 -125
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c98641a6cc00767af290395984b5b99534adb37b7235ad223d412d99fe9969b4
4
- data.tar.gz: 82db456ab83962e51373c961e41b13b7a2de21d0739d1a047bfc4c74ef548156
3
+ metadata.gz: 37a2b6910315c8913216a368e40556013da8a33e5887adb75729a52ead89daba
4
+ data.tar.gz: 93b34b46c2e9db0586ce251a51e388f668b128cf497cb1ba95920cbe5424e09b
5
5
  SHA512:
6
- metadata.gz: 0e2a3a1c77315364f0d400ddb2127e31e63e95ff1561ed24b63ac71cd2bc49dc122fddd73ecef28607af6f221180536f9256076a4c2b7cd90f2ca66744ce5b34
7
- data.tar.gz: dfb4857bd734da1011f56658a8802686819669a348f1c29a8c1c35308dd1efb2d4d303ced6d57a4db484f55079f32f6282913d152b21e51229577a6b75b73679
6
+ metadata.gz: f6ed4c4157ebb113589f14c1ab020c4199b30b3e673547b48522cf7cc901a4cbfb70b3ffeb7c21f942df2e151d474a5f7662f64ed1fff4ac60005424e403e83f
7
+ data.tar.gz: 87d605938e321c920c969aaf525e6fb7213e9eeef18ef99884175e5d75d14e25f793f1953d55b79dccce61e8270c5d222061c9d10c75fc18d4af9df3726df23d
data/cockpit/config.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "res-url": "https://cpee.org/flow/resources/"
2
+ "res-url": "https://tango.wst.univie.ac.at/flow/resources/"
3
3
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "log-url": "https://cpee.org/logs/",
3
+ "templates-url": "https://cpee.org/design/server/Templates.dir/?stage=developm
4
+ "res-url": "https://cpee.org/flow/resources/",
5
+ "base-url": "https://cpee.org/flow/engine/",
6
+ "save-url": "https://cpee.org/design/server/"
7
+ }
data/cockpit/css/ui.css CHANGED
@@ -129,11 +129,13 @@ ui-tabbed ui-tabbar ui-behind button {
129
129
  #areaendpoints button.relaxngui_control { display: none; }
130
130
  #areaattributes button.relaxngui_control { display: none; }
131
131
 
132
+ #areainstance { height: 100%; }
133
+ #areainstance > div { display: flex; height: 100%; }
132
134
  #areainstance input[type=file] { display: none; }
133
- #areainstance div.section { display: table-cell; vertical-align: middle; }
134
- #areainstance div.section:nth-child(1) { padding: 0 0.5em 0 0; white-space: nowrap; }
135
- #areainstance div.section:nth-child(2) { border-left: 1px solid var(--x-ui-border-color); padding: 0 0.5em; white-space: nowrap; }
136
- #areainstance div.section:nth-child(3) { border-left: 1px solid var(--x-ui-border-color); padding: 0 0 0 0.5em; white-space: nowrap; }
135
+ #areainstance div.section { vertical-align: middle; height: 100%; }
136
+ #areainstance div.section:nth-child(1) { flex: 0 0 auto; padding: 0 0.5em 0 0; white-space: nowrap; }
137
+ #areainstance div.section:nth-child(2) { flex: 0 0 auto; border-left: 1px solid var(--x-ui-border-color); padding: 0 0.5em; white-space: nowrap; }
138
+ #areainstance div.section:nth-child(3) { flex: 1 1 auto; border-left: 1px solid var(--x-ui-border-color); padding: 0 0 0 0.5em; white-space: nowrap; }
137
139
 
138
140
  #areainstance div.section:nth-child(1) > div:nth-child(2) { white-space: normal; text-align: right; }
139
141
 
@@ -144,9 +146,14 @@ ui-tabbed ui-tabbar ui-behind button {
144
146
  #areainstance div.section:nth-child(1) button[name=loadtestsetfile] { white-space: normal; width: 10em; height: 3.5em; margin-left: 0.2em; }
145
147
  #areainstance div.section:nth-child(1) button[name=loadmodelfile] { white-space: normal; width: 10em; height: 2em; margin-top: 0.2em; }
146
148
 
147
- #areainstance div.section:nth-child(2) button { white-space: normal; width: 6em; height: 4.5em; vertical-align: middle; margin: 0; padding: 0; }
148
- #areainstance div.section:nth-child(3) div { white-space: normal; vertical-align: middle; margin: 0; padding: 0; }
149
- #areainstance div.section:nth-child(3) button[name=loadmodeltype] { white-space: normal; width: 10em; height: 2em; }
149
+ #areainstance div.section:nth-child(2) button { white-space: normal; width: 6em; height: 5.7em; vertical-align: middle; margin: 0; padding: 0; }
150
+
151
+ #areainstance div.section:nth-child(3) { overflow-y: scroll; }
152
+ #areainstance div.section:nth-child(3) strong { margin:0; padding:0; white-space: normal; font-size: 1em; }
153
+ #areainstance div.section:nth-child(3) > div:not(:first-child) { padding-top: 0.5em; }
154
+ #areainstance div.section:nth-child(3) > div { padding-bottom: 0.2em; }
155
+ #areainstance div.section:nth-child(3) select { margin-left: 1em; }
156
+ #areainstance div.section:nth-child(3) div.additional { margin-left: 1em; }
150
157
 
151
158
  #areaexecution input { padding: 0; margin:0; }
152
159
  #areaexecution table.x-ui-compact { width: 100%; }
data/cockpit/edit.html CHANGED
@@ -144,29 +144,32 @@
144
144
  </table>
145
145
  </ui-area> <!--}}}-->
146
146
  <ui-area data-belongs-to-tab="instance" id="areainstance" class="inactive"> <!--{{{-->
147
- <div class='section'>
148
- <div>
149
- <form id='fuckchrome'>
150
- <input type='file' name='testsetfile' id='testsetfile'/>
151
- </form>
152
- <button title='save a testset includes various settings, subscriptions and a model' name="save" disabled=""><div>save</div><div class="hidden" id='lastsavedline'>(last: <span id="lastsaved"></span>)</div></button>
153
- <button title='a testset includes various settings, subscriptions or a model' name="loadtestsetfile">load testset</button>
154
- </div>
155
- <div>
156
- <input type='file' name='modelfile' id='modelfile'/>
157
- <button title='a standalone process model is only loadable if the currently loaded testset sucessfully prepared the current instance for the type of model' name="loadmodelfile">load model</button>
158
- </div>
159
- </div><div class='section'>
160
- <a id="savetestsetfile" href="" download=""></a>
161
- <a id="savesvgfile" href="" download=""></a>
162
- <button title='a testset includes various settings, subscriptions and a model' name="savetestsetfile">save testset</button>
163
- <button title='a testset includes various settings, subscriptions and a model' name="savesvgfile">save svg graph</button>
164
- </div><div class='section'>
165
- <div>
166
- Current model: <span id='currentmodel'></span>
167
- </div>
168
- <div>
169
- <button title='a testset includes various settings, subscriptions and a model' name="loadmodeltype">set model type</button>
147
+ <div>
148
+ <div class='section'>
149
+ <div>
150
+ <form id='fuckchrome'>
151
+ <input type='file' name='testsetfile' id='testsetfile'/>
152
+ </form>
153
+ <button title='save a testset includes various settings, subscriptions and a model' name="save" disabled=""><div>save</div><div class="hidden" id='lastsavedline'>(last: <span id="lastsaved"></span>)</div></button>
154
+ <button title='a testset includes various settings, subscriptions or a model' name="loadtestsetfile">load testset</button>
155
+ </div>
156
+ <div>
157
+ <input type='file' name='modelfile' id='modelfile'/>
158
+ <button title='a standalone process model is only loadable if the currently loaded testset sucessfully prepared the current instance for the type of model' name="loadmodelfile">load model</button>
159
+ </div>
160
+ </div><div class='section'>
161
+ <a id="savetestsetfile" href="" download=""></a>
162
+ <a id="savesvgfile" href="" download=""></a>
163
+ <button title='a testset includes various settings, subscriptions and a model' name="savetestsetfile">save testset</button>
164
+ <button title='a testset includes various settings, subscriptions and a model' name="savesvgfile">save svg graph</button>
165
+ </div><div class='section' id='modifiers'>
166
+ <template id="item">
167
+ <div>
168
+ <div class='title'><strong></strong></div>
169
+ <div class='select'><select/></div>
170
+ <div class='additional'></div>
171
+ </div>
172
+ </template>
170
173
  </div>
171
174
  </div>
172
175
  </ui-area> <!--}}}-->
data/cockpit/index.html CHANGED
@@ -146,28 +146,31 @@
146
146
  </table>
147
147
  </ui-area> <!--}}}-->
148
148
  <ui-area data-belongs-to-tab="instance" id="areainstance" class="inactive"> <!--{{{-->
149
- <div class='section'>
150
- <div>
151
- <form id='fuckchrome'>
152
- <input type='file' name='testsetfile' id='testsetfile'/>
153
- </form>
154
- <button title='a template includes various settings, subscriptions or a (partial) model' name="loadtestset">load template</button><button title='a testset includes various settings, subscriptions or a model' name="loadtestsetfile">load testset</button>
155
- </div>
156
- <div>
157
- <input type='file' name='modelfile' id='modelfile'/>
158
- <button title='a standalone process model is only loadable if the currently loaded testset sucessfully prepared the current instance for the type of model' name="loadmodelfile">load model</button>
159
- </div>
160
- </div><div class='section'>
161
- <a id="savetestsetfile" href="" download=""></a>
162
- <a id="savesvgfile" href="" download=""></a>
163
- <button title='a testset includes various settings, subscriptions and a model' name="savetestsetfile">save testset</button>
164
- <button title='a testset includes various settings, subscriptions and a model' name="savesvgfile">save svg graph</button>
165
- </div><div class='section'>
166
- <div>
167
- Current model: <span id='currentmodel'></span>
168
- </div>
169
- <div>
170
- <button title='a testset includes various settings, subscriptions and a model' name="loadmodeltype">set model type</button>
149
+ <div>
150
+ <div class='section'>
151
+ <div>
152
+ <form id='fuckchrome'>
153
+ <input type='file' name='testsetfile' id='testsetfile'/>
154
+ </form>
155
+ <button title='a template includes various settings, subscriptions or a (partial) model' name="loadtestset">load template</button><button title='a testset includes various settings, subscriptions or a model' name="loadtestsetfile">load testset</button>
156
+ </div>
157
+ <div>
158
+ <input type='file' name='modelfile' id='modelfile'/>
159
+ <button title='a standalone process model is only loadable if the currently loaded testset sucessfully prepared the current instance for the type of model' name="loadmodelfile">load model</button>
160
+ </div>
161
+ </div><div class='section'>
162
+ <a id="savetestsetfile" href="" download=""></a>
163
+ <a id="savesvgfile" href="" download=""></a>
164
+ <button title='a testset includes various settings, subscriptions and a model' name="savetestsetfile">save testset</button>
165
+ <button title='a testset includes various settings, subscriptions and a model' name="savesvgfile">save svg graph</button>
166
+ </div><div class='section' id='modifiers'>
167
+ <template id="item">
168
+ <div>
169
+ <div class='title'><strong></strong></div>
170
+ <div class='select'><select/></div>
171
+ <div class='additional'></div>
172
+ </div>
173
+ </template>
171
174
  </div>
172
175
  </div>
173
176
  </ui-area> <!--}}}-->
@@ -28,6 +28,8 @@ function global_init() {
28
28
  save['details'] = undefined;
29
29
  save['details_target'] = undefined;
30
30
  save['instance_pos'] = [];
31
+ save['modifiers'] = {};
32
+ save['modifiers_active'] = {};
31
33
  node_state = {};
32
34
  }
33
35
 
@@ -95,6 +97,7 @@ function cockpit() { //{{{
95
97
  $("input[name=votecontinue]").click(check_subscription);
96
98
  $("input[name=testsetfile]").change(load_testsetfile_after);
97
99
  $("input[name=modelfile]").change(load_modelfile_after);
100
+ $("#modifiers").on('change','div.select select',function(e){ modifiers_update(e); });
98
101
 
99
102
  $.ajax({
100
103
  url: $('body').attr('current-templates'),
@@ -276,7 +279,6 @@ function sse() { //{{{
276
279
  break;
277
280
  case 'attributes':
278
281
  monitor_instance_values("attributes");
279
- monitor_instance_transformation();
280
282
  if (!suspended_monitoring) { // or else it would load twice, because dsl changes also trigger
281
283
  if (save['graph_theme'] != data.content.values.theme) {
282
284
  monitor_graph_change(true);
@@ -313,7 +315,6 @@ function sse() { //{{{
313
315
  monitor_instance_values("dataelements");
314
316
  monitor_instance_values("endpoints");
315
317
  monitor_instance_values("attributes");
316
- monitor_instance_transformation();
317
318
  monitor_instance_dsl();
318
319
  monitor_instance_state();
319
320
  } //}}}
@@ -406,12 +407,12 @@ function monitor_instance_values(val) {// {{{
406
407
  $(res).find(" > endpoints > *").each(function(k,v) {
407
408
  save['endpoints_list'][v.localName] = v.lastChild.nodeValue;
408
409
  $.ajax({
409
- url: rep + encodeURIComponent($(v).text()),
410
+ url: rep + 'endpoints/' + encodeURIComponent($(v).text()),
410
411
  success: function() {
411
412
  tmp[v.tagName] = {};
412
413
  var deferreds = [new $.Deferred(), new $.Deferred(), new $.Deferred()];
413
414
  $.ajax({
414
- url: rep + encodeURIComponent($(v).text()) + "/symbol.svg",
415
+ url: rep + 'endpoints/' + encodeURIComponent($(v).text()) + "/symbol.svg",
415
416
  success: function(res) {
416
417
  tmp[v.tagName]['symbol'] = res;
417
418
  deferreds[0].resolve(true);
@@ -419,7 +420,7 @@ function monitor_instance_values(val) {// {{{
419
420
  error: deferreds[0].resolve
420
421
  })
421
422
  $.ajax({
422
- url: rep + encodeURIComponent($(v).text()) + "/schema.rng",
423
+ url: rep + 'endpoints/' + encodeURIComponent($(v).text()) + "/schema.rng",
423
424
  success: function(res) {
424
425
  tmp[v.tagName]['schema'] = res;
425
426
  deferreds[1].resolve(true);
@@ -427,7 +428,7 @@ function monitor_instance_values(val) {// {{{
427
428
  error: deferreds[1].resolve
428
429
  })
429
430
  $.ajax({
430
- url: rep + encodeURIComponent($(v).text()) + "/properties.json",
431
+ url: rep + 'endpoints/' + encodeURIComponent($(v).text()) + "/properties.json",
431
432
  success: function(res) {
432
433
  tmp[v.tagName]['properties'] = res;
433
434
  deferreds[2].resolve(true);
@@ -444,6 +445,11 @@ function monitor_instance_values(val) {// {{{
444
445
  });
445
446
  });
446
447
  } else if(val == "attributes") {
448
+ if ($('#modifiers > div').length == 0) {
449
+ modifiers_display().then(modifiers_select);
450
+ } else {
451
+ modifiers_select();
452
+ }
447
453
  var text = $(" > attributes > info",res).text() + " (" + url.replace(/\/$/,'').split(/[\\/]/).pop() + ")";
448
454
  $('#title').text(text);
449
455
  document.title = text;
@@ -632,19 +638,6 @@ function monitor_instance_state() {// {{{
632
638
  }
633
639
  });
634
640
  }// }}}
635
- function monitor_instance_transformation() {// {{{
636
- var url = $('body').attr('current-instance');
637
- $.ajax({
638
- type: "GET",
639
- url: url + "/properties/attributes/modeltype/",
640
- success: function(res){
641
- $("#currentmodel").text(res);
642
- },
643
- error: function() {
644
- $("#currentmodel").text('???');
645
- }
646
- });
647
- }// }}}
648
641
 
649
642
  function monitor_instance_pos() {// {{{
650
643
  var url = $('body').attr('current-instance');
@@ -731,7 +724,6 @@ function monitor_instance_state_change(notification) { //{{{
731
724
  }
732
725
 
733
726
  if (notification != "ready" && notification != "stopped" && notification != "running") {
734
- console.log('rrr');
735
727
  $('#parameters ui-content ui-area > button').attr('disabled','disabled');
736
728
  $('#state_any').hide();
737
729
  } else {
@@ -845,7 +837,36 @@ function get_testset(deferred) {// {{{
845
837
  ele.removeAttribute('xmlns');
846
838
  }
847
839
  });
848
- deferred.resolve(name,testset);
840
+ $.ajax({
841
+ type: "GET",
842
+ url: url + "/notifications/subscriptions/",
843
+ success: async function(res){
844
+ let values = $("subscriptions > subscription[url]",res);
845
+ let subs = $X('<subscriptions xmlns="http://riddl.org/ns/common-patterns/notifications-producer/2.0"/>');
846
+ let promises = [];
847
+ let scount = 0;
848
+ values.each(function(){
849
+ let sid = $(this).attr('id');
850
+ if (sid.match(/^_/)) {
851
+ scount += 1;
852
+ promises.push(
853
+ $.ajax({
854
+ type: "GET",
855
+ url: url + "/notifications/subscriptions/" + sid,
856
+ error: report_failure
857
+ }).then(function(a) {
858
+ subs.append($(a.documentElement));
859
+ })
860
+ );
861
+ };
862
+ });
863
+ await Promise.all(promises);
864
+ if (scount > 0) { testset.append(subs); }
865
+ deferred.resolve(name,testset);
866
+ },
867
+ error: function() { deferred.reject(); report_failure(); }
868
+ });
869
+
849
870
  },
850
871
  error: function() { deferred.reject(); report_failure(); }
851
872
  });
@@ -919,11 +940,10 @@ async function set_testset(testset,exec) {// {{{
919
940
  url: url + "/notifications/subscriptions/",
920
941
  error: report_failure
921
942
  }).then(async function(res) {
922
- var rcount = 0;
923
943
  var values = $("subscriptions > subscription[url]",res);
924
- var vals = [];
944
+ var vals = {};
925
945
  values.each(function(){
926
- vals.push($(this).attr('url'));
946
+ vals[$(this).attr('url')] = $(this).attr('id');
927
947
  });
928
948
  await load_testset_handlers(url,testset,vals);
929
949
  })
@@ -1083,24 +1103,68 @@ async function load_des(url,model) { //{{{
1083
1103
  error: report_failure
1084
1104
  });
1085
1105
  } //}}}
1106
+
1107
+ function load_testset_extract_handlers(inp,han,suburl) { //{{{
1108
+ inp.push("url="+encodeURIComponent(suburl).replace(/~/,'%7E'));
1109
+ $(">*",han).each(function(_,top){
1110
+ let events = [];
1111
+ let votes = [];
1112
+ $(">*",top).each(function(_,it){
1113
+ if (it.nodeName == 'event') {
1114
+ events.push($(it).text());
1115
+ }
1116
+ if (it.nodeName == 'vote') {
1117
+ votes.push($(it).text());
1118
+ }
1119
+ });
1120
+ if (events.length > 0) {
1121
+ inp.push("topic=" + $(top).attr('id'));
1122
+ inp.push("events=" + events.join(','));
1123
+ }
1124
+ if (votes.length > 0) {
1125
+ inp.push("topic=" + $(top).attr('id'));
1126
+ inp.push("votes=" + votes.join(','));
1127
+ }
1128
+ });
1129
+ return inp;
1130
+ } //}}}
1131
+
1086
1132
  async function load_testset_handlers(url,testset,vals) {// {{{
1087
1133
  var promises = [];
1088
- $("testset > handlers > *",testset).each(async function(){
1089
- var han = this;
1090
- var suburl = $(han).attr('url');
1091
- if ($.inArray(suburl,vals) == -1) {
1092
- var inp = "url="+encodeURIComponent(suburl).replace(/~/,'%7E');
1093
- $("*",han).each(function(){
1094
- inp += "&topic=" + $(this).attr('topic');
1095
- inp += "&" + this.nodeName + "=" + $(this).text();
1096
- });
1097
- promises.push(
1134
+ $("testset > subscriptions > *",testset).each(async function(){
1135
+ let han = this;
1136
+ let sid = $(han).attr('id');
1137
+ let suburl = $(han).attr('url');
1138
+ if (typeof(vals[suburl]) == 'undefined') {
1139
+ if ($("*",han).length > 0) {
1140
+ let inp = [];
1141
+ if (sid) { inp.push("id="+encodeURIComponent(sid)); }
1142
+ inp = load_testset_extract_handlers(inp,han,suburl);
1143
+ promises.push(
1144
+ $.ajax({
1145
+ type: "POST",
1146
+ url: url + "/notifications/subscriptions/",
1147
+ data: inp.join('&')
1148
+ })
1149
+ )
1150
+ }
1151
+ } else {
1152
+ if ($("*",han).length == 0) {
1098
1153
  $.ajax({
1099
- type: "POST",
1100
- url: url + "/notifications/subscriptions/",
1101
- data: inp
1154
+ type: "DELETE",
1155
+ url: url + "/notifications/subscriptions/" + vals[suburl] + '/'
1102
1156
  })
1103
- )
1157
+ delete vals[suburl];
1158
+ } else {
1159
+ let inp = load_testset_extract_handlers([],han,suburl);
1160
+ promises.push(
1161
+ $.ajax({
1162
+ type: "PUT",
1163
+ url: url + "/notifications/subscriptions/" + vals[suburl] + '/',
1164
+ data: inp.join('&')
1165
+ })
1166
+ )
1167
+ }
1104
1168
  }
1105
1169
  });
1106
1170
  return Promise.all(promises);
@@ -1215,7 +1279,6 @@ function format_visual_vote_clear() {//{{{
1215
1279
 
1216
1280
  function format_instance_pos() { //{{{
1217
1281
  $(save['instance_pos']).each(function(){
1218
- console.log(this);
1219
1282
  var taskname = this.nodeName;
1220
1283
  var taskstate = this.textContent;
1221
1284
  format_visual_add(taskname,save['state'] == 'running' ? (taskstate == 'at' ? 'active' : 'passive') : 'passive');
@@ -1308,6 +1371,113 @@ function append_to_log(what,type,message) {//{{{
1308
1371
  }
1309
1372
  }//}}}
1310
1373
 
1374
+ async function modifiers_display() {
1375
+ let promises = [];
1376
+ let rep = $('body').attr('current-resources');
1377
+ $('#modifiers > div').remove();
1378
+
1379
+ promises.push(
1380
+ $.ajax({
1381
+ url: rep + 'modifiers/'
1382
+ }).then(async function(res) {
1383
+ let ipromises = [];
1384
+ $('resource',res).each(function(_,r) {
1385
+ ipromises.push(
1386
+ $.ajax({
1387
+ url: rep + 'modifiers/' + $(r).text()
1388
+ }).then(async function(ses){
1389
+ let clone = document.importNode(document.querySelector('#modifiers template').content,true);
1390
+ let t = $(r).text();
1391
+ $('> div',clone).attr('data-resource',t);
1392
+ $('div.title *',clone).text(decodeURIComponent(t));
1393
+
1394
+ let cpromises = [];
1395
+ $('resource',ses).each(function(_,s) {
1396
+ let opt = $('<option/>');
1397
+ opt.text(decodeURIComponent($(s).text()));
1398
+ $('div.select select',clone).append(opt);
1399
+
1400
+ cpromises.push(
1401
+ $.ajax({
1402
+ url: rep + 'modifiers/' + $(r).text() + '/' + $(s).text() + '/condition.json'
1403
+ }).then(function(tes){
1404
+ save['modifiers'][$(r).text() + '/' + $(s).text()] = tes;
1405
+ })
1406
+ );
1407
+
1408
+ });
1409
+ $(clone).insertBefore($('#modifiers template'));
1410
+
1411
+ await Promise.all(cpromises);
1412
+ })
1413
+ );
1414
+ });
1415
+ await Promise.all(ipromises);
1416
+ })
1417
+ );
1418
+ await Promise.all(promises);
1419
+ }
1420
+
1421
+ function modifiers_select(e) {
1422
+ let atts = {}
1423
+ let attr = save['attributes'].save();
1424
+ $('> attributes > *',attr).each(function(_,s){
1425
+ atts[s.nodeName] = $(s).text();
1426
+ });
1427
+ $('#modifiers div[data-resource]').each(function(_,r){
1428
+ $('select option',r).each(function(_,s){
1429
+ let where = $(r).attr('data-resource') + '/' + encodeURIComponent($(s).text());
1430
+ let cond = save['modifiers'][where];
1431
+ let success = true;
1432
+ for (x in cond) {
1433
+ if (cond[x] != atts[x]) { success = false; }
1434
+ }
1435
+ if (success) {
1436
+ save['modifiers_active'][$(r).attr('data-resource')] = $(s).text();
1437
+ $('select',r).val($(s).text());
1438
+ }
1439
+ });
1440
+ });
1441
+ }
1442
+
1443
+ function modifiers_update_patch(url,now) {
1444
+ $.ajax({
1445
+ url: url + '/' + now + '/patch.xml',
1446
+ success: function(res) {
1447
+ set_testset(res,false);
1448
+ }
1449
+ });
1450
+ }
1451
+ function modifiers_update_unpatch(url,last,now) {
1452
+ $.ajax({
1453
+ url: url + '/' + last + '/unpatch.xml',
1454
+ success: function(res) {
1455
+ set_testset(res,false).then(function() {
1456
+ modifiers_update_patch(url,now);
1457
+ });
1458
+ },
1459
+ error: function() {
1460
+ modifiers_update_patch(url,now);
1461
+ }
1462
+ });
1463
+ }
1464
+
1465
+ function modifiers_update(e) {
1466
+ // when change path
1467
+ // unpach from what changed
1468
+ // show ui
1469
+ let rep = $('body').attr('current-resources');
1470
+ let top = $(e.target).parents('div[data-resource]').attr('data-resource');
1471
+ let last = save['modifiers_active'][top];
1472
+ let now = $(e.target).val();
1473
+
1474
+ if (last) {
1475
+ modifiers_update_unpatch(rep + 'modifiers/' + top,last,now);
1476
+ } else {
1477
+ modifiers_update_patch(rep + 'modifiers/' + top,now);
1478
+ }
1479
+ }
1480
+
1311
1481
  function report_failure(){}
1312
1482
 
1313
1483
  function ui_pos(e,bl) {