Thomas Vachuska
Committed by Gerrit Code Review

GUI Fixes.

Change-Id: I5b5de2b74b65f1af613e04e226ee633ee50f695d
...@@ -164,6 +164,7 @@ public class TopologyViewIntentFilter { ...@@ -164,6 +164,7 @@ public class TopologyViewIntentFilter {
164 164
165 // Indicates whether the specified intent involves the given device. 165 // Indicates whether the specified intent involves the given device.
166 private boolean isIntentRelevantToDevice(List<Intent> installables, Device device) { 166 private boolean isIntentRelevantToDevice(List<Intent> installables, Device device) {
167 + if (installables != null) {
167 for (Intent installable : installables) { 168 for (Intent installable : installables) {
168 if (installable instanceof PathIntent) { 169 if (installable instanceof PathIntent) {
169 PathIntent pathIntent = (PathIntent) installable; 170 PathIntent pathIntent = (PathIntent) installable;
...@@ -177,6 +178,7 @@ public class TopologyViewIntentFilter { ...@@ -177,6 +178,7 @@ public class TopologyViewIntentFilter {
177 } 178 }
178 } 179 }
179 } 180 }
181 + }
180 return false; 182 return false;
181 } 183 }
182 184
......
...@@ -124,7 +124,6 @@ svg .node.host circle { ...@@ -124,7 +124,6 @@ svg .node.host circle {
124 124
125 #topo svg .link { 125 #topo svg .link {
126 opacity: .7; 126 opacity: .7;
127 - stroke-width: 1.2px;
128 } 127 }
129 128
130 #topo svg .link.inactive { 129 #topo svg .link.inactive {
...@@ -210,15 +209,17 @@ svg .node.host circle { ...@@ -210,15 +209,17 @@ svg .node.host circle {
210 text-align: center; 209 text-align: center;
211 210
212 /* theme specific... */ 211 /* theme specific... */
213 - border: 1px solid #ddf; 212 + border: 2px solid #ddd;
214 - color: #99f; 213 + border-radius: 4px;
214 + color: #eee;
215 + background: #888;
215 } 216 }
216 217
217 #topo-detail .actionBtn:hover { 218 #topo-detail .actionBtn:hover {
218 /* theme specific... */ 219 /* theme specific... */
219 - border: 1px solid #ddf; 220 + border: 2px solid #ddd;
220 - background: #eef; 221 + color: #eee;
221 - color: #77d; 222 + background: #444;
222 } 223 }
223 224
224 225
......
...@@ -741,21 +741,15 @@ ...@@ -741,21 +741,15 @@
741 741
742 function showTraffic(data) { 742 function showTraffic(data) {
743 evTrace(data); 743 evTrace(data);
744 - var paths = data.payload.paths; 744 + var paths = data.payload.paths,
745 + hasTraffic = false;
745 746
746 // Revert any links hilighted previously. 747 // Revert any links hilighted previously.
747 - link.attr('stroke-width', null) 748 + link.style('stroke-width', null)
748 - .style('stroke-width', null)
749 .classed('primary secondary animated optical', false); 749 .classed('primary secondary animated optical', false);
750 // Remove all previous labels. 750 // Remove all previous labels.
751 removeLinkLabels(); 751 removeLinkLabels();
752 752
753 - if (paths.length && !antTimer) {
754 - startAntTimer();
755 - } else if (!paths.length && antTimer) {
756 - stopAntTimer();
757 - }
758 -
759 // Now hilight all links in the paths payload, and attach 753 // Now hilight all links in the paths payload, and attach
760 // labels to them, if they are defined. 754 // labels to them, if they are defined.
761 paths.forEach(function (p) { 755 paths.forEach(function (p) {
...@@ -763,15 +757,23 @@ ...@@ -763,15 +757,23 @@
763 i, 757 i,
764 ldata; 758 ldata;
765 759
760 + hasTraffic = hasTraffic || p.traffic;
766 for (i=0; i<n; i++) { 761 for (i=0; i<n; i++) {
767 ldata = findLinkById(p.links[i]); 762 ldata = findLinkById(p.links[i]);
768 - if (ldata) { 763 + if (ldata && ldata.el) {
769 ldata.el.classed(p.class, true); 764 ldata.el.classed(p.class, true);
770 ldata.label = p.labels[i]; 765 ldata.label = p.labels[i];
771 } 766 }
772 } 767 }
773 }); 768 });
769 +
774 updateLinks(); 770 updateLinks();
771 +
772 + if (hasTraffic && !antTimer) {
773 + startAntTimer();
774 + } else if (!hasTraffic && antTimer) {
775 + stopAntTimer();
776 + }
775 } 777 }
776 778
777 // ............................... 779 // ...............................
...@@ -1736,14 +1738,17 @@ ...@@ -1736,14 +1738,17 @@
1736 1738
1737 linkLabel.each(function (d) { 1739 linkLabel.each(function (d) {
1738 var el = d3.select(this); 1740 var el = d3.select(this);
1739 - var lnk = findLinkById(d.key), 1741 + var lnk = findLinkById(d.key);
1740 - parms = { 1742 +
1743 + if (lnk) {
1744 + var parms = {
1741 x1: lnk.source.x, 1745 x1: lnk.source.x,
1742 y1: lnk.source.y, 1746 y1: lnk.source.y,
1743 x2: lnk.target.x, 1747 x2: lnk.target.x,
1744 y2: lnk.target.y 1748 y2: lnk.target.y
1745 }; 1749 };
1746 el.attr('transform', transformLabel(parms)); 1750 el.attr('transform', transformLabel(parms));
1751 + }
1747 }); 1752 });
1748 } 1753 }
1749 1754
...@@ -1973,7 +1978,7 @@ ...@@ -1973,7 +1978,7 @@
1973 table = detailPane.append("table"), 1978 table = detailPane.append("table"),
1974 tbody = table.append("tbody"); 1979 tbody = table.append("tbody");
1975 1980
1976 - title.text('Multi-Select...'); 1981 + title.text('Selected Nodes');
1977 1982
1978 selectOrder.forEach(function (d, i) { 1983 selectOrder.forEach(function (d, i) {
1979 addProp(tbody, i+1, d); 1984 addProp(tbody, i+1, d);
...@@ -2000,22 +2005,26 @@ ...@@ -2000,22 +2005,26 @@
2000 } 2005 }
2001 }); 2006 });
2002 2007
2003 - addSingleSelectActions(); 2008 + addSingleSelectActions(data);
2004 } 2009 }
2005 2010
2006 - function addSingleSelectActions() { 2011 + function addSingleSelectActions(data) {
2007 detailPane.append('hr'); 2012 detailPane.append('hr');
2008 // always want to allow 'show traffic' 2013 // always want to allow 'show traffic'
2009 - addAction(detailPane, 'Show Traffic', showTrafficAction); 2014 + addAction(detailPane, 'Show Related Traffic', showTrafficAction);
2015 +
2016 + if (data.type === 'switch') {
2017 + addAction(detailPane, 'Show Device Flows', showDeviceLinkFlowsAction);
2018 + }
2010 } 2019 }
2011 2020
2012 function addMultiSelectActions() { 2021 function addMultiSelectActions() {
2013 detailPane.append('hr'); 2022 detailPane.append('hr');
2014 // always want to allow 'show traffic' 2023 // always want to allow 'show traffic'
2015 - addAction(detailPane, 'Show Traffic', showTrafficAction); 2024 + addAction(detailPane, 'Show Related Traffic', showTrafficAction);
2016 // if exactly two hosts are selected, also want 'add host intent' 2025 // if exactly two hosts are selected, also want 'add host intent'
2017 if (nSel() === 2 && allSelectionsClass('host')) { 2026 if (nSel() === 2 && allSelectionsClass('host')) {
2018 - addAction(detailPane, 'Add Host Intent', addIntentAction); 2027 + addAction(detailPane, 'Add Host-to-Host Intent', addIntentAction);
2019 } 2028 }
2020 } 2029 }
2021 2030
...@@ -2306,7 +2315,8 @@ ...@@ -2306,7 +2315,8 @@
2306 } 2315 }
2307 2316
2308 function startAntTimer() { 2317 function startAntTimer() {
2309 - var pulses = [ 5, 3, 1.2, 3 ], 2318 + if (!antTimer) {
2319 + var pulses = [5, 3, 1.2, 3],
2310 pulse = 0; 2320 pulse = 0;
2311 antTimer = setInterval(function () { 2321 antTimer = setInterval(function () {
2312 pulse = pulse + 1; 2322 pulse = pulse + 1;
...@@ -2314,6 +2324,7 @@ ...@@ -2314,6 +2324,7 @@
2314 d3.selectAll('.animated').style('stroke-width', pulses[pulse]); 2324 d3.selectAll('.animated').style('stroke-width', pulses[pulse]);
2315 }, 200); 2325 }, 200);
2316 } 2326 }
2327 + }
2317 2328
2318 function stopAntTimer() { 2329 function stopAntTimer() {
2319 if (antTimer) { 2330 if (antTimer) {
......