\r
providers.forEach(function(p) {\r
p.contract.forEach(function(con) {\r
- providerLinkItems.push(JointGraphFactory.createLink(epgItem.id, contracts[con].id, 'blue')); \r
+ providerLinkItems.push(JointGraphFactory.createLink(epgItem.id, contracts[con].id, 'blue'));\r
});\r
});\r
\r
JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.subject ,offsetHobj.pEpg, paper);\r
offsetHobj.subject = JointGraphOffsetFactory.getCurrentOffset(itemsArray.subject, 'y');\r
JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.cEpg ,offsetHobj.subject, paper);\r
+\r
}, function(){});\r
\r
}\r
// init();\r
}]);\r
\r
- gbp.register.controller('policyRendererCtrl', ['$scope', '$http', '$timeout', 'PGNServices', 'TopoServices', 'GBPTenantServices', 'GBPConstants',\r
- function ($scope, $http, $timeout, PGNServices, TopoServices, GBPTenantServices, GBPConstants) {\r
+ gbp.register.controller('policyRendererCtrl', ['$scope', '$http', '$timeout', 'PGNServices', 'TopoServices', 'GBPTenantServices', 'GBPConstants', 'JointGraphFactory','GBPJointGraphBuilder',\r
+ function ($scope, $http, $timeout, PGNServices, TopoServices, GBPTenantServices, GBPConstants, JointGraphFactory, GBPJointGraphBuilder) {\r
\r
$scope.topologyData = { nodes: [], links: [] };\r
$scope.topologyType = null;\r
+ $scope.topologyArgs = {};\r
$scope.legend = {};\r
$scope.showLegend = false;\r
\r
+ var paper = JointGraphFactory.createGraph();\r
+\r
var reloadShowLegend = function() {\r
$scope.showLegend = !$.isEmptyObject($scope.legend);\r
};\r
button: false\r
};\r
\r
-\r
- // $scope.selectedTenant = null;\r
+ paper.on('cell:pointerdown', function(cellView, evt) {\r
+ if (cellView.model.isLink() && cellView.model.attributes.objData) {\r
+ $scope.$broadcast('SET_LINK_DATA', cellView.model.attributes.objData);\r
+ }\r
+ });\r
\r
$scope.mandatoryProperties = [];\r
$scope.loadTopology = function(type, args) {\r
- if ( $scope.selectedTenant ) {\r
-\r
- $scope.topologyData = { nodes: [], links: [] };\r
+ if ($scope.selectedTenant) {\r
$scope.topologyType = type;\r
-\r
- TopoServices.loadTopology(type, function(nodes, links) {\r
- $scope.topologyData = { nodes: nodes, links: links };\r
- $scope.viewTopo.box = true;\r
- $scope.viewTopo.button = type !== GBPConstants.strings.l2l3 && type !== null ? true : false;\r
- $scope.legend = TopoServices.getLegend(type);\r
- reloadShowLegend();\r
- }, function() {\r
- $scope.legend = {};\r
- reloadShowLegend();\r
- }, args);\r
-\r
+ $scope.topologyArgs = args;\r
+ GBPJointGraphBuilder.loadTopology(args, paper, type);\r
}\r
};\r
-\r
- $scope.topologyCustfunc = function(sigmaIstance, getSlowDownNum, dragListener, resize){\r
-\r
- sigmaIstance.bind('clickStage', function(e){\r
- sigmaIstance.killForceAtlas2();\r
- });\r
-\r
- // Bind the events:\r
- // sigmaIstance.bind('overNode outNode clickNode doubleClickNode rightClickNode', function(e) {\r
- // console.log(e.type, e.data.node.label, e.data.captor);\r
- // });\r
- // sigmaIstance.bind('overEdge outEdge clickEdge doubleClickEdge rightClickEdge', function(e) {\r
- // console.log(e.type, e.data.edge, e.data.captor);\r
- // });\r
- // sigmaIstance.bind('clickStage', function(e) {\r
- // console.log(e.type, e.data.captor);\r
- // });\r
- // sigmaIstance.bind('doubleClickStage rightClickStage', function(e) {\r
- // console.log(e.type, e.data.captor);\r
- // });\r
-\r
- };\r
-\r
$scope.toggleExpanded = function(expand, show) {\r
$scope.setViewExpand('policyRendererView',expand, show, 'l2');\r
\r
- if($scope.policyRendererView[expand]) {\r
+ if($scope.policyRendererView[expand] && $scope.selectedTenant) {\r
+ $scope.topologyArgs.tenantId = $scope.selectedTenant.id;\r
+\r
if((expand === 'epg' || expand === 'contracts' || expand === 'classifiers' || expand === 'actions' || expand === 'renderers') && ($scope.topologyType !== GBPConstants.strings.config)) {\r
- $scope.loadTopology(GBPConstants.strings.config, { tenantId: $scope.selectedTenant ? $scope.selectedTenant.id : null, storage: 'config' });\r
+ $scope.loadTopology(GBPConstants.strings.config, $scope.topologyArgs);\r
} else if((expand === 'l2l3' || expand === 'registerEndpoint' || expand === 'registerL3PrefixEndpoint') && ($scope.topologyType !== GBPConstants.strings.l2l3)) {\r
- $scope.loadTopology(GBPConstants.strings.l2l3, { tenantId: $scope.selectedTenant ? $scope.selectedTenant.id : null });\r
+ $scope.loadTopology(GBPConstants.strings.l2l3, $scope.topologyArgs);\r
}\r
}\r
};\r
\r
- $scope.loadTopo = function() {\r
+ $scope.reloadTopo = function() {\r
if($scope.selectedTenant) {\r
- $scope.loadTopology($scope.topologyType, { tenantId: $scope.selectedTenant.id });\r
+ $scope.topologyArgs.tenantId = $scope.selectedTenant.id;\r
+ GBPJointGraphBuilder.loadTopology($scope.topologyArgs, paper, $scope.topologyType);\r
}\r
};\r
\r
\r
}]);\r
\r
- gbp.register.controller('topoDataCtrl',['$scope', 'TopoServices', function($scope, TopoServices){\r
+ gbp.register.controller('linkDataCtrl',['$scope', function($scope){\r
$scope.showTable = false;\r
\r
- $scope.getConsProvLabel = function(edge){\r
- return TopoServices.getConsProvLabel(edge, $scope.topologyData);\r
- };\r
-\r
$scope.show = function(){\r
$scope.showTable = true;\r
};\r
$scope.close = function(){\r
$scope.showTable = false;\r
};\r
+ \r
+ $scope.$on('SET_LINK_DATA', function(e, obj){\r
+ $scope.linkData = obj;\r
+ $scope.show();\r
+ $scope.$apply();\r
+ });\r
}]);\r
\r
gbp.register.controller('crudCtrl',['$scope', function($scope){\r
$scope.internalView.epg = false;\r
$scope.reloadNewObj();\r
$scope.internalView.edit = "view";\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
GBPEpgServices.delete(path, function(data){\r
$scope.init();\r
$scope.internalView.epg = false;\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.internalView.cns = false;\r
$scope.internalView.cns = "view";\r
$scope.reloadNewObj();\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedCNS.name);\r
GBPConNamedSelServices.delete(path, function(data){\r
$scope.init();\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.internalView.pns = false;\r
$scope.reloadNewObj();\r
$scope.internalView.cns = "view";\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedPNS.name);\r
GBPProNamedSelServices.delete(path, function(data){\r
$scope.init();\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.view.l2flood = false;\r
$scope.view.edit = "view";\r
$scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD');\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.view.l2flood = false;\r
$scope.view.edit = "view";\r
$scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD');\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.view.l2bridge = false;\r
$scope.view.edit = "view";\r
$scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD');\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.view.l2bridge = false;\r
$scope.view.edit = "view";\r
$scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD');\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.view.l3context = false;\r
$scope.view.edit = "view";\r
$scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD');\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.view.l3context = false;\r
$scope.view.edit = "view";\r
$scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD');\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.init();\r
$scope.view.subnet = false;\r
$scope.view.edit = "view";\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
$scope.init();\r
$scope.view.subnet = false;\r
$scope.view.edit = "view";\r
+\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r
GBPTenantServices.send(path, $scope.tenant, function(data){\r
$scope.wizards.accessModelWizard = false;\r
$scope.sendReloadEventFromRoot('GBP_GLOBAL_TENANT_RELOAD');\r
+ $scope.reloadTopo();\r
}, function(){\r
//TODO: error cbk\r
});\r