Simon Hunt

ONOS-3738: implemented F1..F5 key bindings to topology overlay selection.

- added size() function to radio button sets
- removed noisy warning (panel resize when contents not defined)

Change-Id: Id39cffe5c6c9f608b9d9af672b1535610a97f0fc
......@@ -240,7 +240,8 @@
return {
width: rsetWidth,
selected: selected,
selectedIndex: selectedIndex
selectedIndex: selectedIndex,
size: function () { return rads.length; }
}
}
......
......@@ -65,6 +65,13 @@
E: [equalizeMasters, 'Equalize mastership roles'],
// topology overlay selections
F1: function () { ttbs.fnkey(0); },
F2: function () { ttbs.fnkey(1); },
F3: function () { ttbs.fnkey(2); },
F4: function () { ttbs.fnkey(3); },
F5: function () { ttbs.fnkey(4); },
esc: handleEscape,
_keyListener: ttbs.keyListener,
......
......@@ -97,7 +97,9 @@
$log.warn('adjustHeight: height from top of page not given');
return null;
} else if (!body || !p) {
$log.warn('adjustHeight: panel contents are not defined');
// panel contents are not defined
// this may happen when window is resizing but panel has
// been cleared or removed
return null;
}
......
......@@ -270,6 +270,13 @@
ovRset.selectedIndex(idx);
}
// an overlay was selected via Function-Key press
function fnkey(idx) {
if (idx < ovRset.size() && idx !== ovRset.selectedIndex()) {
ovRset.selectedIndex(idx);
}
}
angular.module('ovTopo')
.factory('TopoToolbarService',
['$log', 'FnService', 'ToolbarService', 'PrefsService',
......@@ -289,7 +296,8 @@
destroyToolbar: destroyToolbar,
keyListener: keyListener,
toggleToolbar: toggleToolbar,
setDefaultOverlay: setDefaultOverlay
setDefaultOverlay: setDefaultOverlay,
fnkey: fnkey
};
}]);
}());
\ No newline at end of file
......