cockpit/themes/compact/theme.js in cpee-1.4.31 vs cockpit/themes/compact/theme.js in cpee-1.4.32

- old
+ new

@@ -3,11 +3,12 @@ this.adaptor = adaptor; this.resources = {}; this.elements = {}; this.events = {}; - this.compact = true; + this.compact = false; + this.striped = false; this.endpoints = {}; //{{{ transform the details data to description parts based on rng this.source = function(base,opts) { if (base[0].namespaceURI == "http://relaxng.org/ns/structure/1.0") { @@ -30,15 +31,15 @@ }); } return base; } }; //}}} - //{{{ Return the svgid for the clicked task - this.clicked = function(){ + //{{{ Return the svgid for the selected task + this.selected = function(){ var svgid = 'unknown'; _.each(self.adaptor.illustrator.get_elements(),function(value,key) { - if ($(value).hasClass('clicked')) { + if ($(value).hasClass('selected')) { svgid = $(value).attr('element-id'); } }); return svgid; }; //}}} @@ -62,10 +63,13 @@ 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')) { + $(rng).find(' > element[name="parameters"] > element[name="method"]').remove(); + } save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true); save['details'].content(node); format_visual_forms(); } }; //}}} @@ -193,11 +197,12 @@ this.events.click = function(svgid, e) { // {{{ if (self.adaptor.description.get_node_by_svg_id(svgid).length == 0) { return; } - self.adaptor.illustrator.get_elements().removeClass('clicked'); + self.adaptor.illustrator.get_elements().removeClass('selected'); + self.adaptor.illustrator.get_labels().removeClass('selected'); if (e && e.ctrlKey) { if (save['state'] != "ready" && save['state'] != "stopped") { return false; } var tab = $('#dat_details'); tab.empty(); @@ -208,24 +213,29 @@ } else { self.adaptor.illustrator.get_elements().removeClass('marked'); var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid); if (vtarget.length > 0) { - vtarget.parents('g.element[element-id]').addClass('clicked'); + vtarget.parents('g.element[element-id]').addClass('selected'); } + self.adaptor.illustrator.get_label_by_svg_id(svgid).addClass('selected'); self.update_details(svgid); } } // }}} this.events.dblclick = function(svgid, e) { // {{{ } // }}} this.events.mouseover = function(svgid, e) { // {{{ - $('.tile[element-id = "' + svgid + '"]').css('display','block'); + self.adaptor.illustrator.svg.container.find('.tile[element-id = "' + svgid + '"]').css('display','block'); + self.adaptor.illustrator.svg.container.find('[element-id = "' + svgid + '"]').addClass('hover'); + self.adaptor.illustrator.svg.label_container.find('[element-id = "' + svgid + '"]').addClass('hover'); return false; } // }}} this.events.mouseout = function(svgid, e) { // {{{ - $('.tile[element-id = "' + svgid + '"]').css('display','none'); + self.adaptor.illustrator.svg.container.find('.tile[element-id = "' + svgid + '"]').css('display','none'); + self.adaptor.illustrator.svg.container.find('[element-id = "' + svgid + '"]').removeClass('hover'); + self.adaptor.illustrator.svg.label_container.find('[element-id = "' + svgid + '"]').removeClass('hover'); return false; } // }}} this.events.dragstart = function (svgid, e) { //{{{ } //}}} @@ -236,24 +246,12 @@ this.elements.call = { /*{{{*/ 'type': 'primitive', 'illustrator': {//{{{ 'endnodes': 'this', 'label': function(node){ - var ep = self.endpoints[$(node).attr('endpoint')]; - var eplen = 1; - if (ep != undefined && ep[0] == '[') { - try { - eplen = JSON.parse(ep).length; - } catch(e) { - eplen = 1; - } - } else { - eplen = 1; - } - var avg = $('> _timing_avg',$(node).children('_timing')).text(); - var lnd = $(node).attr('endpoint'); - return $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'') + (lnd == '' ? '' : ' (Resource ' + lnd + (eplen > 1 ? ' - ' + (eplen) + ' Alternatives': ' - 1 Alternative') + ')') + (avg == '' ? '' : ' (Avg. Duration ' + avg + ' Min)'); + var ret = [ { column: 'Label', value: $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'') } ]; + return ret; }, 'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; }, 'resolve_symbol': function(node) { if($('finalize,update', node).length > 0) { return 'callmanipulate'; @@ -273,38 +271,42 @@ 'type': undefined, 'params': [self.adaptor.description.elements.scripts, node]} ]; return []; }, //}}} - 'adaptor': {//{{{ - 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); }, - 'click': self.events.click, - 'dragstart': self.events.dragstart, - }//}}} + 'adaptor': {//{{{ + 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); }, + 'click': self.events.click, + 'dragstart': self.events.dragstart, + 'mouseover': self.events.mouseover, + 'mouseout': self.events.mouseout + }//}}} }; /*}}}*/ this.elements.manipulate = { /*{{{*/ 'type': 'primitive', 'illustrator': {//{{{ 'endnodes': 'this', 'label': function(node){ var lab = $(node).attr('label'); if (lab) { - return lab.replace(/^['"]/,'').replace(/['"]$/,''); + return [ { column: 'Label', value: lab.replace(/^['"]/,'').replace(/['"]$/,'') } ]; } else { - return ""; + return []; } }, 'svg': self.adaptor.theme_dir + 'symbols/manipulate.svg' },//}}} 'description': self.adaptor.theme_dir + 'rngs/manipulate.rng', 'permissible_children': function(node,mode) { //{{{ return []; }, //}}} - 'adaptor': {//{{{ - 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); }, - 'click': self.events.click, - }//}}} + 'adaptor': {//{{{ + 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); }, + 'click': self.events.click, + 'mouseover': self.events.mouseover, + 'mouseout': self.events.mouseout + }//}}} }; /*}}}*/ this.elements.escape = { /*{{{*/ 'type': 'primitive', 'illustrator': {//{{{ 'endnodes': 'this', @@ -315,10 +317,12 @@ return []; }, //}}} 'adaptor': {//{{{ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); }, 'click': self.events.click, + 'mouseover': self.events.mouseover, + 'mouseout': self.events.mouseout }//}}} }; /*}}}*/ this.elements.stop = { /*{{{*/ 'type': 'primitive', 'illustrator': {//{{{ @@ -330,10 +334,12 @@ return []; }, //}}} 'adaptor': {//{{{ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); }, 'click': self.events.click, + 'mouseover': self.events.mouseover, + 'mouseout': self.events.mouseout }//}}} }; /*}}}*/ this.elements.terminate = { /*{{{*/ 'type': 'primitive', 'illustrator': {//{{{ @@ -345,10 +351,12 @@ 'permissible_children': function(node,mode) { //{{{ return []; }, //}}} 'adaptor': {//{{{ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,false); }, + 'mouseover': self.events.mouseover, + 'mouseout': self.events.mouseout }//}}} }; /*}}}*/ this.elements.end = { /*{{{*/ 'type': 'primitive', 'illustrator': {//{{{ @@ -426,14 +434,13 @@ // Complex Elements this.elements.choose = { /*{{{*/ 'type': 'complex', 'illustrator': {//{{{ - 'label': function(node){return $(node).attr('mode') == 'exclusive' ? 'exclusive' : 'inclusive' }, + 'label': function(node){ return [ { column: 'Label', value: $(node).attr('mode') == 'exclusive' ? 'exclusive' : 'inclusive' } ]; }, 'endnodes': 'aggregate', 'closeblock': false, - 'closing_symbol': 'choose_finish', 'expansion': function(node) { return 'horizontal'; }, 'resolve_symbol': function(node) { if($(node).attr('mode') == 'exclusive') { @@ -483,20 +490,16 @@ self.events.mousedown(node,e,true,true); }, 'click': self.events.click, 'dblclick': self.events.dblclick, 'mouseover': self.events.mouseover, - 'mouseout': self.events.mouseout, + 'mouseout': self.events.mouseout }//}}} }; /*}}}*/ this.elements.otherwise = { /*{{{*/ 'type': 'complex', 'illustrator': {//{{{ - 'label': function(node){ - var avg = $('> _probability_avg',$(node).children('_probability')).text(); - return (avg == '' ? '' : ' (Avg. Probability ' + avg + '%)'); - }, 'endnodes': 'passthrough', 'closeblock': false, 'noarrow': true, 'expansion': function(node) { return 'vertical'; @@ -573,12 +576,12 @@ }; /*}}}*/ this.elements.alternative = { /*{{{*/ 'type': 'complex', 'illustrator': {//{{{ 'label': function(node){ - var avg = $('> _probability_avg',$(node).children('_probability')).text(); - return $(node).attr('condition') + (avg == '' ? '' : ' (Avg. Probability ' + avg + '%)'); + var ret = [ { column: 'Label', value: $(node).attr('condition') } ]; + return ret; }, 'endnodes': 'passthrough', 'noarrow': true, 'closeblock':false, 'expansion': function(node) { @@ -660,12 +663,12 @@ }; /*}}}*/ this.elements.loop = { /*{{{*/ 'type': 'complex', 'illustrator': {//{{{ 'label': function(node){ - var avg = $('> _probability_avg',$(node).children('_probability')).text(); - return $(node).attr('condition') + ($(node).attr('mode') == 'pre_test' ? ' (⭱)' : ' (⭳)') + (avg == '' ? '' : ' (Avg. ' + avg + ' Times)'); + var ret = [ { column: 'Label', value: $(node).attr('condition') + ($(node).attr('mode') == 'pre_test' ? ' (⭱)' : ' (⭳)') } ]; + return ret; }, 'endnodes': 'this', 'closeblock': true, 'expansion': function(node) { return 'vertical'; @@ -829,11 +832,11 @@ 'expansion': function(node) { return 'vertical'; }, 'resolve_symbol': function(node,shift) { if(shift == true) { - return 'parallel_branch_event'; + return 'parallel_branch_compact'; } else { return 'parallel_branch_normal'; } }, 'col_shift': function(node) { @@ -1113,11 +1116,10 @@ // * they HAVE TO have a parent this.elements.callmanipulate = { /*{{{*/ 'parent': 'call', 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng', 'illustrator': {//{{{ - 'label': function(node){return $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'')}, 'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; }, 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate.svg' },//}}} }; /*}}}*/ this.elements.choose_inclusive = { /*{{{*/ @@ -1169,9 +1171,16 @@ 'noarrow': false, 'border': true, 'wide': true, 'closing_symbol': 'event_end', 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_event.svg' + }//}}} + }; /*}}}*/ + this.elements.parallel_branch_compact = { /*{{{*/ + 'parent': 'parallel_branch', + 'illustrator': {//{{{ + 'endnodes': 'this', + 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_compact.svg' }//}}} }; /*}}}*/ this.elements.scripts = { /*{{{*/ 'description': [self.adaptor.theme_dir + 'rngs/update.rng',self.adaptor.theme_dir + 'rngs/finalize.rng'] }; /*}}}*/