Web UI -- Added cog as nav icon for driver matrix view.
- fixed bug where glyph was not installed when icon mapping made.

Change-Id: Iea9a145ff0caf6b4977bec4e71f75738d3174719
diff --git a/apps/drivermatrix/src/main/java/org/onosproject/drivermatrix/DriverViewComponent.java b/apps/drivermatrix/src/main/java/org/onosproject/drivermatrix/DriverViewComponent.java
index 5f4f918..958b022 100644
--- a/apps/drivermatrix/src/main/java/org/onosproject/drivermatrix/DriverViewComponent.java
+++ b/apps/drivermatrix/src/main/java/org/onosproject/drivermatrix/DriverViewComponent.java
@@ -38,6 +38,7 @@
 
     private static final String VIEW_ID = "driverMatrix";
     private static final String VIEW_TEXT = "Driver Matrix";
+    private static final String NAV_ICON = "nav_drivers";
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -46,7 +47,7 @@
 
     // List of application views
     private final List<UiView> uiViews = ImmutableList.of(
-            new UiView(UiView.Category.PLATFORM, VIEW_ID, VIEW_TEXT)
+            new UiView(UiView.Category.PLATFORM, VIEW_ID, VIEW_TEXT, NAV_ICON)
     );
 
     // Factory for UI message handlers
diff --git a/apps/drivermatrix/src/main/resources/app/view/driverMatrix/driverMatrix.js b/apps/drivermatrix/src/main/resources/app/view/driverMatrix/driverMatrix.js
index 80d46a3..e0a4689 100644
--- a/apps/drivermatrix/src/main/resources/app/view/driverMatrix/driverMatrix.js
+++ b/apps/drivermatrix/src/main/resources/app/view/driverMatrix/driverMatrix.js
@@ -48,6 +48,10 @@
     }
 
     angular.module('ovDriverMatrix', [])
+        .run(['IconService', function (is) {
+            // Create our icon-to-glyph binding here:
+            is.registerIconMapping('nav_drivers', 'cog');
+        }])
         .controller('OvDriverMatrixCtrl',
         ['$log', '$scope', 'TableBuilderService',
             'FnService', 'WebSocketService',
diff --git a/web/gui/src/main/webapp/app/fw/svg/icon.js b/web/gui/src/main/webapp/app/fw/svg/icon.js
index b8d249e..fc7fc68 100644
--- a/web/gui/src/main/webapp/app/fw/svg/icon.js
+++ b/web/gui/src/main/webapp/app/fw/svg/icon.js
@@ -73,12 +73,11 @@
 
     function ensureIconLibDefs() {
         var body = d3.select('body'),
-            svg = body.select('svg#IconLibDefs'),
-            defs;
+            svg = body.select('svg#IconLibDefs');
 
         if (svg.empty()) {
             svg = body.append('svg').attr('id', 'IconLibDefs');
-            defs = svg.append('defs');
+            svg.append('defs');
         }
         return svg.select('defs');
     }
@@ -227,7 +226,10 @@
         if (glyphMapping[iconId]) {
             $log.warn('Icon with id', iconId, 'already mapped. Ignoring.');
         } else {
+            // map icon-->glyph
             glyphMapping[iconId] = glyphId;
+            // make sure definition is installed
+            gs.loadDefs(ensureIconLibDefs(), [glyphId], true);
         }
     }