cockpit/js/instance.js in cpee-1.3.185 vs cockpit/js/instance.js in cpee-1.3.187
- old
+ new
@@ -3,10 +3,11 @@
var subscription;
var subscription_state = 'less';
var save = {};
save['state']= undefined;
save['dsl'] = undefined;
+ save['graph'] = undefined;
save['endpoints'] = undefined;
save['dataelements'] = undefined;
save['attributes'] = undefined;
save['details'] = undefined;
save['details_target'] = undefined;
@@ -226,11 +227,11 @@
monitor_instance_values("endpoints");
break;
case 'attributes':
monitor_instance_values("attributes");
monitor_instance_transformation();
- monitor_graph_change();
+ monitor_graph_change(true);
break;
case 'state':
monitor_instance_state_change(JSON.parse($('event > notification',data).text()).state);
break;
case 'position':
@@ -286,37 +287,41 @@
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);
$.ajax({
type: "PUT",
url: url + "/properties/values/description/",
- data: ({'content': '<content>' + graphrealization.get_description() + '</content>'})
+ data: ({'content': '<content>' + g + '</content>'})
});
- manifestation.events.click(svgid,undefined);
+ manifestation.events.click(svgid);
};
monitor_instance_pos();
});
}
-function monitor_graph_change() {
+function monitor_graph_change(force) {
var url = $("#current-instance").text();
$.ajax({
type: "GET",
url: url + "/properties/values/dslx/",
success: function(dslx){
- $.ajax({
- type: "GET",
- url: url + "/properties/values/attributes/theme/",
- success: function(res){
- adaptor_init(url,$('value',res).text(),dslx);
- },
- error: function() {
- adaptor_init(url,'default',dslx);
- }
- });
+ if (force || !save['graph'] || (save['graph'] && save['graph'].serializePrettyXML() != $(dslx).serializePrettyXML())) {
+ $.ajax({
+ type: "GET",
+ url: url + "/properties/values/attributes/theme/",
+ success: function(res){
+ adaptor_init(url,$('value',res).text(),dslx);
+ },
+ error: function() {
+ adaptor_init(url,'default',dslx);
+ }
+ });
+ }
}
});
}
function monitor_instance_dsl() {// {{{
@@ -334,10 +339,10 @@
res = format_code(res,false,true);
res = res.replace(/activity\s+:([A-Za-z][a-zA-Z0-9_]+)/g,"<span class='activities' id=\"activity-$1\">activity :$1</span>");
res = res.replace(/activity\s+\[:([A-Za-z][a-zA-Z0-9_]+)([^\]]*\])/g,"<span class='activities' id=\"activity-$1\">activity [:$1$2</span>");
ctv.append(res);
- monitor_graph_change();
+ monitor_graph_change(false);
}
}
});
}// }}}