cockpit/js/instance.js in cpee-1.3.214 vs cockpit/js/instance.js in cpee-1.3.215

- old
+ new

@@ -4,10 +4,12 @@ var subscription_state = 'less'; var save = {}; save['state']= undefined; save['dsl'] = undefined; save['graph'] = undefined; + save['graph_theme'] = undefined; + save['graph_adaptor'] = undefined; save['endpoints'] = undefined; save['dataelements'] = undefined; save['attributes'] = undefined; save['details'] = undefined; save['details_target'] = undefined; @@ -297,29 +299,40 @@ } }); } // }}} function adaptor_init(url,theme,dslx) { - new WfAdaptor($('body').data('theme-base') + '/' + theme + '/theme.js',function(graphrealization){ - graphrealization.set_svg_container($('#graphcanvas')); - graphrealization.set_description($(dslx), true); - graphrealization.notify = function(svgid) { - var g = graphrealization.get_description(); - save['graph'] = $X(g); - save['graph'].find('[xmlns]').removeAttr('xmlns'); - $.ajax({ - type: "PUT", - url: url + "/properties/values/description/", - data: ({'content': '<content>' + g + '</content>'}) - }); + if (save['graph_theme'] != theme) { + save['graph_theme'] = theme; + save['graph_adaptor'] = new WfAdaptor($('body').data('theme-base') + '/' + theme + '/theme.js',function(graphrealization){ + graphrealization.set_svg_container($('#graphcanvas')); + graphrealization.set_description($(dslx), true); + graphrealization.notify = function(svgid) { + var g = graphrealization.get_description(); + save['graph'] = $X(g); + save['graph'].find('[xmlns]').removeAttr('xmlns'); + $.ajax({ + type: "PUT", + url: url + "/properties/values/description/", + data: ({'content': '<content>' + g + '</content>'}) + }); + manifestation.events.click(svgid); + }; + monitor_instance_pos(); + $('#dat_details').empty(); + }); + } else { + save['graph_adaptor'].update(function(graphrealization){ + var svgid = manifestation.clicked(); + graphrealization.set_description($(dslx)); manifestation.events.click(svgid); - }; - monitor_instance_pos(); - }); + monitor_instance_pos(); + }); + } } -function monitor_graph_change(force) { +function monitor_graph_change(force) { //{{{ var url = $("#current-instance").text(); $.ajax({ type: "GET", url: url + "/properties/values/dslx/", success: function(dslx){ @@ -335,11 +348,11 @@ } }); } } }); -} +} //}}} function monitor_instance_dsl() {// {{{ var url = $("#current-instance").text(); $.ajax({ type: "GET", @@ -675,11 +688,11 @@ } var files = $('#testsetfile').get(0).files; var reader = new FileReader(); reader.onload = function(){ set_testset($.parseXML(reader.result),false); - document.getElementById("fuckchrome").reset(); + document.getElementById('fuckchrome').reset(); running = false; } reader.onerror = function(){ console.log('error reading file'); running = false; } reader.onabort = function(){ console.log('abort reading file'); running = false; } reader.readAsText(files[0]); @@ -943,15 +956,21 @@ } }//}}} function format_visual_clear() {//{{{ node_state = {}; - $('.super .active').each(function(a,b){b.setAttribute("class","active");}); - $('.super .passive').each(function(a,b){b.setAttribute("class","passive");}); - $('.super .vote').each(function(a,b){b.setAttribute("class","vote");}); - $('.super .colon').each(function(a,b){b.setAttribute("class","colon");}); - $('.activities').each(function(a,b){b.setAttribute("class","activities");}); - $("#votes").empty(); + $('.super .active').each(function(a,b){b.setAttribute('class','active');}); + $('.super .passive').each(function(a,b){b.setAttribute('class','passive');}); + $('.super .vote').each(function(a,b){b.setAttribute('class','vote');}); + $('.super .colon').each(function(a,b){b.setAttribute('class','colon');}); + $('.activities').each(function(a,b){ + if (b.hasAttribute('clicked')) { + b.setAttribute('class','activities clicked'); + } else { + b.setAttribute('class','activities'); + } + }); + $('#votes').empty(); }//}}} function format_visual_vote_clear() {//{{{ node_state = {}; $('.super .vote').each(function(a,b){b.setAttribute("class","vote");}); $("#votes").empty();