X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vbd%2Fgui%2Fmodule%2Fsrc%2Fmain%2Fresources%2Fvpp%2Fservices%2Fvpp.services.js;fp=vbd%2Fgui%2Fmodule%2Fsrc%2Fmain%2Fresources%2Fvpp%2Fservices%2Fvpp.services.js;h=4c20f844e8da18e19e35b8f718e4845173a0909b;hb=37c09259c1958fe5ed7c28bc24f593577070bbcb;hp=70b1631f75774e1dc669e4d08b14df1f5a3c01a1;hpb=1fe1660a989f6018115331e6a6c4b096ef088c82;p=honeycomb.git diff --git a/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js b/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js index 70b1631f7..4c20f844e 100644 --- a/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js +++ b/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js @@ -30,14 +30,15 @@ define(['app/vpp/vpp.module', 'next'], function(vpp) { } }); - vpp.register.service('dataService', function() { + vpp.register.service('dataService', ['$timeout', function($timeout) { + + var self = this; nx.graphic.Icons.registerIcon("bd", "src/app/vpp/assets/images/bd1.svg", 45, 45); nx.graphic.Icons.registerIcon("interf", "src/app/vpp/assets/images/interf.svg", 45, 45); this.bridgeDomainsTopo = new nx.graphic.Topology({ - height: 350, - width: 500, + adaptive: true, scalable: true, theme:'blue', enableGradualScaling:true, @@ -49,8 +50,6 @@ define(['app/vpp/vpp.module', 'next'], function(vpp) { var type = vertex.get().type; if (type === 'bd') { return 'bd' - } else if (type === 'vpp') { - return 'switch' } else { return 'interf'; } @@ -82,11 +81,11 @@ define(['app/vpp/vpp.module', 'next'], function(vpp) { } }); this.nextApp = new nx.ui.Application; + this.bridgedomainsLoaded = false; this.vpps = []; - this.tableContent = []; - this.unassignedInterfaces = []; + this.originalAssignments = []; this.interfaces = []; this.injectedInterfaces = []; this.bridgedomains = []; @@ -95,69 +94,188 @@ define(['app/vpp/vpp.module', 'next'], function(vpp) { name: '' }; - this.setBridgeDomains = function(data) { - angular.copy(data['bridge-domains']['bridge-domain'], this.bridgedomains); + this.generateInterfaces = function() { + self.interfaces.length = 0; + _.forEach(this.vpps, function(vpp) { + _.forEach(vpp.interfaces, function(interf) { + interf.vppName = vpp.name; + interf.label = vpp.name+'/'+interf.name; + interf.scale = 0.5; + self.interfaces.push(interf); + }); + }); + console.log(this.interfaces); }; - this.clearInjectedInterfacesInBridgeDomainTopo = function() { - this.bridgeDomainsTopo.clear(); - this.injectedInterfaces.length = 0; + this.buildAssignedInterfaces = function() { + this.originalAssignments.length = 0; + _.forEach(this.bridgedomains, function(bd){ + var bdName = bd['topology-id']; + var nodes = bd.node; + if (nodes) { + _.forEach(nodes, function(vpp) { + var vppName = vpp['node-id']; + var tps = vpp['termination-point']; + if (tps) { + _.forEach(tps, function(tp) { + tp.vppName = vppName; + tp.vbd = bdName; + self.originalAssignments.push(tp); + }) + } + }) + } + }); + console.log('Assigned Interfaces: '); + console.log(this.originalAssignments); }; - this.generateUnassignedInterfaces = function() { - this.unassignedInterfaces.length = 0; - for (var x=0; x