cpee 2.1.140 → 2.1.141
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/cockpit/css/compliance.css +26 -0
- data/cockpit/js/compliance.js +182 -27
- data/cockpit/js/instance.js +47 -16
- data/cockpit/js/llm.js +153 -81
- data/cockpit/templates/Coopis 2010.xml +10 -2
- data/cockpit/themes/presetlr/theme.js +2 -0
- data/cpee.gemspec +1 -1
- data/lib/cpee/implementation_properties.rb +36 -18
- data/lib/cpee/message.rb +3 -1
- data/lib/properties/set-properties.rng +4 -0
- data/lib/properties/set-some-properties.rng +4 -0
- data/lib/properties/set-testset.rng +4 -0
- data/lib/properties/transformation.rng +43 -34
- data/server/executionhandlers/ruby/controller.rb +12 -8
- data/server/resources/notifications/logging/subscription.xml +5 -0
- data/server/routing/end.pid +1 -1
- data/server/routing/forward-events-00.pid +1 -1
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/persist.pid +1 -1
- data/server/routing/persist.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f547523f74f142284b29919bbbcbaaddab033c3215243101bcbd3a768781176
|
|
4
|
+
data.tar.gz: bfb7a0ecb73438751b05c1b6f9b0d1d6269270e305530eb33d9b4af076b49fc0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 938f0bbef822a1ba53cc8579d4ca9be6599cc9a0ce05681e20072d5ec537eb39d2d367d38e72ebe0e32383dad8fd95e2de3da20aac4b6de2e08bbd8448deb5c6
|
|
7
|
+
data.tar.gz: 447f21ba8503fd112891eacb2f282b8a840897efcb166360132ec9b62750ecd553aaed0da51c69cd10b1c16022171b4940c4217457f776ffe6099f921ebadefb
|
data/cockpit/css/compliance.css
CHANGED
|
@@ -45,6 +45,32 @@
|
|
|
45
45
|
overflow-y: scroll;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
#dat_requirements .astreq-save {
|
|
49
|
+
margin-right: 0.5em;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#dat_requirements input.astreq-key {
|
|
53
|
+
width: 2.8em;
|
|
54
|
+
min-width: 2.8em;
|
|
55
|
+
max-width: 3.4em;
|
|
56
|
+
color: #555;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#dat_requirements input.astreq-key[readonly] {
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
border: 0 none;
|
|
62
|
+
box-shadow: none;
|
|
63
|
+
color: #555;
|
|
64
|
+
padding-left: 0;
|
|
65
|
+
padding-right: 0;
|
|
66
|
+
caret-color: transparent;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#dat_requirements input.astreq-value {
|
|
70
|
+
margin-left: 0.25em;
|
|
71
|
+
width: calc(100% - 8.5em);
|
|
72
|
+
}
|
|
73
|
+
|
|
48
74
|
#dat_nlrequirements {
|
|
49
75
|
border-collapse: collapse;
|
|
50
76
|
border-spacing: 0;
|
data/cockpit/js/compliance.js
CHANGED
|
@@ -12,6 +12,7 @@ $(document).ready(function() { //{{{
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
initialize_nl_requirements_tab();
|
|
15
|
+
initialize_ast_requirements_tab();
|
|
15
16
|
|
|
16
17
|
function loadComplianceLog(uuid, options) {
|
|
17
18
|
var renderOptions = options || {};
|
|
@@ -155,7 +156,7 @@ $(document).ready(function() { //{{{
|
|
|
155
156
|
|
|
156
157
|
function extractDescriptionXmlFromTestset(testsetXml) {
|
|
157
158
|
var xmlDoc = $.parseXML(testsetXml);
|
|
158
|
-
var descriptionContainer = xmlDoc.getElementsByTagName('description')[0];
|
|
159
|
+
var descriptionContainer = xmlDoc.getElementsByTagName('dslx')[0] || xmlDoc.getElementsByTagName('description')[0];
|
|
159
160
|
|
|
160
161
|
if (!descriptionContainer) {
|
|
161
162
|
return null;
|
|
@@ -449,6 +450,7 @@ $(document).ready(function() { //{{{
|
|
|
449
450
|
req.append(ele);
|
|
450
451
|
}
|
|
451
452
|
save['requirements'].content(req);
|
|
453
|
+
ensure_ast_inline_save_buttons(reqj);
|
|
452
454
|
sync_nl_rows_to_requirement_keys(reqj);
|
|
453
455
|
|
|
454
456
|
let nlReqj = parse_saved_object(save.attributes_raw['NL-requirements']);
|
|
@@ -456,27 +458,36 @@ $(document).ready(function() { //{{{
|
|
|
456
458
|
apply_nl_requirements_values(nlReqj);
|
|
457
459
|
});
|
|
458
460
|
|
|
459
|
-
var timer;
|
|
460
|
-
// when input in one of the inputs, save
|
|
461
|
-
$(document).on('input','#dat_requirements input',function(event){
|
|
462
|
-
clearTimeout(timer);
|
|
463
|
-
timer = setTimeout(function(){ do_requirements_save(event); }, 5000);
|
|
464
|
-
});
|
|
465
461
|
$(document).on('relaxngui_remove', '#dat_requirements', function(event){
|
|
466
|
-
clearTimeout(timer);
|
|
467
462
|
sync_nl_rows_to_requirement_keys(read_requirements_object(), true);
|
|
468
463
|
do_nl_requirements_save(event);
|
|
469
464
|
do_requirements_save(event);
|
|
470
465
|
});
|
|
471
466
|
$(document).on('relaxngui_move', '#dat_requirements', function(event){
|
|
472
|
-
clearTimeout(timer);
|
|
473
467
|
do_requirements_save(event);
|
|
474
468
|
});
|
|
475
469
|
$(document).on('relaxngui_change', '#dat_requirements', function(event){
|
|
476
|
-
clearTimeout(timer);
|
|
477
470
|
do_requirements_save(event);
|
|
478
471
|
});
|
|
479
472
|
|
|
473
|
+
var astButtonsTimer;
|
|
474
|
+
function schedule_ast_buttons_sync() {
|
|
475
|
+
clearTimeout(astButtonsTimer);
|
|
476
|
+
astButtonsTimer = setTimeout(function() {
|
|
477
|
+
ensure_ast_inline_save_buttons(read_requirements_object());
|
|
478
|
+
}, 250);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Requirements RNG is generic anyName/value, so keys can be renamed live.
|
|
482
|
+
// Keep the per-requirement action list aligned with current editor content.
|
|
483
|
+
$(document).on(
|
|
484
|
+
'input change keyup blur paste',
|
|
485
|
+
'#dat_requirements input, #dat_requirements textarea, #dat_requirements select, #dat_requirements [contenteditable=true]',
|
|
486
|
+
function() {
|
|
487
|
+
schedule_ast_buttons_sync();
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
|
|
480
491
|
var nlTimer;
|
|
481
492
|
$(document).on('input', '#dat_nlrequirements .nlreq-text', function(event){
|
|
482
493
|
clearTimeout(nlTimer);
|
|
@@ -486,6 +497,7 @@ $(document).ready(function() { //{{{
|
|
|
486
497
|
|
|
487
498
|
function initialize_nl_requirements_tab() { //{{{
|
|
488
499
|
$('#nlreq_add').on('click', function() {
|
|
500
|
+
sync_nl_rows_to_requirement_keys(read_requirements_object(), true);
|
|
489
501
|
add_nl_requirement_row();
|
|
490
502
|
do_nl_requirements_save();
|
|
491
503
|
});
|
|
@@ -495,6 +507,109 @@ function initialize_nl_requirements_tab() { //{{{
|
|
|
495
507
|
}
|
|
496
508
|
} //}}}
|
|
497
509
|
|
|
510
|
+
function initialize_ast_requirements_tab() { //{{{
|
|
511
|
+
$(document).on('click', '#dat_requirements .astreq-save', function() {
|
|
512
|
+
persist_ast_requirements_inline($(this));
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
ensure_ast_inline_save_buttons(read_requirements_object());
|
|
516
|
+
} //}}}
|
|
517
|
+
|
|
518
|
+
function ensure_ast_inline_save_buttons(requirementsObject) { //{{{
|
|
519
|
+
if ($('#dat_requirements').length === 0) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
$('#dat_requirements input.relaxngui_cell').removeClass('astreq-key astreq-value');
|
|
524
|
+
|
|
525
|
+
var reqObject = requirementsObject && typeof requirementsObject === 'object'
|
|
526
|
+
? requirementsObject
|
|
527
|
+
: read_requirements_object();
|
|
528
|
+
|
|
529
|
+
Object.keys(reqObject)
|
|
530
|
+
.sort(sort_requirement_ids)
|
|
531
|
+
.forEach(function(key) {
|
|
532
|
+
var keyInput = $('#dat_requirements input.relaxngui_cell').filter(function() {
|
|
533
|
+
return ($(this).val() || '').trim() === key;
|
|
534
|
+
}).first();
|
|
535
|
+
|
|
536
|
+
if (keyInput.length === 0) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (keyInput.prev('.astreq-save').length === 0) {
|
|
541
|
+
$('<button type="button" class="astreq-save" title="Save requirements into attributes">Save</button>')
|
|
542
|
+
.attr('data-requirement-id', key)
|
|
543
|
+
.insertBefore(keyInput);
|
|
544
|
+
} else {
|
|
545
|
+
keyInput.prev('.astreq-save').attr('data-requirement-id', key);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
keyInput.addClass('astreq-key');
|
|
549
|
+
if ((keyInput.val() || '').trim() !== '') {
|
|
550
|
+
keyInput.prop('readonly', true);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
var valueInput = keyInput.parent().find('input.relaxngui_cell').not(keyInput).first();
|
|
554
|
+
if (valueInput.length > 0) {
|
|
555
|
+
valueInput.addClass('astreq-value');
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
apply_ast_field_roles();
|
|
560
|
+
|
|
561
|
+
$('#dat_requirements .astreq-save').each(function() {
|
|
562
|
+
var btn = $(this);
|
|
563
|
+
var nextInput = btn.next('input.relaxngui_cell');
|
|
564
|
+
if (nextInput.length === 0) {
|
|
565
|
+
btn.remove();
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
} //}}}
|
|
569
|
+
|
|
570
|
+
function apply_ast_field_roles() { //{{{
|
|
571
|
+
$('#dat_requirements .astreq-key').prop('readonly', false).removeAttr('tabindex').css('pointer-events', '');
|
|
572
|
+
$('#dat_requirements .astreq-value').removeClass('astreq-value');
|
|
573
|
+
|
|
574
|
+
$('#dat_requirements').find('div').each(function() {
|
|
575
|
+
var cells = $(this).children('input.relaxngui_cell');
|
|
576
|
+
if (cells.length < 2) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
var keyCell = cells.first();
|
|
581
|
+
var valueCell = cells.last();
|
|
582
|
+
|
|
583
|
+
keyCell.addClass('astreq-key');
|
|
584
|
+
valueCell.addClass('astreq-value');
|
|
585
|
+
|
|
586
|
+
if ((keyCell.val() || '').trim() !== '') {
|
|
587
|
+
keyCell.prop('readonly', true);
|
|
588
|
+
keyCell.attr('tabindex', '-1');
|
|
589
|
+
keyCell.css('pointer-events', 'none');
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
} //}}}
|
|
593
|
+
|
|
594
|
+
function persist_ast_requirements_inline(button) { //{{{
|
|
595
|
+
if (!button || button.length === 0) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
var originalText = button.text();
|
|
600
|
+
button.text('Saving...');
|
|
601
|
+
button.prop('disabled', true);
|
|
602
|
+
|
|
603
|
+
var reqj = current_requirements_json_string();
|
|
604
|
+
do_requirements_save({ target: $('#dat_requirements')[0] }, reqj);
|
|
605
|
+
|
|
606
|
+
button.text('Saved');
|
|
607
|
+
button.prop('disabled', false);
|
|
608
|
+
setTimeout(function() {
|
|
609
|
+
button.text(originalText);
|
|
610
|
+
}, 900);
|
|
611
|
+
} //}}}
|
|
612
|
+
|
|
498
613
|
function initialize_nl_requirements_from_saved_requirements() { //{{{
|
|
499
614
|
if (!save['requirements']) {
|
|
500
615
|
return;
|
|
@@ -580,24 +695,21 @@ function sync_nl_rows_to_requirement_keys(requirementsObject, pruneMissing) { //
|
|
|
580
695
|
} //}}}
|
|
581
696
|
|
|
582
697
|
function next_requirement_id() { //{{{
|
|
583
|
-
var maxId = 0;
|
|
584
|
-
$('#dat_nlrequirements .nlreq-row').each(function() {
|
|
585
|
-
var rid = $(this).attr('data-requirement-id') || '';
|
|
586
|
-
var m = rid.match(/^R(\d+)$/);
|
|
587
|
-
if (m) {
|
|
588
|
-
maxId = Math.max(maxId, parseInt(m[1], 10));
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
|
|
592
698
|
var currentReqs = read_requirements_object();
|
|
699
|
+
var used = {};
|
|
593
700
|
Object.keys(currentReqs).forEach(function(key) {
|
|
594
701
|
var m = key.match(/^R(\d+)$/);
|
|
595
702
|
if (m) {
|
|
596
|
-
|
|
703
|
+
used[parseInt(m[1], 10)] = true;
|
|
597
704
|
}
|
|
598
705
|
});
|
|
599
706
|
|
|
600
|
-
|
|
707
|
+
var candidate = 1;
|
|
708
|
+
while (used[candidate]) {
|
|
709
|
+
candidate += 1;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return 'R' + candidate;
|
|
601
713
|
} //}}}
|
|
602
714
|
|
|
603
715
|
function upsert_requirement_ast(requirementId, astText) { //{{{
|
|
@@ -606,6 +718,26 @@ function upsert_requirement_ast(requirementId, astText) { //{{{
|
|
|
606
718
|
write_requirements_object(reqObject);
|
|
607
719
|
} //}}}
|
|
608
720
|
|
|
721
|
+
function stringify_requirements_object(reqObject) { //{{{
|
|
722
|
+
var ordered = {};
|
|
723
|
+
Object.keys(reqObject || {})
|
|
724
|
+
.sort(sort_requirement_ids)
|
|
725
|
+
.forEach(function(key) {
|
|
726
|
+
ordered[key] = reqObject[key];
|
|
727
|
+
});
|
|
728
|
+
return JSON.stringify(ordered);
|
|
729
|
+
} //}}}
|
|
730
|
+
|
|
731
|
+
function current_requirements_json_string() { //{{{
|
|
732
|
+
if (!save['requirements']) {
|
|
733
|
+
return '{}';
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
var raw = save['requirements'].save_json();
|
|
737
|
+
var parsed = parse_saved_object(raw);
|
|
738
|
+
return stringify_requirements_object(parsed);
|
|
739
|
+
} //}}}
|
|
740
|
+
|
|
609
741
|
function read_requirements_object() { //{{{
|
|
610
742
|
if (!save['requirements']) {
|
|
611
743
|
return {};
|
|
@@ -684,8 +816,11 @@ function write_requirements_object(reqObject) { //{{{
|
|
|
684
816
|
ele.text(reqObject[key]);
|
|
685
817
|
req.append(ele);
|
|
686
818
|
});
|
|
819
|
+
var reqj = stringify_requirements_object(reqObject);
|
|
820
|
+
save['attributes_raw'].requirements = reqj;
|
|
687
821
|
save['requirements'].content(req);
|
|
688
|
-
|
|
822
|
+
ensure_ast_inline_save_buttons(reqObject);
|
|
823
|
+
do_requirements_save({ target: $('#dat_requirements')[0] }, reqj);
|
|
689
824
|
} //}}}
|
|
690
825
|
|
|
691
826
|
function sort_requirement_ids(a, b) { //{{{
|
|
@@ -991,11 +1126,24 @@ function getCurrentProcessXml() { //{{{
|
|
|
991
1126
|
return null;
|
|
992
1127
|
} //}}}
|
|
993
1128
|
|
|
994
|
-
function do_requirements_save(event) { //{{{
|
|
995
|
-
if (save['requirements']
|
|
1129
|
+
function do_requirements_save(event, forcedRequirementsJson) { //{{{
|
|
1130
|
+
if (!save['attributes'] || !save['requirements']) {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
var requirementsChanged = save['requirements'].has_changed();
|
|
1135
|
+
var hasForced = typeof forcedRequirementsJson === 'string';
|
|
1136
|
+
if (!requirementsChanged && !hasForced) {
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
if (requirementsChanged) {
|
|
996
1141
|
save['requirements'].set_checkpoint();
|
|
997
|
-
|
|
998
|
-
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
let reqj = hasForced ? forcedRequirementsJson : current_requirements_json_string();
|
|
1145
|
+
ensure_ast_inline_save_buttons(parse_saved_object(reqj));
|
|
1146
|
+
{
|
|
999
1147
|
let att = save['attributes'].save();
|
|
1000
1148
|
let attributesNode = $(' > attributes', att);
|
|
1001
1149
|
if (attributesNode.length === 0) {
|
|
@@ -1007,6 +1155,8 @@ function do_requirements_save(event) { //{{{
|
|
|
1007
1155
|
attributesNode.append(requirementsNode);
|
|
1008
1156
|
}
|
|
1009
1157
|
requirementsNode.text(reqj);
|
|
1158
|
+
save['attributes_raw'].requirements = reqj;
|
|
1159
|
+
save['attributes'].content(att);
|
|
1010
1160
|
do_parameters_save_part('attributes',$(att).serializePrettyXML());
|
|
1011
1161
|
}
|
|
1012
1162
|
} //}}}
|
|
@@ -1035,15 +1185,20 @@ function do_nl_requirements_save(event) { //{{{
|
|
|
1035
1185
|
}
|
|
1036
1186
|
|
|
1037
1187
|
if (save['requirements']) {
|
|
1038
|
-
let reqj = save['requirements'].
|
|
1188
|
+
let reqj = (typeof save['attributes_raw'].requirements === 'string' && save['attributes_raw'].requirements.trim() !== '')
|
|
1189
|
+
? save['attributes_raw'].requirements
|
|
1190
|
+
: current_requirements_json_string();
|
|
1039
1191
|
let requirementsNode = attributesNode.children('requirements');
|
|
1040
1192
|
if (requirementsNode.length === 0) {
|
|
1041
1193
|
requirementsNode = $X("<requirements xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
1042
1194
|
attributesNode.append(requirementsNode);
|
|
1043
1195
|
}
|
|
1044
1196
|
requirementsNode.text(reqj);
|
|
1197
|
+
save['attributes_raw'].requirements = reqj;
|
|
1045
1198
|
}
|
|
1046
1199
|
|
|
1047
1200
|
nlReqNode.text(nlReqj);
|
|
1201
|
+
save['attributes_raw']['NL-requirements'] = nlReqj;
|
|
1202
|
+
save['attributes'].content(att);
|
|
1048
1203
|
do_parameters_save_part('attributes',$(att).serializePrettyXML());
|
|
1049
1204
|
} //}}}
|
data/cockpit/js/instance.js
CHANGED
|
@@ -41,6 +41,7 @@ function global_init() {
|
|
|
41
41
|
save['dsl'] = undefined;
|
|
42
42
|
save['change_uuid'] = undefined; // of the last description/change
|
|
43
43
|
save['description'] = undefined; // description that belongs to change_uuid, undefined means get it from the server
|
|
44
|
+
save['transformation'] = undefined; // types of description, dataelements, endpoints, dslx transformation
|
|
44
45
|
save['activity_red_states'] = {}
|
|
45
46
|
save['graph'] = undefined;
|
|
46
47
|
save['graph_theme'] = undefined;
|
|
@@ -396,26 +397,35 @@ async function sse() { //{{{
|
|
|
396
397
|
if (data['name'] == 'sync') {
|
|
397
398
|
if (data.content.change_uuid == save['change_uuid']) {
|
|
398
399
|
save['description'] = data.content.description;
|
|
399
|
-
|
|
400
|
+
savemodel_enable(true);
|
|
400
401
|
}
|
|
401
402
|
break;
|
|
402
403
|
}
|
|
403
404
|
if (data['name'] == 'change') {
|
|
404
405
|
save['change_uuid'] = data.content.change_uuid;
|
|
405
406
|
save['description'] = data.content.change_pending ? undefined : data.content.description;
|
|
406
|
-
|
|
407
|
+
savemodel_enable(data.content.change_pending != true);
|
|
407
408
|
} else if (data['name'] == 'error' && data.content.change_uuid && data.content.change_uuid == save['change_uuid']) {
|
|
408
|
-
|
|
409
|
+
savemodel_enable(true);
|
|
409
410
|
}
|
|
410
411
|
monitor_instance_dsl();
|
|
411
412
|
monitor_graph_change(false);
|
|
412
413
|
document.dispatchEvent(graph_changed);
|
|
413
414
|
break;
|
|
414
415
|
case 'transformation':
|
|
416
|
+
model_buttons_update({
|
|
417
|
+
description: data.content.description_type,
|
|
418
|
+
dataelements: data.content.dataelements_type,
|
|
419
|
+
endpoints: data.content.endpoints_type,
|
|
420
|
+
dslx: data.content.dslx_type,
|
|
421
|
+
extension: data.content.dslx_extension
|
|
422
|
+
});
|
|
415
423
|
if (data.content.change_pending) { // the description for the new model type follows with description/sync
|
|
416
424
|
save['change_uuid'] = data.content.change_uuid;
|
|
417
425
|
save['description'] = undefined;
|
|
418
|
-
|
|
426
|
+
savemodel_enable(false);
|
|
427
|
+
} else {
|
|
428
|
+
savemodel_enable(true);
|
|
419
429
|
}
|
|
420
430
|
break;
|
|
421
431
|
case 'endpoints':
|
|
@@ -534,6 +544,8 @@ function monitor_instance(cin,rep,load,exec) {// {{{
|
|
|
534
544
|
// Change url to return to current instance when reloading (because new subscription is made)
|
|
535
545
|
$("input[name=votecontinue]").prop( "checked", false );
|
|
536
546
|
|
|
547
|
+
monitor_instance_transformation(url);
|
|
548
|
+
|
|
537
549
|
subscribe(url,false,function(){
|
|
538
550
|
if (load || exec) {
|
|
539
551
|
load_testset(exec);
|
|
@@ -547,6 +559,30 @@ function monitor_instance(cin,rep,load,exec) {// {{{
|
|
|
547
559
|
});
|
|
548
560
|
}// }}}
|
|
549
561
|
|
|
562
|
+
function monitor_instance_transformation(url) {// {{{
|
|
563
|
+
$.ajax({
|
|
564
|
+
type: "GET",
|
|
565
|
+
url: url + "properties/transformation/",
|
|
566
|
+
success: function(res){
|
|
567
|
+
let trans = {};
|
|
568
|
+
['description','dataelements','endpoints','dslx'].forEach(t => {
|
|
569
|
+
trans[t] = $('transformation > ' + t,res).attr('type') || 'none';
|
|
570
|
+
});
|
|
571
|
+
trans.extension = $('transformation > dslx',res).attr('extension') || 'txt';
|
|
572
|
+
model_buttons_update(trans);
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
}// }}}
|
|
576
|
+
function model_buttons_update(trans) {// {{{
|
|
577
|
+
// load model needs a transformation into the instance, save model one out of it
|
|
578
|
+
save['transformation'] = trans;
|
|
579
|
+
$("button[name=loadmodelfile]").prop('disabled',['description','dataelements','endpoints'].every(t => trans[t] == 'none'));
|
|
580
|
+
if (trans.dslx == 'none') { $("button[name=savemodelfile]").prop('disabled',true); }
|
|
581
|
+
}// }}}
|
|
582
|
+
function savemodel_enable(enabled) {// {{{
|
|
583
|
+
$("button[name=savemodelfile]").prop('disabled',!enabled || (save['transformation'] !== undefined && save['transformation'].dslx == 'none'));
|
|
584
|
+
}// }}}
|
|
585
|
+
|
|
550
586
|
function monitor_instance_values(type,vals,first=false) {// {{{
|
|
551
587
|
if (type == "dataelements" && save['state'] == "running") {
|
|
552
588
|
let de = save[type].save();
|
|
@@ -1064,13 +1100,8 @@ function get_testset(deferred) {// {{{
|
|
|
1064
1100
|
$('testset > status',testset).remove();
|
|
1065
1101
|
$('testset > positions',testset).remove();
|
|
1066
1102
|
$('testset > dsl',testset).remove();
|
|
1067
|
-
$('testset > description
|
|
1068
|
-
$('testset > description',testset).append($('testset > dslx',testset).children());
|
|
1069
|
-
$('testset > transformation',testset).remove();
|
|
1070
|
-
$('testset > dsl',testset).remove();
|
|
1071
|
-
$('testset > dslx',testset).remove();
|
|
1103
|
+
$('testset > description',testset).remove();
|
|
1072
1104
|
$('testset > attributes > uuid',testset).remove();
|
|
1073
|
-
testset.append($X('<transformation xmlns="http://cpee.org/ns/properties/2.0"><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>'));
|
|
1074
1105
|
var name = $('testset > attributes > info',testset).text();
|
|
1075
1106
|
$('[xmlns]',testset).each((idx,ele) => {
|
|
1076
1107
|
if (ele.parentNode.namespaceURI == ele.getAttribute('xmlns')) {
|
|
@@ -1132,13 +1163,12 @@ function save_modelfile() {// {{{
|
|
|
1132
1163
|
var url = $('body').attr('current-instance');
|
|
1133
1164
|
if (!save['graph_adaptor']) { return; } // no instance loaded
|
|
1134
1165
|
|
|
1135
|
-
let
|
|
1166
|
+
let extension = (save['transformation'] && save['transformation'].extension) || 'txt';
|
|
1136
1167
|
Promise.all([
|
|
1137
1168
|
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
|
-
|
|
1140
|
-
|
|
1141
|
-
$('#savemodelfile').attr('download',info + '.' + (extensions[modeltype] || 'xml'));
|
|
1169
|
+
$.ajax({ type: "GET", url: url + "/properties/attributes/info/" })
|
|
1170
|
+
]).then(function([desc,info]){
|
|
1171
|
+
$('#savemodelfile').attr('download',info + '.' + extension);
|
|
1142
1172
|
$('#savemodelfile').attr('href','data:application/xml;charset=utf-8;base64,' + $B64(desc));
|
|
1143
1173
|
document.getElementById('savemodelfile').click();
|
|
1144
1174
|
},function(xhr){
|
|
@@ -1152,7 +1182,7 @@ async function set_testset(testset,exec) {// {{{
|
|
|
1152
1182
|
var tset = $X('<properties xmlns="http://cpee.org/ns/properties/2.0"/>');
|
|
1153
1183
|
|
|
1154
1184
|
// load old testsets. remove 12/2026
|
|
1155
|
-
$("testset > description manipulate",testset).each((_,t) => {
|
|
1185
|
+
$("testset > description manipulate, testset > dslx manipulate",testset).each((_,t) => {
|
|
1156
1186
|
if ($('code',t).length == 0) {
|
|
1157
1187
|
// only direct text nodes, children (if any) stay untouched
|
|
1158
1188
|
let txt = $(t).contents().filter((_,n) => n.nodeType == Node.TEXT_NODE);
|
|
@@ -1171,6 +1201,7 @@ async function set_testset(testset,exec) {// {{{
|
|
|
1171
1201
|
tset.append($("testset > endpoints",testset));
|
|
1172
1202
|
tset.append($("testset > attributes",testset));
|
|
1173
1203
|
tset.append($("testset > description",testset));
|
|
1204
|
+
tset.append($("testset > dslx",testset));
|
|
1174
1205
|
tset.append($("testset > transformation",testset));
|
|
1175
1206
|
if (skip_location) {
|
|
1176
1207
|
$('properties > attributes > info',tset).remove();
|