ONOS-5726: completed implementation of "showIntent" overlay support.
(note, there is still some cleanup to be done).
Change-Id: I6c805ad954b97ca261b5536240b277df7712a834
diff --git a/web/gui/src/main/webapp/app/fw/util/prefs.js b/web/gui/src/main/webapp/app/fw/util/prefs.js
index 14bc5e2..16f2607 100644
--- a/web/gui/src/main/webapp/app/fw/util/prefs.js
+++ b/web/gui/src/main/webapp/app/fw/util/prefs.js
@@ -43,15 +43,28 @@
}
// converts string values to numbers for selected (or all) keys
- function asNumbers(obj, keys) {
+ // asNumbers(obj, ['a', 'b']) <-- convert keys .a, .b to numbers
+ // asNumbers(obj, ['a', 'b'], true) <-- convert ALL BUT keys .a, .b to numbers
+
+ function asNumbers(obj, keys, not) {
if (!obj) return null;
- if (!keys) {
+ var skip = {};
+ if (not) {
+ keys.forEach(function (k) {
+ skip[k] = 1;
+ });
+ }
+
+ if (!keys || not) {
// do them all
angular.forEach(obj, function (v, k) {
- obj[k] = Number(obj[k]);
+ if (!not || !skip[k]) {
+ obj[k] = Number(obj[k]);
+ }
});
} else {
+ // do the explicitly named keys
keys.forEach(function (k) {
obj[k] = Number(obj[k]);
});