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
diff --git a/web/gui/src/main/webapp/app/fw/widget/button.js b/web/gui/src/main/webapp/app/fw/widget/button.js
index 2ef5b4b..734cb10 100644
--- a/web/gui/src/main/webapp/app/fw/widget/button.js
+++ b/web/gui/src/main/webapp/app/fw/widget/button.js
@@ -240,7 +240,8 @@
return {
width: rsetWidth,
selected: selected,
- selectedIndex: selectedIndex
+ selectedIndex: selectedIndex,
+ size: function () { return rads.length; }
}
}
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.js b/web/gui/src/main/webapp/app/view/topo/topo.js
index 3564eb3..ace9a0e 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.js
+++ b/web/gui/src/main/webapp/app/view/topo/topo.js
@@ -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,
diff --git a/web/gui/src/main/webapp/app/view/topo/topoPanel.js b/web/gui/src/main/webapp/app/view/topo/topoPanel.js
index 748c17f..af2c4bc 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoPanel.js
@@ -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;
}
diff --git a/web/gui/src/main/webapp/app/view/topo/topoToolbar.js b/web/gui/src/main/webapp/app/view/topo/topoToolbar.js
index fbcdaf6..c62e52b 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoToolbar.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoToolbar.js
@@ -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