Simon Hunt
Committed by Gerrit Code Review

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
...@@ -38,6 +38,7 @@ public class DriverViewComponent { ...@@ -38,6 +38,7 @@ public class DriverViewComponent {
38 38
39 private static final String VIEW_ID = "driverMatrix"; 39 private static final String VIEW_ID = "driverMatrix";
40 private static final String VIEW_TEXT = "Driver Matrix"; 40 private static final String VIEW_TEXT = "Driver Matrix";
41 + private static final String NAV_ICON = "nav_drivers";
41 42
42 private final Logger log = LoggerFactory.getLogger(getClass()); 43 private final Logger log = LoggerFactory.getLogger(getClass());
43 44
...@@ -46,7 +47,7 @@ public class DriverViewComponent { ...@@ -46,7 +47,7 @@ public class DriverViewComponent {
46 47
47 // List of application views 48 // List of application views
48 private final List<UiView> uiViews = ImmutableList.of( 49 private final List<UiView> uiViews = ImmutableList.of(
49 - new UiView(UiView.Category.PLATFORM, VIEW_ID, VIEW_TEXT) 50 + new UiView(UiView.Category.PLATFORM, VIEW_ID, VIEW_TEXT, NAV_ICON)
50 ); 51 );
51 52
52 // Factory for UI message handlers 53 // Factory for UI message handlers
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
48 } 48 }
49 49
50 angular.module('ovDriverMatrix', []) 50 angular.module('ovDriverMatrix', [])
51 + .run(['IconService', function (is) {
52 + // Create our icon-to-glyph binding here:
53 + is.registerIconMapping('nav_drivers', 'cog');
54 + }])
51 .controller('OvDriverMatrixCtrl', 55 .controller('OvDriverMatrixCtrl',
52 ['$log', '$scope', 'TableBuilderService', 56 ['$log', '$scope', 'TableBuilderService',
53 'FnService', 'WebSocketService', 57 'FnService', 'WebSocketService',
......
...@@ -73,12 +73,11 @@ ...@@ -73,12 +73,11 @@
73 73
74 function ensureIconLibDefs() { 74 function ensureIconLibDefs() {
75 var body = d3.select('body'), 75 var body = d3.select('body'),
76 - svg = body.select('svg#IconLibDefs'), 76 + svg = body.select('svg#IconLibDefs');
77 - defs;
78 77
79 if (svg.empty()) { 78 if (svg.empty()) {
80 svg = body.append('svg').attr('id', 'IconLibDefs'); 79 svg = body.append('svg').attr('id', 'IconLibDefs');
81 - defs = svg.append('defs'); 80 + svg.append('defs');
82 } 81 }
83 return svg.select('defs'); 82 return svg.select('defs');
84 } 83 }
...@@ -227,7 +226,10 @@ ...@@ -227,7 +226,10 @@
227 if (glyphMapping[iconId]) { 226 if (glyphMapping[iconId]) {
228 $log.warn('Icon with id', iconId, 'already mapped. Ignoring.'); 227 $log.warn('Icon with id', iconId, 'already mapped. Ignoring.');
229 } else { 228 } else {
229 + // map icon-->glyph
230 glyphMapping[iconId] = glyphId; 230 glyphMapping[iconId] = glyphId;
231 + // make sure definition is installed
232 + gs.loadDefs(ensureIconLibDefs(), [glyphId], true);
231 } 233 }
232 } 234 }
233 235
......