ONOS-3263 : Added code to exercise the topology dialog API.

Change-Id: Ic0d9a55597ffa85ad27ab3e68bf0243c9e0b7d8e
diff --git a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
index 338c1d5..eae2249 100644
--- a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
+++ b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovDemo.js
@@ -7,7 +7,7 @@
     'use strict';
 
     // injected refs
-    var $log, fs, flash, wss;
+    var $log, fs, flash, wss, tss, tds;
 
     // constants
     var displayStart = 'uiRefTopovDisplayStart',
@@ -37,6 +37,23 @@
         wss.sendEvent(displayStop);
     }
 
+    function createDialogContent(devs) {
+        var content = tds.createDiv('my-content-class');
+        content.append('p').text('Do something to these devices?');
+        devs.forEach(function (d) {
+            content.append('p').text(d);
+        });
+        return content;
+    }
+
+    function dCancel() {
+        $log.debug('Dialog CANCEL button pressed');
+    }
+
+    function dOk() {
+        $log.debug('Dialog OK button pressed');
+    }
+
     // === ---------------------------
     // === Main API functions
 
@@ -66,23 +83,42 @@
         return false;
     }
 
+    function deviceDialog() {
+        var ctx = tss.selectionContext();
+
+        $log.debug('dialog invoked with context:', ctx);
+
+        // only if at least one device was selected
+        if (ctx.devices.length) {
+            tds.openDialog()
+                .addContent(createDialogContent(ctx.devices))
+                .addButton('Cancel', dCancel)
+                .addButton('OK', dOk);
+        }
+    }
+
     // === ---------------------------
     // === Module Factory Definition
 
     angular.module('ovUiRefTopov', [])
         .factory('UiRefTopovDemoService',
         ['$log', 'FnService', 'FlashService', 'WebSocketService',
+            'TopoSelectService', 'TopoDialogService',
 
-            function (_$log_, _fs_, _flash_, _wss_) {
+            function (_$log_, _fs_, _flash_, _wss_, _tss_, _tds_) {
                 $log = _$log_;
                 fs = _fs_;
                 flash = _flash_;
                 wss = _wss_;
+                tss = _tss_;
+                tds = _tds_;
 
                 return {
                     startDisplay: startDisplay,
                     updateDisplay: updateDisplay,
-                    stopDisplay: stopDisplay
+                    stopDisplay: stopDisplay,
+
+                    deviceDialog: deviceDialog
                 };
             }]);
 }());
diff --git a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js
index 7d137a2..1abb1d5 100644
--- a/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js
+++ b/uiref/src/main/resources/app/view/uiRefTopov/uiRefTopovOverlay.js
@@ -7,7 +7,7 @@
     'use strict';
 
     // injected refs
-    var $log, tov, stds;
+    var $log, tov, demo;
 
     // internal state should be kept in the service module (not here)
 
@@ -37,7 +37,7 @@
             $log.debug("UI Ref topology overlay ACTIVATED");
         },
         deactivate: function () {
-            stds.stopDisplay();
+            demo.stopDisplay();
             $log.debug("UI Ref topology overlay DEACTIVATED");
         },
 
@@ -46,8 +46,8 @@
             foo: {
                 gid: 'chain',
                 tt: 'A FOO action',
-                cb: function (data) {
-                    $log.debug('FOO action invoked with data:', data);
+                cb: function() {
+                    demo.deviceDialog();
                 }
             },
             bar: {
@@ -63,17 +63,17 @@
         // NOTE: fully qual. button ID is derived from overlay-id and key-name
         keyBindings: {
             0: {
-                cb: function () { stds.stopDisplay(); },
+                cb: function () { demo.stopDisplay(); },
                 tt: 'Cancel Display Mode',
                 gid: 'xMark'
             },
             V: {
-                cb: function () { stds.startDisplay('mouse'); },
+                cb: function () { demo.startDisplay('mouse'); },
                 tt: 'Start Mouse Mode',
                 gid: '*banner'
             },
             F: {
-                cb: function () { stds.startDisplay('link'); },
+                cb: function () { demo.startDisplay('link'); },
                 tt: 'Start Link Mode',
                 gid: 'chain'
             },
@@ -93,7 +93,7 @@
             // Must return true to consume ESC, false otherwise.
             escape: function () {
                 // Must return true to consume ESC, false otherwise.
-                return stds.stopDisplay();
+                return demo.stopDisplay();
             },
 
             // hooks for when the selection changes...
@@ -111,11 +111,11 @@
             mouseover: function (m) {
                 // m has id, class, and type properties
                 $log.debug('mouseover:', m);
-                stds.updateDisplay(m);
+                demo.updateDisplay(m);
             },
             mouseout: function () {
                 $log.debug('mouseout');
-                stds.updateDisplay();
+                demo.updateDisplay();
             }
         }
     };
@@ -133,10 +133,10 @@
     angular.module('ovUiRefTopov')
         .run(['$log', 'TopoOverlayService', 'UiRefTopovDemoService',
 
-            function (_$log_, _tov_, _stds_) {
+            function (_$log_, _tov_, _demo_) {
                 $log = _$log_;
                 tov = _tov_;
-                stds = _stds_;
+                demo = _demo_;
                 tov.register(overlay);
             }]);