Added in support for navigating to Topo View from Intent View

Change-Id: Ia62428dee29013cc7fa52727662b67f5673d725c
diff --git a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology.service.ts b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology.service.ts
index f2a1f60..fab3db2 100644
--- a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology.service.ts
+++ b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology.service.ts
@@ -27,6 +27,21 @@
 } from './layer/forcesvg/models';
 
 /**
+ * Model of the Intent to be displayed
+ */
+export interface Intent {
+    appId: string;
+    appName: string;
+    key: string;
+    type: string;
+}
+
+export interface RelatedIntent {
+    ids: string[];
+    hover: string;
+}
+
+/**
  * ONOS GUI -- Topology Service Module.
  */
 @Injectable()
@@ -87,7 +102,8 @@
                 }
             ],
             ['showHighlights', (event) => {
-                force.handleHighlights(event.devices, event.hosts, event.links);
+                this.log.debug('Handling showHighlights', event);
+                force.handleHighlights(event.devices, event.hosts, event.links, 5000);
             }]
             // topo2Highlights is handled by TrafficService
         ]));
@@ -96,6 +112,7 @@
         this.handlers.push('topo2CurrentRegion');
         this.handlers.push('topo2PeerRegions');
         this.handlers.push('topo2UiModelEvent');
+        this.handlers.push('showHighlights');
         // this.handlers.push('topo2Highlights');
 
         // in case we fail over to a new server,
@@ -124,4 +141,30 @@
         // tell the server we are ready to receive topo events
         this.wss.sendEvent('topo2Start', {});
     }
+
+    /*
+     * Result will be handled by showHighlights handler (set up in topology service)
+     * which will call handleHighlights() in Force Component
+     */
+    setSelectedIntent(selectedIntent: Intent): void {
+        this.log.debug('Selected intent changed to', selectedIntent);
+        this.wss.sendEvent('selectIntent', selectedIntent);
+    }
+
+    selectRelatedIntent(ids: string[]): void {
+        this.log.debug('Select next intent');
+        this.wss.sendEvent('requestNextRelatedIntent', <RelatedIntent>{
+            ids: ids,
+            hover: undefined,
+        });
+    }
+
+    /*
+     * Tell the backend to stop sending highlights - any present will fade after 5 seconds
+     * There is also a cancel traffic for Topo 2 in Traffic Service
+     */
+    cancelHighlights(): void {
+        this.wss.sendEvent('cancelTraffic', {});
+        this.log.debug('Highlights canceled');
+    }
 }