Simon Hunt

Added styling to unpinned nodes.

Also wired up the radio buttons to suppress nodes/links appropriately.
...@@ -156,7 +156,53 @@ ...@@ -156,7 +156,53 @@
156 if (id !== viewMode) { 156 if (id !== viewMode) {
157 radioButton('displayModes', id); 157 radioButton('displayModes', id);
158 viewMode = id; 158 viewMode = id;
159 - alert('action: ' + id); 159 + doRadioAction(id);
160 + }
161 + });
162 + }
163 +
164 + function doRadioAction(id) {
165 + showAllLayers();
166 + if (id === 'showPkt') {
167 + showPacketLayer();
168 + } else if (id === 'showOpt') {
169 + showOpticalLayer();
170 + }
171 + }
172 +
173 + function showAllLayers() {
174 + network.node.classed('inactive', false);
175 + network.link.classed('inactive', false);
176 + }
177 +
178 + function showPacketLayer() {
179 + network.node.each(function(d) {
180 + // deactivate nodes that are not hosts or switches
181 + if (d.class === 'device' && d.type !== 'switch') {
182 + d3.select(this).classed('inactive', true);
183 + }
184 + });
185 +
186 + network.link.each(function(lnk) {
187 + // deactivate infrastructure links that have opt's as endpoints
188 + if (lnk.source.type === 'roadm' || lnk.target.type === 'roadm') {
189 + d3.select(this).classed('inactive', true);
190 + }
191 + });
192 + }
193 +
194 + function showOpticalLayer() {
195 + network.node.each(function(d) {
196 + // deactivate nodes that are not optical devices
197 + if (d.type !== 'roadm') {
198 + d3.select(this).classed('inactive', true);
199 + }
200 + });
201 +
202 + network.link.each(function(lnk) {
203 + // deactivate infrastructure links that have opt's as endpoints
204 + if (lnk.source.type !== 'roadm' || lnk.target.type !== 'roadm') {
205 + d3.select(this).classed('inactive', true);
160 } 206 }
161 }); 207 });
162 } 208 }
...@@ -216,6 +262,7 @@ ...@@ -216,6 +262,7 @@
216 function unpin() { 262 function unpin() {
217 if (hovered) { 263 if (hovered) {
218 hovered.fixed = false; 264 hovered.fixed = false;
265 + findNodeFromData(hovered).classed('fixed', false);
219 network.force.resume(); 266 network.force.resume();
220 } 267 }
221 console.log('Unpin - context = ' + contextLabel()); 268 console.log('Unpin - context = ' + contextLabel());
...@@ -434,9 +481,10 @@ ...@@ -434,9 +481,10 @@
434 d.fixed &= ~6; 481 d.fixed &= ~6;
435 482
436 // once we've finished moving, pin the node in position, 483 // once we've finished moving, pin the node in position,
437 - // if it is a device 484 + // if it is a device (not a host)
438 if (d.class === 'device') { 485 if (d.class === 'device') {
439 d.fixed = true; 486 d.fixed = true;
487 + d3.select(this).classed('fixed', true)
440 } 488 }
441 }); 489 });
442 490
......
...@@ -94,13 +94,19 @@ svg .link.host { ...@@ -94,13 +94,19 @@ svg .link.host {
94 } 94 }
95 95
96 svg .node.device rect { 96 svg .node.device rect {
97 - stroke-width: 1.5px; 97 + stroke-width: 3.0px;
98 + stroke: white;
99 + stroke-dasharray: 2,2;
98 100
99 transition: opacity 250ms; 101 transition: opacity 250ms;
100 -webkit-transition: opacity 250ms; 102 -webkit-transition: opacity 250ms;
101 -moz-transition: opacity 250ms; 103 -moz-transition: opacity 250ms;
102 } 104 }
103 105
106 +svg .node.device.fixed rect {
107 + stroke-width: 0;
108 +}
109 +
104 svg .node.device.roadm rect { 110 svg .node.device.roadm rect {
105 fill: #229; 111 fill: #229;
106 } 112 }
...@@ -142,7 +148,7 @@ svg .node.inactive rect, ...@@ -142,7 +148,7 @@ svg .node.inactive rect,
142 svg .node.inactive circle, 148 svg .node.inactive circle,
143 svg .node.inactive text, 149 svg .node.inactive text,
144 svg .node.inactive image { 150 svg .node.inactive image {
145 - opacity: .2; 151 + opacity: .05;
146 } 152 }
147 153
148 svg .node.inactive.selected rect, 154 svg .node.inactive.selected rect,
......