GUI -- Working towards embedding icons in tables. WIP.
- Skeleton of icon directive added.
- icons embedded in table - test HTML file.
- Augmented GlyphService.loadDefs() to allow subset of glyph ids to be specified.
Change-Id: I775a958ef9dc35b0b89a126d5c0497f72a721b71
diff --git a/web/gui/src/main/webapp/app/common.css b/web/gui/src/main/webapp/app/common.css
index 7759f4d..4253efa 100644
--- a/web/gui/src/main/webapp/app/common.css
+++ b/web/gui/src/main/webapp/app/common.css
@@ -22,8 +22,7 @@
*/
table.summary-list {
- /*border: 1px solid red;*/
- margin: 4px 50px;
+ margin: 4px 4px;
font-size: 10pt;
}
diff --git a/web/gui/src/main/webapp/app/directives.js b/web/gui/src/main/webapp/app/directives.js
index 2cb6dc1..7d574d5 100644
--- a/web/gui/src/main/webapp/app/directives.js
+++ b/web/gui/src/main/webapp/app/directives.js
@@ -56,4 +56,23 @@
};
}])
+
+ // create icon directive, so that we can inject icons into
+ // HTML tables etc.
+ .directive('icon', ['GlyphService', function (gs) {
+ return {
+ templateUrl: 'toBeDecided-iconContext.html',
+ restrict: 'A',
+ link: function (scope, element, attrs) {
+ // TODO: implement this
+ // needs to pull out the parameters for the icon
+ // from the attributes of the element, and use those
+ // as arguments to the IconService.addIcon(...) call.
+
+
+ }
+ };
+
+
+ }]);
}());
diff --git a/web/gui/src/main/webapp/app/fw/svg/glyph.js b/web/gui/src/main/webapp/app/fw/svg/glyph.js
index 844d0f3..ef017e0 100644
--- a/web/gui/src/main/webapp/app/fw/svg/glyph.js
+++ b/web/gui/src/main/webapp/app/fw/svg/glyph.js
@@ -23,6 +23,7 @@
'use strict';
var $log,
+ fs,
glyphs = d3.map(),
msgGS = 'GlyphService.';
@@ -121,8 +122,9 @@
// ----------------------------------------------------------------------
angular.module('onosSvg')
- .factory('GlyphService', ['$log', function (_$log_) {
+ .factory('GlyphService', ['$log', 'FnService', function (_$log_, _fs_) {
$log = _$log_;
+ fs = _fs_;
function clear() {
// start with a fresh map
@@ -166,15 +168,20 @@
}
// Note: defs should be a D3 selection of a single <defs> element
- function loadDefs(defs) {
+ function loadDefs(defs, glyphIds) {
+ var list = fs.isA(glyphIds) || ids();
+
// remove all existing content
defs.html(null);
- // load up the currently registered glyphs
- glyphs.values().forEach(function (g) {
- defs.append('symbol')
- .attr({ id: g.id, viewBox: g.vb })
- .append('path').attr('d', g.d);
+ // load up the requested glyphs
+ list.forEach(function (id) {
+ var g = glyph(id);
+ if (g) {
+ defs.append('symbol')
+ .attr({ id: g.id, viewBox: g.vb })
+ .append('path').attr('d', g.d);
+ }
});
}