cockpit/js/instance.js in cpee-2.1.10 vs cockpit/js/instance.js in cpee-2.1.11

- old
+ new

@@ -1,7 +1,7 @@ var es; -var suspended_monitoring = false; +var suspended_redrawing = false; var myid = ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)); var paths = '#dat_details input, #dat_details textarea, #dat_details select, #dat_details button, #dat_details [contenteditable], #dat_dataelements input, #dat_dataelements textarea, #dat_dataelements select, #dat_dataelements button, #dat_dataelements [contenteditable], #dat_endpoints input, #dat_endpoints textarea, #dat_endpoints select, #dat_endpoints button, #dat_endpoints [contenteditable], #dat_attributes input, #dat_attributes textarea, #dat_attributes select, #dat_attributes button, #dat_attributes [contenteditable]'; var loading = false; var subscription; var subscription_state = 'less'; @@ -11,11 +11,11 @@ save['dataelements'] = undefined; save['attributes'] = undefined; var node_state = {}; function global_init() { - suspended_monitoring = false; + suspended_redrawing = false; loading = false; subscription = undefined; subscription_state = 'less'; save['state']= undefined; save['dsl'] = undefined; @@ -278,14 +278,12 @@ case 'endpoints': monitor_instance_values("endpoints"); break; case 'attributes': monitor_instance_values("attributes"); - if (!suspended_monitoring) { // or else it would load twice, because dsl changes also trigger - if (save['graph_theme'] != data.content.values.theme) { - monitor_graph_change(true); - } + if (save['graph_theme'] != data.content.values.theme) { + monitor_graph_change(true); } break; case 'task': if ($('#trackcolumn').length > 0) { $('#trackcolumn').append($('<iframe src="track.html?monitor=' + data.content.received['CPEE-INSTANCE-URL'].replace(/\/*$/,'/') + '"></iframe>')); @@ -480,11 +478,15 @@ } } }); } //}}} function adaptor_init(url,theme,dslx) { //{{{ + // while inside and svgs are reloaded, do nothing here + if (suspended_redrawing) { return; } if (save['graph_theme'] != theme) { + // while inside and svgs are reloaded, do nothing here + suspended_redrawing = true; save['graph_theme'] = theme; save['graph_adaptor'] = new WfAdaptor($('body').data('theme-base') + '/' + theme + '/theme.js',function(graphrealization){ manifestation.endpoints = save.endpoints_list; graphrealization.draw_labels = function(max,labels,shift,striped) { $('#graphcanvas').css('grid-row', '1/span ' + (max.row + 2)); @@ -568,21 +570,23 @@ } }; adaptor_update(); monitor_instance_pos(); $('#dat_details').empty(); + + // while inside and svgs are reloaded, do nothing here + suspended_redrawing = false; }); } else { save['graph_adaptor'].update(function(graphrealization){ var svgid = manifestation.selected(); graphrealization.set_description($(dslx)); adaptor_update(); manifestation.events.click(svgid); format_instance_pos(); }); } - suspended_monitoring = false; } //}}} function monitor_graph_change(force) { //{{{ var url = $('body').attr('current-instance'); $.ajax({ @@ -919,10 +923,9 @@ } }); }// }}} async function set_testset(testset,exec) {// {{{ var url = $('body').attr('current-instance'); - suspended_monitoring = true; var promises = []; var tset = $X('<properties xmlns="http://cpee.org/ns/properties/2.0"/>'); tset.append($("testset > executionwrapper",testset));