Topo2: Host panel clickable titles
Clicking a host panel title will now navigate to the hosts page and highlight the selected host
JIRA-TASKS: ONOS-6656
Change-Id: I0a1ddccc34cd833b55688f8a9aa0a6291fb41e81
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js
index 987136f..285221f 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js
@@ -15,18 +15,19 @@
*/
/*
- ONOS GUI -- Topology Layout Module.
- Module that contains the d3.force.layout logic
+ ONOS GUI -- Topo2 Hosts Panel
+ Module that builds the Hosts Panel for the selected Host
*/
(function () {
'use strict';
// Injected Services
- var panel, gs, flash, ls;
+ var panel, gs, flash, ls, ns;
// Internal State
- var hostPanel, hostData;
+ var hostPath = 'host',
+ hostPanel, hostData;
function init() {
hostPanel = panel();
@@ -64,10 +65,16 @@
hostPanel.show();
hostPanel.emptyRegions();
+ var navFn = function () {
+ ns.navTo(hostPath, { hostId: hostData.title });
+ };
+
var svg = hostPanel.appendToHeader('div')
.classed('icon', true)
.append('svg'),
- title = hostPanel.appendToHeader('h2'),
+ title = hostPanel.appendToHeader('h2')
+ .on('click', navFn)
+ .classed('clickable', true),
table = hostPanel.appendToBody('table'),
tbody = table.append('tbody');
@@ -97,12 +104,14 @@
angular.module('ovTopo2')
.factory('Topo2HostsPanelService', [
'Topo2DetailsPanelService', 'GlyphService', 'FlashService', 'ListService',
- function (_ps_, _gs_, _flash_, _ls_) {
+ 'NavService',
+ function (_ps_, _gs_, _flash_, _ls_, _ns_) {
panel = _ps_;
gs = _gs_;
flash = _flash_;
ls = _ls_;
+ ns = _ns_;
return {
displayPanel: displayPanel,