cpee 2.1.4 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cockpit/css/ui.css +15 -8
- data/cockpit/edit.html +28 -25
- data/cockpit/graph.html +1 -0
- data/cockpit/index.html +27 -24
- data/cockpit/js/edit.js +8 -1
- data/cockpit/js/instance.js +12 -18
- data/cockpit/js/modifiers.js +188 -0
- data/cockpit/model.html +2 -10
- data/cockpit/templates/UR-VUE 2020 Solution Baseline.xml.active +1 -0
- data/cockpit/templates/UR-VUE 2020 Solution Baseline.xml.active-uuid +1 -0
- data/cockpit/track.html +1 -0
- data/cpee.gemspec +1 -1
- data/lib/cpee/redis.rb +13 -6
- data/server/routing/end.pid +1 -1
- data/server/routing/forward-events.pid +1 -1
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/persist.pid +1 -1
- data/tools/cpee +30 -2
- data/tools/cpee.sic +306 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d53dc72e24a3fb020406bdc895b053ea57e66e0c8fd2c31494ac45d821186bb8
|
4
|
+
data.tar.gz: fe2f6c47d2cec87e99d233867e86de7c4d86d02c2ceff30e31abcd418f5ce506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d63332228480551be2515cc616524dbdc1d3f02605ad7774341ee2bc6f5138f2cb15d9ef0c44708ec78c4f697c16b3be4c1359919726089f3fce3d4181578692
|
7
|
+
data.tar.gz: 5633233f63f21712876b602c5997bce33ea5f80eb6733803f7228fe3f927a53156c6b4950a79c5062957c8fe4df759aba94d6ba6954d38c0832cfe0e8b7feff2
|
data/cockpit/css/ui.css
CHANGED
@@ -129,11 +129,13 @@ ui-tabbed ui-tabbar ui-behind button {
|
|
129
129
|
#areaendpoints button.relaxngui_control { display: none; }
|
130
130
|
#areaattributes button.relaxngui_control { display: none; }
|
131
131
|
|
132
|
+
#areainstance { height: 100%; }
|
133
|
+
#areainstance > div { display: flex; height: 100%; }
|
132
134
|
#areainstance input[type=file] { display: none; }
|
133
|
-
#areainstance div.section {
|
134
|
-
#areainstance div.section:nth-child(1) { padding: 0 0.5em 0 0; white-space: nowrap; }
|
135
|
-
#areainstance div.section:nth-child(2) { border-left: 1px solid var(--x-ui-border-color); padding: 0 0.5em; white-space: nowrap; }
|
136
|
-
#areainstance div.section:nth-child(3) { border-left: 1px solid var(--x-ui-border-color); padding: 0 0 0 0.5em; white-space: nowrap; }
|
135
|
+
#areainstance div.section { vertical-align: middle; height: 100%; }
|
136
|
+
#areainstance div.section:nth-child(1) { flex: 0 0 auto; padding: 0 0.5em 0 0; white-space: nowrap; }
|
137
|
+
#areainstance div.section:nth-child(2) { flex: 0 0 auto; border-left: 1px solid var(--x-ui-border-color); padding: 0 0.5em; white-space: nowrap; }
|
138
|
+
#areainstance div.section:nth-child(3) { flex: 1 1 auto; border-left: 1px solid var(--x-ui-border-color); padding: 0 0 0 0.5em; white-space: nowrap; }
|
137
139
|
|
138
140
|
#areainstance div.section:nth-child(1) > div:nth-child(2) { white-space: normal; text-align: right; }
|
139
141
|
|
@@ -144,9 +146,14 @@ ui-tabbed ui-tabbar ui-behind button {
|
|
144
146
|
#areainstance div.section:nth-child(1) button[name=loadtestsetfile] { white-space: normal; width: 10em; height: 3.5em; margin-left: 0.2em; }
|
145
147
|
#areainstance div.section:nth-child(1) button[name=loadmodelfile] { white-space: normal; width: 10em; height: 2em; margin-top: 0.2em; }
|
146
148
|
|
147
|
-
#areainstance div.section:nth-child(2) button { white-space: normal; width: 6em; height:
|
148
|
-
|
149
|
-
#areainstance div.section:nth-child(3)
|
149
|
+
#areainstance div.section:nth-child(2) button { white-space: normal; width: 6em; height: 5.7em; vertical-align: middle; margin: 0; padding: 0; }
|
150
|
+
|
151
|
+
#areainstance div.section:nth-child(3) { overflow-y: scroll; }
|
152
|
+
#areainstance div.section:nth-child(3) strong { margin:0; padding:0; white-space: normal; font-size: 0.7em; }
|
153
|
+
#areainstance div.section:nth-child(3) > div:not(:first-child) { padding-top: 0.2em; }
|
154
|
+
#areainstance div.section:nth-child(3) > div { padding-bottom: 0em; }
|
155
|
+
#areainstance div.section:nth-child(3) select { margin-left: 1em; }
|
156
|
+
#areainstance div.section:nth-child(3) div.additional { margin: 0 1em; font-size: 0.9em; }
|
150
157
|
|
151
158
|
#areaexecution input { padding: 0; margin:0; }
|
152
159
|
#areaexecution table.x-ui-compact { width: 100%; }
|
@@ -236,4 +243,4 @@ span.vote {
|
|
236
243
|
overflow: auto;
|
237
244
|
}
|
238
245
|
#disclaimer p { max-width: 80ex; text-align: justify; }
|
239
|
-
#disclaimer input { margin:0; padding:0; vertical-align:
|
246
|
+
#disclaimer input { margin:0; padding:0; vertical-align:baseline; margin-right: 0.5em; }
|
data/cockpit/edit.html
CHANGED
@@ -54,6 +54,7 @@
|
|
54
54
|
<script type="text/javascript" src="js/details.js"></script>
|
55
55
|
<script type="text/javascript" src="js/parameters.js"></script>
|
56
56
|
<script type="text/javascript" src="js/edit.js"></script>
|
57
|
+
<script type="text/javascript" src="js/modifiers.js"></script>
|
57
58
|
<link rel="stylesheet" href="css/ui.css" type="text/css"/>
|
58
59
|
<link rel="stylesheet" href="/global_ui/uicpee.css" type="text/css"/>
|
59
60
|
<style>
|
@@ -91,14 +92,13 @@
|
|
91
92
|
</p>
|
92
93
|
|
93
94
|
<p>
|
94
|
-
This demonstrator
|
95
|
+
This demonstrator is hosted in Austria. All liability is excluded to the extent
|
95
96
|
permitted by law including any implied terms. Any interpretation of its
|
96
97
|
content, claims or disputes (of whatever nature and not limited to contractual
|
97
98
|
issues) shall be subject to the exclusive jurisdiction of the Austrian Courts
|
98
99
|
under Austrian law.
|
99
100
|
</p>
|
100
101
|
|
101
|
-
|
102
102
|
<p>
|
103
103
|
All actions performed while using this demonstrator will be logged, including
|
104
104
|
the IP address of the user.
|
@@ -144,29 +144,32 @@
|
|
144
144
|
</table>
|
145
145
|
</ui-area> <!--}}}-->
|
146
146
|
<ui-area data-belongs-to-tab="instance" id="areainstance" class="inactive"> <!--{{{-->
|
147
|
-
<div
|
148
|
-
<div>
|
149
|
-
<
|
150
|
-
<
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
<
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
147
|
+
<div>
|
148
|
+
<div class='section'>
|
149
|
+
<div>
|
150
|
+
<form id='fuckchrome'>
|
151
|
+
<input type='file' name='testsetfile' id='testsetfile'/>
|
152
|
+
</form>
|
153
|
+
<button title='save a testset includes various settings, subscriptions and a model' name="save" disabled=""><div>save</div><div class="hidden" id='lastsavedline'>(last: <span id="lastsaved"></span>)</div></button>
|
154
|
+
<button title='a testset includes various settings, subscriptions or a model' name="loadtestsetfile">load testset</button>
|
155
|
+
</div>
|
156
|
+
<div>
|
157
|
+
<input type='file' name='modelfile' id='modelfile'/>
|
158
|
+
<button title='a standalone process model is only loadable if the currently loaded testset sucessfully prepared the current instance for the type of model' name="loadmodelfile">load model</button>
|
159
|
+
</div>
|
160
|
+
</div><div class='section'>
|
161
|
+
<a id="savetestsetfile" href="" download=""></a>
|
162
|
+
<a id="savesvgfile" href="" download=""></a>
|
163
|
+
<button title='a testset includes various settings, subscriptions and a model' name="savetestsetfile">save testset</button>
|
164
|
+
<button title='a testset includes various settings, subscriptions and a model' name="savesvgfile">save svg graph</button>
|
165
|
+
</div><div class='section' id='modifiers'>
|
166
|
+
<template id="item">
|
167
|
+
<div>
|
168
|
+
<div class='title'><strong></strong></div>
|
169
|
+
<div class='select'><select></select></div>
|
170
|
+
<div class='additional'></div>
|
171
|
+
</div>
|
172
|
+
</template>
|
170
173
|
</div>
|
171
174
|
</div>
|
172
175
|
</ui-area> <!--}}}-->
|
data/cockpit/graph.html
CHANGED
@@ -54,6 +54,7 @@
|
|
54
54
|
<script type="text/javascript" src="js/instance.js"></script>
|
55
55
|
<script type="text/javascript" src="js/details.js"></script>
|
56
56
|
<script type="text/javascript" src="js/parameters.js"></script>
|
57
|
+
<script type="text/javascript" src="js/modifiers.js"></script>
|
57
58
|
<link rel="stylesheet" href="css/ui.css" type="text/css"/>
|
58
59
|
</head>
|
59
60
|
<body data-base-port="8298" data-res-port="9303" data-theme-base="themes" is="x-ui-">
|
data/cockpit/index.html
CHANGED
@@ -53,6 +53,7 @@
|
|
53
53
|
<script type="text/javascript" src="js/instance.js"></script>
|
54
54
|
<script type="text/javascript" src="js/details.js"></script>
|
55
55
|
<script type="text/javascript" src="js/parameters.js"></script>
|
56
|
+
<script type="text/javascript" src="js/modifiers.js"></script>
|
56
57
|
<link rel="stylesheet" href="css/ui.css" type="text/css"/>
|
57
58
|
<link rel="stylesheet" href="/global_ui/uicpee.css" type="text/css"/>
|
58
59
|
<style>
|
@@ -90,14 +91,13 @@
|
|
90
91
|
</p>
|
91
92
|
|
92
93
|
<p>
|
93
|
-
This demonstrator
|
94
|
+
This demonstrator is hosted in Austria. All liability is excluded to the extent
|
94
95
|
permitted by law including any implied terms. Any interpretation of its
|
95
96
|
content, claims or disputes (of whatever nature and not limited to contractual
|
96
97
|
issues) shall be subject to the exclusive jurisdiction of the Austrian Courts
|
97
98
|
under Austrian law.
|
98
99
|
</p>
|
99
100
|
|
100
|
-
|
101
101
|
<p>
|
102
102
|
All actions performed while using this demonstrator will be logged, including
|
103
103
|
the IP address of the user.
|
@@ -146,28 +146,31 @@
|
|
146
146
|
</table>
|
147
147
|
</ui-area> <!--}}}-->
|
148
148
|
<ui-area data-belongs-to-tab="instance" id="areainstance" class="inactive"> <!--{{{-->
|
149
|
-
<div
|
150
|
-
<div>
|
151
|
-
<
|
152
|
-
<
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
<
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
149
|
+
<div>
|
150
|
+
<div class='section'>
|
151
|
+
<div>
|
152
|
+
<form id='fuckchrome'>
|
153
|
+
<input type='file' name='testsetfile' id='testsetfile'/>
|
154
|
+
</form>
|
155
|
+
<button title='a template includes various settings, subscriptions or a (partial) model' name="loadtestset">load template</button><button title='a testset includes various settings, subscriptions or a model' name="loadtestsetfile">load testset</button>
|
156
|
+
</div>
|
157
|
+
<div>
|
158
|
+
<input type='file' name='modelfile' id='modelfile'/>
|
159
|
+
<button title='a standalone process model is only loadable if the currently loaded testset sucessfully prepared the current instance for the type of model' name="loadmodelfile">load model</button>
|
160
|
+
</div>
|
161
|
+
</div><div class='section'>
|
162
|
+
<a id="savetestsetfile" href="" download=""></a>
|
163
|
+
<a id="savesvgfile" href="" download=""></a>
|
164
|
+
<button title='a testset includes various settings, subscriptions and a model' name="savetestsetfile">save testset</button>
|
165
|
+
<button title='a testset includes various settings, subscriptions and a model' name="savesvgfile">save svg graph</button>
|
166
|
+
</div><div class='section' id='modifiers'>
|
167
|
+
<template id="item">
|
168
|
+
<div>
|
169
|
+
<div class='title'><strong></strong></div>
|
170
|
+
<div class='select'><select></select></div>
|
171
|
+
<div class='additional'></div>
|
172
|
+
</div>
|
173
|
+
</template>
|
171
174
|
</div>
|
172
175
|
</div>
|
173
176
|
</ui-area> <!--}}}-->
|
data/cockpit/js/edit.js
CHANGED
@@ -4,6 +4,13 @@ document.addEventListener('graph:changed', function (e) {
|
|
4
4
|
document.addEventListener('parameters:changed', function (e) {
|
5
5
|
$("button[name=save]").prop("disabled",false);
|
6
6
|
}, false);
|
7
|
+
document.addEventListener('modifiers:changed', function (e) {
|
8
|
+
$("button[name=save]").prop("disabled",false);
|
9
|
+
}, false);
|
10
|
+
|
11
|
+
function leading_zeros(dt) {
|
12
|
+
return (dt < 10 ? '0' : '') + dt;
|
13
|
+
}
|
7
14
|
|
8
15
|
$(document).ready(function() {
|
9
16
|
$("button[name=save]").click(function(){
|
@@ -19,7 +26,7 @@ $(document).ready(function() {
|
|
19
26
|
$("button[name=save]").prop("disabled",true);
|
20
27
|
$("#lastsavedline").removeClass('hidden');
|
21
28
|
var dt = new Date();
|
22
|
-
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
|
29
|
+
var time = leading_zeros(dt.getHours()) + ":" + leading_zeros(dt.getMinutes()) + ":" + leading_zeros(dt.getSeconds());
|
23
30
|
$("#lastsaved").text(time);
|
24
31
|
},
|
25
32
|
error: function() {
|
data/cockpit/js/instance.js
CHANGED
@@ -28,6 +28,9 @@ function global_init() {
|
|
28
28
|
save['details'] = undefined;
|
29
29
|
save['details_target'] = undefined;
|
30
30
|
save['instance_pos'] = [];
|
31
|
+
save['modifiers'] = {};
|
32
|
+
save['modifiers_active'] = {};
|
33
|
+
save['modifiers_additional'] = {};
|
31
34
|
node_state = {};
|
32
35
|
}
|
33
36
|
|
@@ -95,6 +98,7 @@ function cockpit() { //{{{
|
|
95
98
|
$("input[name=votecontinue]").click(check_subscription);
|
96
99
|
$("input[name=testsetfile]").change(load_testsetfile_after);
|
97
100
|
$("input[name=modelfile]").change(load_modelfile_after);
|
101
|
+
$("#modifiers").on('change','div.select select',function(e){ modifiers_update(e); });
|
98
102
|
|
99
103
|
$.ajax({
|
100
104
|
url: $('body').attr('current-templates'),
|
@@ -276,7 +280,6 @@ function sse() { //{{{
|
|
276
280
|
break;
|
277
281
|
case 'attributes':
|
278
282
|
monitor_instance_values("attributes");
|
279
|
-
monitor_instance_transformation();
|
280
283
|
if (!suspended_monitoring) { // or else it would load twice, because dsl changes also trigger
|
281
284
|
if (save['graph_theme'] != data.content.values.theme) {
|
282
285
|
monitor_graph_change(true);
|
@@ -313,7 +316,6 @@ function sse() { //{{{
|
|
313
316
|
monitor_instance_values("dataelements");
|
314
317
|
monitor_instance_values("endpoints");
|
315
318
|
monitor_instance_values("attributes");
|
316
|
-
monitor_instance_transformation();
|
317
319
|
monitor_instance_dsl();
|
318
320
|
monitor_instance_state();
|
319
321
|
} //}}}
|
@@ -444,6 +446,11 @@ function monitor_instance_values(val) {// {{{
|
|
444
446
|
});
|
445
447
|
});
|
446
448
|
} else if(val == "attributes") {
|
449
|
+
if ($('#modifiers > div').length == 0) {
|
450
|
+
modifiers_display().then(function(){ modifiers_select(); });
|
451
|
+
} else {
|
452
|
+
modifiers_select();
|
453
|
+
}
|
447
454
|
var text = $(" > attributes > info",res).text() + " (" + url.replace(/\/$/,'').split(/[\\/]/).pop() + ")";
|
448
455
|
$('#title').text(text);
|
449
456
|
document.title = text;
|
@@ -632,19 +639,6 @@ function monitor_instance_state() {// {{{
|
|
632
639
|
}
|
633
640
|
});
|
634
641
|
}// }}}
|
635
|
-
function monitor_instance_transformation() {// {{{
|
636
|
-
var url = $('body').attr('current-instance');
|
637
|
-
$.ajax({
|
638
|
-
type: "GET",
|
639
|
-
url: url + "/properties/attributes/modeltype/",
|
640
|
-
success: function(res){
|
641
|
-
$("#currentmodel").text(res);
|
642
|
-
},
|
643
|
-
error: function() {
|
644
|
-
$("#currentmodel").text('???');
|
645
|
-
}
|
646
|
-
});
|
647
|
-
}// }}}
|
648
642
|
|
649
643
|
function monitor_instance_pos() {// {{{
|
650
644
|
var url = $('body').attr('current-instance');
|
@@ -1159,14 +1153,15 @@ async function load_testset_handlers(url,testset,vals) {// {{{
|
|
1159
1153
|
if ($("*",han).length == 0) {
|
1160
1154
|
$.ajax({
|
1161
1155
|
type: "DELETE",
|
1162
|
-
url: url + "/notifications/subscriptions/" + vals[suburl]
|
1156
|
+
url: url + "/notifications/subscriptions/" + vals[suburl] + '/'
|
1163
1157
|
})
|
1158
|
+
delete vals[suburl];
|
1164
1159
|
} else {
|
1165
1160
|
let inp = load_testset_extract_handlers([],han,suburl);
|
1166
1161
|
promises.push(
|
1167
1162
|
$.ajax({
|
1168
1163
|
type: "PUT",
|
1169
|
-
url: url + "/notifications/subscriptions/" + vals[suburl],
|
1164
|
+
url: url + "/notifications/subscriptions/" + vals[suburl] + '/',
|
1170
1165
|
data: inp.join('&')
|
1171
1166
|
})
|
1172
1167
|
)
|
@@ -1285,7 +1280,6 @@ function format_visual_vote_clear() {//{{{
|
|
1285
1280
|
|
1286
1281
|
function format_instance_pos() { //{{{
|
1287
1282
|
$(save['instance_pos']).each(function(){
|
1288
|
-
console.log(this);
|
1289
1283
|
var taskname = this.nodeName;
|
1290
1284
|
var taskstate = this.textContent;
|
1291
1285
|
format_visual_add(taskname,save['state'] == 'running' ? (taskstate == 'at' ? 'active' : 'passive') : 'passive');
|
@@ -0,0 +1,188 @@
|
|
1
|
+
var modifiers_changed = new Event("modifiers:changed", {"bubbles":true, "cancelable":false});
|
2
|
+
|
3
|
+
$(document).ready(function() {
|
4
|
+
var timer;
|
5
|
+
|
6
|
+
$(document).on('input','#modifiers div.additional input, #modifiers div.additional textarea, #modifiers div.additional [contenteditable]',function(e){
|
7
|
+
clearTimeout(timer);
|
8
|
+
timer = setTimeout(function(){ do_mod_save(e.target) }, 5000);
|
9
|
+
});
|
10
|
+
$(document).on('change','#modifiers div.additional select',function(e){
|
11
|
+
clearTimeout(timer);
|
12
|
+
do_mod_save(e.target);
|
13
|
+
});
|
14
|
+
$(document).on('blur','#modifiers div.additional input, #modifiers div.additional textarea, #modifiers div.additional [contenteditable]',function(e){
|
15
|
+
clearTimeout(timer);
|
16
|
+
do_mod_save(e.target);
|
17
|
+
});
|
18
|
+
$(document).on('keypress','#modifiers div.additional input',function(e){
|
19
|
+
if (e.keyCode == 13) {
|
20
|
+
clearTimeout(timer);
|
21
|
+
do_mod_save(e.target);
|
22
|
+
}
|
23
|
+
});
|
24
|
+
$(document).on('keypress','#modifiers div.additional [contenteditable]',function(e){
|
25
|
+
if (e.keyCode == 13) {
|
26
|
+
document.execCommand('insertText', false, '\n');
|
27
|
+
return false;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
$(document).on('relaxngui_remove', '#modifiers div.additional', function(e){
|
31
|
+
clearTimeout(timer);
|
32
|
+
do_mod_save(e.target);
|
33
|
+
});
|
34
|
+
$(document).on('relaxngui_move', '#modifiers div.additional', function(e){
|
35
|
+
clearTimeout(timer);
|
36
|
+
do_mod_save(e.target);
|
37
|
+
});
|
38
|
+
});
|
39
|
+
|
40
|
+
function do_mod_save(target) {
|
41
|
+
let div = $(target).parents('div[data-resource]');
|
42
|
+
let top = div.attr('data-resource');
|
43
|
+
let doc = save['modifiers_additional'][top].save();
|
44
|
+
let rep = $('body').attr('current-resources');
|
45
|
+
let now = encodeURIComponent($('div.select select',div).val());
|
46
|
+
|
47
|
+
var tset = $X('<testset xmlns="http://cpee.org/ns/properties/2.0"/>');
|
48
|
+
tset.append(doc.documentElement);
|
49
|
+
|
50
|
+
set_testset(tset,false);
|
51
|
+
document.dispatchEvent(modifiers_changed);
|
52
|
+
}
|
53
|
+
|
54
|
+
async function modifiers_display() {
|
55
|
+
let promises = [];
|
56
|
+
let rep = $('body').attr('current-resources');
|
57
|
+
$('#modifiers > div').remove();
|
58
|
+
|
59
|
+
promises.push(
|
60
|
+
$.ajax({
|
61
|
+
url: rep + 'modifiers/'
|
62
|
+
}).then(async function(res) {
|
63
|
+
let ipromises = [];
|
64
|
+
$('resource',res).each(function(_,r) {
|
65
|
+
ipromises.push(
|
66
|
+
$.ajax({
|
67
|
+
url: rep + 'modifiers/' + $(r).text()
|
68
|
+
}).then(async function(ses){
|
69
|
+
let clone = document.importNode(document.querySelector('#modifiers template').content,true);
|
70
|
+
let t = $(r).text();
|
71
|
+
$('> div',clone).attr('data-resource',t);
|
72
|
+
$('div.title *',clone).text(decodeURIComponent(t));
|
73
|
+
|
74
|
+
let cpromises = [];
|
75
|
+
$('resource',ses).each(function(_,s) {
|
76
|
+
let opt = $('<option/>');
|
77
|
+
opt.text(decodeURIComponent($(s).text()));
|
78
|
+
$('div.select select',clone).append(opt);
|
79
|
+
|
80
|
+
cpromises.push(
|
81
|
+
$.ajax({
|
82
|
+
url: rep + 'modifiers/' + $(r).text() + '/' + $(s).text() + '/condition.json'
|
83
|
+
}).then(function(tes){
|
84
|
+
save['modifiers'][$(r).text() + '/' + $(s).text()] = tes;
|
85
|
+
})
|
86
|
+
);
|
87
|
+
|
88
|
+
});
|
89
|
+
$(clone).insertBefore($('#modifiers template'));
|
90
|
+
|
91
|
+
await Promise.all(cpromises);
|
92
|
+
})
|
93
|
+
);
|
94
|
+
});
|
95
|
+
await Promise.all(ipromises);
|
96
|
+
})
|
97
|
+
);
|
98
|
+
await Promise.all(promises);
|
99
|
+
}
|
100
|
+
|
101
|
+
function modifiers_display_ui(url,top,it,notchanged) {
|
102
|
+
if (notchanged) {
|
103
|
+
if (save['modifiers_additional'][top]) {
|
104
|
+
let attr = save['attributes'].save();
|
105
|
+
save['modifiers_additional'][top].content(attr);
|
106
|
+
}
|
107
|
+
} else {
|
108
|
+
$('#modifiers div[data-resource]').each(function(_,r){
|
109
|
+
if ($(r).attr('data-resource') == top) {
|
110
|
+
$('div.additional',r).empty();
|
111
|
+
}
|
112
|
+
});
|
113
|
+
$.ajax({
|
114
|
+
url: url + top + '/' + it + '/ui.rng',
|
115
|
+
success: function(rng) {
|
116
|
+
$('#modifiers div[data-resource]').each(function(_,r){
|
117
|
+
if ($(r).attr('data-resource') == top) {
|
118
|
+
save['modifiers_additional'][top] = new RelaxNGui(rng, $('div.additional',r));
|
119
|
+
let attr = save['attributes'].save();
|
120
|
+
save['modifiers_additional'][top].content(attr);
|
121
|
+
}
|
122
|
+
});
|
123
|
+
}
|
124
|
+
});
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
function modifiers_select() {
|
129
|
+
let atts = {}
|
130
|
+
let attr = save['attributes'].save();
|
131
|
+
let rep = $('body').attr('current-resources');
|
132
|
+
$('> attributes > *',attr).each(function(_,s){
|
133
|
+
atts[s.nodeName] = $(s).text();
|
134
|
+
});
|
135
|
+
$('#modifiers div[data-resource]').each(function(_,r){
|
136
|
+
$('select option',r).each(function(_,s){
|
137
|
+
let where = $(r).attr('data-resource') + '/' + encodeURIComponent($(s).text());
|
138
|
+
let cond = save['modifiers'][where];
|
139
|
+
let success = true;
|
140
|
+
for (x in cond) {
|
141
|
+
if (cond[x] != atts[x]) { success = false; }
|
142
|
+
}
|
143
|
+
if (success) {
|
144
|
+
let top = $(r).attr('data-resource');
|
145
|
+
let it = encodeURIComponent($(s).text());
|
146
|
+
$('select',r).val($(s).text());
|
147
|
+
modifiers_display_ui(rep + 'modifiers/',top,it,save['modifiers_active'][top] == it);
|
148
|
+
save['modifiers_active'][top] = it;
|
149
|
+
}
|
150
|
+
});
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
function modifiers_update_patch(url,top,now) {
|
155
|
+
$.ajax({
|
156
|
+
url: url + top + '/' + now + '/patch.xml',
|
157
|
+
success: function(res) {
|
158
|
+
set_testset(res,false);
|
159
|
+
document.dispatchEvent(modifiers_changed);
|
160
|
+
}
|
161
|
+
});
|
162
|
+
}
|
163
|
+
function modifiers_update_unpatch(url,top,last,now) {
|
164
|
+
$.ajax({
|
165
|
+
url: url + top + '/' + last + '/unpatch.xml',
|
166
|
+
success: function(res) {
|
167
|
+
set_testset(res,false).then(function() {
|
168
|
+
modifiers_update_patch(url,top,now);
|
169
|
+
});
|
170
|
+
},
|
171
|
+
error: function() {
|
172
|
+
modifiers_update_patch(url,top,now);
|
173
|
+
}
|
174
|
+
});
|
175
|
+
}
|
176
|
+
|
177
|
+
function modifiers_update(e) {
|
178
|
+
let rep = $('body').attr('current-resources');
|
179
|
+
let top = $(e.target).parents('div[data-resource]').attr('data-resource');
|
180
|
+
let last = save['modifiers_active'][top];
|
181
|
+
let now = $(e.target).val();
|
182
|
+
|
183
|
+
if (last) {
|
184
|
+
modifiers_update_unpatch(rep + 'modifiers/',top,last,now);
|
185
|
+
} else {
|
186
|
+
modifiers_update_patch(rep + 'modifiers/',top,now);
|
187
|
+
}
|
188
|
+
}
|
data/cockpit/model.html
CHANGED
@@ -54,6 +54,7 @@
|
|
54
54
|
<script type="text/javascript" src="js/details.js"></script>
|
55
55
|
<script type="text/javascript" src="js/parameters.js"></script>
|
56
56
|
<script type="text/javascript" src="js/model.js"></script>
|
57
|
+
<script type="text/javascript" src="js/modifiers.js"></script>
|
57
58
|
<script type="text/javascript" src="js/edit.js"></script>
|
58
59
|
<link rel="stylesheet" href="css/ui.css" type="text/css"/>
|
59
60
|
<link rel="stylesheet" href="css/model.css" type="text/css"/>
|
@@ -93,14 +94,13 @@
|
|
93
94
|
</p>
|
94
95
|
|
95
96
|
<p>
|
96
|
-
This demonstrator
|
97
|
+
This demonstrator is hosted in Austria. All liability is excluded to the extent
|
97
98
|
permitted by law including any implied terms. Any interpretation of its
|
98
99
|
content, claims or disputes (of whatever nature and not limited to contractual
|
99
100
|
issues) shall be subject to the exclusive jurisdiction of the Austrian Courts
|
100
101
|
under Austrian law.
|
101
102
|
</p>
|
102
103
|
|
103
|
-
|
104
104
|
<p>
|
105
105
|
All actions performed while using this demonstrator will be logged, including
|
106
106
|
the IP address of the user.
|
@@ -151,14 +151,6 @@
|
|
151
151
|
<button title='a testset includes various settings, subscriptions and a model' name="savesvgfile">save SVG</button>
|
152
152
|
</div>
|
153
153
|
</div>
|
154
|
-
<div class='section'>
|
155
|
-
<div>
|
156
|
-
Current model: <span id='currentmodel'></span>
|
157
|
-
</div>
|
158
|
-
<div>
|
159
|
-
<button title='a testset includes various settings, subscriptions and a model' name="loadmodeltype">set model type</button>
|
160
|
-
</div>
|
161
|
-
</div>
|
162
154
|
</ui-area> <!--}}}-->
|
163
155
|
<ui-area data-belongs-to-tab="dataelements" id="areadataelements" class="inactive"> <!--{{{-->
|
164
156
|
<button title='add entry'><span>New</span></button>
|
@@ -0,0 +1 @@
|
|
1
|
+
https://cpee.org/flow/engine/613
|
@@ -0,0 +1 @@
|
|
1
|
+
ffbc55c8-0759-42f8-955e-30ebf9c086a6
|
data/cockpit/track.html
CHANGED
@@ -55,6 +55,7 @@
|
|
55
55
|
<script type="text/javascript" src="js/details.js"></script>
|
56
56
|
<script type="text/javascript" src="js/parameters.js"></script>
|
57
57
|
<script type="text/javascript" src="js/track.js"></script>
|
58
|
+
<script type="text/javascript" src="js/modifiers.js"></script>
|
58
59
|
<link rel="stylesheet" href="css/ui.css" type="text/css"/>
|
59
60
|
<link rel="stylesheet" href="css/track.css" type="text/css"/>
|
60
61
|
</head>
|
data/cpee.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cpee"
|
3
|
-
s.version = "2.1.
|
3
|
+
s.version = "2.1.9"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.license = "LGPL-3.0"
|
6
6
|
s.summary = "Preliminary release of cloud process execution engine (cpee.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
|
data/lib/cpee/redis.rb
CHANGED
@@ -33,18 +33,25 @@ module CPEE
|
|
33
33
|
end
|
34
34
|
else # we always assume file socket if redis is startet locally
|
35
35
|
opts[:redis_dyn] = Proc.new { Redis.new(path: File.join(opts[:basepath],opts[:redis_path]), db: opts[:redis_db].to_i) }
|
36
|
+
tried = false
|
36
37
|
begin
|
37
38
|
opts[:redis] = opts[:redis_dyn].call
|
38
39
|
opts[:redis].dbsize
|
39
40
|
rescue
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
res = if tried
|
42
|
+
rcmd = opts[:redis_cmd]
|
43
|
+
rcmd.gsub! /#redis_path#/, File.join(opts[:basepath],opts[:redis_path])
|
44
|
+
rcmd.gsub! /#redis_db_dir#/, opts[:basepath]
|
45
|
+
rcmd.gsub! /#redis_db_name#/, opts[:redis_db_name]
|
46
|
+
rcmd.gsub! /#redis_pid#/, File.join(opts[:basepath],opts[:redis_pid])
|
47
|
+
system rcmd
|
48
|
+
else
|
49
|
+
true
|
50
|
+
end
|
46
51
|
if res
|
52
|
+
tried = true
|
47
53
|
puts 'starting redis ... it will keep running, just to let you know ...'
|
54
|
+
puts 'waiting for successful start ...'
|
48
55
|
sleep 1
|
49
56
|
retry
|
50
57
|
else
|
data/server/routing/end.pid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
42643
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
42631
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
42635
|
data/server/routing/persist.pid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
42639
|
data/tools/cpee
CHANGED
@@ -97,7 +97,7 @@ elsif command == 'cpui'
|
|
97
97
|
if !File.exists?(p1)
|
98
98
|
FileUtils.cp_r(cockpit,p1)
|
99
99
|
else
|
100
|
-
FileUtils.cp_r(Dir.glob(File.join(cockpit,'*')).delete_if{|e| e =~ /\.json/ || e=~ /legacy/ })
|
100
|
+
FileUtils.cp_r(Dir.glob(File.join(cockpit,'*')).delete_if{|e| e =~ /\.json/ || e=~ /legacy/ },p1,remove_destination: true)
|
101
101
|
puts "Directory already exists, updating ..."
|
102
102
|
end
|
103
103
|
js_libs(p1)
|
@@ -162,6 +162,7 @@ elsif command == 'archive'
|
|
162
162
|
names << File.basename(p2)
|
163
163
|
end
|
164
164
|
names.each do |name|
|
165
|
+
print "Working on: " + name.to_s + "\r"
|
165
166
|
res = Typhoeus.get(File.join(base,name.to_s,'/'))
|
166
167
|
if res.success?
|
167
168
|
if res.headers['Content-Type'] =~ /^(text|application)\/xml/
|
@@ -193,6 +194,7 @@ elsif command == 'archive'
|
|
193
194
|
end
|
194
195
|
end
|
195
196
|
end
|
197
|
+
puts
|
196
198
|
elsif command == 'abandon'
|
197
199
|
p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
|
198
200
|
base = File.dirname(p1)
|
@@ -215,6 +217,7 @@ elsif command == 'abandon'
|
|
215
217
|
names << File.basename(p1)
|
216
218
|
end
|
217
219
|
names.each do |name|
|
220
|
+
print "Working on: " + name.to_s + "\r"
|
218
221
|
res1 = Typhoeus.get(File.join(base,name.to_s,'properties','state','/'))
|
219
222
|
if res1.success?
|
220
223
|
if res1.response_body == 'ready' || res1.response_body == 'stopped'
|
@@ -222,6 +225,7 @@ elsif command == 'abandon'
|
|
222
225
|
end
|
223
226
|
end
|
224
227
|
end
|
228
|
+
puts
|
225
229
|
elsif command == 'start'
|
226
230
|
p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
|
227
231
|
base = File.dirname(p1)
|
@@ -256,7 +260,31 @@ elsif command == 'start'
|
|
256
260
|
end
|
257
261
|
end
|
258
262
|
elsif command == 'delete!'
|
259
|
-
|
263
|
+
p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
|
264
|
+
base = File.dirname(p1)
|
265
|
+
names = []
|
266
|
+
if File.basename(p1) =~ /(\d+)-(\d+)/
|
267
|
+
names = ($1.to_i..$2.to_i).to_a
|
268
|
+
elsif File.basename(p1) == '*'
|
269
|
+
res = Typhoeus.get(File.join(base,'/'))
|
270
|
+
if res.success?
|
271
|
+
XML::Smart.string(res.response_body) do |doc|
|
272
|
+
doc.find('//instance/@id').each do |ele|
|
273
|
+
names << ele.value
|
274
|
+
end
|
275
|
+
end
|
276
|
+
names.reverse!
|
277
|
+
else
|
278
|
+
exit
|
279
|
+
end
|
280
|
+
else
|
281
|
+
names << File.basename(p1)
|
282
|
+
end
|
283
|
+
names.each do |name|
|
284
|
+
print "Working on: " + name.to_s + "\r"
|
285
|
+
Typhoeus.delete(File.join(base,name.to_s,'/'))
|
286
|
+
end
|
287
|
+
puts
|
260
288
|
elsif command == 'new'
|
261
289
|
if !File.exists?(p1)
|
262
290
|
FileUtils.cp_r("#{curpath}/server/",p1)
|
data/tools/cpee.sic
ADDED
@@ -0,0 +1,306 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
curpath = __dir__
|
3
|
+
require 'rubygems'
|
4
|
+
require 'optparse'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'webrick'
|
7
|
+
require 'typhoeus'
|
8
|
+
require 'xml/smart'
|
9
|
+
require 'zip'
|
10
|
+
require 'pp'
|
11
|
+
|
12
|
+
def wrap(s, width=78, indent=18)
|
13
|
+
lines = []
|
14
|
+
line, s = s[0..indent-2], s[indent..-1]
|
15
|
+
s.split(/\n/).each do |ss|
|
16
|
+
ss.split(/[ \t]+/).each do |word|
|
17
|
+
if line.size + word.size >= width
|
18
|
+
lines << line
|
19
|
+
line = (" " * (indent)) + word
|
20
|
+
else
|
21
|
+
line << " " << word
|
22
|
+
end
|
23
|
+
end
|
24
|
+
lines << line if line
|
25
|
+
line = (" " * (indent-1))
|
26
|
+
end
|
27
|
+
return lines.join "\n"
|
28
|
+
end
|
29
|
+
|
30
|
+
ARGV.options { |opt|
|
31
|
+
opt.summary_indent = ' ' * 2
|
32
|
+
opt.summary_width = 15
|
33
|
+
opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] convert | ui | cpui DIR | new DIR | archive DIR URL | start URL | delete! URL | abandon URL\n"
|
34
|
+
opt.on("Options:")
|
35
|
+
opt.on("--help", "-h", "This text") { puts opt; exit }
|
36
|
+
opt.on("")
|
37
|
+
opt.on(wrap("[archive DIR URL] save properties from all finished instances listed at URL into DIR. Examples:\ncpee archive ./archive http://localhost:9298/1/\ncpee archive ./archive http://localhost:9298/1-200\ncpee archive ./archive http://localhost:9298/*"))
|
38
|
+
opt.on("")
|
39
|
+
opt.on(wrap("[abandon URL] running processes are stopped; ready or stopped processes are abandoned. Examples:\ncpee abandon http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200\ncpee abandon http://localhost:9298/*"))
|
40
|
+
opt.on("")
|
41
|
+
opt.on(wrap("[start URL] stopped processes are started; all others are not touched. Examples:\ncpee start http://localhost:9298/1\ncpee start http://localhost:9298/1-200\ncpee start http://localhost:9298/*"))
|
42
|
+
opt.on("")
|
43
|
+
opt.on(wrap("[delete! URL] DANGER ZONE. Vanishes forever. Not in archive. Examples:\ncpee delete! http://localhost:9298/1/"))
|
44
|
+
opt.on("")
|
45
|
+
opt.on(wrap("[new DIR] scaffolds a sample execution engine. Everything except instances can be removed for default behaviour."))
|
46
|
+
opt.on("")
|
47
|
+
opt.on(wrap("[cpui DIR] scaffolds a sample html client. New versions might require manual merging if you changed something."))
|
48
|
+
opt.on("")
|
49
|
+
opt.on(wrap("[ui] starts a simple static web server with the ui on http://localhost:8080. Use [cpui DIR] if you want stuff in apache or nginx."))
|
50
|
+
opt.on("")
|
51
|
+
opt.on(wrap("[convert] converts all testsets in the current directory to cpee2"))
|
52
|
+
opt.parse!
|
53
|
+
}
|
54
|
+
if (ARGV.length == 0) ||
|
55
|
+
(ARGV.length == 1 && !(%w(ui convert).include?(ARGV[0]))) ||
|
56
|
+
(ARGV.length == 2 && !(%w(abandon start delete! cpui new).include?(ARGV[0]))) ||
|
57
|
+
(ARGV.length == 3 && ARGV[0] != 'archive') ||
|
58
|
+
(ARGV.length > 3)
|
59
|
+
puts ARGV.options
|
60
|
+
exit
|
61
|
+
end
|
62
|
+
command = ARGV[0]
|
63
|
+
p1 = ARGV[1]
|
64
|
+
p2 = ARGV[2]
|
65
|
+
cockpit = "#{curpath}/../cockpit/"
|
66
|
+
|
67
|
+
def js_libs(cockpit)
|
68
|
+
res = Typhoeus.get('https://cpee.org/js_libs/js_libs.zip')
|
69
|
+
if res.success?
|
70
|
+
File.write(File.join(cockpit,'js_libs.zip'),res.response_body)
|
71
|
+
Zip::File.open(File.join(cockpit,'js_libs.zip')) do |zip_file|
|
72
|
+
zip_file.each do |entry|
|
73
|
+
case entry.ftype
|
74
|
+
when :directory
|
75
|
+
Dir.mkdir(File.join(cockpit,entry.name)) rescue nil
|
76
|
+
when :file
|
77
|
+
File.write(File.join(cockpit,entry.name),entry.get_input_stream.read)
|
78
|
+
when :symlink
|
79
|
+
FileUtils.ln_s(File.join('.',entry.get_input_stream.read),File.join(cockpit,entry.name), force: true)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
true
|
84
|
+
else
|
85
|
+
puts 'Internet access required to download javascript libs from "http://cpee.org/js_libs/js_libs.zip".'
|
86
|
+
false
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
if command == 'ui'
|
91
|
+
if js_libs(cockpit)
|
92
|
+
s = WEBrick::HTTPServer.new(:Port => 8080, :DocumentRoot => cockpit)
|
93
|
+
trap("INT"){ s.shutdown }
|
94
|
+
s.start
|
95
|
+
end
|
96
|
+
elsif command == 'cpui'
|
97
|
+
if !File.exists?(p1)
|
98
|
+
FileUtils.cp_r(cockpit,p1)
|
99
|
+
else
|
100
|
+
FileUtils.cp_r(Dir.glob(File.join(cockpit,'*')),p1,remove_destination: true)
|
101
|
+
puts "Directory already exists, updating ..."
|
102
|
+
end
|
103
|
+
js_libs(p1)
|
104
|
+
elsif command == 'convert'
|
105
|
+
Dir['*.xml'].each do |f|
|
106
|
+
XML::Smart.modify(f) do |doc|
|
107
|
+
doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
|
108
|
+
doc.register_namespace 'p', 'http://riddl.org/ns/common-patterns/properties/1.0'
|
109
|
+
doc.register_namespace 'x', 'http://cpee.org/ns/properties/2.0'
|
110
|
+
if doc.root.qname.name == 'testset'
|
111
|
+
doc.root.namespaces[nil] = 'http://cpee.org/ns/properties/2.0'
|
112
|
+
doc.root.namespace = nil
|
113
|
+
|
114
|
+
doc.find('//x:handlerwrapper').each do |e|
|
115
|
+
if e.text == 'DefaultHandlerWrapper'
|
116
|
+
doc.root.prepend('x:executionhandler','ruby')
|
117
|
+
end
|
118
|
+
end rescue nil
|
119
|
+
doc.find('//x:handlerwrapper').delete_all!
|
120
|
+
doc.find('//x:start_url').each do |e|
|
121
|
+
e.text = 'https://cpee.org/flow/start/url/'
|
122
|
+
end rescue nil
|
123
|
+
doc.find('//x:start_git').each do |e|
|
124
|
+
e.text = 'https://cpee.org/flow/start/git/'
|
125
|
+
end rescue nil
|
126
|
+
doc.find('//d:finalize | //d:update | //d:prepare | //d:rescue').each do |e|
|
127
|
+
if e.parent.qname.name != 'code'
|
128
|
+
n = e.parent
|
129
|
+
if (x = n.find('d:code')).any?
|
130
|
+
x.first.add(e)
|
131
|
+
else
|
132
|
+
n.add('d:code').add(e)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end rescue nil
|
136
|
+
|
137
|
+
doc.find('//p:*').each do |e|
|
138
|
+
e.namespaces.delete_all!
|
139
|
+
end rescue nil
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
elsif command == 'archive'
|
144
|
+
p2 = File.join(p2,'*') if p2 =~ /([a-zA-Z]|\/)$/
|
145
|
+
base = File.dirname(p2)
|
146
|
+
names = []
|
147
|
+
if File.basename(p2) =~ /(\d+)-(\d+)/
|
148
|
+
names = ($1.to_i..$2.to_i).to_a
|
149
|
+
elsif File.basename(p2) == '*'
|
150
|
+
res = Typhoeus.get(File.join(base,'/'))
|
151
|
+
if res.success?
|
152
|
+
XML::Smart.string(res.response_body) do |doc|
|
153
|
+
doc.find('//instance/@id').each do |ele|
|
154
|
+
names << ele.value
|
155
|
+
end
|
156
|
+
end
|
157
|
+
names.reverse!
|
158
|
+
else
|
159
|
+
exit
|
160
|
+
end
|
161
|
+
else
|
162
|
+
names << File.basename(p2)
|
163
|
+
end
|
164
|
+
names.each do |name|
|
165
|
+
print "Working on: " + name.to_s + "\r"
|
166
|
+
res = Typhoeus.get(File.join(base,name.to_s,'/'))
|
167
|
+
if res.success?
|
168
|
+
if res.headers['Content-Type'] =~ /^(text|application)\/xml/
|
169
|
+
XML::Smart.string(res.response_body) do |doc|
|
170
|
+
if doc.root.qname.to_s == "instances"
|
171
|
+
doc.root.children.each do |i|
|
172
|
+
if ["finished","abandoned"].include?(i.attributes['state']) || (["ready"].include?(i.attributes['state']) && Time.parse(i.attributes['changed']).to_i < Time.now-(60*60*24))
|
173
|
+
prop = Typhoeus.get(File.join(base,name.to_s,i.attributes['id'],'properties','/'))
|
174
|
+
if prop.success?
|
175
|
+
File.write(File.join(p1,i.attributes['uuid'] + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
|
176
|
+
Typhoeus.delete(File.join(base,name.to_s,i.attributes['id'],'/'))
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
elsif doc.root.qname.to_s == "info"
|
181
|
+
prop = Typhoeus.get(File.join(base,name.to_s,'properties','/'))
|
182
|
+
if prop.success?
|
183
|
+
xprop = XML::Smart::string(prop.response_body)
|
184
|
+
xprop.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
185
|
+
if ["finished","abandoned"].include?(xprop.find("string(/p:properties/p:state)")) || (["ready"].include?(xprop.find("string(/p:properties/p:state)")) && Time.parse(xprop.find("string(/p:properties/p:state/@changed)")) < Time.now-(60*60*12))
|
186
|
+
uuid = xprop.find("string(/p:properties/p:attributes/p:uuid)")
|
187
|
+
id = name.to_s
|
188
|
+
File.write(File.join(p1,uuid + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
|
189
|
+
Typhoeus.delete(File.join(base,name.to_s,'/'))
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
puts
|
198
|
+
elsif command == 'abandon'
|
199
|
+
p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
|
200
|
+
base = File.dirname(p1)
|
201
|
+
names = []
|
202
|
+
if File.basename(p1) =~ /(\d+)-(\d+)/
|
203
|
+
names = ($1.to_i..$2.to_i).to_a
|
204
|
+
elsif File.basename(p1) == '*'
|
205
|
+
res = Typhoeus.get(File.join(base,'/'))
|
206
|
+
if res.success?
|
207
|
+
XML::Smart.string(res.response_body) do |doc|
|
208
|
+
doc.find('//instance/@id').each do |ele|
|
209
|
+
names << ele.value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
names.reverse!
|
213
|
+
else
|
214
|
+
exit
|
215
|
+
end
|
216
|
+
else
|
217
|
+
names << File.basename(p1)
|
218
|
+
end
|
219
|
+
names.each do |name|
|
220
|
+
print "Working on: " + name.to_s + "\r"
|
221
|
+
res1 = Typhoeus.get(File.join(base,name.to_s,'properties','state','/'))
|
222
|
+
if res1.success?
|
223
|
+
if res1.response_body == 'ready' || res1.response_body == 'stopped'
|
224
|
+
Typhoeus.put(File.join(base,name.to_s,'properties','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
puts
|
229
|
+
elsif command == 'start'
|
230
|
+
p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
|
231
|
+
base = File.dirname(p1)
|
232
|
+
names = []
|
233
|
+
if File.basename(p1) =~ /(\d+)-(\d+)/
|
234
|
+
names = ($1.to_i..$2.to_i).to_a
|
235
|
+
elsif File.basename(p1) == '*'
|
236
|
+
res = Typhoeus.get(File.join(base,'/'))
|
237
|
+
if res.success?
|
238
|
+
XML::Smart.string(res.response_body) do |doc|
|
239
|
+
doc.find('//instance/@id').each do |ele|
|
240
|
+
names << ele.value
|
241
|
+
end
|
242
|
+
end
|
243
|
+
names.reverse!
|
244
|
+
else
|
245
|
+
exit
|
246
|
+
end
|
247
|
+
else
|
248
|
+
names << File.basename(p1)
|
249
|
+
end
|
250
|
+
names.each do |name|
|
251
|
+
res = Typhoeus.get(File.join(base,name.to_s,'properties','state','/'))
|
252
|
+
if res.success?
|
253
|
+
case res.response_body
|
254
|
+
when "stopped" then
|
255
|
+
keep_alive = Typhoeus.get(File.join(base,name.to_s,'properties','attributes','keep_alive','/'))
|
256
|
+
if keep_alive.success?
|
257
|
+
Typhoeus.put(File.join(base,name.to_s,'properties','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=running")
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
elsif command == 'delete!'
|
263
|
+
p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
|
264
|
+
base = File.dirname(p1)
|
265
|
+
names = []
|
266
|
+
if File.basename(p1) =~ /(\d+)-(\d+)/
|
267
|
+
names = ($1.to_i..$2.to_i).to_a
|
268
|
+
elsif File.basename(p1) == '*'
|
269
|
+
res = Typhoeus.get(File.join(base,'/'))
|
270
|
+
if res.success?
|
271
|
+
XML::Smart.string(res.response_body) do |doc|
|
272
|
+
doc.find('//instance/@id').each do |ele|
|
273
|
+
names << ele.value
|
274
|
+
end
|
275
|
+
end
|
276
|
+
names.reverse!
|
277
|
+
else
|
278
|
+
exit
|
279
|
+
end
|
280
|
+
else
|
281
|
+
names << File.basename(p1)
|
282
|
+
end
|
283
|
+
names.each do |name|
|
284
|
+
print "Working on: " + name.to_s + "\r"
|
285
|
+
Typhoeus.delete(File.join(base,name.to_s,'/'))
|
286
|
+
end
|
287
|
+
puts
|
288
|
+
elsif command == 'new'
|
289
|
+
if !File.exists?(p1)
|
290
|
+
FileUtils.cp_r("#{curpath}/server/",p1)
|
291
|
+
FileUtils.mkdir("#{p1}/archive") rescue nil
|
292
|
+
FileUtils.mkdir("#{p1}/instances") rescue nil
|
293
|
+
FileUtils.mkdir("#{p1}/resources") rescue nil
|
294
|
+
FileUtils.mkdir("#{p1}/executionhandler") rescue nil
|
295
|
+
Dir["#{curpath}/../systemd/*.service"].each do |f|
|
296
|
+
nam = File.basename f
|
297
|
+
cont = File.read(f)
|
298
|
+
cont.gsub!(/{CPEEUSER}/,`whoami`.strip)
|
299
|
+
cont.gsub!(/{CPEEWORKINGDIR}/,"#{File.realpath(p1)}")
|
300
|
+
cont.gsub!(/{CPEESERVER}/,"#{File.realpath(p1)}/server")
|
301
|
+
File.write("#{p1}/#{nam}",cont)
|
302
|
+
end
|
303
|
+
else
|
304
|
+
puts 'Directory already exists.'
|
305
|
+
end
|
306
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cpee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: tools
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-06-
|
13
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: riddl
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- cockpit/js/edit.js
|
140
140
|
- cockpit/js/instance.js
|
141
141
|
- cockpit/js/model.js
|
142
|
+
- cockpit/js/modifiers.js
|
142
143
|
- cockpit/js/parameters.js
|
143
144
|
- cockpit/js/replay.js
|
144
145
|
- cockpit/js/track.js
|
@@ -201,6 +202,8 @@ files:
|
|
201
202
|
- cockpit/templates/Track Test.xml
|
202
203
|
- cockpit/templates/UR-VUE 2020 Manual Adjust.xml
|
203
204
|
- cockpit/templates/UR-VUE 2020 Solution Baseline.xml
|
205
|
+
- cockpit/templates/UR-VUE 2020 Solution Baseline.xml.active
|
206
|
+
- cockpit/templates/UR-VUE 2020 Solution Baseline.xml.active-uuid
|
204
207
|
- cockpit/templates/UR-VUE 2020 Solution NN.xml
|
205
208
|
- cockpit/templates/UR-VUE 2020 Solution View.xml
|
206
209
|
- cockpit/templates/UR-VUE 2020.xml
|
@@ -640,6 +643,7 @@ files:
|
|
640
643
|
- server/server.conf
|
641
644
|
- server/server.rb
|
642
645
|
- tools/cpee
|
646
|
+
- tools/cpee.sic
|
643
647
|
- tools/server/cpee
|
644
648
|
- tools/server/resources/notifications/logging/subscription.xml
|
645
649
|
- tools/server/resources/properties.init
|