GUI -- Adjusted link details display to suppress nonsensical line items for edge-links.
Change-Id: If272c783f4d471e30ac5342a6b12d2b66926d43d
Showing
1 changed file
with
29 additions
and
9 deletions
... | @@ -49,12 +49,13 @@ | ... | @@ -49,12 +49,13 @@ |
49 | } | 49 | } |
50 | 50 | ||
51 | function addProp(tbody, label, value) { | 51 | function addProp(tbody, label, value) { |
52 | - var tr = tbody.append('tr'); | 52 | + var tr = tbody.append('tr'), |
53 | + lab = label.replace(/_/g, ' '); | ||
53 | 54 | ||
54 | function addCell(cls, txt) { | 55 | function addCell(cls, txt) { |
55 | tr.append('td').attr('class', cls).html(txt); | 56 | tr.append('td').attr('class', cls).html(txt); |
56 | } | 57 | } |
57 | - addCell('label', label + ' :'); | 58 | + addCell('label', lab + ' :'); |
58 | addCell('value', value); | 59 | addCell('value', value); |
59 | } | 60 | } |
60 | 61 | ||
... | @@ -147,27 +148,44 @@ | ... | @@ -147,27 +148,44 @@ |
147 | return d ? d.type + ' / ' + o : '-'; | 148 | return d ? d.type + ' / ' + o : '-'; |
148 | } | 149 | } |
149 | 150 | ||
151 | + // provided to change presentation of internal type name | ||
152 | + var linkTypePres = { | ||
153 | + hostLink: 'edge link' | ||
154 | + }; | ||
155 | + | ||
156 | + function linkType(d) { | ||
157 | + return linkTypePres[d.type()] || d.type(); | ||
158 | + } | ||
159 | + | ||
160 | + var coreOrder = [ | ||
161 | + 'Type', '-', | ||
162 | + 'A_type', 'A_id', 'A_label', 'A_port', '-', | ||
163 | + 'B_type', 'B_id', 'B_label', 'B_port', '-' | ||
164 | + ], | ||
165 | + edgeOrder = [ | ||
166 | + 'Type', '-', | ||
167 | + 'A_type', 'A_id', 'A_label', '-', | ||
168 | + 'B_type', 'B_id', 'B_label', 'B_port' | ||
169 | + ]; | ||
170 | + | ||
150 | function displayLink(data) { | 171 | function displayLink(data) { |
151 | detailPanel.empty(); | 172 | detailPanel.empty(); |
152 | 173 | ||
153 | var svg = dpa('svg'), | 174 | var svg = dpa('svg'), |
154 | title = dpa('h2'), | 175 | title = dpa('h2'), |
155 | table = dpa('table'), | 176 | table = dpa('table'), |
156 | - tbody = table.append('tbody'); | 177 | + tbody = table.append('tbody'), |
178 | + edgeLink = data.type() === 'hostLink', | ||
179 | + order = edgeLink ? edgeOrder : coreOrder; | ||
157 | 180 | ||
158 | gs.addGlyph(svg, 'ports', 40); | 181 | gs.addGlyph(svg, 'ports', 40); |
159 | title.text('Link'); | 182 | title.text('Link'); |
160 | 183 | ||
161 | - var order = [ | ||
162 | - 'Type', '-', | ||
163 | - 'A_type', 'A_id', 'A_label', 'A_port', '-', | ||
164 | - 'B_type', 'B_id', 'B_label', 'B_port', '-' | ||
165 | - ]; | ||
166 | 184 | ||
167 | listProps(tbody, { | 185 | listProps(tbody, { |
168 | propOrder: order, | 186 | propOrder: order, |
169 | props: { | 187 | props: { |
170 | - Type: data.type(), | 188 | + Type: linkType(data), |
171 | 189 | ||
172 | A_type: data.source.class, | 190 | A_type: data.source.class, |
173 | A_id: data.source.id, | 191 | A_id: data.source.id, |
... | @@ -181,9 +199,11 @@ | ... | @@ -181,9 +199,11 @@ |
181 | } | 199 | } |
182 | }); | 200 | }); |
183 | 201 | ||
202 | + if (!edgeLink) { | ||
184 | addProp(tbody, 'A → B', linkSummary(data.fromSource)); | 203 | addProp(tbody, 'A → B', linkSummary(data.fromSource)); |
185 | addProp(tbody, 'B → A', linkSummary(data.fromTarget)); | 204 | addProp(tbody, 'B → A', linkSummary(data.fromTarget)); |
186 | } | 205 | } |
206 | + } | ||
187 | 207 | ||
188 | function displayNothing() { | 208 | function displayNothing() { |
189 | haveDetails = false; | 209 | haveDetails = false; | ... | ... |
-
Please register or login to post a comment