|
187 | 187 | el.value = "bandwidth";
|
188 | 188 | selectColors.appendChild(el);
|
189 | 189 | }
|
| 190 | + { |
| 191 | + var el = document.createElement("option"); |
| 192 | + el.textContent = "bandwidth_check"; |
| 193 | + el.value = "bandwidth_check"; |
| 194 | + selectColors.appendChild(el); |
| 195 | + } |
190 | 196 |
|
191 | 197 | /* Add elements to selectPartition */
|
192 | 198 | var selectPartition = document.getElementById("selectPartition");
|
|
270 | 276 | shownNodes.update({id: n.id, color: normalSwitchColor});
|
271 | 277 | });
|
272 | 278 |
|
273 |
| - if (lastColorMode == "bandwidth") { |
| 279 | + if (lastColorMode == "bandwidth" || lastColorMode == "bandwidth_check") { |
274 | 280 | shownEdges.forEach(function(n) {
|
275 | 281 | shownEdges.update({id: n.id, color: normalEdgeColor});
|
276 | 282 | });
|
277 | 283 | }
|
278 |
| - } |
279 |
| - else if (colorMode == "partition") { |
| 284 | + |
| 285 | + } else if (colorMode == "partition") { |
280 | 286 | var nodeColors = palette(partitions.length);
|
281 | 287 | shownNodes.forEach(function(n) {
|
282 | 288 | if (n.type == "host") {
|
283 | 289 | var colorIdx = n.part[0];
|
284 | 290 | shownNodes.update({id: n.id, color: {background: nodeColors[colorIdx]}});
|
285 |
| - } |
286 |
| - else |
| 291 | + |
| 292 | + } else |
287 | 293 | shownNodes.update({id: n.id, color: normalSwitchColor});
|
288 | 294 | });
|
289 | 295 |
|
290 |
| - if (lastColorMode == "bandwidth") { |
| 296 | + if (lastColorMode == "bandwidth" || lastColorMode == "bandwidth_check") { |
291 | 297 | shownEdges.forEach(function(n) {
|
292 | 298 | shownEdges.update({id: n.id, color: normalEdgeColor});
|
293 | 299 | });
|
294 | 300 | }
|
295 |
| - } |
296 |
| - else if (colorMode == "hwloc") { |
| 301 | + |
| 302 | + } else if (colorMode == "hwloc") { |
297 | 303 | var nodeColors = palette(topos.length);
|
298 | 304 | shownNodes.forEach(function(n) {
|
299 | 305 | if (n.type == "host") {
|
300 | 306 | var colorIdx = n.topo;
|
301 | 307 | if (colorIdx != -1) {
|
302 | 308 | shownNodes.update({id: n.id, color: {background: nodeColors[colorIdx]}});
|
303 | 309 | }
|
304 |
| - } |
305 |
| - else |
| 310 | + |
| 311 | + } else |
306 | 312 | shownNodes.update({id: n.id, color: normalSwitchColor});
|
307 | 313 | });
|
308 | 314 |
|
309 |
| - if (lastColorMode == "bandwidth") { |
| 315 | + if (lastColorMode == "bandwidth" || lastColorMode == "bandwidth_check") { |
310 | 316 | shownEdges.forEach(function(n) {
|
311 | 317 | shownEdges.update({id: n.id, color: normalEdgeColor});
|
312 | 318 | });
|
313 | 319 | }
|
314 |
| - } |
315 |
| - else if (colorMode == "bandwidth") { |
| 320 | + |
| 321 | + } else if (colorMode == "bandwidth") { |
316 | 322 | var nodeColors = palette(nodeBandwidthList.length);
|
317 | 323 | shownNodes.forEach(function(n) {
|
318 | 324 | var colorIdx = nodeBandwidthList.indexOf(n.size);
|
319 | 325 | if (colorIdx != -1) {
|
320 | 326 | shownNodes.update({id: n.id, color: {background: nodeColors[colorIdx]}});
|
321 | 327 | }
|
322 | 328 | });
|
| 329 | + var edgeColors = palette(edgeBandwidthList.length); |
| 330 | + shownEdges.forEach(function(n) { |
| 331 | + var colorIdx = edgeBandwidthList.indexOf(n.gbits); |
| 332 | + if (colorIdx != -1) { |
| 333 | + shownEdges.update({id: n.id, color: {color: edgeColors[colorIdx]}}); |
| 334 | + } |
| 335 | + }); |
323 | 336 |
|
324 |
| - var edgeeColors = palette(edgeBandwidthList.length); |
| 337 | + } else if (colorMode == "bandwidth_check") { |
| 338 | + var edgeColors = palette(edgeBandwidthList.length); |
325 | 339 | shownEdges.forEach(function(n) {
|
326 | 340 | var colorIdx = edgeBandwidthList.indexOf(n.gbits);
|
327 | 341 | if (colorIdx != -1) {
|
328 |
| - shownEdges.update({id: n.id, color: {color: edgeeColors[colorIdx]}}); |
| 342 | + shownEdges.update({id: n.id, color: {color: edgeColors[colorIdx]}}); |
| 343 | + } |
| 344 | + }); |
| 345 | + |
| 346 | + shownNodes.forEach(function(n) { |
| 347 | + /* Quick check about in bw = out bd */ |
| 348 | + if (n.edges.length == 1) { |
| 349 | + var colorIdx = edgeBandwidthList.indexOf(n.bandwidth); |
| 350 | + shownNodes.update({id: n.id, color: {background: edgeColors[colorIdx]}}); |
| 351 | + |
| 352 | + } else { |
| 353 | + var colorIdx = edgeBandwidthList.indexOf(n.bandwidth/2); |
| 354 | + if (colorIdx != -1) { |
| 355 | + shownNodes.update({id: n.id, color: {background: edgeColors[colorIdx]}}); |
| 356 | + } else { |
| 357 | + shownNodes.update({id: n.id, color: {background: "black"}}); |
| 358 | + } |
329 | 359 | }
|
330 | 360 | });
|
331 | 361 | }
|
|
489 | 519 |
|
490 | 520 | if (!similarNeighbours) {
|
491 | 521 | similarNeighbours = neighbours;
|
| 522 | + |
492 | 523 | } else {
|
493 | 524 | similarNeighbours = similarNeighbours.filter(function(n) {
|
494 | 525 | return neighbours.indexOf(n) != -1;
|
|
529 | 560 | var field = selectSearch.options[selectSearch.selectedIndex].value;
|
530 | 561 |
|
531 | 562 | if (field == "") {
|
532 |
| - } |
533 |
| - else { |
| 563 | + |
| 564 | + } else { |
534 | 565 | var searchValue = document.getElementById("searchValue");
|
535 | 566 | var value = searchValue.value;
|
536 | 567 | selectNodesAndEdges(field, value);
|
|
554 | 585 | // TODO improve
|
555 | 586 | subEdges = new vis.DataSet(edges.get());
|
556 | 587 | shownNodes = new vis.DataSet(subNodes.get());
|
557 |
| - } |
558 |
| - else { |
| 588 | + |
| 589 | + } else { |
559 | 590 | subEdges = new vis.DataSet(edges.get({filter: function (e) {
|
560 | 591 | return (e.part.indexOf(partition) > -1);
|
561 | 592 | }}));
|
|
573 | 604 | e.arrows = {to: true};
|
574 | 605 | }
|
575 | 606 | return true;
|
576 |
| - } |
577 |
| - else if (!subEdges.get(e.reverse)) { |
| 607 | + |
| 608 | + } else if (!subEdges.get(e.reverse)) { |
578 | 609 | e.arrows = {to: true};
|
579 | 610 | return true;
|
580 |
| - } |
581 |
| - else |
| 611 | + |
| 612 | + } else |
582 | 613 | return false;
|
583 | 614 | }}));
|
584 | 615 | printWithTime("Edges filtered (keep one way)");
|
|
0 commit comments