Simon Hunt
Committed by Gerrit Code Review

GUI - removing dead code from topo.js

Change-Id: I5d43234314d269874c684245b8a45ac816bca20b
...@@ -33,17 +33,10 @@ ...@@ -33,17 +33,10 @@
33 useLiveData: true, 33 useLiveData: true,
34 fnTrace: true, 34 fnTrace: true,
35 debugOn: false, 35 debugOn: false,
36 - debug: {
37 - showNodeXY: true,
38 - showKeyHandler: false
39 - },
40 birdDim: 400, 36 birdDim: 400,
41 options: { 37 options: {
42 - layering: true,
43 - collisionPrevention: true,
44 showBackground: true 38 showBackground: true
45 }, 39 },
46 - backgroundUrl: 'img/us-map.png',
47 webSockUrl: 'ws/topology', 40 webSockUrl: 'ws/topology',
48 data: { 41 data: {
49 live: { 42 live: {
...@@ -251,14 +244,6 @@ ...@@ -251,14 +244,6 @@
251 // ============================== 244 // ==============================
252 // For Debugging / Development 245 // For Debugging / Development
253 246
254 - function note(label, msg) {
255 - console.log('NOTE: ' + label + ': ' + msg);
256 - }
257 -
258 - function debug(what) {
259 - return config.debugOn && config.debug[what];
260 - }
261 -
262 function fnTrace(msg, id) { 247 function fnTrace(msg, id) {
263 if (config.fnTrace) { 248 if (config.fnTrace) {
264 console.log('FN: ' + msg + ' [' + id + ']'); 249 console.log('FN: ' + msg + ' [' + id + ']');
...@@ -909,8 +894,6 @@ ...@@ -909,8 +894,6 @@
909 fStart(); 894 fStart();
910 } 895 }
911 896
912 - // TODO: fold updateX(...) methods into one base method; remove duplication
913 -
914 function updateInstance(data) { 897 function updateInstance(data) {
915 evTrace(data); 898 evTrace(data);
916 var inst = data.payload, 899 var inst = data.payload,
...@@ -975,7 +958,6 @@ ...@@ -975,7 +958,6 @@
975 } 958 }
976 } 959 }
977 960
978 - // TODO: fold removeX(...) methods into base method - remove dup code
979 function removeInstance(data) { 961 function removeInstance(data) {
980 evTrace(data); 962 evTrace(data);
981 var inst = data.payload, 963 var inst = data.payload,
...@@ -1147,7 +1129,6 @@ ...@@ -1147,7 +1129,6 @@
1147 } 1129 }
1148 } 1130 }
1149 1131
1150 - // request overall summary data
1151 function requestSummary() { 1132 function requestSummary() {
1152 sendMessage('requestSummary'); 1133 sendMessage('requestSummary');
1153 } 1134 }
...@@ -1228,7 +1209,6 @@ ...@@ -1228,7 +1209,6 @@
1228 flash('Multi-Source flow added'); 1209 flash('Multi-Source flow added');
1229 } 1210 }
1230 1211
1231 -
1232 function cancelTraffic() { 1212 function cancelTraffic() {
1233 sendMessage('cancelTraffic'); 1213 sendMessage('cancelTraffic');
1234 } 1214 }
...@@ -1300,7 +1280,6 @@ ...@@ -1300,7 +1280,6 @@
1300 } 1280 }
1301 } 1281 }
1302 1282
1303 -
1304 function showAllTrafficAction() { 1283 function showAllTrafficAction() {
1305 hoverMode = hoverModeAll; 1284 hoverMode = hoverModeAll;
1306 requestAllTraffic(); 1285 requestAllTraffic();
...@@ -1416,7 +1395,6 @@ ...@@ -1416,7 +1395,6 @@
1416 1395
1417 svg.append('rect').attr(rectAttr); 1396 svg.append('rect').attr(rectAttr);
1418 1397
1419 - //appendGlyph(svg, c.nodeOx, c.nodeOy, c.nodeDim, '#node');
1420 appendBadge(svg, 14, 14, 28, '#bird'); 1398 appendBadge(svg, 14, 14, 28, '#bird');
1421 1399
1422 if (d.uiAttached) { 1400 if (d.uiAttached) {
...@@ -1770,7 +1748,7 @@ ...@@ -1770,7 +1748,7 @@
1770 el.attr('transform', transformLabel(parms)); 1748 el.attr('transform', transformLabel(parms));
1771 }); 1749 });
1772 1750
1773 - // Remove any links that are no longer required. 1751 + // Remove any labels that are no longer required.
1774 linkLabel.exit().remove(); 1752 linkLabel.exit().remove();
1775 } 1753 }
1776 1754
...@@ -1800,8 +1778,7 @@ ...@@ -1800,8 +1778,7 @@
1800 // start with the object as is 1778 // start with the object as is
1801 var node = device, 1779 var node = device,
1802 type = device.type, 1780 type = device.type,
1803 - svgCls = type ? 'node device ' + type : 'node device', 1781 + svgCls = type ? 'node device ' + type : 'node device';
1804 - labels = device.labels || [];
1805 1782
1806 // Augment as needed... 1783 // Augment as needed...
1807 node.class = 'device'; 1784 node.class = 'device';
...@@ -2115,7 +2092,6 @@ ...@@ -2115,7 +2092,6 @@
2115 addDeviceIcon(node, box, noLabel, iconGlyphUrl(d)); 2092 addDeviceIcon(node, box, noLabel, iconGlyphUrl(d));
2116 }); 2093 });
2117 2094
2118 -
2119 // augment host nodes... 2095 // augment host nodes...
2120 entering.filter('.host').each(function (d) { 2096 entering.filter('.host').each(function (d) {
2121 var node = d3.select(this), 2097 var node = d3.select(this),
...@@ -2263,7 +2239,6 @@ ...@@ -2263,7 +2239,6 @@
2263 g; 2239 g;
2264 2240
2265 if (noLabel) { 2241 if (noLabel) {
2266 - box = emptyBox();
2267 dx = -cfg.dim/2; 2242 dx = -cfg.dim/2;
2268 dy = -cfg.dim/2; 2243 dy = -cfg.dim/2;
2269 } else { 2244 } else {
...@@ -2535,41 +2510,7 @@ ...@@ -2535,41 +2510,7 @@
2535 // console.log('[' + rxtx + '] ' + msg); 2510 // console.log('[' + rxtx + '] ' + msg);
2536 } 2511 }
2537 2512
2538 - // NOTE: Temporary hardcoded example for showing detail pane 2513 + function handleTestSend(msg) { }
2539 - // while we fine-
2540 - // Probably should not merge this change...
2541 - function handleTestSend(msg) {
2542 - if (msg.event === 'requestDetails') {
2543 - showDetails({
2544 - event: 'showDetails',
2545 - sid: 1001,
2546 - payload: {
2547 - "id": "of:0000ffffffffff09",
2548 - "type": "roadm",
2549 - "propOrder": [
2550 - "Name",
2551 - "Vendor",
2552 - "H/W Version",
2553 - "S/W Version",
2554 - "-",
2555 - "Latitude",
2556 - "Longitude",
2557 - "Ports"
2558 - ],
2559 - "props": {
2560 - "Name": null,
2561 - "Vendor": "Linc",
2562 - "H/W Version": "OE",
2563 - "S/W Version": "?",
2564 - "-": "",
2565 - "Latitude": "40.8",
2566 - "Longitude": "73.1",
2567 - "Ports": "2"
2568 - }
2569 - }
2570 - });
2571 - }
2572 - }
2573 2514
2574 // ============================== 2515 // ==============================
2575 // Selection stuff 2516 // Selection stuff
...@@ -2710,7 +2651,6 @@ ...@@ -2710,7 +2651,6 @@
2710 addMultiSelectActions(); 2651 addMultiSelectActions();
2711 } 2652 }
2712 2653
2713 - // TODO: refactor to consolidate with populateDetails
2714 function populateSummary(data) { 2654 function populateSummary(data) {
2715 summaryPane.empty(); 2655 summaryPane.empty();
2716 2656
...@@ -3028,10 +2968,6 @@ ...@@ -3028,10 +2968,6 @@
3028 view.setKeys(keyDispatch); 2968 view.setKeys(keyDispatch);
3029 view.setGestures(gestures); 2969 view.setGestures(gestures);
3030 2970
3031 - // patch in our "button bar" for now
3032 - // TODO: implement a more official frameworky way of doing this..
3033 - //addButtonBar(view);
3034 -
3035 // Load map data asynchronously; complete startup after that.. 2971 // Load map data asynchronously; complete startup after that..
3036 loadGeoJsonData(); 2972 loadGeoJsonData();
3037 } 2973 }
...@@ -3060,15 +2996,13 @@ ...@@ -3060,15 +2996,13 @@
3060 stopAntTimer(); 2996 stopAntTimer();
3061 } 2997 }
3062 2998
3063 - // TODO: move these to config/state portion of script
3064 var geoJsonUrl = 'json/map/continental_us.json', 2999 var geoJsonUrl = 'json/map/continental_us.json',
3065 geoJson; 3000 geoJson;
3066 3001
3067 function loadGeoJsonData() { 3002 function loadGeoJsonData() {
3068 d3.json(geoJsonUrl, function (err, data) { 3003 d3.json(geoJsonUrl, function (err, data) {
3069 if (err) { 3004 if (err) {
3070 - // fall back to USA map background 3005 + console.error('failed to load Map data', err);
3071 - loadStaticMap();
3072 } else { 3006 } else {
3073 geoJson = data; 3007 geoJson = data;
3074 loadGeoMap(); 3008 loadGeoMap();
...@@ -3081,28 +3015,6 @@ ...@@ -3081,28 +3015,6 @@
3081 }); 3015 });
3082 } 3016 }
3083 3017
3084 - function showBg() {
3085 - return visVal(config.options.showBackground);
3086 - }
3087 -
3088 - function loadStaticMap() {
3089 - fnTrace('loadStaticMap', config.backgroundUrl);
3090 - var w = network.view.width(),
3091 - h = network.view.height();
3092 -
3093 - // load the background image
3094 - bgImg = svg.insert('svg:image', '#topo-G')
3095 - .attr({
3096 - id: 'topo-bg',
3097 - width: w,
3098 - height: h,
3099 - 'xlink:href': config.backgroundUrl
3100 - })
3101 - .style({
3102 - visibility: showBg()
3103 - });
3104 - }
3105 -
3106 function setProjForView(path, topoData) { 3018 function setProjForView(path, topoData) {
3107 var dim = config.logicalSize; 3019 var dim = config.logicalSize;
3108 3020
......