From e25c5a2d15af11aa39f7e6a75ce6631349b36a07 Mon Sep 17 00:00:00 2001 From: Simon Hunt Date: Thu, 2 Apr 2015 14:37:12 -0700 Subject: [PATCH] GUI -- Adjusted link details display to suppress nonsensical line items for edge-links. Change-Id: If272c783f4d471e30ac5342a6b12d2b66926d43d --- .../main/webapp/app/view/topo/topoPanel.js | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/web/gui/src/main/webapp/app/view/topo/topoPanel.js b/web/gui/src/main/webapp/app/view/topo/topoPanel.js index 2b3e760370..2d54328fc3 100644 --- a/web/gui/src/main/webapp/app/view/topo/topoPanel.js +++ b/web/gui/src/main/webapp/app/view/topo/topoPanel.js @@ -49,12 +49,13 @@ } function addProp(tbody, label, value) { - var tr = tbody.append('tr'); + var tr = tbody.append('tr'), + lab = label.replace(/_/g, ' '); function addCell(cls, txt) { tr.append('td').attr('class', cls).html(txt); } - addCell('label', label + ' :'); + addCell('label', lab + ' :'); addCell('value', value); } @@ -147,27 +148,44 @@ return d ? d.type + ' / ' + o : '-'; } + // provided to change presentation of internal type name + var linkTypePres = { + hostLink: 'edge link' + }; + + function linkType(d) { + return linkTypePres[d.type()] || d.type(); + } + + var coreOrder = [ + 'Type', '-', + 'A_type', 'A_id', 'A_label', 'A_port', '-', + 'B_type', 'B_id', 'B_label', 'B_port', '-' + ], + edgeOrder = [ + 'Type', '-', + 'A_type', 'A_id', 'A_label', '-', + 'B_type', 'B_id', 'B_label', 'B_port' + ]; + function displayLink(data) { detailPanel.empty(); var svg = dpa('svg'), title = dpa('h2'), table = dpa('table'), - tbody = table.append('tbody'); + tbody = table.append('tbody'), + edgeLink = data.type() === 'hostLink', + order = edgeLink ? edgeOrder : coreOrder; gs.addGlyph(svg, 'ports', 40); title.text('Link'); - var order = [ - 'Type', '-', - 'A_type', 'A_id', 'A_label', 'A_port', '-', - 'B_type', 'B_id', 'B_label', 'B_port', '-' - ]; listProps(tbody, { propOrder: order, props: { - Type: data.type(), + Type: linkType(data), A_type: data.source.class, A_id: data.source.id, @@ -181,8 +199,10 @@ } }); - addProp(tbody, 'A → B', linkSummary(data.fromSource)); - addProp(tbody, 'B → A', linkSummary(data.fromTarget)); + if (!edgeLink) { + addProp(tbody, 'A → B', linkSummary(data.fromSource)); + addProp(tbody, 'B → A', linkSummary(data.fromTarget)); + } } function displayNothing() {