cockpit/js/instance.js in cpee-1.3.173 vs cockpit/js/instance.js in cpee-1.3.174
- old
+ new
@@ -22,10 +22,12 @@
'events' + '=' + 'change' + '&' +
'topic' + '=' + 'properties/dataelements' + '&' +
'events' + '=' + 'change' + '&' +
'topic' + '=' + 'properties/endpoints' + '&' +
'events' + '=' + 'change' + '&' +
+ 'topic' + '=' + 'properties/transformation' + '&' +
+ 'events' + '=' + 'change' + '&' +
'topic' + '=' + 'properties/handlerwrapper' + '&' +
'events' + '=' + 'result' + '&' +
'topic' + '=' + 'properties/handlers' + '&' +
'events' + '=' + 'change';// }}}
var sub_less = 'topic' + '=' + 'running' + '&' +// {{{
@@ -38,22 +40,25 @@
'events' + '=' + 'change' + '&' +
'topic' + '=' + 'properties/dataelements' + '&' +
'events' + '=' + 'change' + '&' +
'topic' + '=' + 'properties/endpoints' + '&' +
'events' + '=' + 'change' + '&' +
+ 'topic' + '=' + 'properties/transformation' + '&' +
+ 'events' + '=' + 'change' + '&' +
'topic' + '=' + 'properties/handlerwrapper' + '&' +
'events' + '=' + 'result' + '&' +
'topic' + '=' + 'properties/handlers' + '&' +
'events' + '=' + 'change';// }}}
$(document).ready(function() {// {{{
$("input[name=base-url]").val(location.protocol + "//" + location.host + ":" + $('body').data('defaultport'));
$("button[name=base]").click(function(){ create_instance(null); });
$("button[name=instance]").click(function(){ ui_tab_click("#tabinstance"); monitor_instance(false); });
- $("button[name=loadtestset]").click(load_testset);
- $("button[name=loadmodeltype]").click(load_modeltype);
- $("button[name=loadmodelfile]").click(load_model);
+ $("button[name=loadtestset]").click(function(e){new CustomMenu(e).menu($('#predefinedtestsets'),load_testset); });
+ $("button[name=loadtestsetfile]").click(load_testsetfile);
+ $("button[name=loadmodelfile]").click(load_modelfile);
+ $("button[name=loadmodeltype]").click(function(e){new CustomMenu(e).menu($('#modeltypes'),load_modeltype, $("button[name=loadmodeltype]")); });
$("button[name=savetestset]").click(function(){ save_testset(); });
$("button[name=savesvg]").click(function(){ save_svg(); });
$("input[name=votecontinue]").click(check_subscription);
$("input[name=testsetfile]").change(load_testsetfile);
$("input[name=modelfile]").change(load_modelfile);
@@ -62,15 +67,12 @@
url: "testsets/testsets.xml",
dataType: 'xml',
success: function(res){
$('testset',res).each(function(){
var ts = $(this).text();
- $('select[name=testset-names] optgroup:last-child').append(
- $("<option></option>").attr("value",ts).text(ts)
- );
+ $('#predefinedtestsets').append($("<div class='menuitem'></div>").text(ts));
});
- $('select[name=testset-names] optgroup:last-child option:first-child').attr('selected','selected');
var q = $.parseQuery();
if (q.monitor && q.load) {
$("input[name=instance-url]").val(q.monitor);
$("select[name=testset-names]").val(q.load)
ui_tab_click("#tabexecution");
@@ -91,13 +93,11 @@
url: "testsets/transformations.xml",
dataType: 'xml',
success: function(res){
$('transformation',res).each(function(){
var ts = $(this).text();
- $('select[name=transformation-names]').append(
- $("<option></option>").attr("value",ts).text(ts)
- );
+ $('#modeltypes').append($("<div class='menuitem'></div>").text(ts));
});
}
});
});// }}}
@@ -214,10 +214,13 @@
monitor_instance_state_change(JSON.parse($('event > notification',data).text()).state);
break;
case 'properties/position':
monitor_instance_pos_change($('event > notification',data).text());
break;
+ case 'properties/transformation':
+ monitor_instance_transformation();
+ break;
case 'running':
monitor_instance_running($('event > notification',data).text(),$('event > event',data).text());
break;
}
append_to_log("event", $('event > topic',data).text() + "/" + $('event > event',data).text(), $('event > notification',data).text());
@@ -235,10 +238,11 @@
}
});
monitor_instance_dataelements();
monitor_instance_endpoints();
+ monitor_instance_transformation();
monitor_instance_dsl();
monitor_instance_state();
},
error: function(a,b,c) {
alert("This ain't no CPEE instance");
@@ -353,10 +357,23 @@
success: function(res){
monitor_instance_state_change(res);
}
});
}// }}}
+function monitor_instance_transformation() {// {{{
+ var url = $("input[name=current-instance]").val();
+ $.ajax({
+ type: "GET",
+ url: url + "/properties/values/attributes/modeltype",
+ success: function(res){
+ $("#currentmodel").text($(res.documentElement).text());
+ },
+ error: function() {
+ $("#currentmodel").text('???');
+ }
+ });
+}// }}}
function monitor_instance_pos() {// {{{
var url = $("input[name=current-instance]").val();
$.ajax({
type: "GET",
@@ -518,13 +535,17 @@
testset.append(pars);
pars = $X('<transformation><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>');
testset.append(pars);
$.ajax({
type: "GET",
- url: base + "/properties/values/info/",
+ url: base + "/properties/values/attributes/",
success: function(res){
- var name = res;
+ var pars = $X('<attributes/>');
+ pars.append($(res.documentElement));
+ testset.append(pars);
+ var name = $("values > info",res);
+ console.log(res);
$('#savetestset').attr('download',name + '.xml');
$('#savetestset').attr('href','data:application/xml;charset=utf-8;base64,' + window.btoa(testset.serializeXML()));
document.getElementById('savetestset').click();
},
error: report_failure
@@ -555,11 +576,11 @@
url: "lib/wfadaptor.css",
success: function(res){
gc.prepend($X('<style xmlns="http://www.w3.org/2000/svg" type="text/css"><![CDATA[' + res + ']]></style>'));
$.ajax({
type: "GET",
- url: base + "/properties/values/info/",
+ url: base + "/properties/values/attributes/info/",
success: function(res){
var name = res;
$('#savesvg').attr('download',name + '.svg');
$('#savesvg').attr('href','data:application/xml;charset=utf-8;base64,' + window.btoa(gc.serializeXML()));
@@ -624,11 +645,12 @@
error: report_failure
});
}
});
}// }}}
-function load_testsetfile() { //{{{
+
+function load_testsetfile_after() { //{{{
if (running) return;
running = true;
if (typeof window.FileReader !== 'function') {
alert('FileReader not yet supportet');
return;
@@ -641,12 +663,17 @@
}
reader.onerror = function(){ running = false; }
reader.onabort = function(){ running = false; }
reader.readAsText(files[0]);
} //}}}
-function load_modelfile() { //{{{
+function load_testsetfile() {// {{{
if (running) return;
+ document.getElementById('testsetfile').click();
+}// }}}
+
+function load_modelfile_after() { //{{{
+ if (running) return;
running = true;
if (typeof window.FileReader !== 'function') {
alert('FileReader not yet supportet');
return;
}
@@ -659,55 +686,56 @@
}
reader.onerror = function(){ running = false; }
reader.onabort = function(){ running = false; }
reader.readAsText(files[0]);
} //}}}
+function load_modelfile() {// {{{
+ if (running) return;
+ document.getElementById('modelfile').click();
+}// }}}
+
function load_testset() {// {{{
if (running) return;
running = true;
- save['dsl'] = null; // reload dsl and position under all circumstances
-
- $('#main .tabbehind button').hide();
- $('#dat_details').empty();
- var name = $("select[name=testset-names]").val();
+ var name = $("#predefinedtestsets div.menuitem[data-selected=selected]").text();
+ $.ajax({
+ cache: false,
+ dataType: 'xml',
+ url: "testsets/" + name + ".xml",
+ success: function(res){
+ save['dsl'] = null; // reload dsl and position under all circumstances
+ $('#main .tabbehind button').hide();
+ $('#dat_details').empty();
- if (name == '###') {
- running = false;
- document.getElementById('testsetfile').click();
- } else {
- $.ajax({
- cache: false,
- dataType: 'xml',
- url: "testsets/" + name + ".xml",
- success: function(res){
- document.title = name;
- set_testset(res);
- },
- complete: function() {
- running = false;
- }
- });
- }
+ document.title = name;
+ set_testset(res);
+ },
+ complete: function() {
+ running = false;
+ }
+ });
}// }}}
-
-function load_model() {// {{{
- if (running) return;
- document.getElementById('modelfile').click();
-}// }}}
-
function load_modeltype() {// {{{
if (running) return;
+ var url = $("input[name=current-instance]").val();
running = true;
- var name = $("select[name=transformation-names]").val();
-
+ var name = $("#modeltypes div.menuitem[data-selected=selected]").text();
$.ajax({
cache: false,
dataType: 'xml',
url: "testsets/" + name + ".xml",
success: function(res){
- set_testset(res);
+ $.ajax({
+ type: "PUT",
+ url: url + "/properties/values/attributes/modeltype",
+ data: ({value: name}),
+ success: function(){
+ set_testset(res);
+ },
+ error: report_failure
+ });
},
complete: function() {
running = false;
}
});