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 {
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 @@ public class DriverViewComponent {
// 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
......
......@@ -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',
......
......@@ -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);
}
}
......