cockpit/js/instance.js in cpee-1.3.119 vs cockpit/js/instance.js in cpee-1.3.120

- old
+ new

@@ -48,11 +48,10 @@ $("button[name=loadtestset]").click(load_testset); $("button[name=loadtestsetfile]").click(load_testsetfile); $("button[name=savetestset]").click(function(){ save_testset(); }); $("button[name=savesvg]").click(function(){ save_svg(); }); $("input[name=votecontinue]").click(check_subscription); - $("input[name=votestop]").click(check_subscription); $.ajax({ url: "testsets/index.xml", dataType: 'xml', success: function(res){ @@ -80,11 +79,10 @@ function check_subscription() { // {{{ var url = $("input[name=current-instance]").val(); var num = 0; if ($("input[name=votecontinue]").is(':checked')) num += 1; - if ($("input[name=votestop]").is(':checked')) num += 1; if (num > 0 && subscription_state == 'less') { $.ajax({ type: "PUT", url: url + "/notifications/subscriptions/" + subscription, data: ( @@ -147,15 +145,18 @@ $(".tabbed.hidden").removeClass("hidden"); $(".tabbed .tab.hidden").removeClass("hidden"); // Change url to return to current instance when reloading $("input[name=current-instance]").val(url); - $("#current-instance").html("<a href='" + url + "' target='_blank'>" + url + "</a>"); + $("#current-instance").text(url); + $("#current-instance").attr('href',url); history.replaceState({}, '', '?monitor='+url); ui_tab_click($("#tabinstance")[0]); + // Change url to return to current instance when reloading (because new subscription is made) + $("input[name=votecontinue]").removeAttr('checked'); $.ajax({ type: "POST", url: url + "/notifications/subscriptions/", data: sub_less, success: function(res){ @@ -295,11 +296,11 @@ ctv.append(res); $.ajax({ type: "GET", - url: url + "/properties/values/description/", + url: url + "/properties/values/dslx/", success: function(res){ graphrealization = new WfAdaptor(CPEE); graphrealization.set_svg_container($('#graphcanvas')); graphrealization.set_description($(res), true); graphrealization.notify = function(svgid) { @@ -369,17 +370,17 @@ format_visual_clear(); } var but = ""; if (notification == "ready" || notification == "stopped") { - but = "<td>⇒</td><td><button onclick='$(this).attr(\"disabled\",\"disabled\");start_instance();'>start</button> / <button onclick='$(this).attr(\"disabled\",\"disabled\");sim_instance();'>simulate</button></td>"; + but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");start_instance();'>start</button> / <button onclick='$(this).attr(\"disabled\",\"disabled\");sim_instance();'>simulate</button>"; } if (notification == "running") { - but = "<td>⇒</td><td><button onclick='$(this).attr(\"disabled\",\"disabled\");stop_instance();'>stop</button></td>"; + but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");stop_instance();'>stop</button>"; } - ctv.append("<tr><td>State:</td><td>" + notification + "</td>" + but + "</tr>"); + ctv.append(notification + but); } } //}}} function monitor_instance_pos_change(notification) {// {{{ var parts = JSON.parse(notification); if (parts['unmark']) { @@ -396,16 +397,13 @@ function monitor_instance_vote_add(notification) {// {{{ var parts = JSON.parse(notification); var ctv = $("#votes"); - var astr = "<tr id='vote_to_continue-" + parts.activity + "-" + parts.callback + "'><td>Activity:</td><td>" + parts.activity + "</td><td>⇒</td>"; + astr = ''; if ($("input[name=votecontinue]").is(':checked')) - astr += "<td><button onclick='$(this).attr(\"disabled\",\"disabled\");monitor_instance_vote_remove(\"" + parts.activity + "\",\"" + parts.callback + "\",\"true\");'>vote to continue</button></td>"; - if ($("input[name=votestop]").is(':checked')) - astr += "<td><button onclick='$(this).attr(\"disabled\",\"disabled\");monitor_instance_vote_remove(\"" + parts.activity + "\",\"" + parts.callback + "\",\"false\");'>vote to stop</button></td>"; - astr += "</tr>"; + astr += "<button id='vote_to_continue-" + parts.activity + "-" + parts.callback + "' onclick='$(this).attr(\"disabled\",\"disabled\");monitor_instance_vote_remove(\"" + parts.activity + "\",\"" + parts.callback + "\",\"true\");'>" + parts.activity + "</button>"; ctv.append(astr); format_visual_add(parts.activity,"vote") }// }}} function monitor_instance_vote_remove(activity,callback,value) {//{{{ var url = $("input[name=current-instance]").val(); @@ -480,21 +478,23 @@ testset.append(pars); $.ajax({ type: "GET", url: base + "/properties/values/description/", success: function(res){ - testset.append($(res.documentElement)); + var pars = $X('<description/>'); + pars.append($(res.documentElement)); + testset.append(pars); $.ajax({ type: "GET", url: base + "/properties/values/transformation/", success: function(res){ var pars = $X('<transformation/>'); - pars.append($(res.documentElement)); + pars.append($(res.documentElement).children()); testset.append(pars); $.ajax({ type: "GET", - url: base + "/properties/values/name/", + url: base + "/properties/values/info/", success: function(res){ var name = res; $('#savetestset').attr('download',name + '.xml'); $('#savetestset').attr('href','data:application/xml;charset=utf-8;base64,' + window.btoa(testset.serializeXML())); @@ -531,11 +531,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/name/", + url: base + "/properties/values/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())); @@ -581,15 +581,23 @@ load_testset_des(url,testset); }, error: report_failure }); + load_testset_hw(url,testset); $.ajax({ - type: "PUT", - url: url + "/properties/values/handlerwrapper", - success: function() { load_testset_hw(url,testset); }, - error: report_failure + type: "GET", + url: url + "/properties/values/state/", + dataType: "text", + success: function(res){ + $.ajax({ + type: "PUT", + url: url + "/properties/values/state", + data: ({value: res}), + error: report_failure + }); + } }); }// }}} function load_testsetfile() { //{{{ if (running) return; if (typeof window.FileReader !== 'function') { @@ -627,17 +635,19 @@ }); running = false; }// }}} function load_testset_des(url,testset) {// {{{ - $("testset > description",testset).each(function(){ - var val = "<content>" + $(this).serializeXML() + "</content>"; - $.ajax({ - type: "PUT", - url: url + "/properties/values/description", - data: ({content: val}), - error: report_failure - }); + var ser = ''; + $("testset > description > *",testset).each(function(){ + ser += $(this).serializeXML() + "\n"; + }); + var val = "<content>" + ser + "</content>"; + $.ajax({ + type: "PUT", + url: url + "/properties/values/description", + data: ({content: val}), + error: report_failure }); } // }}} function load_testset_hw(url,testset) {// {{{ $("testset > handlerwrapper",testset).each(function(){ var val = $(this).text();