cpee 2.1.140 → 2.1.143
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/compliance-view.html +2 -5
- data/cockpit/compliance.html +2 -5
- data/cockpit/conformance.html +299 -0
- data/cockpit/css/compliance.css +7 -42
- data/cockpit/css/ui.css +7 -5
- data/cockpit/edit.html +1 -4
- data/cockpit/graph.html +1 -4
- data/cockpit/index.html +1 -4
- data/cockpit/js/compliance.js +102 -258
- data/cockpit/js/extended_columns.js +1 -1
- data/cockpit/js/instance.js +50 -19
- data/cockpit/js/llm.js +153 -81
- data/cockpit/js/mp-conformance.js +84 -0
- data/cockpit/js/parameters.js +3 -1
- data/cockpit/js/ui.js +2 -2
- data/cockpit/js/wfadaptor.js +41 -30
- data/cockpit/llm.html +1 -4
- data/cockpit/llmmodel.html +1 -4
- data/cockpit/model.html +1 -4
- data/cockpit/only_llm.html +1 -4
- data/cockpit/rngs/aggregations.rng +15 -0
- data/cockpit/rngs/intervals.rng +12 -0
- data/cockpit/rngs/nlrequirements.rng +8 -0
- data/cockpit/rngs/requirements.rng +2 -2
- data/cockpit/rngs/rules.rng +30 -0
- data/cockpit/templates/Coopis 2010.xml +10 -2
- data/cockpit/themes/base.js +5 -4
- data/cockpit/themes/presetlr/theme.js +2 -0
- data/cockpit/track.html +1 -4
- data/cpee.gemspec +1 -1
- data/lib/cpee/implementation_callbacks.rb +4 -2
- data/lib/cpee/implementation_notifications.rb +2 -2
- 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 +16 -9
- 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 +7 -1
data/cockpit/js/compliance.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var latestComplianceResult = null;
|
|
2
|
+
var requirements_state = { requirements: null, nl: null };
|
|
2
3
|
|
|
3
4
|
$(document).ready(function() { //{{{
|
|
4
5
|
$.ajax({
|
|
@@ -7,11 +8,18 @@ $(document).ready(function() { //{{{
|
|
|
7
8
|
dataType: "xml",
|
|
8
9
|
success: function(rng){
|
|
9
10
|
save['requirements'] = new RelaxNGui(rng,$('#dat_requirements'));
|
|
10
|
-
|
|
11
|
+
load_requirements();
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
$.ajax({
|
|
15
|
+
type: "GET",
|
|
16
|
+
url: "rngs/nlrequirements.rng",
|
|
17
|
+
dataType: "xml",
|
|
18
|
+
success: function(rng){
|
|
19
|
+
save['nlrequirements'] = new RelaxNGui(rng,$('#dat_nlrequirements'));
|
|
20
|
+
load_requirements();
|
|
11
21
|
}
|
|
12
22
|
});
|
|
13
|
-
|
|
14
|
-
initialize_nl_requirements_tab();
|
|
15
23
|
|
|
16
24
|
function loadComplianceLog(uuid, options) {
|
|
17
25
|
var renderOptions = options || {};
|
|
@@ -155,7 +163,7 @@ $(document).ready(function() { //{{{
|
|
|
155
163
|
|
|
156
164
|
function extractDescriptionXmlFromTestset(testsetXml) {
|
|
157
165
|
var xmlDoc = $.parseXML(testsetXml);
|
|
158
|
-
var descriptionContainer = xmlDoc.getElementsByTagName('description')[0];
|
|
166
|
+
var descriptionContainer = xmlDoc.getElementsByTagName('dslx')[0] || xmlDoc.getElementsByTagName('description')[0];
|
|
159
167
|
|
|
160
168
|
if (!descriptionContainer) {
|
|
161
169
|
return null;
|
|
@@ -433,199 +441,140 @@ $(document).ready(function() { //{{{
|
|
|
433
441
|
});
|
|
434
442
|
});
|
|
435
443
|
|
|
436
|
-
document.addEventListener('attributes:changed', function
|
|
437
|
-
|
|
438
|
-
let reqs;
|
|
439
|
-
let regex = /\"\s*=>\s*"/g
|
|
440
|
-
if (save.attributes_raw.requirements.match(regex)) {
|
|
441
|
-
reqs = save.attributes_raw.requirements.replace(regex,"\":\"");
|
|
442
|
-
} else {
|
|
443
|
-
reqs = save.attributes_raw.requirements;
|
|
444
|
-
}
|
|
445
|
-
reqj = JSON.parse(reqs);
|
|
446
|
-
for (let key in reqj) {
|
|
447
|
-
let ele = $X("<" + key + " xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
448
|
-
ele.text(reqj[key]);
|
|
449
|
-
req.append(ele);
|
|
450
|
-
}
|
|
451
|
-
save['requirements'].content(req);
|
|
452
|
-
sync_nl_rows_to_requirement_keys(reqj);
|
|
453
|
-
|
|
454
|
-
let nlReqj = parse_saved_object(save.attributes_raw['NL-requirements']);
|
|
455
|
-
sync_nl_rows_to_requirement_keys(nlReqj);
|
|
456
|
-
apply_nl_requirements_values(nlReqj);
|
|
457
|
-
});
|
|
458
|
-
|
|
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
|
-
$(document).on('relaxngui_remove', '#dat_requirements', function(event){
|
|
466
|
-
clearTimeout(timer);
|
|
467
|
-
sync_nl_rows_to_requirement_keys(read_requirements_object(), true);
|
|
468
|
-
do_nl_requirements_save(event);
|
|
469
|
-
do_requirements_save(event);
|
|
470
|
-
});
|
|
471
|
-
$(document).on('relaxngui_move', '#dat_requirements', function(event){
|
|
472
|
-
clearTimeout(timer);
|
|
473
|
-
do_requirements_save(event);
|
|
474
|
-
});
|
|
475
|
-
$(document).on('relaxngui_change', '#dat_requirements', function(event){
|
|
476
|
-
clearTimeout(timer);
|
|
477
|
-
do_requirements_save(event);
|
|
444
|
+
document.addEventListener('attributes:changed', function() {
|
|
445
|
+
load_requirements();
|
|
478
446
|
});
|
|
479
447
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
clearTimeout(nlTimer);
|
|
483
|
-
nlTimer = setTimeout(function(){ do_nl_requirements_save(event); }, 2000);
|
|
448
|
+
$(document).on('relaxngui_remove', '#dat_requirements', function() {
|
|
449
|
+
prune_nl_requirements();
|
|
484
450
|
});
|
|
485
451
|
}); //}}}
|
|
486
452
|
|
|
487
|
-
function
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
do_nl_requirements_save();
|
|
491
|
-
});
|
|
453
|
+
function read_requirements(editor) { //{{{
|
|
454
|
+
return editor ? parse_saved_object(editor.save_json()) : {};
|
|
455
|
+
} //}}}
|
|
492
456
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
457
|
+
function requirements_xml(rootName, reqObject) { //{{{
|
|
458
|
+
let req = $X("<" + rootName + " xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
459
|
+
Object.keys(reqObject).forEach(function(key) {
|
|
460
|
+
let ele = $X("<" + key + " xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
461
|
+
ele.text(reqObject[key]);
|
|
462
|
+
req.append(ele);
|
|
463
|
+
});
|
|
464
|
+
return req;
|
|
496
465
|
} //}}}
|
|
497
466
|
|
|
498
|
-
function
|
|
499
|
-
if (!save['requirements']) {
|
|
467
|
+
function load_requirements() { //{{{
|
|
468
|
+
if (!save['requirements'] || !save['nlrequirements'] || !save['attributes_raw']) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
let raw = save['attributes_raw'].requirements || '';
|
|
472
|
+
let nlraw = save['attributes_raw']['NL-requirements'] || '';
|
|
473
|
+
if (raw === requirements_state.requirements && nlraw === requirements_state.nl) {
|
|
500
474
|
return;
|
|
501
475
|
}
|
|
502
|
-
|
|
503
|
-
|
|
476
|
+
requirements_state.requirements = raw;
|
|
477
|
+
requirements_state.nl = nlraw;
|
|
478
|
+
|
|
479
|
+
let req = parse_saved_object(raw);
|
|
480
|
+
let nl = parse_saved_object(nlraw);
|
|
481
|
+
Object.keys(req).forEach(function(key) {
|
|
482
|
+
if (!(key in nl)) {
|
|
483
|
+
nl[key] = '';
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
save['requirements'].content(requirements_xml('requirements', req));
|
|
487
|
+
save['nlrequirements'].content(requirements_xml('nlrequirements', nl));
|
|
504
488
|
} //}}}
|
|
505
489
|
|
|
506
|
-
function
|
|
507
|
-
|
|
508
|
-
|
|
490
|
+
function save_requirements() { //{{{
|
|
491
|
+
if (!save['requirements'] || !save['nlrequirements'] || !save['attributes']) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
let req = JSON.stringify(read_requirements(save['requirements']));
|
|
495
|
+
let nl = JSON.stringify(read_requirements(save['nlrequirements']));
|
|
496
|
+
if (req === requirements_state.requirements && nl === requirements_state.nl) {
|
|
509
497
|
return;
|
|
510
498
|
}
|
|
511
499
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
500
|
+
let att = save['attributes'].save();
|
|
501
|
+
let attributes = $(' > attributes', att);
|
|
502
|
+
if (attributes.length === 0) {
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
[['requirements', req], ['NL-requirements', nl]].forEach(function([name, value]) {
|
|
506
|
+
let node = attributes.children(name);
|
|
507
|
+
if (node.length === 0) {
|
|
508
|
+
node = $X("<" + name + " xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
509
|
+
attributes.append(node);
|
|
510
|
+
}
|
|
511
|
+
node.text(value);
|
|
512
|
+
save['attributes_raw'][name] = value;
|
|
522
513
|
});
|
|
523
|
-
|
|
514
|
+
requirements_state.requirements = req;
|
|
515
|
+
requirements_state.nl = nl;
|
|
516
|
+
save['attributes'].content(att);
|
|
517
|
+
do_parameters_save_part('attributes', $(att).serializePrettyXML());
|
|
524
518
|
} //}}}
|
|
525
519
|
|
|
526
|
-
function
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if (!naturalText) {
|
|
533
|
-
status.text('Enter text').removeClass('ok').addClass('error');
|
|
520
|
+
function prune_nl_requirements() { //{{{
|
|
521
|
+
let current = read_requirements(save['requirements']);
|
|
522
|
+
let removed = Object.keys(parse_saved_object(requirements_state.requirements)).filter(function(key) {
|
|
523
|
+
return !(key in current);
|
|
524
|
+
});
|
|
525
|
+
if (removed.length === 0) {
|
|
534
526
|
return;
|
|
535
527
|
}
|
|
536
|
-
|
|
537
|
-
|
|
528
|
+
let nl = read_requirements(save['nlrequirements']);
|
|
529
|
+
removed.forEach(function(key) {
|
|
530
|
+
delete nl[key];
|
|
531
|
+
});
|
|
532
|
+
save['nlrequirements'].content(requirements_xml('nlrequirements', nl));
|
|
533
|
+
} //}}}
|
|
534
|
+
|
|
535
|
+
function extract_single_nl_requirement(entry) { //{{{
|
|
536
|
+
var inputs = entry.find('.relaxngui_row > input.relaxngui_cell');
|
|
537
|
+
var requirementId = inputs.first().val();
|
|
538
|
+
var naturalText = (inputs.last().val() || '').trim();
|
|
539
|
+
var button = entry.children('[data-type=act]');
|
|
540
|
+
|
|
541
|
+
if (!naturalText || !save['requirements']) {
|
|
538
542
|
return;
|
|
539
543
|
}
|
|
540
544
|
|
|
541
|
-
status.text('Extracting...').removeClass('ok error');
|
|
542
545
|
button.prop('disabled', true);
|
|
543
546
|
|
|
544
547
|
extract_ast_from_natural_language(
|
|
545
548
|
naturalText,
|
|
546
549
|
function(ast) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
+
let req = read_requirements(save['requirements']);
|
|
551
|
+
req[requirementId] = ast;
|
|
552
|
+
save['requirements'].content(requirements_xml('requirements', req));
|
|
553
|
+
save_requirements();
|
|
550
554
|
button.prop('disabled', false);
|
|
551
555
|
},
|
|
552
|
-
function(
|
|
553
|
-
status.text(message || 'Failed').removeClass('ok').addClass('error');
|
|
556
|
+
function() {
|
|
554
557
|
button.prop('disabled', false);
|
|
555
558
|
}
|
|
556
559
|
);
|
|
557
560
|
} //}}}
|
|
558
561
|
|
|
559
|
-
function sync_nl_rows_to_requirement_keys(requirementsObject, pruneMissing) { //{{{
|
|
560
|
-
if (!requirementsObject || typeof requirementsObject !== 'object') {
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
var keys = Object.keys(requirementsObject);
|
|
565
|
-
|
|
566
|
-
if (pruneMissing) {
|
|
567
|
-
$('#dat_nlrequirements .nlreq-row').each(function() {
|
|
568
|
-
var rid = $(this).attr('data-requirement-id');
|
|
569
|
-
if (rid && keys.indexOf(rid) === -1) {
|
|
570
|
-
$(this).remove();
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
keys.forEach(function(key) {
|
|
576
|
-
if ($('#dat_nlrequirements .nlreq-row[data-requirement-id="' + key + '"]').length === 0) {
|
|
577
|
-
add_nl_requirement_row(key, '');
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
} //}}}
|
|
581
|
-
|
|
582
562
|
function next_requirement_id() { //{{{
|
|
583
|
-
var
|
|
584
|
-
|
|
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
|
-
var currentReqs = read_requirements_object();
|
|
563
|
+
var currentReqs = Object.assign({}, read_requirements(save['nlrequirements']), read_requirements(save['requirements']));
|
|
564
|
+
var used = {};
|
|
593
565
|
Object.keys(currentReqs).forEach(function(key) {
|
|
594
566
|
var m = key.match(/^R(\d+)$/);
|
|
595
567
|
if (m) {
|
|
596
|
-
|
|
568
|
+
used[parseInt(m[1], 10)] = true;
|
|
597
569
|
}
|
|
598
570
|
});
|
|
599
571
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
function upsert_requirement_ast(requirementId, astText) { //{{{
|
|
604
|
-
var reqObject = read_requirements_object();
|
|
605
|
-
reqObject[requirementId] = astText;
|
|
606
|
-
write_requirements_object(reqObject);
|
|
607
|
-
} //}}}
|
|
608
|
-
|
|
609
|
-
function read_requirements_object() { //{{{
|
|
610
|
-
if (!save['requirements']) {
|
|
611
|
-
return {};
|
|
572
|
+
var candidate = 1;
|
|
573
|
+
while (used[candidate]) {
|
|
574
|
+
candidate += 1;
|
|
612
575
|
}
|
|
613
576
|
|
|
614
|
-
|
|
615
|
-
if (raw == null || raw === '') {
|
|
616
|
-
return {};
|
|
617
|
-
}
|
|
618
|
-
if (typeof raw === 'string') {
|
|
619
|
-
try {
|
|
620
|
-
return JSON.parse(raw);
|
|
621
|
-
} catch (e) {
|
|
622
|
-
return {};
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
if (typeof raw === 'object') {
|
|
626
|
-
return raw;
|
|
627
|
-
}
|
|
628
|
-
return {};
|
|
577
|
+
return 'R' + candidate;
|
|
629
578
|
} //}}}
|
|
630
579
|
|
|
631
580
|
function parse_saved_object(raw) { //{{{
|
|
@@ -649,54 +598,6 @@ function parse_saved_object(raw) { //{{{
|
|
|
649
598
|
return {};
|
|
650
599
|
} //}}}
|
|
651
600
|
|
|
652
|
-
function apply_nl_requirements_values(nlReqObject) { //{{{
|
|
653
|
-
if (!nlReqObject || typeof nlReqObject !== 'object') {
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
Object.keys(nlReqObject).forEach(function(key) {
|
|
658
|
-
var row = $('#dat_nlrequirements .nlreq-row[data-requirement-id="' + key + '"]');
|
|
659
|
-
if (row.length > 0) {
|
|
660
|
-
row.find('.nlreq-text').val(nlReqObject[key] || '');
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
} //}}}
|
|
664
|
-
|
|
665
|
-
function read_nl_requirements_object_from_ui() { //{{{
|
|
666
|
-
var data = {};
|
|
667
|
-
$('#dat_nlrequirements .nlreq-row').each(function() {
|
|
668
|
-
var requirementId = $(this).attr('data-requirement-id');
|
|
669
|
-
if (!requirementId) {
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
var text = $(this).find('.nlreq-text').val();
|
|
673
|
-
data[requirementId] = text == null ? '' : String(text);
|
|
674
|
-
});
|
|
675
|
-
return data;
|
|
676
|
-
} //}}}
|
|
677
|
-
|
|
678
|
-
function write_requirements_object(reqObject) { //{{{
|
|
679
|
-
let req = $X("<requirements xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
680
|
-
Object.keys(reqObject)
|
|
681
|
-
.sort(sort_requirement_ids)
|
|
682
|
-
.forEach(function(key) {
|
|
683
|
-
let ele = $X("<" + key + " xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
684
|
-
ele.text(reqObject[key]);
|
|
685
|
-
req.append(ele);
|
|
686
|
-
});
|
|
687
|
-
save['requirements'].content(req);
|
|
688
|
-
do_requirements_save({ target: $('#dat_requirements')[0] });
|
|
689
|
-
} //}}}
|
|
690
|
-
|
|
691
|
-
function sort_requirement_ids(a, b) { //{{{
|
|
692
|
-
var am = String(a).match(/^R(\d+)$/);
|
|
693
|
-
var bm = String(b).match(/^R(\d+)$/);
|
|
694
|
-
if (am && bm) {
|
|
695
|
-
return parseInt(am[1], 10) - parseInt(bm[1], 10);
|
|
696
|
-
}
|
|
697
|
-
return String(a).localeCompare(String(b));
|
|
698
|
-
} //}}}
|
|
699
|
-
|
|
700
601
|
function extract_ast_from_natural_language(naturalText, onSuccess, onError) { //{{{
|
|
701
602
|
var configuredEndpoint = $('body').attr('data-singlerule-endpoint') || '/compextract/singlerule';
|
|
702
603
|
var url = absolute_extract_url(configuredEndpoint);
|
|
@@ -990,60 +891,3 @@ function getCurrentProcessXml() { //{{{
|
|
|
990
891
|
|
|
991
892
|
return null;
|
|
992
893
|
} //}}}
|
|
993
|
-
|
|
994
|
-
function do_requirements_save(event) { //{{{
|
|
995
|
-
if (save['requirements'].has_changed()) {
|
|
996
|
-
save['requirements'].set_checkpoint();
|
|
997
|
-
var url = $('body').attr('current-instance');
|
|
998
|
-
let reqj = save['requirements'].save_json();
|
|
999
|
-
let att = save['attributes'].save();
|
|
1000
|
-
let attributesNode = $(' > attributes', att);
|
|
1001
|
-
if (attributesNode.length === 0) {
|
|
1002
|
-
return;
|
|
1003
|
-
}
|
|
1004
|
-
let requirementsNode = attributesNode.children('requirements');
|
|
1005
|
-
if (requirementsNode.length === 0) {
|
|
1006
|
-
requirementsNode = $X("<requirements xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
1007
|
-
attributesNode.append(requirementsNode);
|
|
1008
|
-
}
|
|
1009
|
-
requirementsNode.text(reqj);
|
|
1010
|
-
do_parameters_save_part('attributes',$(att).serializePrettyXML());
|
|
1011
|
-
}
|
|
1012
|
-
} //}}}
|
|
1013
|
-
|
|
1014
|
-
function do_nl_requirements_save(event) { //{{{
|
|
1015
|
-
if (!save['attributes']) {
|
|
1016
|
-
return;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
// Keep regular requirements in sync when NL requirements are persisted.
|
|
1020
|
-
if (save['requirements']) {
|
|
1021
|
-
do_requirements_save({ target: $('#dat_requirements')[0] });
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
let nlReqj = JSON.stringify(read_nl_requirements_object_from_ui());
|
|
1025
|
-
let att = save['attributes'].save();
|
|
1026
|
-
let attributesNode = $(' > attributes', att);
|
|
1027
|
-
if (attributesNode.length === 0) {
|
|
1028
|
-
return;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
let nlReqNode = attributesNode.children('NL-requirements');
|
|
1032
|
-
if (nlReqNode.length === 0) {
|
|
1033
|
-
nlReqNode = $X("<NL-requirements xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
1034
|
-
attributesNode.append(nlReqNode);
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
if (save['requirements']) {
|
|
1038
|
-
let reqj = save['requirements'].save_json();
|
|
1039
|
-
let requirementsNode = attributesNode.children('requirements');
|
|
1040
|
-
if (requirementsNode.length === 0) {
|
|
1041
|
-
requirementsNode = $X("<requirements xmlns='http://cpee.org/ns/properties/2.0'/>");
|
|
1042
|
-
attributesNode.append(requirementsNode);
|
|
1043
|
-
}
|
|
1044
|
-
requirementsNode.text(reqj);
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
nlReqNode.text(nlReqj);
|
|
1048
|
-
do_parameters_save_part('attributes',$(att).serializePrettyXML());
|
|
1049
|
-
} //}}}
|
|
@@ -204,7 +204,7 @@ function draw_extended_columns(graphrealization,max,labels,dimensions,striped) {
|
|
|
204
204
|
svgcolumn.append(svgback);
|
|
205
205
|
svgcolumn.append(svgfront);
|
|
206
206
|
svgcolumn.css('grid-row', '1/span ' + (max.row + 2))
|
|
207
|
-
svgcolumn.css('grid-column', tcolumns.indexOf(
|
|
207
|
+
svgcolumn.css('grid-column', tcolumns.indexOf(h) + 2);
|
|
208
208
|
svgcolumn.attr('height', graphrealization.illustrator.svg.container.attr('height'));
|
|
209
209
|
graphrealization.illustrator.svg.label_container.append(svgcolumn);
|
|
210
210
|
|
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;
|
|
@@ -209,7 +210,7 @@ function cockpit() { //{{{
|
|
|
209
210
|
$("button[name=loadtestset]").attr('disabled','disabled');
|
|
210
211
|
},
|
|
211
212
|
complete: function() {
|
|
212
|
-
var q = $.
|
|
213
|
+
var q = $.query_params();
|
|
213
214
|
if (q.theme) { graph_theme = q.theme; }
|
|
214
215
|
if (q.position) { graph_position = q.position == 'false' ? 'false' : 'true'; }
|
|
215
216
|
if (q.highlight) {
|
|
@@ -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':
|
|
@@ -528,12 +538,14 @@ function monitor_instance(cin,rep,load,exec) {// {{{
|
|
|
528
538
|
$("#current-index").show();
|
|
529
539
|
$("#current-index").attr('href','index.html?monitor=' + url);
|
|
530
540
|
|
|
531
|
-
var q = $.
|
|
541
|
+
var q = $.query_params();
|
|
532
542
|
history.replaceState({}, '', '?' + ('debug' in q ? "debug&" : "") + (graph_position ? "position=" + graph_position + "&" : "") + (graph_highlight ? "highlight=" + graph_highlight + "&" : "") + (graph_theme ? "theme=" + graph_theme + "&" : "") + (q.min || q.min=="" ? "min&" : "") + 'monitor='+url);
|
|
533
543
|
|
|
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();
|
|
@@ -1556,7 +1587,7 @@ function format_code(res,skim,lnums) {// {{{
|
|
|
1556
1587
|
while (m = res.match(/^ +|^(?!<div style=)|^$/m)) {
|
|
1557
1588
|
m = m[0];
|
|
1558
1589
|
var tm = (m.length + 2) * 0.6 + 2 * 0.6 + 4 * 0.6;
|
|
1559
|
-
var ln = (lnums ?
|
|
1590
|
+
var ln = (lnums ? l.sprintf("%03d") + ': ' : '');
|
|
1560
1591
|
res = res.replace(/^ +|^(?!<div style=)|^$/m,"<div style='text-indent:-" + tm + "em;margin-left:" + tm + "em'>" + ln + " ".repeat(m.length));
|
|
1561
1592
|
l++;
|
|
1562
1593
|
}
|