Skip to content

Commit 29ef2f7

Browse files
committed
remove visualization of enumeration
1 parent d74dbdb commit 29ef2f7

File tree

1 file changed

+10
-71
lines changed
  • src/main/resources/static/js

1 file changed

+10
-71
lines changed

src/main/resources/static/js/knox.js

Lines changed: 10 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,8 @@ $('#enumerate-designs-tooltip').click(() => {
334334
let loadingDiv = document.createElement('div');
335335
loadingDiv.appendChild(document.createTextNode("Loading..."));
336336

337-
//svg div
338-
let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
339-
svg.style.display = "block";
340-
341337
//append all
342338
div.appendChild(loadingDiv);
343-
div.appendChild(svg);
344-
345-
//save x and y max values
346-
let maxX = 0;
347-
let maxY = 0;
348339

349340
swal({
350341
title: "Designs",
@@ -353,77 +344,25 @@ $('#enumerate-designs-tooltip').click(() => {
353344
});
354345

355346
endpoint.enumerateDesigns(currentSpace, (err, data) => {
356-
console.log(data);
357347
if (err) {
358348
swalError("Enumeration error: " + JSON.stringify(err));
359349
} else {
360350
div.removeChild(loadingDiv);
361-
362-
const celHeight = 80;
363-
const celWidth = 50;
364-
var pen = { x: 0, y: 0 };
365-
351+
let para = document.createElement("p");
366352
data.map((list) => {
367-
list.map((element) => {
368-
369-
var svgimg = document.createElementNS("http://www.w3.org/2000/svg", "image");
370-
svgimg.setAttribute("height", "100");
371-
svgimg.setAttribute("width", "100");
372-
svgimg.style.display = "block";
373-
svgimg.setAttributeNS(
374-
"http://www.w3.org/1999/xlink",
375-
"href", getSBOLImage(element.roles[0]));
376-
svgimg.setAttribute("x", "" + pen.x);
377-
svgimg.setAttribute("y", "" + pen.y);
378-
$(svgimg).tooltipster({
379-
content: element.id
380-
});
381-
svg.appendChild(svgimg);
382-
383-
var svgtext = document.createElementNS("http://www.w3.org/2000/svg", "text");
384-
svgtext.setAttribute("height", "100");
385-
svgtext.setAttribute("width", "100");
386-
svgtext.setAttribute("id", "testimg2");
387-
svgtext.setAttribute("font-family", "sans-serif");
388-
svgtext.setAttribute("font-size", "10px");
389-
svgtext.setAttribute("fill", "black");
390-
391-
let text = element.id;
392-
if (text.length > 10) {
393-
text = text.substring(0, 7) + '...';
394-
}
395-
svgtext.textContent = text;
396-
397-
svgtext.style.display = "block";
398-
svgtext.setAttribute("x", "" + (pen.x + 0.40*celWidth));
399-
if (element.roles[0] === "CDS") {
400-
svgtext.setAttribute("y", "" + (pen.y + 1.1*celHeight));
401-
} else {
402-
svgtext.setAttribute("y", "" + (pen.y + celHeight));
353+
para.appendChild(document.createTextNode("["));
354+
const length = list.length;
355+
list.map((element, i) => {
356+
para.appendChild(document.createTextNode(element.id));
357+
if (length !== i+1){
358+
para.appendChild(document.createTextNode(","));
403359
}
404-
svg.appendChild(svgtext);
405-
pen.x += celWidth;
406360
});
407-
408-
var line = document.createElementNS("http://www.w3.org/2000/svg", "line");
409-
line.setAttribute("stroke", "black");
410-
line.setAttribute("stroke-width", "4");
411-
line.setAttribute("x1", "" + 0);
412-
line.setAttribute("y1", "" + (pen.y + celWidth));
413-
line.setAttribute("x2", "" + (pen.x + celWidth));
414-
line.setAttribute("y2", "" + (pen.y + celWidth));
415-
svg.appendChild(line);
416-
417-
pen.y += celHeight;
418-
419-
maxY = Math.max(pen.y + celHeight, maxY);
420-
maxX = Math.max(pen.x + celWidth, maxX);
421-
422-
pen.x = 0;
361+
para.appendChild(document.createTextNode("]"));
362+
para.appendChild(document.createElement('br'));
423363
});
424364

425-
svg.setAttribute("height", maxY);
426-
svg.setAttribute("width", maxX);
365+
div.appendChild(para);
427366
}
428367
});
429368

0 commit comments

Comments
 (0)