cockpit/js/instance.js in cpee-1.3.175 vs cockpit/js/instance.js in cpee-1.3.176

- old
+ new

@@ -8,47 +8,47 @@ save['dsl'] = undefined; save['endpoints'] = undefined; save['dataelements'] = undefined; save['details'] = undefined; var node_state = {}; -var sub_more = 'topic' + '=' + 'running' + '&' +// {{{ - 'events' + '=' + 'activity_calling,activity_manipulating,activity_failed,activity_done' + '&' + - 'topic' + '=' + 'running' + '&' + +var sub_more = 'topic' + '=' + 'activity' + '&' +// {{{ + 'events' + '=' + 'calling,status,manipulating,failed,done' + '&' + + 'topic' + '=' + 'activity' + '&' + 'votes' + '=' + 'syncing_after' + '&' + - 'topic' + '=' + 'properties/description' + '&' + + 'topic' + '=' + 'description' + '&' + 'events' + '=' + 'change,error' + '&' + - 'topic' + '=' + 'properties/position' + '&' + + 'topic' + '=' + 'position' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/state' + '&' + + 'topic' + '=' + 'state' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/dataelements' + '&' + + 'topic' + '=' + 'dataelements' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/endpoints' + '&' + + 'topic' + '=' + 'endpoints' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/transformation' + '&' + + 'topic' + '=' + 'transformation' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/handlerwrapper' + '&' + + 'topic' + '=' + 'handlerwrapper' + '&' + 'events' + '=' + 'result' + '&' + - 'topic' + '=' + 'properties/handlers' + '&' + + 'topic' + '=' + 'handlers' + '&' + 'events' + '=' + 'change';// }}} -var sub_less = 'topic' + '=' + 'running' + '&' +// {{{ - 'events' + '=' + 'activity_calling,activity_manipulating,activity_failed,activity_done' + '&' + - 'topic' + '=' + 'properties/position' + '&' + +var sub_less = 'topic' + '=' + 'activity' + '&' +// {{{ + 'events' + '=' + 'calling,status,manipulating,failed,done' + '&' + + 'topic' + '=' + 'position' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/description' + '&' + + 'topic' + '=' + 'description' + '&' + 'events' + '=' + 'change,error' + '&' + - 'topic' + '=' + 'properties/state' + '&' + + 'topic' + '=' + 'state' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/dataelements' + '&' + + 'topic' + '=' + 'dataelements' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/endpoints' + '&' + + 'topic' + '=' + 'endpoints' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/transformation' + '&' + + 'topic' + '=' + 'transformation' + '&' + 'events' + '=' + 'change' + '&' + - 'topic' + '=' + 'properties/handlerwrapper' + '&' + + 'topic' + '=' + 'handlerwrapper' + '&' + 'events' + '=' + 'result' + '&' + - 'topic' + '=' + 'properties/handlers' + '&' + + 'topic' + '=' + '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); }); @@ -58,12 +58,12 @@ $("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); + $("input[name=testsetfile]").change(load_testsetfile_after); + $("input[name=modelfile]").change(load_modelfile_after); $.ajax({ url: "testsets/testsets.xml", dataType: 'xml', success: function(res){ @@ -171,10 +171,13 @@ // Change url to return to current instance when reloading $("input[name=current-instance]").val(url); $("#current-instance").text(url); $("#current-instance").attr('href',url); + $("#current-instance-properties").attr('href',url + 'properties/'); + $("#current-instance-subscriptions").attr('href',url + 'subscriptions/'); + $("#current-instance-callbacks").attr('href',url + 'callbacks/'); history.replaceState({}, '', '?monitor='+url); // Change url to return to current instance when reloading (because new subscription is made) $("input[name=votecontinue]").removeAttr('checked'); subscription_state = 'less'; @@ -199,29 +202,29 @@ }; ws.onmessage = function(e) { data = $.parseXML(e.data); if ($('event > topic',data).length > 0) { switch($('event > topic',data).text()) { - case 'properties/dataelements': + case 'dataelements': monitor_instance_dataelements(); break; - case 'properties/description': + case 'description': monitor_instance_dsl(); break; - case 'properties/endpoints': + case 'endpoints': monitor_instance_endpoints(); break; - case 'properties/state': + case 'state': monitor_instance_state_change(JSON.parse($('event > notification',data).text()).state); break; - case 'properties/position': + case 'position': monitor_instance_pos_change($('event > notification',data).text()); break; - case 'properties/transformation': + case 'transformation': monitor_instance_transformation(); break; - case 'running': + case 'activity': 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()); } @@ -390,13 +393,13 @@ }// }}} function monitor_instance_running(notification,event) {// {{{ if (save['state'] == "stopping") return; var parts = JSON.parse(notification); - if (event == "activity_calling") + if (event == "calling") format_visual_add(parts.activity,"active") - if (event == "activity_done") + if (event == "done") format_visual_remove(parts.activity,"active") } // }}} function monitor_instance_state_change(notification) { //{{{ if (notification == "ready" || notification == "stopped" || notification == "running") { $("#state button").removeAttr('disabled'); @@ -537,15 +540,14 @@ testset.append(pars); $.ajax({ type: "GET", url: base + "/properties/values/attributes/", success: function(res){ + var name = $("value > info",res).text(); var pars = $X('<attributes/>'); - pars.append($(res.documentElement)); + pars.append($(res.documentElement).children()); 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 @@ -563,11 +565,11 @@ error: report_failure }); }, error: report_failure }); -}// }}} +}// }}} function save_svg() {// {{{ var base = $("input[name=current-instance]").val(); var params = { mimetype: 'image/svg+xml' }; var gc = $('#graphcanvas').clone(); @@ -578,11 +580,11 @@ gc.prepend($X('<style xmlns="http://www.w3.org/2000/svg" type="text/css"><![CDATA[' + res + ']]></style>')); $.ajax({ type: "GET", url: base + "/properties/values/attributes/info/", success: function(res){ - var name = res; + var name = $(res.documentElement).text(); $('#savesvg').attr('download',name + '.svg'); $('#savesvg').attr('href','data:application/xml;charset=utf-8;base64,' + window.btoa(gc.serializeXML())); document.getElementById('savesvg').click(); }, @@ -649,9 +651,10 @@ }); }// }}} function load_testsetfile_after() { //{{{ if (running) return; + console.log('rrrr'); running = true; if (typeof window.FileReader !== 'function') { alert('FileReader not yet supportet'); return; }