Simon Hunt
Committed by Gerrit Code Review

GUI --Cleaned up mouse-over/out in preparation for 'show-traffic' behavior.

 - re-instated the unpin function.

Change-Id: I310804084b93e1cd16f3da31b49ea646db36c6d7
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 "intentId": "0x4321", 13 "intentId": "0x4321",
14 "links": [ "5-6", "6-7" ], 14 "links": [ "5-6", "6-7" ],
15 "class": "animated", 15 "class": "animated",
16 - "traffic": [ "4GB", "4GB" ] 16 + "labels": [ "4GB", "4GB" ]
17 } 17 }
18 ] 18 ]
19 } 19 }
......
...@@ -160,9 +160,9 @@ ...@@ -160,9 +160,9 @@
160 detailPane, 160 detailPane,
161 selectOrder = [], 161 selectOrder = [],
162 selections = {}, 162 selections = {},
163 + hovered = null,
163 164
164 highlighted = null, 165 highlighted = null,
165 - hovered = null,
166 viewMode = 'showAll', 166 viewMode = 'showAll',
167 portLabelsOn = false; 167 portLabelsOn = false;
168 168
...@@ -290,8 +290,12 @@ ...@@ -290,8 +290,12 @@
290 view.alert('togglePorts() callback') 290 view.alert('togglePorts() callback')
291 } 291 }
292 292
293 - function unpin(view) { 293 + function unpin() {
294 - view.alert('unpin() callback') 294 + if (hovered) {
295 + hovered.fixed = false;
296 + hovered.el.classed('fixed', false);
297 + network.force.resume();
298 + }
295 } 299 }
296 300
297 // ============================== 301 // ==============================
...@@ -931,6 +935,21 @@ ...@@ -931,6 +935,21 @@
931 // TODO: review what else might need to be updated 935 // TODO: review what else might need to be updated
932 } 936 }
933 937
938 + function nodeMouseOver(d) {
939 + console.log("Hover:", d);
940 + hovered = d;
941 + if (d.class === 'host') {
942 + //requestTraffic(d);
943 + }
944 + }
945 +
946 + function nodeMouseOut(d) {
947 + console.log("Unhover:", d);
948 + hovered = null;
949 + if (d.class === 'host') {
950 + //cancelTraffic(d);
951 + }
952 + }
934 953
935 function updateNodes() { 954 function updateNodes() {
936 node = nodeG.selectAll('.node') 955 node = nodeG.selectAll('.node')
...@@ -950,19 +969,8 @@ ...@@ -950,19 +969,8 @@
950 opacity: 0 969 opacity: 0
951 }) 970 })
952 .call(network.drag) 971 .call(network.drag)
953 - .on('mouseover', function (d) { 972 + .on('mouseover', nodeMouseOver)
954 - console.log(d); 973 + .on('mouseout', nodeMouseOut)
955 - if (d.class === 'host') {
956 - requestTraffic(d);
957 - }
958 - })
959 - .on('mouseout', function (d) {
960 - console.log(d);
961 - if (d.class === 'host') {
962 - cancelTraffic(d);
963 - }
964 - })
965 - //.on('mouseover', function (d) {})
966 .transition() 974 .transition()
967 .attr('opacity', 1); 975 .attr('opacity', 1);
968 976
......