cpee 2.1.135 → 2.1.139
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/cockpit/compliance-view.html +11 -19
- data/cockpit/compliance.html +11 -19
- data/cockpit/css/llm.css +3 -3
- data/cockpit/css/llmmodel.css +140 -0
- data/cockpit/css/model.css +0 -1
- data/cockpit/css/ui.css +13 -7
- data/cockpit/css/wfadaptor.css +15 -10
- data/cockpit/edit.html +11 -19
- data/cockpit/graph.html +8 -13
- data/cockpit/index.html +11 -19
- data/cockpit/js/details.js +27 -10
- data/cockpit/js/instance.js +219 -206
- data/cockpit/js/llm-ui-bubble.js +36 -0
- data/cockpit/js/llm-ui-status.js +34 -0
- data/cockpit/js/llm-ui.js +87 -0
- data/cockpit/js/llm.js +469 -121
- data/cockpit/js/parameters.js +45 -14
- data/cockpit/js/wfadaptor.js +402 -77
- data/cockpit/llm.html +16 -21
- data/cockpit/llmmodel.html +17 -23
- data/cockpit/model.html +8 -15
- data/cockpit/only_llm.html +14 -19
- data/cockpit/themes/THEMES.MD +4 -0
- data/cockpit/themes/base.js +1 -1
- data/cockpit/themes/packed/theme.js +3 -0
- data/cockpit/themes/presetlr/rngs/alternative.rng +28 -0
- data/cockpit/themes/presetlr/rngs/call.rng +249 -0
- data/cockpit/themes/presetlr/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/presetlr/rngs/choose.rng +27 -0
- data/cockpit/themes/presetlr/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/presetlr/rngs/critical.rng +8 -0
- data/cockpit/themes/presetlr/rngs/escape.rng +5 -0
- data/cockpit/themes/presetlr/rngs/group.rng +3 -0
- data/cockpit/themes/presetlr/rngs/loop.rng +40 -0
- data/cockpit/themes/presetlr/rngs/manipulate.rng +76 -0
- data/cockpit/themes/presetlr/rngs/otherwise.rng +25 -0
- data/cockpit/themes/presetlr/rngs/parallel.rng +24 -0
- data/cockpit/themes/presetlr/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/presetlr/rngs/scripts.rng +23 -0
- data/cockpit/themes/presetlr/rngs/start.rng +143 -0
- data/cockpit/themes/presetlr/rngs/stop.rng +5 -0
- data/cockpit/themes/presetlr/rngs/terminate.rng +8 -0
- data/cockpit/themes/presetlr/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/presetlr/symbols/alternative.svg +19 -0
- data/cockpit/themes/presetlr/symbols/arrow.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive.svg +13 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/presetlr/symbols/complex.svg +1 -0
- data/cockpit/themes/presetlr/symbols/critical.svg +1 -0
- data/cockpit/themes/presetlr/symbols/delete.svg +1 -0
- data/cockpit/themes/presetlr/symbols/end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/escape.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/loop.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end_pre.svg +15 -0
- data/cockpit/themes/presetlr/symbols/manipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/mark.svg +1 -0
- data/cockpit/themes/presetlr/symbols/otherwise.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event.svg +14 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_normal.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/scripts.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start_event.svg +1 -0
- data/cockpit/themes/presetlr/symbols/stop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/terminate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/presetlr/theme.js +54 -0
- data/cockpit/themes/wellformed/rngs/alternative.rng +28 -0
- data/cockpit/themes/wellformed/rngs/call.rng +249 -0
- data/cockpit/themes/wellformed/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/wellformed/rngs/choose.rng +27 -0
- data/cockpit/themes/wellformed/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/wellformed/rngs/critical.rng +8 -0
- data/cockpit/themes/wellformed/rngs/escape.rng +5 -0
- data/cockpit/themes/wellformed/rngs/group.rng +3 -0
- data/cockpit/themes/wellformed/rngs/loop.rng +40 -0
- data/cockpit/themes/wellformed/rngs/manipulate.rng +76 -0
- data/cockpit/themes/wellformed/rngs/otherwise.rng +25 -0
- data/cockpit/themes/wellformed/rngs/parallel.rng +24 -0
- data/cockpit/themes/wellformed/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/wellformed/rngs/scripts.rng +23 -0
- data/cockpit/themes/wellformed/rngs/start.rng +143 -0
- data/cockpit/themes/wellformed/rngs/stop.rng +5 -0
- data/cockpit/themes/wellformed/rngs/terminate.rng +8 -0
- data/cockpit/themes/wellformed/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/wellformed/symbols/alternative.svg +1 -0
- data/cockpit/themes/wellformed/symbols/arrow.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/wellformed/symbols/complex.svg +1 -0
- data/cockpit/themes/wellformed/symbols/critical.svg +1 -0
- data/cockpit/themes/wellformed/symbols/delete.svg +1 -0
- data/cockpit/themes/wellformed/symbols/end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/escape.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_start.svg +6 -0
- data/cockpit/themes/wellformed/symbols/loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/loop_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/manipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/mark.svg +1 -0
- data/cockpit/themes/wellformed/symbols/otherwise.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_normal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/scripts.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/stop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/terminate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/wellformed/theme.js +32 -0
- data/cockpit/track.html +8 -13
- data/cpee.gemspec +3 -3
- data/lib/callbacks/callbacks.rng +4 -4
- data/lib/callbacks.xml +4 -4
- data/lib/cpee/constants.rb +4 -4
- data/lib/cpee/fail.rb +4 -4
- data/lib/cpee/implementation.rb +10 -4
- data/lib/cpee/implementation_callbacks.rb +6 -6
- data/lib/cpee/implementation_notifications.rb +8 -5
- data/lib/cpee/implementation_properties.rb +132 -12
- data/lib/cpee/json_pointer.rb +110 -0
- data/lib/cpee/message.rb +26 -6
- data/lib/cpee/persistence.rb +10 -4
- data/lib/cpee/redis.rb +12 -4
- data/lib/cpee/statemachine.rb +4 -4
- data/lib/cpee/value_helper.rb +4 -4
- data/lib/cpee.xml +4 -4
- data/lib/engine/executionhandler-list.rng +4 -4
- data/lib/engine/instance-info.rng +4 -4
- data/lib/engine/instances.rng +4 -4
- data/lib/engine.xml +4 -4
- data/lib/properties/t_dslx.rng +356 -0
- data/lib/properties/transformation.rng +14 -0
- data/lib/properties.xml +5 -4
- data/server/executionhandlers/eval/backend/opts.yaml +1 -1
- data/server/executionhandlers/eval/connection.rb +16 -7
- data/server/executionhandlers/eval/execution.rb +4 -4
- data/server/executionhandlers/ruby/backend/opts.yaml +1 -1
- data/server/executionhandlers/ruby/connection.rb +17 -9
- data/server/executionhandlers/ruby/controller.rb +21 -6
- data/server/executionhandlers/ruby/dsl_to_dslx.xsl +6 -2
- data/server/executionhandlers/ruby/execution.rb +4 -4
- data/server/resources/properties.empty +5 -4
- data/server/resources/properties.init +5 -4
- data/server/resources/topics.xml +4 -4
- data/server/routing/end.pid +1 -1
- data/server/routing/end.rb +4 -4
- data/server/routing/forward-events-00.pid +1 -1
- data/server/routing/forward-events.rb +34 -23
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/forward-votes.rb +60 -47
- data/server/routing/persist.pid +1 -1
- data/server/routing/persist.rb +53 -30
- data/tools/server/cpee +1 -1
- data/tools/server/resources/properties.init +4 -4
- metadata +142 -5
- data/cockpit/CPEE.xml +0 -8
- data/cockpit/Signavio.xml +0 -8
- data/cockpit/transformations.xml +0 -4
- /data/{COPYING → LICENSE} +0 -0
data/cockpit/js/instance.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var es;
|
|
2
|
+
var es_reconnect;
|
|
2
3
|
var suspended_redrawing = false;
|
|
3
4
|
var skip_location = false;
|
|
4
5
|
var myid = ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
|
|
@@ -20,8 +21,16 @@ var save = {};
|
|
|
20
21
|
save['attributes'] = undefined;
|
|
21
22
|
save['attributes_raw'] = {};
|
|
22
23
|
var node_state = {};
|
|
24
|
+
var tracking_memory = 10000; // ms finished uuids are remembered, to drop late events
|
|
23
25
|
var debug = false;
|
|
24
26
|
|
|
27
|
+
var cpee= {
|
|
28
|
+
'instance': undefined,
|
|
29
|
+
'base': undefined,
|
|
30
|
+
'attributes': {},
|
|
31
|
+
'url': undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
function global_init() {
|
|
26
35
|
suspended_redrawing = false;
|
|
27
36
|
loading = false;
|
|
@@ -30,6 +39,8 @@ function global_init() {
|
|
|
30
39
|
save['states']= {};
|
|
31
40
|
save['state']= undefined;
|
|
32
41
|
save['dsl'] = undefined;
|
|
42
|
+
save['change_uuid'] = undefined; // of the last description/change
|
|
43
|
+
save['description'] = undefined; // description that belongs to change_uuid, undefined means get it from the server
|
|
33
44
|
save['activity_red_states'] = {}
|
|
34
45
|
save['graph'] = undefined;
|
|
35
46
|
save['graph_theme'] = undefined;
|
|
@@ -39,7 +50,8 @@ function global_init() {
|
|
|
39
50
|
save['details'] = undefined;
|
|
40
51
|
save['details_target'] = {};
|
|
41
52
|
save['instance_pos'] = [];
|
|
42
|
-
save['
|
|
53
|
+
save['instance_pos_anon'] = {};
|
|
54
|
+
save['position_states'] = {};
|
|
43
55
|
save['modifiers'] = {};
|
|
44
56
|
save['modifiers_active'] = {};
|
|
45
57
|
save['modifiers_additional'] = {};
|
|
@@ -54,7 +66,7 @@ var sub_more = 'topic' + '=' + 'activity' + '&' +// {{{
|
|
|
54
66
|
'topic' + '=' + 'activity' + '&' +
|
|
55
67
|
'votes' + '=' + 'syncing_after' + '&' +
|
|
56
68
|
'topic' + '=' + 'description' + '&' +
|
|
57
|
-
'events' + '=' + 'change,error' + '&' +
|
|
69
|
+
'events' + '=' + 'change,error,sync' + '&' +
|
|
58
70
|
'topic' + '=' + 'position' + '&' +
|
|
59
71
|
'events' + '=' + 'change' + '&' +
|
|
60
72
|
'topic' + '=' + 'state' + '&' +
|
|
@@ -80,7 +92,7 @@ var sub_less = 'topic' + '=' + 'activity' + '&' +// {{{
|
|
|
80
92
|
'topic' + '=' + 'position' + '&' +
|
|
81
93
|
'events' + '=' + 'change' + '&' +
|
|
82
94
|
'topic' + '=' + 'description' + '&' +
|
|
83
|
-
'events' + '=' + 'change,error' + '&' +
|
|
95
|
+
'events' + '=' + 'change,error,sync' + '&' +
|
|
84
96
|
'topic' + '=' + 'state' + '&' +
|
|
85
97
|
'events' + '=' + 'change' + '&' +
|
|
86
98
|
'topic' + '=' + 'dataelements' + '&' +
|
|
@@ -147,9 +159,8 @@ function cockpit() { //{{{
|
|
|
147
159
|
$("button[name=loadtestset]").click(function(e){new CustomMenu(e).menu($('#templates'),function(){ load_testset(false) } ); });
|
|
148
160
|
$("button[name=loadtestsetfile]").click(load_testsetfile);
|
|
149
161
|
$("button[name=loadmodelfile]").click(load_modelfile);
|
|
150
|
-
$("button[name=loadmodeltype]").click(function(e){new CustomMenu(e).menu($('#modeltypes'),load_modeltype, $("button[name=loadmodeltype]")); });
|
|
151
162
|
$("button[name=savetestsetfile]").click(function(){ save_testsetfile(); });
|
|
152
|
-
$("button[name=
|
|
163
|
+
$("button[name=savemodelfile]").click(function(){ save_modelfile(); });
|
|
153
164
|
$("button[name=savesvgfile]").click(function(){ save_svgfile(); });
|
|
154
165
|
$("button[name=state_start]").click(function(){ $(this).parent().find('button').attr("disabled","disabled");start_instance(); });
|
|
155
166
|
$("button[name=state_stop]").click(function(){ $(this).parent().find('button').attr("disabled","disabled");stop_instance(); });
|
|
@@ -163,6 +174,7 @@ function cockpit() { //{{{
|
|
|
163
174
|
save['graph_adaptor'].illustrator.get_elements().removeClass('marked');
|
|
164
175
|
localStorage.removeItem('marked');
|
|
165
176
|
localStorage.removeItem('marked_from');
|
|
177
|
+
details_leave(true);
|
|
166
178
|
$('#dat_details').empty();
|
|
167
179
|
e.stopImmediatePropagation();
|
|
168
180
|
});
|
|
@@ -263,16 +275,6 @@ function cockpit() { //{{{
|
|
|
263
275
|
}
|
|
264
276
|
}
|
|
265
277
|
});
|
|
266
|
-
$.ajax({
|
|
267
|
-
url: "transformations.xml",
|
|
268
|
-
dataType: 'xml',
|
|
269
|
-
success: function(res){
|
|
270
|
-
$('transformation',res).each(function(){
|
|
271
|
-
var ts = $(this).text();
|
|
272
|
-
$('#modeltypes').append($("<div class='menuitem'></div>").text(ts));
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
278
|
} //}}}
|
|
277
279
|
|
|
278
280
|
function check_subscription() { // {{{
|
|
@@ -348,6 +350,31 @@ function create_instance(base,name,load,exec) {// {{{
|
|
|
348
350
|
}
|
|
349
351
|
}// }}}
|
|
350
352
|
|
|
353
|
+
function subscribe(url,retry,success) { //{{{
|
|
354
|
+
es_reconnect = undefined;
|
|
355
|
+
if ($('body').attr('current-instance') != url) { return; } // instance switched while waiting for reconnect
|
|
356
|
+
$.ajax({
|
|
357
|
+
type: "POST",
|
|
358
|
+
url: url + "/notifications/subscriptions/",
|
|
359
|
+
data: subscription_state == 'more' ? sub_more : sub_less,
|
|
360
|
+
success: function(res){
|
|
361
|
+
subscription = res;
|
|
362
|
+
append_to_log("monitoring", "id", subscription);
|
|
363
|
+
sse(); // also (re)loads everything, so a reconnect catches up on what was missed
|
|
364
|
+
if (success) { success(); }
|
|
365
|
+
},
|
|
366
|
+
error: function(xhr) {
|
|
367
|
+
if (retry && (xhr.status == 0 || xhr.status >= 500)) {
|
|
368
|
+
append_to_log("monitoring", "closed", "server not reachable, reconnecting in 5 seconds.");
|
|
369
|
+
es_reconnect = setTimeout(() => subscribe(url,true), 5000);
|
|
370
|
+
} else {
|
|
371
|
+
subscription = undefined;
|
|
372
|
+
append_to_log("monitoring", "closed", "For Good.");
|
|
373
|
+
sse();
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
} //}}}
|
|
351
378
|
async function sse() { //{{{
|
|
352
379
|
var url = $('body').attr('current-instance');
|
|
353
380
|
if (subscription) {
|
|
@@ -366,10 +393,31 @@ async function sse() { //{{{
|
|
|
366
393
|
monitor_instance_values("documents",data.content.values);
|
|
367
394
|
break;
|
|
368
395
|
case 'description':
|
|
396
|
+
if (data['name'] == 'sync') {
|
|
397
|
+
if (data.content.change_uuid == save['change_uuid']) {
|
|
398
|
+
save['description'] = data.content.description;
|
|
399
|
+
$("button[name=savemodelfile]").prop('disabled',false);
|
|
400
|
+
}
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
if (data['name'] == 'change') {
|
|
404
|
+
save['change_uuid'] = data.content.change_uuid;
|
|
405
|
+
save['description'] = data.content.change_pending ? undefined : data.content.description;
|
|
406
|
+
$("button[name=savemodelfile]").prop('disabled',data.content.change_pending == true);
|
|
407
|
+
} else if (data['name'] == 'error' && data.content.change_uuid && data.content.change_uuid == save['change_uuid']) {
|
|
408
|
+
$("button[name=savemodelfile]").prop('disabled',false);
|
|
409
|
+
}
|
|
369
410
|
monitor_instance_dsl();
|
|
370
411
|
monitor_graph_change(false);
|
|
371
412
|
document.dispatchEvent(graph_changed);
|
|
372
413
|
break;
|
|
414
|
+
case 'transformation':
|
|
415
|
+
if (data.content.change_pending) { // the description for the new model type follows with description/sync
|
|
416
|
+
save['change_uuid'] = data.content.change_uuid;
|
|
417
|
+
save['description'] = undefined;
|
|
418
|
+
$("button[name=savemodelfile]").prop('disabled',true);
|
|
419
|
+
}
|
|
420
|
+
break;
|
|
373
421
|
case 'endpoints':
|
|
374
422
|
monitor_instance_values("endpoints");
|
|
375
423
|
break;
|
|
@@ -408,20 +456,29 @@ async function sse() { //{{{
|
|
|
408
456
|
append_to_log(data['type'], data['topic'] + '/' + data['name'], JSON.stringify(data['content']));
|
|
409
457
|
};
|
|
410
458
|
es.onerror = function() {
|
|
411
|
-
|
|
412
|
-
//
|
|
459
|
+
// the server deletes the subscription when the connection closes, so the
|
|
460
|
+
// native EventSource retry can never succeed. resubscribe instead.
|
|
461
|
+
this.close();
|
|
462
|
+
if (save['state'] == 'finished' || save['state'] == 'abandoned') {
|
|
463
|
+
append_to_log("monitoring", "closed", "instance " + save['state'] + ".");
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
append_to_log("monitoring", "closed", "connection lost, reconnecting in 5 seconds.");
|
|
467
|
+
es_reconnect = setTimeout(() => subscribe(url,true), 5000);
|
|
413
468
|
};
|
|
414
469
|
}
|
|
415
|
-
await monitor_instance_values("endpoints"); // we cant render before we know specialized endpoint symbols
|
|
416
|
-
await monitor_instance_values("attributes"); // attributes first, to catch the <resources> attribute which overrides current-resources
|
|
417
|
-
monitor_instance_values("
|
|
418
|
-
monitor_instance_values("
|
|
470
|
+
await monitor_instance_values("endpoints",undefined,true); // we cant render before we know specialized endpoint symbols
|
|
471
|
+
await monitor_instance_values("attributes",undefined,true); // attributes first, to catch the <resources> attribute which overrides current-resources
|
|
472
|
+
monitor_instance_values("documents",undefined,true);
|
|
473
|
+
monitor_instance_values("dataelements",undefined,true);
|
|
419
474
|
monitor_instance_dsl();
|
|
420
475
|
monitor_graph_change(false);
|
|
421
476
|
monitor_instance_state();
|
|
422
477
|
} //}}}
|
|
423
478
|
|
|
424
479
|
function monitor_instance(cin,rep,load,exec) {// {{{
|
|
480
|
+
if (es) { es.close(); }
|
|
481
|
+
clearTimeout(es_reconnect);
|
|
425
482
|
global_init();
|
|
426
483
|
format_visual_clear();
|
|
427
484
|
format_visual_vote_clear();
|
|
@@ -429,16 +486,21 @@ function monitor_instance(cin,rep,load,exec) {// {{{
|
|
|
429
486
|
$("body").attr('current-instance',sanitize_url(cin));
|
|
430
487
|
$("body").attr('current-resources',sanitize_url(rep));
|
|
431
488
|
|
|
489
|
+
url = $("body").attr('current-instance');
|
|
490
|
+
|
|
491
|
+
cpee.url = $("body").attr('current-instance');
|
|
492
|
+
cpee.base = $("body").attr('current-base');
|
|
493
|
+
cpee.instance = url.match(/(\d+)\/?$/)[1];
|
|
494
|
+
|
|
432
495
|
$("input[name=instance-url]").val($("body").attr('current-instance'));
|
|
433
496
|
$("input[name=res-url]").val($("body").attr('current-resources'));
|
|
434
497
|
|
|
435
498
|
$('#parameters ui-content ui-area > button, ui-tabbed.parameters ui-content ui-area > button').attr('disabled','disabled');
|
|
499
|
+
details_leave(false);
|
|
436
500
|
$('#dat_details').empty();
|
|
437
501
|
|
|
438
502
|
$('#modifiers > div').remove();
|
|
439
503
|
|
|
440
|
-
url = $("body").attr('current-instance');
|
|
441
|
-
|
|
442
504
|
$.ajax({
|
|
443
505
|
type: "GET",
|
|
444
506
|
url: url,
|
|
@@ -472,22 +534,9 @@ function monitor_instance(cin,rep,load,exec) {// {{{
|
|
|
472
534
|
// Change url to return to current instance when reloading (because new subscription is made)
|
|
473
535
|
$("input[name=votecontinue]").prop( "checked", false );
|
|
474
536
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
data: sub_less,
|
|
479
|
-
success: function(res){
|
|
480
|
-
subscription = res;
|
|
481
|
-
append_to_log("monitoring", "id", subscription);
|
|
482
|
-
sse();
|
|
483
|
-
if (load || exec) {
|
|
484
|
-
load_testset(exec);
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
error: function() {
|
|
488
|
-
subscription = undefined;
|
|
489
|
-
append_to_log("monitoring", "closed", "For Good.");
|
|
490
|
-
sse();
|
|
537
|
+
subscribe(url,false,function(){
|
|
538
|
+
if (load || exec) {
|
|
539
|
+
load_testset(exec);
|
|
491
540
|
}
|
|
492
541
|
});
|
|
493
542
|
},
|
|
@@ -498,7 +547,7 @@ function monitor_instance(cin,rep,load,exec) {// {{{
|
|
|
498
547
|
});
|
|
499
548
|
}// }}}
|
|
500
549
|
|
|
501
|
-
function monitor_instance_values(type,vals) {// {{{
|
|
550
|
+
function monitor_instance_values(type,vals,first=false) {// {{{
|
|
502
551
|
if (type == "dataelements" && save['state'] == "running") {
|
|
503
552
|
let de = save[type].save();
|
|
504
553
|
Object.entries(vals).forEach(([key,value]) => {
|
|
@@ -527,6 +576,9 @@ function monitor_instance_values(type,vals) {// {{{
|
|
|
527
576
|
url: url + "/properties/" + type + "/",
|
|
528
577
|
success: function(res){
|
|
529
578
|
save[type].content(res);
|
|
579
|
+
if (first) {
|
|
580
|
+
document.dispatchEvent(eval(type + '_loaded'));
|
|
581
|
+
}
|
|
530
582
|
if (type == "endpoints") {
|
|
531
583
|
save['endpoints_list'] = {};
|
|
532
584
|
var tmp = {};
|
|
@@ -545,6 +597,7 @@ function monitor_instance_values(type,vals) {// {{{
|
|
|
545
597
|
save['endpoints_cache'] = tmp;
|
|
546
598
|
def.resolve();
|
|
547
599
|
// when updating attributes clear the attributes, because they might change as well. New arguments are possible.
|
|
600
|
+
details_leave(true);
|
|
548
601
|
$('#dat_details').empty();
|
|
549
602
|
});
|
|
550
603
|
},
|
|
@@ -562,6 +615,7 @@ function monitor_instance_values(type,vals) {// {{{
|
|
|
562
615
|
save['endpoints_cache'] = tmp;
|
|
563
616
|
def.resolve();
|
|
564
617
|
// when updating attributes clear the attributes, because they might change as well. New arguments are possible.
|
|
618
|
+
details_leave(true);
|
|
565
619
|
$('#dat_details').empty();
|
|
566
620
|
});
|
|
567
621
|
},
|
|
@@ -577,6 +631,7 @@ function monitor_instance_values(type,vals) {// {{{
|
|
|
577
631
|
} else if(type == "attributes") {
|
|
578
632
|
$(" > attributes > *",res).each((k,v)=>{
|
|
579
633
|
save['attributes_raw'][v.nodeName] = v.textContent;
|
|
634
|
+
cpee.attributes[v.nodeName] = v.textContent;
|
|
580
635
|
});
|
|
581
636
|
document.dispatchEvent(eval(type + '_changed'));
|
|
582
637
|
if ($(" > attributes > resources",res).length > 0) {
|
|
@@ -584,11 +639,6 @@ function monitor_instance_values(type,vals) {// {{{
|
|
|
584
639
|
} else {
|
|
585
640
|
save['resources'] = undefined;
|
|
586
641
|
}
|
|
587
|
-
if ($(" > attributes > modeltype",res).length > 0) {
|
|
588
|
-
save['modeltype'] = $(" > attributes > modeltype",res).text();
|
|
589
|
-
} else {
|
|
590
|
-
save['modeltype'] = undefined;
|
|
591
|
-
}
|
|
592
642
|
if ($('#modifiers').length > 0) {
|
|
593
643
|
if ($('#modifiers > div').length == 0) {
|
|
594
644
|
modifiers_display().then(function(){ modifiers_select(); });
|
|
@@ -679,58 +729,27 @@ function adaptor_init(url,theme,dslx) { //{{{
|
|
|
679
729
|
save['graph'].removeAttr('svg-subtype');
|
|
680
730
|
save['graph'].removeAttr('svg-label');
|
|
681
731
|
document.dispatchEvent(graph_changed);
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
headers: {
|
|
694
|
-
'Content-ID': 'transformation',
|
|
695
|
-
'CPEE-Event-Source': myid
|
|
696
|
-
},
|
|
697
|
-
data: '<transformation xmlns="http://cpee.org/ns/properties/2.0"><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>',
|
|
698
|
-
success: function() {
|
|
699
|
-
$.ajax({
|
|
700
|
-
type: "PUT",
|
|
701
|
-
url: url + "/properties/description/",
|
|
702
|
-
contentType: 'text/xml',
|
|
703
|
-
headers: {
|
|
704
|
-
'Content-ID': 'description',
|
|
705
|
-
'CPEE-Event-Source': myid
|
|
706
|
-
},
|
|
707
|
-
data: g,
|
|
708
|
-
error: report_failure
|
|
709
|
-
});
|
|
710
|
-
},
|
|
711
|
-
error: report_failure
|
|
712
|
-
});
|
|
713
|
-
} else {
|
|
714
|
-
$.ajax({
|
|
715
|
-
type: "PUT",
|
|
716
|
-
url: url + "/properties/description/",
|
|
717
|
-
contentType: 'text/xml',
|
|
718
|
-
headers: {
|
|
719
|
-
'Content-ID': 'description',
|
|
720
|
-
'CPEE-Event-Source': myid
|
|
721
|
-
},
|
|
722
|
-
data: g,
|
|
723
|
-
error: report_failure
|
|
724
|
-
});
|
|
725
|
-
}
|
|
732
|
+
$.ajax({
|
|
733
|
+
type: "PUT",
|
|
734
|
+
url: url + "/properties/dslx/",
|
|
735
|
+
contentType: 'text/xml',
|
|
736
|
+
headers: {
|
|
737
|
+
'Content-ID': 'dslx',
|
|
738
|
+
'CPEE-Event-Source': myid
|
|
739
|
+
},
|
|
740
|
+
data: g,
|
|
741
|
+
error: report_model_failure
|
|
742
|
+
});
|
|
726
743
|
manifestation.events.click(svgid);
|
|
727
744
|
format_instance_pos();
|
|
728
745
|
if (manifestation.selected() == "unknown") { // nothing selected
|
|
746
|
+
details_leave(false);
|
|
729
747
|
$('#dat_details').empty();
|
|
730
748
|
}
|
|
731
749
|
};
|
|
732
750
|
|
|
733
751
|
monitor_instance_pos();
|
|
752
|
+
details_leave(false);
|
|
734
753
|
$('#dat_details').empty();
|
|
735
754
|
|
|
736
755
|
// while inside and svgs are reloaded, do nothing here
|
|
@@ -805,7 +824,7 @@ function monitor_instance_pos() {// {{{
|
|
|
805
824
|
if (graph_position && graph_position == 'false') {
|
|
806
825
|
save['instance_pos'] = [];
|
|
807
826
|
format_visual_clear();
|
|
808
|
-
|
|
827
|
+
format_instance_pos_load();
|
|
809
828
|
return;
|
|
810
829
|
};
|
|
811
830
|
var url = $('body').attr('current-instance');
|
|
@@ -815,42 +834,84 @@ function monitor_instance_pos() {// {{{
|
|
|
815
834
|
success: function(res){
|
|
816
835
|
save['instance_pos'] = $("positions > *",res);
|
|
817
836
|
format_visual_clear();
|
|
818
|
-
|
|
837
|
+
format_instance_pos_load();
|
|
819
838
|
}
|
|
820
839
|
});
|
|
821
840
|
}// }}}
|
|
822
841
|
|
|
842
|
+
function track_start(states,uuid,what,cls) {// {{{
|
|
843
|
+
if (states[uuid]) { return; } // already running, or a late start after the end
|
|
844
|
+
states[uuid] = { position: what, state: 'running' };
|
|
845
|
+
let anon = save['instance_pos_anon'][what];
|
|
846
|
+
if (anon && anon[cls] > 0) {
|
|
847
|
+
anon[cls] -= 1; // most likely the snapshot entry itself, so it is already counted
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
format_visual_add(what,cls);
|
|
851
|
+
} // }}}
|
|
852
|
+
function track_end(states,uuid,what,cls) {// {{{
|
|
853
|
+
let cur = states[uuid];
|
|
854
|
+
if (cur && cur.state == 'done') { return; }
|
|
855
|
+
states[uuid] = { position: what, state: 'done' };
|
|
856
|
+
setTimeout(() => {delete states[uuid]},tracking_memory);
|
|
857
|
+
let anon = save['instance_pos_anon'][what];
|
|
858
|
+
if (!cur) { // start never seen, so it belongs to a snapshot entry, if any
|
|
859
|
+
if (!anon || !(anon[cls] > 0)) { return; }
|
|
860
|
+
anon[cls] -= 1;
|
|
861
|
+
}
|
|
862
|
+
format_visual_remove(what,cls);
|
|
863
|
+
} // }}}
|
|
864
|
+
function track_forget_running(states,what) {// {{{
|
|
865
|
+
// counts were reset, so running uuids are no longer counted. ends of them
|
|
866
|
+
// consume snapshot entries instead.
|
|
867
|
+
for (const [uuid, ele] of Object.entries(states)) {
|
|
868
|
+
if (ele.state == 'running' && (what == undefined || ele.position == what)) { delete states[uuid]; }
|
|
869
|
+
}
|
|
870
|
+
} // }}}
|
|
871
|
+
|
|
823
872
|
function monitor_instance_running(content,event) {// {{{
|
|
824
|
-
let uuid = content['activity-uuid'];
|
|
825
|
-
let cur = save['activity_red_states'][uuid];
|
|
826
873
|
if (event == "calling" || event == "manipulating") {
|
|
827
|
-
|
|
828
|
-
save['activity_red_states'][uuid] = { position: content.activity, state: 'active' };
|
|
829
|
-
format_visual_add(content.activity,"active");
|
|
830
|
-
}
|
|
874
|
+
track_start(save['activity_red_states'],content['activity-uuid'],content.activity,"active");
|
|
831
875
|
} else if (event == "done") {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
876
|
+
track_end(save['activity_red_states'],content['activity-uuid'],content.activity,"active");
|
|
877
|
+
}
|
|
878
|
+
} // }}}
|
|
879
|
+
function monitor_instance_pos_mark(b) {// {{{
|
|
880
|
+
if (b.uuid) {
|
|
881
|
+
track_start(save['position_states'],b.uuid,b.position,"passive");
|
|
882
|
+
} else { // set by user, behaves like a snapshot entry
|
|
883
|
+
let anon = save['instance_pos_anon'][b.position] ??= {};
|
|
884
|
+
if (anon['passive'] > 0) { return; }
|
|
885
|
+
anon['passive'] = 1;
|
|
886
|
+
format_visual_add(b.position,"passive");
|
|
887
|
+
}
|
|
888
|
+
} // }}}
|
|
889
|
+
function monitor_instance_pos_unmark(b) {// {{{
|
|
890
|
+
if (b.uuid) {
|
|
891
|
+
track_end(save['position_states'],b.uuid,b.position,"passive");
|
|
892
|
+
} else { // set by user, clears the node
|
|
893
|
+
track_forget_running(save['position_states'],b.position);
|
|
894
|
+
if (save['instance_pos_anon'][b.position]) { save['instance_pos_anon'][b.position]['passive'] = 0; }
|
|
895
|
+
if (node_state[b.position]) { node_state[b.position]['passive'] = 0; }
|
|
896
|
+
format_visual_set(b.position);
|
|
837
897
|
}
|
|
838
898
|
} // }}}
|
|
839
899
|
function monitor_instance_pos_change(content) {// {{{
|
|
840
900
|
if (graph_position && graph_position == 'false') { return; }
|
|
901
|
+
// unmark first, a single change may unmark and mark the same node (e.g. loops)
|
|
902
|
+
if (content['unmark']) {
|
|
903
|
+
$.each(content['unmark'],function(a,b){
|
|
904
|
+
monitor_instance_pos_unmark(b);
|
|
905
|
+
});
|
|
906
|
+
}
|
|
841
907
|
if (content['at']) {
|
|
842
908
|
$.each(content['at'],function(a,b){
|
|
843
|
-
|
|
909
|
+
monitor_instance_pos_mark(b);
|
|
844
910
|
});
|
|
845
911
|
}
|
|
846
912
|
if (content['after']) {
|
|
847
913
|
$.each(content['after'],function(a,b){
|
|
848
|
-
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
if (content['unmark']) {
|
|
852
|
-
$.each(content['unmark'],function(a,b){
|
|
853
|
-
format_visual_remove(b.position,"passive",false)
|
|
914
|
+
monitor_instance_pos_mark(b);
|
|
854
915
|
});
|
|
855
916
|
}
|
|
856
917
|
if (!content['at'] && !content['unmark'] && !content['after'] && !content['wait']) {
|
|
@@ -882,6 +943,8 @@ function monitor_instance_state_change(notification) { //{{{
|
|
|
882
943
|
monitor_instance_pos();
|
|
883
944
|
}
|
|
884
945
|
if (notification == "running") {
|
|
946
|
+
track_forget_running(save['position_states']);
|
|
947
|
+
for (const [key, ele] of Object.entries(save['instance_pos_anon'])) { ele['passive'] = 0; }
|
|
885
948
|
for (const [key, ele] of Object.entries(node_state)) {
|
|
886
949
|
for (i=0; i<ele.passive; i++) {
|
|
887
950
|
format_visual_remove(key,'passive');
|
|
@@ -1050,56 +1113,9 @@ function get_testset(deferred) {// {{{
|
|
|
1050
1113
|
}// }}}
|
|
1051
1114
|
function save_svgfile() {// {{{
|
|
1052
1115
|
var url = $('body').attr('current-instance');
|
|
1116
|
+
if (!save['graph_adaptor']) { return; } // no instance loaded
|
|
1053
1117
|
|
|
1054
|
-
var gc = $('
|
|
1055
|
-
var start = parseInt(gc.attr('width'));
|
|
1056
|
-
$('#graphgrid > svg:not(#graphcanvas)').each( (i,ele) => {
|
|
1057
|
-
const gr = $X('<g transform="translate(' + start + ')" xmlns="http://www.w3.org/2000/svg"></g>');
|
|
1058
|
-
start = start + parseInt(ele.getAttribute('width'));
|
|
1059
|
-
$('g',ele).each((j,g) => {
|
|
1060
|
-
gr.append($(g).clone());
|
|
1061
|
-
});
|
|
1062
|
-
gc.append(gr);
|
|
1063
|
-
});
|
|
1064
|
-
gc.find('.selected').removeClass('selected');
|
|
1065
|
-
var varreps = {};
|
|
1066
|
-
var ffamily = '';
|
|
1067
|
-
$(window.document.styleSheets).each(function(i,x){
|
|
1068
|
-
if (x && x.href && x.ownerNode.attributes.getNamedItem('data-include-export')) {
|
|
1069
|
-
$(x.cssRules).each(function(j,y){
|
|
1070
|
-
if (y.selectorText == ":root") {
|
|
1071
|
-
$(y.style).each(function(k,z) {
|
|
1072
|
-
varreps['var\\(' + z + '\\)'] = getComputedStyle(document.documentElement).getPropertyValue(z).toString();
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
if (y.selectorText == "svg") {
|
|
1076
|
-
$(y.style).each(function(k,z) {
|
|
1077
|
-
if (z == 'font-family') {
|
|
1078
|
-
ffamily = getComputedStyle($('#graphgrid > svg')[0]).getPropertyValue(z).toString();
|
|
1079
|
-
}
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
var loc = $(gc).find(y.selectorText.replace(/svg /g,''));
|
|
1083
|
-
var cst = y.style.cssText;
|
|
1084
|
-
for (k in varreps) {
|
|
1085
|
-
cst = cst.replace(new RegExp(k,'g'),varreps[k]);
|
|
1086
|
-
}
|
|
1087
|
-
loc.each(function(k,loco) {
|
|
1088
|
-
var sty = $(loco).attr('style') == undefined ? '' : $(loco).attr('style');
|
|
1089
|
-
$(loco).attr('style',cst + sty);
|
|
1090
|
-
});
|
|
1091
|
-
});
|
|
1092
|
-
$(gc).find('text.super,g.hoverstyle,g.markstyle').each(function(k,loco){
|
|
1093
|
-
$(loco).attr('style',$(loco).attr('style') + ' display: none; ');
|
|
1094
|
-
});
|
|
1095
|
-
ffamily = ffamily.replace(/-/,' ').split(' ').map(function(word) { return word[0].toUpperCase() + word.substr(1); }).join(' ');
|
|
1096
|
-
$(gc).find('text').each(function(k,loco){
|
|
1097
|
-
$(loco).attr('style',$(loco).attr('style') + ' font-family: \'' + ffamily + '\'; ');
|
|
1098
|
-
});
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
gc.attr('width',start+1);
|
|
1102
|
-
gc.find('.duration').remove();
|
|
1118
|
+
var gc = $(save['graph_adaptor'].get_svg());
|
|
1103
1119
|
$.ajax({
|
|
1104
1120
|
type: "GET",
|
|
1105
1121
|
url: url + "/properties/attributes/info/",
|
|
@@ -1112,23 +1128,21 @@ function save_svgfile() {// {{{
|
|
|
1112
1128
|
});
|
|
1113
1129
|
} // }}}
|
|
1114
1130
|
|
|
1115
|
-
function
|
|
1131
|
+
function save_modelfile() {// {{{
|
|
1116
1132
|
var url = $('body').attr('current-instance');
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
let
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
},
|
|
1131
|
-
error: report_failure
|
|
1133
|
+
if (!save['graph_adaptor']) { return; } // no instance loaded
|
|
1134
|
+
|
|
1135
|
+
let extensions = { 'Signavio': 'bpmn', 'ChatGPT_Mermaid': 'mmd', 'ChatGPT_Graphviz': 'dot' };
|
|
1136
|
+
Promise.all([
|
|
1137
|
+
save['description'] !== undefined ? save['description'] : $.ajax({ type: "GET", url: url + "/properties/description/", dataType: 'text' }), // from the events, persist.rb might not have stored it yet
|
|
1138
|
+
$.ajax({ type: "GET", url: url + "/properties/attributes/info/" }),
|
|
1139
|
+
$.ajax({ type: "GET", url: url + "/properties/attributes/modeltype/" }).catch(() => 'CPEE') // instances without modeltype
|
|
1140
|
+
]).then(function([desc,info,modeltype]){
|
|
1141
|
+
$('#savemodelfile').attr('download',info + '.' + (extensions[modeltype] || 'xml'));
|
|
1142
|
+
$('#savemodelfile').attr('href','data:application/xml;charset=utf-8;base64,' + $B64(desc));
|
|
1143
|
+
document.getElementById('savemodelfile').click();
|
|
1144
|
+
},function(xhr){
|
|
1145
|
+
append_to_log("failure", 'GET ' + url + '/properties/description/', xhr.status + ' ' + xhr.statusText);
|
|
1132
1146
|
});
|
|
1133
1147
|
}// }}}
|
|
1134
1148
|
async function set_testset(testset,exec) {// {{{
|
|
@@ -1140,8 +1154,10 @@ async function set_testset(testset,exec) {// {{{
|
|
|
1140
1154
|
// load old testsets. remove 12/2026
|
|
1141
1155
|
$("testset > description manipulate",testset).each((_,t) => {
|
|
1142
1156
|
if ($('code',t).length == 0) {
|
|
1143
|
-
|
|
1144
|
-
$(t).
|
|
1157
|
+
// only direct text nodes, children (if any) stay untouched
|
|
1158
|
+
let txt = $(t).contents().filter((_,n) => n.nodeType == Node.TEXT_NODE);
|
|
1159
|
+
let st = txt.text();
|
|
1160
|
+
txt.remove();
|
|
1145
1161
|
let c = $X('<code xmlns="http://cpee.org/ns/description/1.0"/>');
|
|
1146
1162
|
c.text(st);
|
|
1147
1163
|
$(t).append(c);
|
|
@@ -1267,6 +1283,7 @@ function load_testset(exec) {// {{{
|
|
|
1267
1283
|
url: url,
|
|
1268
1284
|
success: function(res){
|
|
1269
1285
|
save['dsl'] = null; // reload dsl and position under all circumstances
|
|
1286
|
+
details_leave(false);
|
|
1270
1287
|
$('#dat_details').empty();
|
|
1271
1288
|
|
|
1272
1289
|
document.title = "Untitled";
|
|
@@ -1278,32 +1295,6 @@ function load_testset(exec) {// {{{
|
|
|
1278
1295
|
});
|
|
1279
1296
|
}
|
|
1280
1297
|
}// }}}
|
|
1281
|
-
function load_modeltype() {// {{{
|
|
1282
|
-
if (loading) return;
|
|
1283
|
-
var url = $('body').attr('current-instance');
|
|
1284
|
-
loading = true;
|
|
1285
|
-
|
|
1286
|
-
var name = $("#modeltypes div.menuitem[data-selected=selected]").text();
|
|
1287
|
-
$.ajax({
|
|
1288
|
-
cache: false,
|
|
1289
|
-
dataType: 'xml',
|
|
1290
|
-
url: name + ".xml",
|
|
1291
|
-
success: function(res){
|
|
1292
|
-
$.ajax({
|
|
1293
|
-
type: "PUT",
|
|
1294
|
-
url: url + "/properties/attributes/modeltype/",
|
|
1295
|
-
data: ({value: name}),
|
|
1296
|
-
success: function(){
|
|
1297
|
-
set_testset(res,false);
|
|
1298
|
-
},
|
|
1299
|
-
error: report_failure
|
|
1300
|
-
});
|
|
1301
|
-
},
|
|
1302
|
-
complete: function() {
|
|
1303
|
-
loading = false;
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
}// }}}
|
|
1307
1298
|
|
|
1308
1299
|
async function load_des(url,model) { //{{{
|
|
1309
1300
|
return $.ajax({
|
|
@@ -1510,13 +1501,27 @@ function format_visual_vote_clear() {//{{{
|
|
|
1510
1501
|
$("#votes").empty();
|
|
1511
1502
|
}//}}}
|
|
1512
1503
|
|
|
1513
|
-
function
|
|
1504
|
+
function format_instance_pos_load() { //{{{
|
|
1505
|
+
// counts were just cleared, they are rebuilt from the snapshot
|
|
1506
|
+
save['instance_pos_anon'] = {};
|
|
1507
|
+
track_forget_running(save['activity_red_states']);
|
|
1508
|
+
track_forget_running(save['position_states']);
|
|
1514
1509
|
$(save['instance_pos']).each(function(){
|
|
1515
1510
|
var taskname = this.nodeName;
|
|
1516
1511
|
var taskstate = this.textContent;
|
|
1517
|
-
|
|
1512
|
+
var anon = save['instance_pos_anon'][taskname] ??= {};
|
|
1513
|
+
var clss = ['passive']; // like position events, at and after are passive
|
|
1514
|
+
if (save['state'] == 'running' && taskstate == 'at') { clss.push('active'); }
|
|
1515
|
+
clss.forEach((cls) => {
|
|
1516
|
+
anon[cls] = (anon[cls] ?? 0) + 1;
|
|
1517
|
+
format_visual_add(taskname,cls);
|
|
1518
|
+
});
|
|
1518
1519
|
});
|
|
1519
1520
|
} //}}}
|
|
1521
|
+
function format_instance_pos() { //{{{
|
|
1522
|
+
// graph was redrawn, so only render the current state again
|
|
1523
|
+
Object.keys(node_state).forEach((what) => { format_visual_set(what); });
|
|
1524
|
+
} //}}}
|
|
1520
1525
|
|
|
1521
1526
|
function format_visual_forms() { //{{{
|
|
1522
1527
|
if (save['state'] != "ready" && save['state'] != "stopped") {
|
|
@@ -1600,7 +1605,7 @@ function append_to_log(what,type,message) {//{{{
|
|
|
1600
1605
|
message = message.replace(/>/g, '>');
|
|
1601
1606
|
message = message.replace(/"/g, '"');
|
|
1602
1607
|
message = message.replace(/'/g, ''');
|
|
1603
|
-
if (type == 'description/change') {
|
|
1608
|
+
if (type == 'description/change' || type == 'description/sync') {
|
|
1604
1609
|
$("#dat_log").prepend("<tr><td class='fixed'><a title=\"" + d.strftime("[%d/%b/%Y %H:%M:%S]") + "\">D</a></td><td class='fixed'> - </td><td class='fixed'><a title=\"" + what + "\">T</a></td><td class='fixed'> - </td><td class='fixed'>" + type + "</td><td class='fixed'> - </td><td class='long'>... check in persistent log ...</td></tr>");
|
|
1605
1610
|
} else {
|
|
1606
1611
|
$("#dat_log").prepend("<tr><td class='fixed'><a title=\"" + d.strftime("[%d/%b/%Y %H:%M:%S]") + "\">D</a></td><td class='fixed'> - </td><td class='fixed'><a title=\"" + what + "\">T</a></td><td class='fixed'> - </td><td class='fixed'>" + type + "</td><td class='fixed'> - </td><td class='long'>" + message + "</td></tr>");
|
|
@@ -1651,4 +1656,12 @@ function add_ui_pos(e) { //{{{
|
|
|
1651
1656
|
});
|
|
1652
1657
|
} //}}}
|
|
1653
1658
|
|
|
1654
|
-
function report_failure(){
|
|
1659
|
+
function report_failure(xhr,status,error){ //{{{
|
|
1660
|
+
// used as ajax error callback, this is the request
|
|
1661
|
+
append_to_log("failure", this.type + ' ' + this.url, xhr.status + ' ' + (error || status));
|
|
1662
|
+
} //}}}
|
|
1663
|
+
function report_model_failure(xhr,status,error){ //{{{
|
|
1664
|
+
// if the server sends a real error, dont reload, we handle in sse, only if
|
|
1665
|
+
// the server is down or we fail on riddl facade, reload
|
|
1666
|
+
if (xhr.status == 0 || xhr.status >= 500) { monitor_graph_change(true); }
|
|
1667
|
+
} //}}}
|