2 'app/gbp/sfc/sfc.service'
6 angular.module('app.gbp').controller('SfcTopologyController', SfcTopologyController);
8 SfcTopologyController.$inject = ['$filter', '$mdDialog', '$scope', 'chainName', 'SfcService'];
10 function SfcTopologyController($filter, $mdDialog, $scope, chainName, SfcService) {
12 $scope.chain = SfcService.createObject({name: 'SFCGBP'});
13 $scope.topologyDataSfc = {nodes:[], links:[]};
14 $scope.cbkFunctionsSfc = {
15 clickNode: function(node){
18 clickLink: function(link){
21 topologyGenerated: function(){
26 $scope.closeDialog = closeDialog;
30 $scope.chain.get(function() {
31 $scope.chain.data && $scope.chain.data['sfc-service-function'] &&
32 $scope.chain.data['sfc-service-function'].length && $scope.viewTopology();
34 $scope.topologyLoaded = true;
37 function closeDialog(){
41 function fillTopologyDataSfc() {
42 var topoData = {nodes:[], links:[]};
43 $scope.chain.data['sfc-service-function'].forEach(function(sf) {
44 topoData.nodes.push({id: sf.name, 'node-id': sf.name, label: sf.name, type: sf.name});
47 $scope.topologyDataSfc = topoData;
50 $scope.viewTopology = function() {
51 $scope.topologySfc = new nx.graphic.Topology({
56 enableGradualScaling:true,
60 //scale: 'model.scale',
61 iconType: function(vertex) {
62 var type = vertex.get().type;
64 case 'service-function-type:firewall':
66 case 'service-function-type:dpi':
80 //dataProcessor: 'force',
82 enableSmartNode: false,
83 tooltipManagerConfig: {
84 showNodeTooltip: false,
85 showLinkTooltip: false
88 $scope.app = new nx.ui.Application;
93 $scope.chain.data['sfc-service-function'].forEach(function(sf, index) {
102 index>0 && links.push({
108 $scope.topologySfc.data({
113 $scope.app.container(document.getElementById('next-vpp-topo'));
114 $scope.topologySfc.attach($scope.app);