cockpit/js/instance.js in cpee-2.1.56 vs cockpit/js/instance.js in cpee-2.1.57

- old
+ new

@@ -565,11 +565,11 @@ } } else { $('#graphgrid').removeClass('striped'); } - $('#graphgrid .graphlabel, #graphgrid .graphempty, #resources, #graphgrid .graphlast').remove(); + $('.labelsrow, #graphgrid .graphlast').remove(); let tcolumns = []; let tcolumntype = {}; let tcolumncount = {} const mapPoints = new Map(); @@ -603,28 +603,32 @@ p.ymax = mapPoints.get(k).ymax; } mapPoints.set(k, p); } - let tsvg = $X('<g xmlns="http://www.w3.org/2000/svg"></g>'); + let tsvg = $X('<g xmlns="http://www.w3.org/2000/svg" class="resource-row" element-row="' + (val.row-1) + '"></g>'); var cx = space; + var count = 0; for (const [k, p] of mapPoints) { let firstAssignFlag = false; p.x = cx; // Including Triangle if (k in col.value) { // Define points for a triangle pointing to the right let inner; if (p.AR == "Read") { - inner = $X('<polygon xmlns="http://www.w3.org/2000/svg" points="' + (p.x) + ',' + pos + ' ' + (p.x + iconsize) + ',' + (pos + iconsize/2) + ' ' + (p.x + iconsize) + ',' + (pos - iconsize/2) + '" class="resource-point read"></polygon>'); + inner = $X('<polygon xmlns="http://www.w3.org/2000/svg" resource-column="' + count + '" points="' + (p.x) + ',' + pos + ' ' + (p.x + iconsize) + ',' + (pos + iconsize/2) + ' ' + (p.x + iconsize) + ',' + (pos - iconsize/2) + '" class="resource-point read"></polygon>'); if (pos == p.y0) { firstAssignFlag = true; } } else if (p.AR == "Assign") { // Define points for a triangle pointing to the left - inner = $X('<polygon xmlns="http://www.w3.org/2000/svg" points="' + (p.x + iconsize) + ',' + pos + ' ' + (p.x) + ',' + (pos + iconsize/2) + ' ' + (p.x) + ',' + (pos - iconsize/2) + '" class="resource-point write"></polygon>'); + inner = $X('<polygon xmlns="http://www.w3.org/2000/svg" resource-column="' + count + '" points="' + (p.x + iconsize) + ',' + pos + ' ' + (p.x) + ',' + (pos + iconsize/2) + ' ' + (p.x) + ',' + (pos - iconsize/2) + '" class="resource-point write"></polygon>'); } else if (p.AR == "AssignRead") { - inner = $X('<circle xmlns="http://www.w3.org/2000/svg" cx="' + (p.x + iconsize/2) + '" cy="' + pos + '" r="' + (iconsize / 2) + '" class="resource-point both"></circle>'); + inner = $X('<circle xmlns="http://www.w3.org/2000/svg" resource-column="' + count + '" cx="' + (p.x + iconsize/2) + '" cy="' + pos + '" r="' + (iconsize / 2) + '" class="resource-point both"></circle>'); + } else if (p.AR == "ReadAssign") { + inner = $X('<circle xmlns="http://www.w3.org/2000/svg" resource-column="' + count + '" cx="' + (p.x + iconsize/2) + '" cy="' + pos + '" r="' + (iconsize / 2) + '" class="resource-point both"></circle>'); + if (pos == p.y0) { firstAssignFlag = true; } } // extend the bars if (pos > p.ymax) { p.ymax = pos; @@ -633,20 +637,30 @@ inner.append($X('<text xmlns="http://www.w3.org/2000/svg"></text>').text(k)); tsvg.append(inner); } if (firstAssignFlag) { - // Additional logic and construction of another polygon for orange triangle pointing left + // Additional logic and construction of another polygon for orange triangle pointing left in row 0 p.y0 -= (val.row-1) * dimensions.height; - tsvg.append($X('<polygon xmlns="http://www.w3.org/2000/svg" points="' + (p.x + iconsize) + ',' + firstpos + ' ' + (p.x) + ',' + (firstpos + iconsize/2) + ' ' + (p.x) + ',' + (firstpos - iconsize/2) + '" class="resource-point write"></polygon>').append($X('<text xmlns="http://www.w3.org/2000/svg"></text>').text(k))); + if (tcolumnsvgs[col.column][1] == undefined) { + tcolumnsvgs[col.column][1] = $X('<g xmlns="http://www.w3.org/2000/svg" class="resource-row" element-row="' + 0 + '"></g>'); + } + tcolumnsvgs[col.column][1].append($X('<polygon xmlns="http://www.w3.org/2000/svg" resource-column="' + count + '" points="' + (p.x + iconsize) + ',' + firstpos + ' ' + (p.x) + ',' + (firstpos + iconsize/2) + ' ' + (p.x) + ',' + (firstpos - iconsize/2) + '" class="resource-point write"></polygon>').append($X('<text xmlns="http://www.w3.org/2000/svg"></text>').text(k))); } cx += iconsize + space; + count += 1; } - tcolumnsvgs[col.column][val.row] = tsvg; + if (tsvg.children().length > 0) { + tcolumnsvgs[col.column][val.row] = tsvg; + } } else { - tsvg = $X('<text x="' + space + '" y="' + (dimensions.height * val.row - dimensions.height_shift) + '" xmlns="http://www.w3.org/2000/svg"></text>').text(col.value); + tsvg = $X('<text class="label" element-id="' + val.element_id + '" x="' + space + '" y="' + (dimensions.height * val.row - dimensions.height_shift) + '" xmlns="http://www.w3.org/2000/svg"></text>') + tsvg.text(col.value); + tsvg.mouseover(function(ev){ manifestation.events.mouseover($(ev.currentTarget).attr('element-id')); }); + tsvg.mouseout(function(ev){ manifestation.events.mouseout($(ev.currentTarget).attr('element-id')); }); + tsvg.click(function(ev){ manifestation.events.click($(ev.currentTarget).attr('element-id')); }); tcolumnsvgs[col.column][val.row] = tsvg; } tcolumncount[col.column] += 1; } @@ -659,11 +673,11 @@ 'grid-template-columns': 'max-content' + (tcolumns.length > 0 ? ' repeat(' + tcolumns.length.toString() + ',max-content)' : '') + ' auto' }); tcolumns.forEach(h => { if (Object.keys(tcolumnsvgs[h]).length > 0) { - const svgcolumn = $X('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:x="http://www.w3.org/1999/xlink" id="resources"></svg>'); + const svgcolumn = $X('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:x="http://www.w3.org/1999/xlink" class="labelsrow"></svg>'); const svgback = $X('<g xmlns="http://www.w3.org/2000/svg"></g>'); const svgfront = $X('<g xmlns="http://www.w3.org/2000/svg"></g>'); let xwidth = 0; svgcolumn.append(svgback); svgcolumn.append(svgfront); @@ -682,12 +696,14 @@ svgback.append($X('<rect xmlns="http://www.w3.org/2000/svg" element-row="' + i + '" class="stripe ' + (i % 2 == 0 ? 'even' : 'odd') + '" x="0" y="' + (dimensions.height * i + dimensions.height_shift/2) + '" width="' + (xwidth + 1) + '" height="' + dimensions.height + '"></rect>')); svgback.append($X('<rect xmlns="http://www.w3.org/2000/svg" element-row="' + i + '" class="border" x="0" y="' + (dimensions.height * i + dimensions.height_shift/2) + '" height="' + dimensions.height + '" width="1"></rect>')); } } if (tcolumntype[h] == 'resource' || tcolumntype[h] == 'bodsod') { + let count = 0; for (const [k, p] of mapPoints) { - svgback.append($X('<line xmlns="http://www.w3.org/2000/svg" x1="' + (p.x + iconsize/2) + '" y1="' + p.y0 + '" x2="' + (p.x + iconsize/2) + '" y2="' + p.ymax + '" class="' + tcolumntype[h] + '-line" stroke-width="' + iconsize + '"><text>' + k + '</text></line>')); + svgback.append($X('<line xmlns="http://www.w3.org/2000/svg" resource-column="' + count + '" x1="' + (p.x + iconsize/2) + '" y1="' + p.y0 + '" x2="' + (p.x + iconsize/2) + '" y2="' + (p.ymax + 0.01) + '" class="' + tcolumntype[h] + '-column" stroke-width="' + iconsize + '"><text>' + k + '</text></line>')); + count += 1; } } $('.resource-label').hide(); // Speech Bubble hide by default @@ -1108,10 +1124,11 @@ $('g',ele).each((j,g) => { gr.append($(g).clone()); }); gc.append(gr); }); + gc.find('.selected').removeClass('selected'); var varreps = {}; $(window.document.styleSheets).each(function(i,x){ if (x && x.href && x.ownerNode.attributes.getNamedItem('data-include-export')) { $(x.cssRules).each(function(j,y){ if (y.selectorText == ":root") { @@ -1125,11 +1142,10 @@ cst = cst.replace(new RegExp(k,'g'),varreps[k]); } loc.each(function(k,loco) { var sty = $(loco).attr('style') == undefined ? '' : $(loco).attr('style'); $(loco).attr('style',cst + sty); - console.log(loco); }); }); var loc = $(gc).find('text.super'); loc.attr('style',loc.attr('style') + ' display: none; '); } @@ -1150,10 +1166,10 @@ var url = $('body').attr('current-instance'); var promises = []; var tset = $X('<properties xmlns="http://cpee.org/ns/properties/2.0"/>'); - tset.append($("testset > executionwrapper",testset)); + tset.append($("testset > executionhandler",testset)); tset.append($("testset > positions",testset)); tset.append($("testset > dataelements",testset)); tset.append($("testset > endpoints",testset)); tset.append($("testset > attributes",testset)); tset.append($("testset > description",testset));