aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoSelect.js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoSelect.js')
-rw-r--r--framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoSelect.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoSelect.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoSelect.js
index 483c4baa..4ad76903 100644
--- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoSelect.js
+++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoSelect.js
@@ -240,6 +240,33 @@
return cc;
}
+ // returns a selection context, providing info about what is selected
+ function selectionContext() {
+ var devices = [],
+ hosts = [],
+ types = {};
+
+ angular.forEach(selections, function (d) {
+ var o = d.obj,
+ c = o.class;
+
+ if (c === 'device') {
+ devices.push(o.id);
+ types[o.id] = o.type;
+ }
+ if (c === 'host') {
+ hosts.push(o.id);
+ types[o.id] = o.type;
+ }
+ });
+
+ return {
+ devices: devices,
+ hosts: hosts,
+ types: types
+ };
+ }
+
// === -----------------------------------------------------
// === MODULE DEFINITION ===
@@ -280,7 +307,8 @@
selectOrder: function () { return selectOrder; },
somethingSelected: somethingSelected,
- clickConsumed: clickConsumed
+ clickConsumed: clickConsumed,
+ selectionContext: selectionContext
};
}]);
}());