cockpit/themes/control/theme.js in cpee-2.1.53 vs cockpit/themes/control/theme.js in cpee-2.1.54
- old
+ new
@@ -61,39 +61,31 @@
return JSON.stringify(nodes);
}; //}}}
//{{{ Render the details from rng (right hand side of graph tab)
this.update_details = function(svgid){
var tab = $('#dat_details');
- var focus_ele = $(':focus',tab);
- var focus_path = focus_ele.attr('data-relaxngui-path');
- var focus_pos = focus_ele.prop('selectionStart');
var node = self.adaptor.description.get_node_by_svg_id(svgid).get(0);
- tab.empty();
if (self.adaptor.description.elements[$(node).attr('svg-subtype')]) {
save['details_target'] = { 'svgid': svgid, 'model': self.adaptor.description };
var rng = self.adaptor.description.elements[$(node).attr('svg-subtype')].clone();
if (save['endpoints_cache'][$(node).attr('endpoint')] && save['endpoints_cache'][$(node).attr('endpoint')].schema) {
var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
$(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
}
if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
$(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
}
- save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
var nn = $X($(node).serializeXML());
nn.removeAttr('svg-id');
nn.removeAttr('svg-type');
nn.removeAttr('svg-subtype');
nn.removeAttr('svg-label');
+
+ tab.empty();
+ save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
save['details'].content(nn);
- if (focus_ele.length > 0) {
- var ele = $('[data-relaxngui-path="' + focus_path + '"]',tab)[0];
- ele.focus();
- if (ele.setSelectionRange) {
- ele.setSelectionRange(focus_pos,focus_pos);
- }
- }
+
format_visual_forms();
}
}; //}}}
function copyOrMove(menu,group,xml_node,mode) { //{{{
@@ -209,12 +201,21 @@
'label': 'Remove Marked Elements',
'function_call': function(){
$(nodes).each(function(key,str) {
nodes[key] = $X(str);
});
+ let svgids = [];
$(nodes).each(function(key,node){
- var target = self.adaptor.description.get_node_by_svg_id($(node).attr('svg-id'));
+ svgids.push($(node).attr('svg-id'));
+ });
+ svgids.sort((a,b) => {
+ if (a > b) { return -1; }
+ else if (a < b) { return 1; }
+ else { return 0; }
+ });
+ svgids.forEach(svgid => {
+ var target = self.adaptor.description.get_node_by_svg_id(svgid);
del_ui_pos(target)
self.adaptor.description.remove(null,target);
localStorage.removeItem('marked');
localStorage.removeItem('marked_from');
});
@@ -383,14 +384,22 @@
}
return ret;
},
'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; },
'resolve_symbol': function(node) {
- if($('> code', node).length > 0) {
- return 'callmanipulate';
+ if ($('> annotations > _context_data_analysis > probes > probe', node).length > 0) {
+ if ($('> code', node).length > 0) {
+ return 'callmanipulate_sensor';
+ } else {
+ return 'call_sensor';
+ }
} else {
- return 'call';
+ if ($('> code', node).length > 0) {
+ return 'callmanipulate';
+ } else {
+ return 'call';
+ }
}
},
'svg': self.adaptor.theme_dir + 'symbols/call.svg'
},//}}}
'description': self.adaptor.theme_dir + 'rngs/call.rng',
@@ -980,11 +989,11 @@
var ret = [ { column: 'Label', value: ($(node).attr('overrun') + ', ' + $(node).attr('execution')) } ];
if (avg != '') {
ret.push({ column: 'Average', value: avg + '%' });
}
return ret;
- },
+ ,
'svg': self.adaptor.theme_dir + 'symbols/closed_loop.svg'
},//}}}
'description': self.adaptor.theme_dir + 'rngs/closed_loop.rng',
'permissible_children': function(node,mode) { //{{{
var func = null;
@@ -1584,17 +1593,46 @@
'closeblock': false,
'balance': true,
'expansion': function(node) {
return 'vertical';
},
+ 'resolve_symbol': function(node) {
+ let alist = []
+ let plist = []
+
+ var regassi = /data\.([a-zA-Z_]+)\s*(=[^=]|\+\=|\-\=|\*\=|\/\=|<<|>>)/g; // we do not have to check for >/< version of stuff as only conditions are in attributes, and conditions can not contain assignments
+ var reg_not_assi = /data\.([a-zA-Z_]+)\s*/g;
+ $ ('call > parameters > arguments > *, call > code > *, loop[condition], alternative[condition]',node).each(function(i,n) {
+ let item;
+ if (n.hasAttribute('condition')) {
+ item = n.getAttribute('condition');
+ } else {
+ item = n.textContent;
+ }
+ if (n.parentNode.nodeName == 'arguments' && item.charAt(0) != '!' ) { return }
+
+ let indices = [];
+
+ for (const match of item.matchAll(regassi)) {
+ indices.push(match.index);
+ alist.push(match[1]);
+ }
+ for (const match of item.matchAll(reg_not_assi)) {
+ const arg1 = match[1];
+ if (indices.includes(match.index)) { continue; }
+ if (!alist.includes(arg1)) { plist.push(arg1); }
+ }
+ })
+ if (plist.length > 0) { return 'start_event'; }
+ },
'closing_symbol': 'end',
'col_shift': function(node) {
return true;
},
'svg': self.adaptor.theme_dir + 'symbols/start.svg'
},//}}}
- 'description': null,
+ 'description': self.adaptor.theme_dir + 'rngs/start.rng',
'permissible_children': function(node,mode) { //{{{
var func = null;
if (mode == 'into') { func = self.adaptor.description.insert_first_into }
else { func = self.adaptor.description.insert_after }
var childs = [
@@ -1662,16 +1700,34 @@
}; /*}}}*/
// Abstract Elements
// * they may only have an illustrator (or other parts)
// * they HAVE TO have a parent
+ this.elements.start_event = { /*{{{*/
+ 'parent': 'start',
+ 'illustrator': {//{{{
+ 'svg': self.adaptor.theme_dir + 'symbols/start_event.svg'
+ }//}}}
+ }; /*}}}*/
+ this.elements.call_sensor = { /*{{{*/
+ 'parent': 'call',
+ 'illustrator': {//{{{
+ 'svg': self.adaptor.theme_dir + 'symbols/call_sensor.svg'
+ }//}}}
+ }; /*}}}*/
this.elements.callmanipulate = { /*{{{*/
'parent': 'call',
'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
'illustrator': {//{{{
- 'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; },
'svg': self.adaptor.theme_dir + 'symbols/callmanipulate.svg'
- },//}}}
+ }//}}}
+ }; /*}}}*/
+ this.elements.callmanipulate_sensor = { /*{{{*/
+ 'parent': 'call',
+ 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
+ 'illustrator': {//{{{
+ 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate_sensor.svg'
+ }//}}}
}; /*}}}*/
this.elements.loop_head = { /*{{{*/
'parent': 'loop',
'illustrator': {//{{{
'endnodes': 'this',