Topo2 - Key Command 'H' to toggel hosts visibility
JIRA Tasks; ONOS-6283

Change-Id: Id1b8c00342af799e1d92c84346bb3fe6f6023af6
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Link.js b/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
index d3f449c..b4b7d95 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
@@ -22,7 +22,7 @@
 (function () {
     'use strict';
 
-    var $log, Collection, Model, ts, sus, t2zs, t2vs, t2lps, fn;
+    var $log, Collection, Model, ts, sus, t2zs, t2vs, t2lps, fn, ps;
 
     var linkLabelOffset = '0.35em';
 
@@ -315,10 +315,7 @@
 
                 this.el = link;
                 this.restyleLinkElement();
-
-                if (this.get('type') === 'hostLink') {
-                    // sus.visible(link, api.showHosts());
-                }
+                this.setVisibility();
             },
             setScale: function () {
 
@@ -340,6 +337,15 @@
                     this.enhance();
                 }
             },
+            setVisibility: function () {
+
+                if (this.get('type') !== 'UiEdgeLink') {
+                    return;
+                }
+
+                var visible = ps.getPrefs('topo2_prefs')['hosts'];
+                this.el.style('visibility', visible ? 'visible' : 'hidden');
+            },
             remove: function () {
 
                 var width = linkScale(widthRatio) / t2zs.scale();
@@ -369,9 +375,9 @@
     .factory('Topo2LinkService', [
         '$log', 'Topo2Collection', 'Topo2Model',
         'ThemeService', 'SvgUtilService', 'Topo2ZoomService',
-        'Topo2ViewService', 'Topo2LinkPanelService', 'FnService',
+        'Topo2ViewService', 'Topo2LinkPanelService', 'FnService', 'PrefsService',
         function (_$log_, _c_, _Model_, _ts_, _sus_,
-            _t2zs_, _t2vs_, _t2lps_, _fn_) {
+            _t2zs_, _t2vs_, _t2lps_, _fn_, _ps_) {
 
             $log = _$log_;
             ts = _ts_;
@@ -382,6 +388,7 @@
             Model = _Model_;
             t2lps = _t2lps_;
             fn = _fn_;
+            ps = _ps_;
 
             return {
                 createLinkCollection: createLinkCollection