cockpit/js/instance.js in cpee-1.4.24 vs cockpit/js/instance.js in cpee-1.4.25

- old
+ new

@@ -88,32 +88,44 @@ ui_toggle_vis_tab($('#instance')); ui_toggle_vis_tab($('#parameters')); } if (q.monitor && q.load) { $("input[name=instance-url]").val(q.monitor); - $("#predefinedtestsets div.menuitem").each(function(k,v){ - if ($(v).text() == q.load) { $(v).attr('data-selected','selected'); } - }); + if (q.load.match(/https?:\/\//)) { + $("#predefinedtestsets").attr('data-other',q.load); + } else { + $("#predefinedtestsets div.menuitem").each(function(k,v){ + if ($(v).text() == q.load) { $(v).attr('data-selected','selected'); } + }); + } ui_activate_tab("#tabexecution"); monitor_instance(true,false); } else if (q.load) { - $("#predefinedtestsets div.menuitem").each(function(k,v){ - if ($(v).text() == q.load) { $(v).attr('data-selected','selected'); } - }); + if (q.load.match(/https?:\/\//)) { + $("#predefinedtestsets").attr('data-other',q.load); + } else { + $("#predefinedtestsets div.menuitem").each(function(k,v){ + if ($(v).text() == q.load) { $(v).attr('data-selected','selected'); } + }); + } ui_activate_tab("#tabexecution"); create_instance(q.load,false); } else if (q.new || q.new == "" || q.load == "") { ui_activate_tab("#tabinstance"); create_instance("Plain Instance",false); } else if (q.monitor) { $("input[name=instance-url]").val(q.monitor); ui_activate_tab("#tabexecution"); monitor_instance(false,false); } else if (q.exec) { - $("#predefinedtestsets div.menuitem").each(function(k,v){ - if ($(v).text() == q.exec) { $(v).attr('data-selected','selected'); } - }); + if (q.exec.match(/https?:\/\//)) { + $("#predefinedtestsets").attr('data-other',q.load); + } else { + $("#predefinedtestsets div.menuitem").each(function(k,v){ + if ($(v).text() == q.exec) { $(v).attr('data-selected','selected'); } + }); + } ui_activate_tab("#tabexecution"); create_instance(q.exec,true); } } }); @@ -680,18 +692,27 @@ error: report_failure }); }// }}} function save_svg() {// {{{ var url = $('body').attr('current-instance'); - var params = { mimetype: 'image/svg+xml' }; var gc = $('#graphcanvas').clone(); $.ajax({ type: "GET", url: "css/wfadaptor.css", success: function(res){ gc.prepend($X('<style xmlns="http://www.w3.org/2000/svg" type="text/css"><![CDATA[' + res + ']]></style>')); + $(window.document.styleSheets).each(function(i,x){ + if (x && x.href && x.href.match(/wfadaptor\.css$/)) { + $(x.cssRules).each(function(j,y){ + var loc = $(gc).find(y.selectorText.replace(/^svg /,'')); + loc.attr('style',y.style.cssText); + }); + var loc = $(gc).find('text.super'); + loc.attr('style',loc.attr('style') + ' display: none'); + } + }); $.ajax({ type: "GET", url: url + "/properties/values/attributes/info/", success: function(res){ var name = $(res.documentElement).text(); @@ -817,25 +838,33 @@ function load_testset(exec) {// {{{ if (loading) return; loading = true; var name = $("#predefinedtestsets div.menuitem[data-selected=selected]").text(); - $.ajax({ - cache: false, - dataType: 'xml', - url: $('body').attr('current-testsets') + name + ".xml", - success: function(res){ - save['dsl'] = null; // reload dsl and position under all circumstances - $('#main .tabbehind button').hide(); - $('#dat_details').empty(); + var url; + if (name) { + url = $('body').attr('current-testsets') + name + ".xml"; + } else { + url = $("#predefinedtestsets").attr('data-other'); + } + if (url) { + $.ajax({ + cache: false, + dataType: 'xml', + url: url, + success: function(res){ + save['dsl'] = null; // reload dsl and position under all circumstances + $('#main .tabbehind button').hide(); + $('#dat_details').empty(); - document.title = "Untitled"; - set_testset(res,exec); - }, - complete: function() { - loading = false; - } - }); + document.title = "Untitled"; + set_testset(res,exec); + }, + complete: function() { + loading = false; + } + }); + } }// }}} function load_modeltype() {// {{{ if (loading) return; var url = $('body').attr('current-instance'); loading = true;