diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-10-19 10:14:31 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-10-19 10:14:31 -0700 |
commit | e9bb60be43af477f17b30ee1f2ba205565b7fa15 (patch) | |
tree | 981fd759a44b751fc45cde774f46fda37c11c257 /framework/src/onos/web | |
parent | 74f3941756a1386cbc1fa99ee73fdc8376a0b6a0 (diff) |
Updated onos src tree to commit id 1e60f97ae50c05b94fcb6a10520738bfb5efdfd1
Diffstat (limited to 'framework/src/onos/web')
4 files changed, 21 insertions, 27 deletions
diff --git a/framework/src/onos/web/gui/src/main/webapp/app/fw/widget/button.js b/framework/src/onos/web/gui/src/main/webapp/app/fw/widget/button.js index 09cdd43a..2ef5b4b0 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/fw/widget/button.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/fw/widget/button.js @@ -224,7 +224,9 @@ } else { if (x >= 0 && x < rads.length) { if (currIdx !== x) { + rads[currIdx].el.classed('selected', false); currIdx = x; + rads[currIdx].el.classed('selected', true); invokeCurrent(); } else { $log.warn('current index already selected:', x); diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js index 42b6f4bd..0dfd6281 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js @@ -525,6 +525,7 @@ // temporary solution for persisting user settings restoreConfigFromPrefs(); + ttbs.setDefaultOverlay(); $log.debug('registered overlays...', tov.list()); $log.log('OvTopoCtrl has been created'); diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js index 7eb45ba4..74fa2f24 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js @@ -107,34 +107,17 @@ $log.debug(tos + 'registered overlay: ' + id, overlay); } - // TODO: remove this redundant code....... - // NOTE: unregister needs to be called if an app is ever - // deactivated/uninstalled via the applications view -/* - function unregister(overlay) { - var u = 'unregister', - over = fs.isO(overlay), - id = over ? over.overlayId : ''; - - if (!id) { - return error(u, 'not a recognized overlay'); - } - if (!overlays[id]) { - return warn(u, 'not registered: "' + id + "'") - } - delete overlays[id]; - $log.debug(tos + 'unregistered overlay: ' + id); - } -*/ - - // returns the list of overlay identifiers function list() { return d3.map(overlays).keys(); } // add a radio button for each registered overlay + // return an overlay id to index map function augmentRbset(rset, switchFn) { + var map = {}, + idx = 1; + angular.forEach(overlays, function (ov) { rset.push({ gid: ov._glyphId, @@ -143,7 +126,9 @@ tbSelection(ov.overlayId, switchFn); } }); + map[ov.overlayId] = idx++; }); + return map; } // an overlay was selected via toolbar radio button press from user @@ -394,7 +379,6 @@ return { register: register, - //unregister: unregister, setApi: setApi, list: list, augmentRbset: augmentRbset, diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js index 84de261b..3928cd21 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js @@ -30,13 +30,14 @@ // setUpKeys // internal state - var toolbar, keyData, cachedState, thirdRow; + var toolbar, keyData, cachedState, thirdRow, ovRset, ovIndex; // constants var name = 'topo-tbar', cooktag = 'topo_prefs', soa = 'switchOverlayActions: ', - selOver = 'Select overlay here ⇧'; + selOver = 'Select overlay here ⇧', + defaultOverlay = 'traffic'; // key to button mapping data @@ -172,8 +173,8 @@ tov.tbSelection(null, switchOverlayActions); } }]; - tov.augmentRbset(rset, switchOverlayActions); - toolbar.addRadioSet('topo-overlays', rset); + ovIndex = tov.augmentRbset(rset, switchOverlayActions); + ovRset = toolbar.addRadioSet('topo-overlays', rset); } // invoked by overlay service to switch out old buttons and switch in new @@ -261,6 +262,11 @@ toolbar.toggle(); } + function setDefaultOverlay() { + var idx = ovIndex[defaultOverlay] || 0; + ovRset.selectedIndex(idx); + } + angular.module('ovTopo') .factory('TopoToolbarService', ['$log', 'FnService', 'ToolbarService', 'PrefsService', @@ -278,7 +284,8 @@ createToolbar: createToolbar, destroyToolbar: destroyToolbar, keyListener: keyListener, - toggleToolbar: toggleToolbar + toggleToolbar: toggleToolbar, + setDefaultOverlay: setDefaultOverlay }; }]); }());
\ No newline at end of file |