Committed by
Gerrit Code Review
GUI -- Augmented the link details display.
Change-Id: Ic5fc65cffe5c61cb14251454c7f6d9baca263445
Showing
1 changed file
with
38 additions
and
9 deletions
... | @@ -52,7 +52,7 @@ | ... | @@ -52,7 +52,7 @@ |
52 | var tr = tbody.append('tr'); | 52 | var tr = tbody.append('tr'); |
53 | 53 | ||
54 | function addCell(cls, txt) { | 54 | function addCell(cls, txt) { |
55 | - tr.append('td').attr('class', cls).text(txt); | 55 | + tr.append('td').attr('class', cls).html(txt); |
56 | } | 56 | } |
57 | addCell('label', label + ' :'); | 57 | addCell('label', label + ' :'); |
58 | addCell('value', value); | 58 | addCell('value', value); |
... | @@ -132,6 +132,21 @@ | ... | @@ -132,6 +132,21 @@ |
132 | .on('click', cb); | 132 | .on('click', cb); |
133 | } | 133 | } |
134 | 134 | ||
135 | + var friendlyIndex = { | ||
136 | + device: 1, | ||
137 | + host: 0 | ||
138 | + }; | ||
139 | + | ||
140 | + function friendly(d) { | ||
141 | + var i = friendlyIndex[d.class] || 0; | ||
142 | + return (d.labels && d.labels[i]) || ''; | ||
143 | + } | ||
144 | + | ||
145 | + function linkSummary(d) { | ||
146 | + var o = d && d.online ? 'online' : 'offline'; | ||
147 | + return d ? d.type + ' / ' + o : '-'; | ||
148 | + } | ||
149 | + | ||
135 | function displayLink(data) { | 150 | function displayLink(data) { |
136 | detailPanel.empty(); | 151 | detailPanel.empty(); |
137 | 152 | ||
... | @@ -142,18 +157,32 @@ | ... | @@ -142,18 +157,32 @@ |
142 | 157 | ||
143 | gs.addGlyph(svg, 'ports', 40); | 158 | gs.addGlyph(svg, 'ports', 40); |
144 | title.text('Link'); | 159 | title.text('Link'); |
160 | + | ||
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 | + | ||
145 | listProps(tbody, { | 167 | listProps(tbody, { |
146 | - propOrder: [ | 168 | + propOrder: order, |
147 | - 'type', '-', 'src', 'srcPort', '-', 'tgt', 'tgtPort' | ||
148 | - ], | ||
149 | props: { | 169 | props: { |
150 | - type: data.type(), | 170 | + Type: data.type(), |
151 | - src: data.source.id, | 171 | + |
152 | - srcPort: data.srcPort, | 172 | + A_type: data.source.class, |
153 | - tgt: data.target.id, | 173 | + A_id: data.source.id, |
154 | - tgtPort: data.tgtPort | 174 | + A_label: friendly(data.source), |
175 | + A_port: data.srcPort, | ||
176 | + | ||
177 | + B_type: data.target.class, | ||
178 | + B_id: data.target.id, | ||
179 | + B_label: friendly(data.target), | ||
180 | + B_port: data.tgtPort | ||
155 | } | 181 | } |
156 | }); | 182 | }); |
183 | + | ||
184 | + addProp(tbody, 'A → B', linkSummary(data.fromSource)); | ||
185 | + addProp(tbody, 'B → A', linkSummary(data.fromTarget)); | ||
157 | } | 186 | } |
158 | 187 | ||
159 | function displayNothing() { | 188 | function displayNothing() { | ... | ... |
-
Please register or login to post a comment