1 var modules = ['app/gbp-old/gbp.module',
2 'app/gbp-old/gbp.services'
6 define(modules, function(gbpOld) {
8 gbpOld.register.controller('gbpCtrl', ['$scope', '$rootScope', 'GBPTenantServices','DesignGbpFactory', 'GBPConstants',
9 function ($scope, $rootScope, GBPTenantServices, DesignGbpFactory, GBPConstants) {
10 $rootScope['section_logo'] = 'logo_gbp';
11 $scope.view_path = 'src/app/gbp-old/views/';
15 'policy-renderer': false,
19 $scope.policyRendererView = {
31 registerEndpoint : false,
32 registerL3PrefixEndpoint : false
35 $scope.subMenuView = {
43 $scope.breadcrumbs = {'l1' : null,
48 accessModelWizard: false,
49 actionReferenceWizard: false
52 $scope.setBreadcrumb = function(level, label, visible){
53 $scope.breadcrumbs[level] = visible ? label : null;
55 $scope.breadcrumbs.l2 = null;
56 $scope.breadcrumbs.l3 = null;
59 $scope.breadcrumbs.l3 = null;
63 $scope.setViewExpand = function(menu, expand, show){
64 $scope[menu][expand] = show ? true : !$scope[menu][expand];
65 for ( var property in $scope[menu] ) {
66 $scope[menu][property] = expand !== property ? false : $scope[menu][expand];
71 $scope.toggleExpandedMM = function(expand, show, broadcast){
72 $scope.setViewExpand('mainView',expand, show);
75 $scope.$broadcast(broadcast);
79 $scope.sliceLabel = function(label){
80 return label.length > GBPConstants.numbers.displayLabelLength ? label.slice(0,GBPConstants.numbers.displayLabelLength)+'...' : label;
83 $scope.getDisplayLabel = function(obj, labelArray, dontSlice){
86 if((typeof labelArray) === 'string'){
87 ret = obj[labelArray];
88 } else if (angular.isFunction(labelArray)) {
89 ret = labelArray(obj);
91 labelArray.some(function(labelParam) {
92 if(angular.isFunction(labelParam)) {
93 ret = labelParam(obj);
94 } else if(obj.hasOwnProperty(labelParam)) {
95 ret = obj[labelParam];
101 return dontSlice ? ret : $scope.sliceLabel(ret);
105 $scope.tenantList = [];
106 $scope.selectedTenant = null;
107 $scope.tenantDisplayLabel = ['name' , 'id'];
109 $scope.loadTenants = function() {
110 GBPTenantServices.load(
112 $scope.tenantList = tenants;
113 console.log('$scope.tenantList', $scope.tenantList);
119 DesignGbpFactory.setMainClass();
122 $scope.setTenant = function(selectedTenant) {
123 $scope.selectedTenant = selectedTenant;
124 $scope.$broadcast('GBP_TENANT_RELOAD', $scope.selectedTenant);
127 $scope.loadTenants();
129 $scope.$on('GBP_GLOBAL_TENANT_RELOAD',function(){
130 $scope.loadTenants();
133 $scope.sendReloadEventFromRoot = function(eventName, val) {
134 $scope.$broadcast(eventName, val);
138 // TODO: rework, use $scope.setViewContent or something
139 $scope.showWizard = function(wizardName, broadcast, broadcastedData, path) {
140 $scope.wizards[wizardName] = true;
143 $scope.sendReloadEventFromRoot(broadcast, {data: broadcastedData, path: path});
147 $scope.closeWizard = function(wizardName) {
148 $scope.wizards[wizardName] = false;
151 $scope.updateList = function(list, object, key) {
152 var elementPos = list.map(function(x) {return x[key]; }).indexOf(object[key]);
158 list[elementPos] = object;
164 gbpOld.register.controller('governanceCtrl', ['$rootScope','$scope',
165 function ($rootScope, $scope) {
166 $scope.menuTpl = 'main-menu';
167 $scope.menuBox = null;
168 $scope.contentTpl = 'main';
169 // $scope.selectedTenant = null;
170 $scope.rendererList = [];
171 var broadcastObj = {};
173 $scope.rendererList.push({'name' : 'of_overlay', 'id' : 0});
175 $scope.toggleExpanded = function(expand, menu, tplType){
176 var type = tplType ? tplType : 'contentTpl';
177 $scope.menuBox = null;
179 $scope[type] = expand;
181 if ( menu && menu === false ) {
182 $scope.menuTpl = !menu ? null : menu;
188 $scope.setViewContent = function(tplName, data, broadcast, tplType) {
190 if ( $scope[tplType] === tplName ) {
191 $scope.$broadcast(broadcast, data, true);
194 broadcastObj[tplType] = {};
195 broadcastObj[tplType].name = broadcast;
196 broadcastObj[tplType].data = data;
198 $scope.toggleExpanded(tplName, null, tplType);
204 $scope.broadcastCalling = function(tplType){
205 $scope.$broadcast(broadcastObj[tplType].name, broadcastObj[tplType].data);
208 $scope.checkBroadcastCalling = function(tplName){
209 var objClickAction = {
210 'epg-detail': function(){
211 $scope.broadcastCalling('contentTpl');
213 'subject-detail': function(){
214 $scope.broadcastCalling('contentTpl');
218 if ( angular.isFunction(objClickAction[tplName]) ) {
219 objClickAction[tplName]();
225 $scope.$on('GOV_INIT', function(){
226 $scope.menuTpl = 'main-menu';
227 $scope.contentTpl = 'main';
228 // $scope.$emit('GBP_GLOBAL_TENANT_RELOAD');
229 $scope.menuBox = null;
232 $scope.$on('GBP_TENANT_RELOAD', function(e, obj){
233 $scope.selectedTenant = obj;
239 gbpOld.register.controller('boxStaticCtrl',['$scope',
242 $scope.selectedObj = null;
244 $scope.getLabel = function(id, type){
246 providerItems: function(){
247 var name = $scope.selectedObj[type][id].attributes.objData['name'];
248 return name ? name + ' : ' + id : id;
250 consumerItems: function(){
251 var name = $scope.selectedObj[type][id].attributes.objData['name'];
252 return name ? name + ' : ' + id : id;
256 if ( angular.isFunction(objAction[type]) ) {
257 return objAction[type]();
261 $scope.$on('SET_SEL_STA_OBJ', function(obj, data, apply){
262 $scope.selectedObj = data;
272 gbpOld.register.controller('graphCtrl', ['$scope', function($scope){
276 $scope.init = function(paperInstance){
277 paper = paperInstance;
278 $scope.loadMouseScrollEvent();
282 $scope.zoom = function(out){
283 paperScale = out ? paperScale - 0.1 : paperScale >= 1 ? 1 : paperScale + 0.1;
284 paper.scale(paperScale, paperScale);
289 $scope.loadMouseScrollEvent = function(){
290 /*mouse wheel event for zooming*/
291 var graph = document.getElementById('graph'),
292 MouseWheelHandler = function(e){
293 var mouseEvent = window.event || e; // old IE support
294 var delta = Math.max(-1, Math.min(1, (mouseEvent.wheelDelta || -mouseEvent.detail)));
295 $scope.zoom(delta === 1 ? false : true);
298 if (graph.addEventListener) {
299 // IE9, Chrome, Safari, Opera
300 graph.addEventListener("mousewheel", MouseWheelHandler, false);
302 graph.addEventListener("DOMMouseScroll", MouseWheelHandler, false);
305 else {graph.attachEvent("onmousewheel", MouseWheelHandler);}
306 /*mouse wheel event for zooming - end*/
311 gbpOld.register.controller('expressedPolicyCtrl', ['$scope', 'JointGraphFactory', 'JointGraphOffsetFactory', 'GBPConstants',
312 function ($scope, JointGraphFactory, JointGraphOffsetFactory, GBPConstants) {
313 var paper = JointGraphFactory.createGraph(),
318 var objClickAction = {
320 $scope.setViewContent('epg-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox');
322 contract: function(data){
323 $scope.setViewContent('contract-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox');
327 paper.on('cell:pointerdown', function(cell) {
328 if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) {
329 objClickAction[cell.model.attributes.objType](cell.model.attributes.objData);
333 var createEpgLinks = function(epg, epgItem, contracts) {
334 var providers = epg['provider-named-selector'] && epg['provider-named-selector'].length>0 ? epg['provider-named-selector'] : [];
335 var consumers = epg['consumer-named-selector'] && epg['consumer-named-selector'].length>0 ? epg['consumer-named-selector'] : [];
336 var consumerLinkItems = [];
337 var providerLinkItems = [];
339 consumers.forEach(function(c) {
340 c.contract.forEach(function(con) {
341 consumerLinkItems.push(JointGraphFactory.createLink(contracts[con].id, epgItem.id, 'green'));
345 providers.forEach(function(p) {
346 p.contract.forEach(function(con) {
347 providerLinkItems.push(JointGraphFactory.createLink(epgItem.id, contracts[con].id, 'blue'));
351 JointGraphFactory.addItemList(paper.model, providerLinkItems);
352 JointGraphFactory.addItemList(paper.model, consumerLinkItems);
356 var loadData = function() {
357 if($scope.selectedTenant) {
377 JointGraphFactory.reloadGraph(paper.model);
379 if ( $scope.selectedTenant && $scope.selectedTenant.contract ) {
381 $scope.selectedTenant.contract.forEach(function(c, i) {
382 var label = c.description ? $scope.sliceLabel(c.description) : c.id,
383 width = JointGraphFactory.getLabelLength(label.length);
384 item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.contract, c, 'Click to see contract info', GBPConstants.colors.graph['subject'], 'Contract');
386 itemsArray.contract.push(item);
388 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper);
389 JointGraphFactory.addItem(paper.model, item);
390 contractItems[c.id] = item;
393 offsetHobj.contract = offsetObj.h;
397 if ( $scope.selectedTenant && $scope.selectedTenant['endpoint-group'] ) {
399 JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h > 400 ? offsetObj.h : 400);
400 $scope.selectedTenant['endpoint-group'].forEach(function(e, i) {
401 var label = e.name || e.id,
402 width = JointGraphFactory.getLabelLength(label.length);
403 item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.epg, e, 'Click to see epg info', GBPConstants.colors.graph['pns'], 'EP group');
405 itemsArray.epg.push(item);
407 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper);
408 JointGraphFactory.addItem(paper.model, item);
409 epgItems[e.id] = item;
411 createEpgLinks(e, item, contractItems);
416 offsetHobj.epg = JointGraphOffsetFactory.getCurrentOffset(itemsArray.contract, 'y');
417 JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.epg ,offsetHobj.epg, paper);
422 $scope.getPaperObj = function(){
426 $scope.$on('GBP_TENANT_RELOAD',function(){
427 if ($scope.selectedTenant) {
431 JointGraphFactory.reloadGraph(paper.model);
438 gbpOld.register.controller('deliveredPolicyCtrl', ['$scope', 'GPBServices', 'JointGraphFactory', 'GBPGovernanceServices', 'JointGraphOffsetFactory', 'GBPConstants',
439 function ($scope, GPBServices, JointGraphFactory, GBPGovernanceServices, JointGraphOffsetFactory, GBPConstants) {
440 var paper = JointGraphFactory.createGraph(),
445 var getEpList = function() {
446 var providerEpKeys = Object.keys(providerItems),
447 consumerEpKeys = Object.keys(consumerItems),
448 epList = providerEpKeys.map(function (k) {
449 return providerItems[k].attributes.objData;
452 consumerEpKeys.forEach(function(k) {
453 if(providerEpKeys.indexOf(k) === -1) {
454 epList.push(consumerItems[k].attributes.objData);
461 var getSubjList = function() {
462 return Object.keys(subjectItems).map(function (k) {
463 return subjectItems[k].attributes.objData;
467 var objClickAction = {
468 subject: function(data){
469 data.providerItems = providerItems;
470 data.consumerItems = consumerItems;
471 $scope.setViewContent('subject-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox');
473 consumer: function(data) {
474 $scope.setViewContent('epg-content-static', data, 'SET_SEL_STA_OBJ', 'menuBox');
476 provider: function(data) {
477 $scope.setViewContent('epg-content-static', data, 'SET_SEL_STA_OBJ', 'menuBox');
481 var objDblClickAction = {
482 consumer: function(data){
483 $scope.setBreadcrumb('l3', 'Endpoint group detail', true);
484 $scope.setViewContent('epg-detail', { ep: data, epList: getEpList() }, 'SET_SELECTED_EPG','contentTpl');
486 provider: function(data){
487 $scope.setBreadcrumb('l3', 'Endpoint group detail', true);
488 $scope.setViewContent('epg-detail', { ep: data, epList: getEpList() }, 'SET_SELECTED_EPG','contentTpl');
490 subject: function(data) {
491 var obj = { subject: data,
492 subjList: Object.keys(subjectItems).map(function (k) {
493 return subjectItems[k].attributes.objData;
495 providerItems: providerItems,
496 consumerItems: consumerItems
498 $scope.setBreadcrumb('l3', 'Subject detail', true);
499 $scope.setViewContent('subject-detail', obj, 'SET_SELECTED_SUBJECT','contentTpl');
503 paper.on('cell:pointerdown', function(cell) {
504 if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) {
505 objClickAction[cell.model.attributes.objType](cell.model.attributes.objData);
509 paper.on('cell:pointerdblclick', function(cell) {
510 objDblClickAction[cell.model.attributes.objType](cell.model.attributes.objData);
513 var createSubjectLinks = function(subject, subjectItem, providerItems, consumerItems) {
514 var providerLinkItems = subject.providers.map(function(p) {
515 return JointGraphFactory.createLink(providerItems[p].id, subjectItem.id, 'green');
517 consumerLinkItems = subject.consumers.map(function(c) {
518 return JointGraphFactory.createLink(subjectItem.id, consumerItems[c].id, 'blue');
521 JointGraphFactory.addItemList(paper.model, providerLinkItems);
522 JointGraphFactory.addItemList(paper.model, consumerLinkItems);
525 var loadData = function() {
526 if($scope.selectedTenant) {
531 var classifierInstances = $scope.selectedTenant['subject-feature-instances'] &&
532 $scope.selectedTenant['subject-feature-instances']['classifier-instance'] &&
533 $scope.selectedTenant['subject-feature-instances']['classifier-instance'].length > 0 ? $scope.selectedTenant['subject-feature-instances']['classifier-instance'] : [];
556 JointGraphFactory.reloadGraph(paper.model);
558 GBPGovernanceServices.getEPGsAndSubjects($scope.selectedTenant.id, classifierInstances, function(data){
559 data.providers.forEach(function(p, i) {
560 var relatedObj = GPBServices.getPropFromListByProp($scope.selectedTenant['endpoint-group'], 'id', p.id),
561 label = relatedObj.name || p.id,
562 width = JointGraphFactory.getLabelLength(label.length);
564 relatedObj.rules = p.rules;
565 var item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.provider, relatedObj, 'Click to see epg info, doubleclick to see Endpoint group detail', GBPConstants.colors.graph['pns'], 'Provider EPG');
567 itemsArray.pEpg.push(item);
569 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper);
570 JointGraphFactory.addItem(paper.model, item);
571 providerItems[p.id] = item;
574 offsetHobj.pEpg = offsetObj.h;
576 JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 500);
577 data.consumers.forEach(function(c, i) {
578 var relatedObj = GPBServices.getPropFromListByProp($scope.selectedTenant['endpoint-group'], 'id', c.id),
579 label = relatedObj.name || c.id,
580 width = JointGraphFactory.getLabelLength(label.length);
582 relatedObj.rules = c.rules;
583 var item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.consumer, relatedObj, 'Click to see epg info, doubleclick to see Endpoint group detail', GBPConstants.colors.graph['cns'], 'Consumer EPG');
585 itemsArray.cEpg.push(item);
587 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper);
588 JointGraphFactory.addItem(paper.model, item);
589 consumerItems[c.id] = item;
592 JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetHobj.pEpg > 300 ? offsetHobj.pEpg : 300);
593 data.subjects.forEach(function(s, i) {
595 width = JointGraphFactory.getLabelLength(label.length),
596 item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.subject, s, 'Click to see subject info, doubleclick to see Subject detail', GBPConstants.colors.graph['subject'], 'Subject');
598 itemsArray.subject.push(item);
600 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper);
601 JointGraphFactory.addItem(paper.model, item);
602 subjectItems[s.name] = item;
603 createSubjectLinks(s, item, providerItems, consumerItems);
606 offsetHobj.pEpg = JointGraphOffsetFactory.getCurrentOffset(itemsArray.pEpg, 'y');
607 JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.subject ,offsetHobj.pEpg, paper);
608 offsetHobj.subject = JointGraphOffsetFactory.getCurrentOffset(itemsArray.subject, 'y');
609 JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.cEpg ,offsetHobj.subject, paper);
616 // paper.scaleContentToFit();
617 // paper.fitToContent();
620 $scope.getPaperObj = function(){
625 $scope.$on('GBP_TENANT_RELOAD',function(){
626 if ($scope.selectedTenant) {
630 JointGraphFactory.reloadGraph(paper.model);
637 gbpOld.register.controller('subjectDetailCtrl', ['$scope', 'GPBServices', 'JointGraphFactory', 'GBPGovernanceServices', 'JointGraphOffsetFactory', 'GBPConstants',
638 function ($scope, GPBServices, JointGraphFactory, GBPGovernanceServices, JointGraphOffsetFactory, GBPConstants) {
639 $scope.selectedSubject = null;
640 $scope.subjectList = [];
642 var paper = JointGraphFactory.createGraph(),
647 var createSubjectLinks = function(subjectItem, ruleItem) {
648 var linkItem = JointGraphFactory.createLink(subjectItem.id, ruleItem.id, 'blue');
649 JointGraphFactory.addItem(paper.model, linkItem);
652 paper.on('cell:pointerdown', function(cell) {
653 var objClickAction = {
654 subject: function(data){
655 $scope.setViewContent('subject-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox');
657 rule: function(data){
658 $scope.setViewContent('rule-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox');
662 // console.log('cell.model.attributes.objType', cell.model.attributes.objType, cell.model.attributes.objData);
663 if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) {
664 objClickAction[cell.model.attributes.objType](cell.model.attributes.objData);
668 var loadData = function() {
669 if($scope.selectedSubject) {
684 JointGraphFactory.reloadGraph(paper.model);
686 var label = $scope.selectedSubject.name || $scope.selectedSubject.id,
687 width = JointGraphFactory.getLabelLength(label.length);
688 subjectItem = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.subject, $scope.selectedSubject, 'Click to see subject info', GBPConstants.colors.graph['subject'], 'Subject');
690 JointGraphFactory.addItem(paper.model, subjectItem);
692 JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 300);
693 $scope.selectedSubject.rules.forEach(function(r, i) {
695 width = JointGraphFactory.getLabelLength(label.length);
696 item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.rule, r, 'Click to see rule info', GBPConstants.colors.graph['cns'], 'Rule');
698 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper);
699 JointGraphFactory.addItem(paper.model, item);
700 ruleItems[r.name] = item;
702 createSubjectLinks(subjectItem, item);
707 $scope.getPaperObj = function(){
711 $scope.$on('SET_SELECTED_SUBJECT', function(event, data){
712 $scope.selectedSubject = data.subject;
713 $scope.subjectList = data.subjList;
717 $scope.setSubject = function(subject) {
718 $scope.selectedSubject = subject;
725 gbpOld.register.controller('epgDetailCtrl', ['$scope', 'JointGraphFactory', 'TopologyDataLoaders', 'GBPEpgServices', 'JointGraphOffsetFactory', 'GBPConstants',
726 function ($scope, JointGraphFactory, TopologyDataLoaders, GBPEpgServices, JointGraphOffsetFactory, GBPConstants) {
727 var paper = JointGraphFactory.createGraph(),
731 $scope.epgDisplayLabel = ['name', 'id'];
733 $scope.selectedEpg = null;
735 $scope.$on('SET_SELECTED_EPG', function(event, epg){
736 $scope.selectedEpg = epg.ep;
737 $scope.epgList = epg.epList;
741 $scope.setEpg = function(epg){
746 paper.on('cell:pointerdown', function(cell) {
747 var objClickAction = {
749 $scope.setViewContent('ep-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox');
752 $scope.setViewContent('epg-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox');
756 if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) {
757 objClickAction[cell.model.attributes.objType](cell.model.attributes.objData);
761 var loadData = function() {
762 if($scope.selectedTenant && $scope.selectedEpg) {
767 JointGraphFactory.reloadGraph(paper.model);
769 TopologyDataLoaders.getEndpointsFromEndpointGroup($scope.selectedTenant.id, $scope.selectedEpg.id, function(data){
781 var label = $scope.selectedEpg.name || $scope.selectedEpg.id,
782 width = JointGraphFactory.getLabelLength(label.length);
783 epgItem = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, 'epg', $scope.selectedEpg, 'Click to see epg info', GBPConstants.colors.graph['subject'], 'EPG');
785 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper);
786 JointGraphFactory.addItem(paper.model, epgItem);
788 JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 500);
789 if(data && data.output && data.output['ui-endpoint'] && data.output['ui-endpoint'].length){
790 data.output['ui-endpoint'].forEach(function(ep, i){
791 var label = ep['mac-address'] + ':' + ep['l2-context'],
792 width = JointGraphFactory.getLabelLength(label.length);
793 item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, 'ep', ep, 'Click to see ep info', GBPConstants.colors.graph['pns'], 'Endpoint');
795 JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper);
796 JointGraphFactory.addItem(paper.model, item);
797 epItems[label] = item;
798 links.push(JointGraphFactory.createLink(item.id, epgItem.id, 'green'));
801 JointGraphFactory.addItemList(paper.model, links);
807 $scope.getPaperObj = function(){
814 gbpOld.register.controller('policyRendererCtrl', ['$scope', '$http', '$timeout', 'PGNServices', 'TopoServices', 'GBPTenantServices', 'GBPConstants', 'JointGraphFactory','GBPJointGraphBuilder',
815 function ($scope, $http, $timeout, PGNServices, TopoServices, GBPTenantServices, GBPConstants, JointGraphFactory, GBPJointGraphBuilder) {
817 $scope.topologyData = { nodes: [], links: [] };
818 $scope.topologyType = null;
819 $scope.topologyArgs = {};
821 $scope.showLegend = false;
823 var paper = JointGraphFactory.createGraph();
825 var reloadShowLegend = function() {
826 $scope.showLegend = !$.isEmptyObject($scope.legend);
829 $scope.settingsSigma = {
830 defaultLabelColor: '#fff',
831 doubleClickEnabled: false,
835 $scope.settingsAtlas = {
845 paper.on('cell:pointerdown', function(cellView, evt) {
846 if (cellView.model.isLink() && cellView.model.attributes.objData) {
847 $scope.$broadcast('SET_LINK_DATA', cellView.model.attributes.objData);
851 $scope.mandatoryProperties = [];
852 $scope.loadTopology = function(type, args) {
853 if ($scope.selectedTenant) {
854 $scope.topologyType = type;
855 $scope.topologyArgs = args;
856 GBPJointGraphBuilder.loadTopology(args, paper, type);
859 $scope.toggleExpanded = function(expand, show) {
860 $scope.setViewExpand('policyRendererView',expand, show, 'l2');
862 if($scope.policyRendererView[expand] && $scope.selectedTenant) {
863 $scope.topologyArgs.tenantId = $scope.selectedTenant.id;
865 if((expand === 'epg' || expand === 'contracts' || expand === 'classifiers' || expand === 'actions' || expand === 'renderers') && ($scope.topologyType !== GBPConstants.strings.config)) {
866 $scope.loadTopology(GBPConstants.strings.config, $scope.topologyArgs);
867 } else if((expand === 'l2l3' || expand === 'registerEndpoint' || expand === 'registerL3PrefixEndpoint') && ($scope.topologyType !== GBPConstants.strings.l2l3)) {
868 $scope.loadTopology(GBPConstants.strings.l2l3, $scope.topologyArgs);
873 $scope.reloadTopo = function() {
874 if($scope.selectedTenant) {
875 $scope.topologyArgs.tenantId = $scope.selectedTenant.id;
876 GBPJointGraphBuilder.loadTopology($scope.topologyArgs, paper, $scope.topologyType);
880 $scope.getDisplayLabelsFromCtrl = function(eventName, val) {
881 $scope.$broadcast(eventName, val);
884 $scope.validateMandatory = function(newObj, mandatoryProps){
888 mandatoryProps.forEach(function(el){
889 if(newObj[el] === '' || newObj[el] === null || newObj[el] === undefined){
890 notFilledProps.push(el);
895 return {'status' : ret, 'notFilledProps' : notFilledProps};
898 $scope.validate = function(value, errors){
899 errors.int32 = !(parseInt(value) >= -2147483648 && parseInt(value) <= 2147483647);
904 $scope.validateForm = function(form) {
908 $scope.$on('GBP_TENANT_RELOAD', function(e, obj){
909 $scope.selectedTenant = obj;
914 gbpOld.register.controller('linkDataCtrl',['$scope', function($scope){
915 $scope.showTable = false;
917 $scope.show = function(){
918 $scope.showTable = true;
921 $scope.close = function(){
922 $scope.showTable = false;
925 $scope.$on('SET_LINK_DATA', function(e, obj){
926 $scope.linkData = obj;
932 gbpOld.register.controller('crudCtrl',['$scope', function($scope){
933 $scope.selectedObj = null;
937 $scope.add = function() {
938 $scope.selectedObj = null;
942 $scope.modify = function() {
943 $scope.$emit('PGN_EDIT_ELEM');
946 $scope.init = function(label) {
947 $scope.label = label;
951 $scope.$on('EV_SET_SEL_CLASS', function(event, selObj){
952 $scope.selectedObj = selObj;
956 gbpOld.register.controller('contractCtrl', ['$scope','GBPContractServices', '$filter', function($scope, GBPContractServices, $filter){
958 $scope.selectedContract = null;
959 $scope.newContractObj = GBPContractServices.createObj();
960 $scope.displayLabel = ['description','id'];
961 $scope.crudLabel = 'Contract list';
963 $scope.internalView = {
969 mandatoryProperties = [],
972 $scope.internalView = {
976 $scope.selectedContract = null;
977 $scope.newContractObj = GBPContractServices.createObj();
980 $scope.init = function() {
981 if ( $scope.selectedTenant ) {
982 $scope.selectedContract = null;
983 path = GBPContractServices.createPathObj($scope.selectedTenant.id);
985 GBPContractServices.load(path, function(data){
987 // $scope.$broadcast('GBP_CONTRACT_RELOAD');
988 $scope.sendReloadEventFromRoot('GBP_CONTRACT_RELOAD');
997 $scope.save = function(){
998 var resp = $scope.validateMandatory($scope.newContractObj, mandatoryProperties);
1000 path = GBPContractServices.createPathObj($scope.selectedTenant.id, $scope.newContractObj.id);
1001 GBPContractServices.send(path, $scope.newContractObj, function(data){
1003 $scope.internalView.contract = false;
1004 $scope.reloadNewObj();
1005 $scope.internalView.edit = "view";
1010 alert($filter('translate')('GBP_MANDATORY_NOT_FILLED')+': '+resp.notFilledProps.join(', '));
1014 $scope.delete = function() {
1015 if ( $scope.selectedContract ) {
1016 path = GBPContractServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id);
1017 GBPContractServices.delete(path, function(data){
1019 $scope.selectedContract = null;
1026 $scope.reloadNewObj = function() {
1027 $scope.newContractObj = GBPContractServices.createObj();
1030 $scope.reload = function(selectedObj) {
1031 $scope.selectedContract = selectedObj;
1032 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
1034 $scope.internalView.contract = true;
1036 $scope.internalView.contract = false;
1037 $scope.internalView.edit = "view";
1040 if($scope.internalView.contract) {
1041 angular.copy(selectedObj, $scope.newContractObj);
1043 $scope.sendReloadEventFromRoot('GBP_CONTRACT_RELOAD');
1046 $scope.showForm = function() {
1047 $scope.reloadNewObj();
1048 $scope.internalView.contract = true;
1049 $scope.selectedContract = null;
1050 $scope.internalView.edit = "add";
1053 $scope.close = function(){
1054 $scope.internalView.contract = false;
1055 $scope.internalView.edit = "view";
1058 $scope.$on('PGN_EDIT_ELEM', function(event){
1059 if(!event.defaultPrevented) {
1060 if ( $scope.selectedContract ) {
1061 $scope.internalView.contract = true;
1062 $scope.internalView.edit = "edit";
1063 angular.copy($scope.selectedContract, $scope.newContractObj);
1065 event.defaultPrevented = true;
1069 $scope.$on('GBP_TENANT_RELOAD',function(event){
1073 $scope.$on('GBP_CONTRACTS_LABEL', function(event, obj){
1074 obj.labels = $scope.displayLabel;
1078 gbpOld.register.controller('clauseCtrl', ['$scope','GBPClauseServices', 'GBPSubjectServices',
1079 function($scope, GBPClauseServices, GBPSubjectServices){
1081 $scope.selectedClause = null;
1082 $scope.newClauseObj = GBPClauseServices.createObj();
1083 $scope.internalView = {
1087 $scope.displayLabel = 'name';
1088 $scope.crudLabel = 'Clause list';
1090 $scope.subjects = {'options' : [], 'labels' : null};
1091 $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects);
1097 $scope.selectedClause = null;
1098 $scope.newClauseObj = GBPClauseServices.createObj();
1099 $scope.internalView = {
1105 //move to separate ctrl \/
1106 $scope.addNewElem = function(templateObj) {
1107 if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) {
1108 var objToPush = templateObj || "";
1109 $scope.newClauseObj['subject-refs'].push(objToPush);
1113 $scope.deleteElemAt = function(index) {
1114 if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) {
1115 $scope.newClauseObj['subject-refs'].splice(index, 1);
1119 $scope.updateAt = function(index, value) {
1120 if($scope.newClauseObj && $scope.newClauseObj['subject-refs'] && $scope.newClauseObj['subject-refs'].length >= index) {
1121 $scope.newClauseObj['subject-refs'][index] = value;
1124 //move to separate ctrl /\
1126 var loadSubjects = function() {
1127 $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects);
1129 GBPSubjectServices.load(path, function(data){
1130 $scope.subjects.options = data;
1136 $scope.init = function() {
1137 if ( $scope.selectedContract ) {
1138 path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id);
1140 GBPClauseServices.load(path, function(data){
1150 $scope.save = function(){
1151 if($scope.validateForm($scope.clauseForm)){
1152 path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.newClauseObj.name);
1153 GBPClauseServices.send(path, $scope.newClauseObj, function(data){
1155 $scope.internalView.clause = false;
1156 $scope.reloadNewObj();
1157 $scope.internalView.clause = "view";
1164 $scope.delete = function() {
1165 if ( $scope.selectedClause ) {
1166 path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedClause.name);
1167 GBPClauseServices.delete(path, function(data){
1169 $scope.selectedClause = null;
1176 $scope.reloadNewObj = function() {
1177 $scope.newClauseObj = GBPClauseServices.createObj();
1180 $scope.reload = function(selectedObj) {
1181 $scope.selectedClause = selectedObj;
1182 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
1184 $scope.internalView.clause = true;
1186 $scope.internalView.clause = false;
1187 $scope.internalView.edit = "view";
1190 if($scope.internalView.clause) {
1191 angular.copy(selectedObj, $scope.newClauseObj);
1195 $scope.showForm = function() {
1196 $scope.reloadNewObj();
1197 $scope.internalView.clause = true;
1198 $scope.internalView.edit = "add";
1199 $scope.selectedClause = null;
1202 $scope.close = function(){
1203 $scope.internalView.clause = false;
1204 $scope.internalView.edit = "view";
1207 $scope.$on('PGN_EDIT_ELEM', function(event){
1208 if (!event.defaultPrevented) {
1209 if ( $scope.selectedClause ) {
1210 $scope.internalView.clause = true;
1211 $scope.internalView.edit = "edit";
1212 angular.copy($scope.selectedClause, $scope.newClauseObj);
1214 event.defaultPrevented = true;
1218 $scope.$on('GBP_CONTRACT_RELOAD',function(){
1219 $scope.internalView.clause = false;
1223 $scope.$on('GBP_SUBJECT_RELOAD',function(){
1228 gbpOld.register.controller('subjectCtrl', ['$scope','GBPSubjectServices', '$filter', function($scope, GBPSubjectServices, $filter){
1230 $scope.selectedSubject = null;
1231 $scope.newSubjectObj = GBPSubjectServices.createObj();
1232 $scope.displayLabel = 'name';
1233 $scope.internalView = {
1237 $scope.crudLabel = 'Subject list';
1241 mandatoryProperties = ['order'],
1245 $scope.selectedSubject = null;
1246 $scope.newSubjectObj = GBPSubjectServices.createObj();
1247 $scope.internalView = {
1253 $scope.init = function() {
1254 if ( $scope.selectedContract ) {
1255 $scope.selectedSubject = null;
1256 path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id);
1258 GBPSubjectServices.load(path, function(data){
1260 $scope.sendReloadEventFromRoot('GBP_SUBJECT_RELOAD');
1269 $scope.save = function(){
1270 if($scope.validateForm($scope.subjectForm)){
1271 path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.newSubjectObj.name);
1272 GBPSubjectServices.send(path, $scope.newSubjectObj, function(data){
1274 $scope.internalView.subject = false;
1275 $scope.reloadNewObj();
1276 $scope.internalView.edit = "view";
1283 $scope.delete = function() {
1284 if ( $scope.selectedSubject ) {
1285 path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name);
1286 GBPSubjectServices.delete(path, function(data){
1288 $scope.selectedSubject = null;
1295 $scope.reloadNewObj = function() {
1296 $scope.newSubjectObj = GBPSubjectServices.createObj();
1299 $scope.reload = function(selectedObj) {
1300 $scope.selectedSubject = selectedObj;
1301 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
1303 $scope.internalView.subject = true;
1305 $scope.internalView.subject = false;
1306 $scope.internalView.edit = "view";
1309 if($scope.internalView.subject) {
1310 angular.copy(selectedObj, $scope.newSubjectObj);
1312 $scope.sendReloadEventFromRoot('GBP_SUBJECT_RELOAD');
1315 $scope.showForm = function() {
1316 $scope.reloadNewObj();
1317 $scope.internalView.subject = true;
1318 $scope.internalView.edit = "add";
1319 $scope.selectedSubject = null;
1322 $scope.close = function(){
1323 $scope.internalView.subject = false;
1324 $scope.internalView.edit = "view";
1327 $scope.$on('PGN_EDIT_ELEM', function(event){
1328 if (!event.defaultPrevented) {
1329 if ( $scope.selectedSubject ) {
1330 $scope.internalView.subject = true;
1331 $scope.internalView.edit = "edit";
1332 angular.copy($scope.selectedSubject, $scope.newSubjectObj);
1334 event.defaultPrevented = true;
1338 $scope.$on('GBP_CONTRACT_RELOAD',function(){
1339 $scope.internalView.subject = false;
1343 $scope.$on('GBP_SUBJECTS_LABEL', function(event, obj){
1344 obj.labels = $scope.displayLabel;
1348 gbpOld.register.controller('ruleCtrl', ['$scope','GBPRuleServices', '$filter', function($scope, GBPRuleServices, $filter){
1350 $scope.selectedRule = null;
1351 $scope.newRuleObj = GBPRuleServices.createObj();
1352 $scope.displayLabel = 'name';
1353 $scope.internalView = {
1357 $scope.crudLabel = 'Rule list';
1361 mandatoryProperties = ['order'],
1365 $scope.selectedRule = null;
1366 $scope.newRuleObj = GBPRuleServices.createObj();
1367 $scope.internalView = {
1373 $scope.init = function() {
1374 if ( $scope.selectedSubject ) {
1375 $scope.selectedRule = null;
1376 path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name);
1378 GBPRuleServices.load(path, function(data){
1388 $scope.save = function(){
1389 if($scope.validateForm($scope.rulesForm)){
1390 path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.newRuleObj.name);
1391 GBPRuleServices.send(path, $scope.newRuleObj, function(data){
1393 $scope.internalView.rule = false;
1394 $scope.reloadNewObj();
1395 $scope.internalView.edit = "view";
1402 $scope.delete = function() {
1403 if ( $scope.selectedRule ) {
1404 path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name);
1405 GBPRuleServices.delete(path, function(data){
1407 $scope.selectedRule = null;
1414 $scope.reloadNewObj = function() {
1415 $scope.newRuleObj = GBPRuleServices.createObj();
1418 $scope.reload = function(selectedObj) {
1419 $scope.selectedRule = selectedObj;
1420 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
1422 $scope.internalView.rule = true;
1424 $scope.internalView.rule = false;
1425 $scope.internalView.edit = "view";
1428 if($scope.internalView.rule) {
1429 angular.copy(selectedObj, $scope.newRuleObj);
1431 $scope.$broadcast('GBP_RULE_RELOAD');
1434 $scope.showForm = function() {
1435 $scope.reloadNewObj();
1436 $scope.internalView.rule = true;
1437 $scope.internalView.edit = "add";
1438 $scope.selectedRule = null;
1441 $scope.close = function(){
1442 $scope.internalView.rule = false;
1443 $scope.internalView.edit = "view";
1446 $scope.$on('PGN_EDIT_ELEM', function(event){
1447 if (!event.defaultPrevented) {
1448 if ( $scope.selectedRule ) {
1449 $scope.internalView.rule = true;
1450 $scope.internalView.edit = "edit";
1451 angular.copy($scope.selectedRule, $scope.newRuleObj);
1453 event.defaultPrevented = true;
1457 $scope.$on('GBP_SUBJECT_RELOAD',function(){
1462 gbpOld.register.controller('actionRefCtrl', ['$scope','GBPActionRefsServices', 'GBPActionInstanceServices', '$filter', function($scope, GBPActionRefsServices, GBPActionInstanceServices, $filter){
1464 $scope.selectedActionRef = null;
1465 $scope.newActionRefObj = GBPActionRefsServices.createObj();
1466 $scope.displayLabel = 'name';
1467 $scope.internalView = {
1471 $scope.crudLabel = 'Action ref list';
1474 $scope.actionInstanceNames = {'options' : [], 'labels' : $scope.displayLabel};
1477 mandatoryProperties = ['order'],
1479 actionInstanceNamesLoad = function() {
1480 var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id);
1481 GBPActionInstanceServices.load(actionInstancePath, function(data){
1482 $scope.actionInstanceNames.options = data;
1490 $scope.selectedActionRef = null;
1491 $scope.newActionRefObj = GBPActionRefsServices.createObj();
1492 $scope.internalView = {
1498 $scope.init = function() {
1499 if ( $scope.selectedRule ) {
1500 $scope.selectedActionRef = null;
1501 path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name);
1503 GBPActionRefsServices.load(path, function(data){
1509 actionInstanceNamesLoad();
1515 $scope.save = function(){
1516 if($scope.validateForm($scope.actionRefForm)){
1517 path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.newActionRefObj.name);
1518 GBPActionRefsServices.send(path, $scope.newActionRefObj, function(data){
1520 $scope.internalView.actionRef = false;
1521 $scope.reloadNewObj();
1522 $scope.internalView.edit = "view";
1529 $scope.delete = function() {
1530 if ( $scope.selectedActionRef ) {
1531 path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.selectedActionRef.name);
1532 GBPActionRefsServices.delete(path, function(data){
1534 $scope.selectedActionRef = null;
1541 $scope.reloadNewObj = function() {
1542 $scope.newActionRefObj = GBPActionRefsServices.createObj();
1545 $scope.reload = function(selectedObj) {
1546 $scope.selectedActionRef = selectedObj;
1547 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
1549 $scope.internalView.actionRef = true;
1551 $scope.internalView.actionRef = false;
1552 $scope.internalView.edit = "view";
1555 if($scope.internalView.actionRef) {
1556 angular.copy(selectedObj, $scope.newActionRefObj);
1560 $scope.showForm = function() {
1561 $scope.reloadNewObj();
1562 $scope.internalView.actionRef = true;
1563 $scope.internalView.edit = "add";
1564 $scope.selectedActionRef = null;
1567 $scope.close = function(){
1568 $scope.internalView.actionRef = false;
1569 $scope.internalView.edit = "view";
1572 $scope.$on('PGN_EDIT_ELEM', function(event){
1573 if (!event.defaultPrevented) {
1574 if ( $scope.selectedActionRef ) {
1575 $scope.internalView.actionRef = true;
1576 $scope.internalView.edit = "edit";
1577 angular.copy($scope.selectedActionRef, $scope.newActionRefObj);
1579 event.defaultPrevented = true;
1583 $scope.$on('GBP_RULE_RELOAD',function(){
1584 $scope.internalView.actionRef = false;
1588 $scope.$on('GBP_ACTION_INSTANCE_RELOAD',function(){
1589 actionInstanceNamesLoad();
1593 gbpOld.register.controller('classifierRefCtrl', ['$scope','GBPClassifierRefsServices', 'GBPClassifierInstanceServices', '$filter', function($scope, GBPClassifierRefsServices, GBPClassifierInstanceServices, $filter){
1595 $scope.selectedClassifierRef = null;
1596 $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj();
1597 $scope.displayLabel = 'name';
1598 $scope.internalView = {
1599 classifierRef : false,
1603 $scope.instanceNames = {'options' : [], 'labels' : $scope.displayLabel};
1605 $scope.formDirections = ['in', 'out', 'bidirectional'];
1606 $scope.formConnectionTracking = ['normal', 'reflexive'];
1608 $scope.crudLabel = 'Classifier ref list';
1612 instanceNamesLoad = function() {
1613 var classifierInstancePath = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id);
1614 GBPClassifierInstanceServices.load(classifierInstancePath, function(data){
1615 $scope.instanceNames.options = data;
1623 $scope.selectedClassifierRef = null;
1624 $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj();
1625 $scope.internalView = {
1626 classifierRef : false,
1631 $scope.init = function() {
1632 if ( $scope.selectedRule ) {
1633 $scope.selectedClassifierRef = null;
1634 path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name);
1638 GBPClassifierRefsServices.load(path, function(data){
1644 instanceNamesLoad();
1650 $scope.save = function(){
1651 if($scope.validateForm($scope.classifierRefForm)){
1652 path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.newClassifierRefObj.name);
1653 GBPClassifierRefsServices.send(path, $scope.newClassifierRefObj, function(data){
1655 $scope.internalView.classifierRef = false;
1656 $scope.reloadNewObj();
1657 $scope.internalView.edit = "view";
1664 $scope.delete = function() {
1665 if ( $scope.selectedClassifierRef ) {
1666 path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.selectedClassifierRef.name);
1667 GBPClassifierRefsServices.delete(path, function(data){
1669 $scope.selectedClassifierRef = null;
1676 $scope.reloadNewObj = function() {
1677 $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj();
1680 $scope.reload = function(selectedObj) {
1681 $scope.selectedClassifierRef = selectedObj;
1682 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
1684 $scope.internalView.classifierRef = true;
1686 $scope.internalView.classifierRef = false;
1687 $scope.internalView.edit = "view";
1690 if($scope.internalView.classifierRef) {
1691 angular.copy(selectedObj, $scope.newClassifierRefObj);
1695 $scope.showForm = function() {
1696 $scope.reloadNewObj();
1697 $scope.internalView.classifierRef = true;
1698 $scope.internalView.edit = "add";
1699 $scope.selectedClassifierRef = null;
1702 $scope.close = function(){
1703 $scope.internalView.classifierRef = false;
1704 $scope.internalView.edit = "view";
1707 $scope.$on('PGN_EDIT_ELEM', function(event){
1708 if (!event.defaultPrevented) {
1709 if ( $scope.selectedClassifierRef ) {
1710 $scope.internalView.classifierRef = true;
1711 $scope.internalView.edit = "edit";
1712 angular.copy($scope.selectedClassifierRef, $scope.newClassifierRefObj);
1714 event.defaultPrevented = true;
1718 $scope.$on('GBP_RULE_RELOAD',function(){
1719 $scope.internalView.classifierRef = false;
1723 $scope.$on('GBP_CLASSIFIER_INSTANCE_RELOAD',function(){
1724 instanceNamesLoad();
1728 gbpOld.register.controller('tenantCtrl', ['$scope', 'GBPTenantServices', '$filter', function($scope, GBPTenantServices, $filter){
1730 $scope.selectedTenantObj = null;
1731 $scope.newTenantObj = GBPTenantServices.createObj();
1732 $scope.displayLabel = ['name' , 'id'];
1733 $scope.crudLabel = 'Tenants list';
1740 $scope.init = function() {
1741 GBPTenantServices.load(
1744 $scope.newTenantObj = GBPTenantServices.createObj();
1745 $scope.selectedTenantObj = null;
1752 $scope.save = function(){
1753 if($scope.validateForm($scope.tenantForm)){
1754 path = GBPTenantServices.createPathObj($scope.newTenantObj.id);
1755 GBPTenantServices.send(path, $scope.newTenantObj, function(data){
1757 $scope.view.tenant = false;
1758 $scope.view.edit = "view";
1759 $scope.$emit('GBP_GLOBAL_TENANT_RELOAD');
1766 $scope.delete = function() {
1767 if($scope.selectedTenantObj) {
1768 path = GBPTenantServices.createPathObj($scope.selectedTenantObj.id);
1770 GBPTenantServices.delete(path, function(data){
1772 $scope.view.tenant = false;
1773 $scope.$emit('GBP_GLOBAL_TENANT_RELOAD');
1780 $scope.reload = function(selectedObj) {
1781 $scope.selectedTenantObj = selectedObj;
1783 $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view";
1785 $scope.view.tenant = true;
1788 $scope.view.tenant = false;
1789 $scope.view.edit = "view";
1792 if ($scope.view.tenant) {
1793 angular.copy(selectedObj, $scope.newTenantObj);
1797 $scope.showForm = function() {
1798 $scope.newTenantObj = GBPTenantServices.createObj();
1799 $scope.selectedTenantObj = null;
1800 $scope.view.tenant = true;
1801 $scope.view.edit = "add";
1804 $scope.close = function(){
1805 $scope.view.tenant = false;
1806 $scope.view.edit = "view";
1809 $scope.$on('PGN_EDIT_ELEM', function(event){
1810 if (!event.defaultPrevented) {
1811 if ( $scope.selectedTenantObj ) {
1812 $scope.view.tenant = true;
1813 $scope.view.edit = "edit";
1814 angular.copy($scope.selectedTenantObj, $scope.newTenantObj);
1816 event.defaultPrevented = true;
1820 $scope.$on('GBP_GLOBAL_TENANT_RELOAD',function(){
1825 gbpOld.register.controller('epgCtrl',['$scope', 'GBPEpgServices', 'GBPContractServices', '$filter',
1826 function($scope, GBPEpgServices, GBPContractServices, $filter){
1827 $scope.selectedEpg = null;
1828 $scope.newEpgObj = GBPEpgServices.createObj();
1829 $scope.displayLabel = ['name', 'id'];
1830 $scope.crudLabel = 'Group list';
1832 $scope.igpOpts = ['allow', 'require-contract'];
1834 $scope.contracts = {'options' : [], 'labels' : null};
1835 $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contracts);
1839 $scope.internalView = {
1844 var loadContracts = function() {
1845 GBPContractServices.load(path, function(data){
1846 $scope.contracts.options = data;
1852 mandatoryProperties = ['name'],
1856 $scope.selectedEpg = null;
1857 $scope.newEpgObj = GBPEpgServices.createObj();
1858 $scope.internalView = {
1864 $scope.init = function() {
1865 if ($scope.selectedTenant) {
1866 path = GBPEpgServices.createPathObj($scope.selectedTenant.id);
1868 GBPEpgServices.load(path, function(data){
1870 // $scope.$broadcast('GBP_EPG_RELOAD');
1871 $scope.sendReloadEventFromRoot('GBP_EPG_RELOAD');
1882 $scope.save = function(){
1883 if($scope.validateForm($scope.epgForm)){
1884 path = GBPEpgServices.createPathObj($scope.selectedTenant.id, $scope.newEpgObj.id);
1885 GBPEpgServices.send(path, $scope.newEpgObj, function(data){
1887 $scope.internalView.epg = false;
1888 $scope.reloadNewObj();
1889 $scope.internalView.edit = "view";
1890 $scope.reloadTopo();
1897 $scope.delete = function() {
1898 if($scope.selectedTenant && $scope.selectedEpg) {
1899 path = GBPEpgServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id);
1900 GBPEpgServices.delete(path, function(data){
1902 $scope.internalView.epg = false;
1903 $scope.reloadTopo();
1910 $scope.showForm = function() {
1911 $scope.internalView.epg = true;
1912 $scope.reloadNewObj();
1913 $scope.selectedEpg = null;
1914 $scope.internalView.edit = "add";
1917 $scope.reloadNewObj = function() {
1918 $scope.newEpgObj = GBPEpgServices.createObj();
1921 $scope.reload = function(selectedObj) {
1922 $scope.selectedEpg = selectedObj;
1923 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
1925 $scope.internalView.epg = true;
1927 $scope.internalView.epg = false;
1928 $scope.internalView.edit = "view";
1931 if($scope.internalView.epg) {
1932 angular.copy(selectedObj, $scope.newEpgObj);
1934 $scope.sendReloadEventFromRoot('GBP_EPG_RELOAD');
1937 $scope.close = function(){
1938 $scope.internalView.epg = false;
1939 $scope.internalView.edit = "view";
1941 $scope.$on('PGN_EDIT_ELEM', function(event){
1942 if (!event.defaultPrevented) {
1943 if ( $scope.selectedEpg ) {
1944 $scope.internalView.epg = true;
1945 $scope.internalView.edit = "edit";
1946 angular.copy($scope.selectedEpg, $scope.newEpgObj);
1948 event.defaultPrevented = true;
1952 $scope.$on('GBP_TENANT_RELOAD',function(){
1956 $scope.$on('GBP_CONTRACT_RELOAD',function(){
1960 $scope.$on('GBP_EPG_LABEL', function(event, obj){
1961 obj.labels = $scope.displayLabel;
1965 gbpOld.register.controller('cnsCtrl',['$scope', 'GBPConNamedSelServices', function($scope, GBPConNamedSelServices){
1967 $scope.selectedCNS = null;
1968 $scope.newCNSObj = GBPConNamedSelServices.createObj();
1969 $scope.internalView = {
1973 $scope.displayLabel = 'name';
1974 $scope.crudLabel = 'Consumer named selectors list';
1976 var clear = function(){
1978 $scope.selectedCNS = null;
1979 $scope.newCNSObj = GBPConNamedSelServices.createObj();
1980 $scope.internalView = {
1986 //move to separate ctrl \/
1987 $scope.addNewElem = function(templateObj) {
1988 if($scope.newCNSObj && $scope.newCNSObj.contract) {
1989 var objToPush = templateObj || "";
1990 $scope.newCNSObj.contract.push(objToPush);
1994 $scope.deleteElemAt = function(index) {
1995 if($scope.newCNSObj && $scope.newCNSObj.contract) {
1996 $scope.newCNSObj.contract.splice(index, 1);
2000 $scope.updateAt = function(index, value) {
2001 if($scope.newCNSObj && $scope.newCNSObj.contract && $scope.newCNSObj.contract.length >= index) {
2002 $scope.newCNSObj.contract[index] = value;
2005 //move to separate ctrl /\
2007 $scope.init = function() {
2008 if ($scope.selectedTenant && $scope.selectedEpg) {
2009 path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id);
2011 GBPConNamedSelServices.load(path, function(data){
2021 $scope.save = function(){
2022 if($scope.validateForm($scope.cnsForm)){
2023 path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.newCNSObj.name);
2024 GBPConNamedSelServices.send(path, $scope.newCNSObj, function(data){
2026 $scope.internalView.cns = false;
2027 $scope.internalView.cns = "view";
2028 $scope.reloadNewObj();
2029 $scope.reloadTopo();
2036 $scope.delete = function() {
2037 if($scope.selectedTenant && $scope.selectedEpg && $scope.selectedCNS) {
2038 path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedCNS.name);
2039 GBPConNamedSelServices.delete(path, function(data){
2041 $scope.reloadTopo();
2048 $scope.showForm = function() {
2049 $scope.reloadNewObj();
2050 $scope.selectedCNS = null;
2051 $scope.internalView.cns = true;
2052 $scope.internalView.edit = "add";
2055 $scope.reloadNewObj = function() {
2056 $scope.newCNSObj = GBPConNamedSelServices.createObj();
2059 $scope.reload = function(selectedObj) {
2060 $scope.selectedCNS = selectedObj;
2061 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
2063 $scope.internalView.cns = true;
2065 $scope.internalView.cns = false;
2066 $scope.internalView.edit = "view";
2069 if($scope.internalView.cns) {
2070 angular.copy(selectedObj, $scope.newCNSObj);
2074 $scope.close = function(){
2075 $scope.internalView.cns = false;
2076 $scope.internalView.edit = "view";
2079 $scope.$on('PGN_EDIT_ELEM', function(event){
2080 if (!event.defaultPrevented) {
2081 if ( $scope.selectedEpg ) {
2082 $scope.internalView.cns = true;
2083 $scope.internalView.edit = "add";
2084 angular.copy($scope.selectedCNS, $scope.newCNSObj);
2086 event.defaultPrevented = true;
2090 $scope.$on('GBP_EPG_RELOAD',function(){
2095 gbpOld.register.controller('pnsCtrl',['$scope', 'GBPProNamedSelServices', function($scope, GBPProNamedSelServices){
2097 $scope.selectedPNS = null;
2098 $scope.newPNSObj = GBPProNamedSelServices.createObj();
2099 $scope.displayLabel = 'name';
2100 $scope.crudLabel = 'Provider named selectors list';
2101 $scope.internalView = {
2106 var clear = function(){
2108 $scope.selectedPNS = null;
2109 $scope.newPNSObj = GBPProNamedSelServices.createObj();
2110 $scope.internalView = {
2116 //move to separate ctrl \/
2117 $scope.addNewElem = function(templateObj) {
2118 if($scope.newPNSObj && $scope.newPNSObj.contract) {
2119 var objToPush = templateObj || "";
2120 $scope.newPNSObj.contract.push(objToPush);
2124 $scope.deleteElemAt = function(index) {
2125 if($scope.newPNSObj && $scope.newPNSObj.contract) {
2126 $scope.newPNSObj.contract.splice(index, 1);
2130 $scope.updateAt = function(index, value) {
2131 if($scope.newPNSObj && $scope.newPNSObj.contract && $scope.newPNSObj.contract.length >= index) {
2132 $scope.newPNSObj.contract[index] = value;
2135 //move to separate ctrl /\
2137 $scope.init = function() {
2138 if ($scope.selectedTenant && $scope.selectedEpg) {
2139 path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id);
2141 GBPProNamedSelServices.load(path, function(data){
2151 $scope.save = function(){
2152 if($scope.validateForm($scope.pnsForm)){
2153 path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.newPNSObj.name);
2154 GBPProNamedSelServices.send(path, $scope.newPNSObj, function(data){
2156 $scope.internalView.pns = false;
2157 $scope.reloadNewObj();
2158 $scope.internalView.cns = "view";
2159 $scope.reloadTopo();
2166 $scope.delete = function() {
2167 if($scope.selectedTenant && $scope.selectedEpg && $scope.selectedPNS) {
2168 path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedPNS.name);
2169 GBPProNamedSelServices.delete(path, function(data){
2171 $scope.reloadTopo();
2178 $scope.showForm = function() {
2179 $scope.reloadNewObj();
2180 $scope.internalView.pns = true;
2181 $scope.internalView.edit = "add";
2182 $scope.selectedPNS = null;
2185 $scope.reloadNewObj = function() {
2186 $scope.newPNSObj = GBPProNamedSelServices.createObj();
2189 $scope.reload = function(selectedObj) {
2190 $scope.selectedPNS = selectedObj;
2191 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
2193 $scope.internalView.pns = true;
2195 $scope.internalView.pns = false;
2196 $scope.internalView.edit = "view";
2199 if($scope.internalView.pns) {
2200 angular.copy(selectedObj, $scope.newPNSObj);
2204 $scope.close = function(){
2205 $scope.internalView.pns = false;
2206 $scope.internalView.edit = "view";
2208 $scope.$on('PGN_EDIT_ELEM', function(event){
2209 if (!event.defaultPrevented) {
2210 if ( $scope.selectedEpg ) {
2211 $scope.internalView.pns = true;
2212 $scope.internalView.edit = "edit";
2213 angular.copy($scope.selectedPNS, $scope.newPNSObj);
2215 event.defaultPrevented = true;
2219 $scope.$on('GBP_EPG_RELOAD',function(){
2224 gbpOld.register.controller('l2FloodCtrl', ['$scope', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', '$filter', function($scope, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, $filter){
2226 $scope.selectedL2Flood = null;
2227 $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj();
2228 $scope.displayLabel = ['name', 'id'];
2229 $scope.crudLabel = 'L2 Flood Domain list';
2231 $scope.l2bridge = {'options' : [], 'labels' : null};
2232 $scope.getDisplayLabelsFromCtrl('GBP_L2BRIDGE_LABEL', $scope.l2bridge);
2241 loadL2BridgeList = function() {
2242 GBPL2BridgeDomainServices.load(GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id), function(data){
2243 $scope.l2bridge.options = data;
2251 $scope.selectedL2Flood = null;
2252 $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj();
2259 $scope.init = function() {
2260 if ( $scope.selectedTenant ) {
2261 path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id);
2263 GBPL2FloodDomainServices.load(path, function(data){
2266 $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj();
2267 $scope.selectedL2Flood = null;
2278 $scope.save = function(){
2279 if($scope.validateForm($scope.l2FloodForm)){
2280 path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id, $scope.newL2FloodObj.id);
2281 GBPL2FloodDomainServices.send(path, $scope.newL2FloodObj, function(data){
2283 $scope.view.l2flood = false;
2284 $scope.view.edit = "view";
2285 $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD');
2287 $scope.reloadTopo();
2294 $scope.delete = function() {
2295 if($scope.selectedTenant && $scope.selectedL2Flood) {
2296 path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id, $scope.selectedL2Flood.id);
2297 GBPL2FloodDomainServices.delete(path, function(data){
2299 $scope.view.l2flood = false;
2300 $scope.view.edit = "view";
2301 $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD');
2303 $scope.reloadTopo();
2310 $scope.reload = function(selectedObj) {
2311 $scope.selectedL2Flood = selectedObj;
2313 $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view";
2315 $scope.view.l2flood = true;
2318 $scope.view.l2flood = false;
2319 $scope.view.edit = "view";
2322 if ($scope.view.l2flood) {
2323 angular.copy(selectedObj, $scope.newL2FloodObj);
2326 $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD');
2329 $scope.showForm = function() {
2330 $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj();
2331 $scope.selectedL2Flood = null;
2332 $scope.view.l2flood = true;
2333 $scope.view.edit = "add";
2336 $scope.close = function(){
2337 $scope.view.l2flood = false;
2340 $scope.$on('PGN_EDIT_ELEM', function(event){
2341 if (!event.defaultPrevented) {
2342 if ( $scope.selectedL2Flood ) {
2343 $scope.view.l2flood = true;
2344 $scope.view.edit = "edit";
2345 angular.copy($scope.selectedL2Flood, $scope.newL2FloodObj);
2347 event.defaultPrevented = true;
2351 $scope.$on('GBP_TENANT_RELOAD',function(){
2355 $scope.$on('GBP_L2BRIDGE_RELOAD',function(){
2359 $scope.$on('GBP_L2FLOOD_LABEL', function(event, obj){
2360 obj.labels = $scope.displayLabel;
2364 gbpOld.register.controller('l2BridgeCtrl', ['$scope', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', '$filter', function($scope, GBPL2BridgeDomainServices, GBPL3ContextServices, $filter){
2366 $scope.selectedL2Bridge = null;
2367 $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj();
2368 $scope.displayLabel = ['name', 'id'];
2369 $scope.crudLabel = 'L2 Bridge Domain list';
2371 $scope.l3context = {'options' : [], 'labels' : null};
2372 $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context);
2381 loadL3ContextList = function() {
2382 GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){
2383 $scope.l3context.options = data;
2384 //$scope.$broadcast('GBP_L2BRIDGE_RELOAD');
2392 $scope.selectedL2Bridge = null;
2393 $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj();
2400 $scope.init = function() {
2401 if ( $scope.selectedTenant ) {
2402 path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id);
2404 GBPL2BridgeDomainServices.load(path, function(data){
2406 $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj();
2407 $scope.selectedL2Bridge = null;
2408 // $scope.$broadcast('GBP_L2BRIDGE_RELOAD');
2413 loadL3ContextList();
2421 $scope.save = function(){
2422 if($scope.validateForm($scope.l2BridgeForm)){
2423 path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id, $scope.newL2BridgeObj.id);
2424 GBPL2BridgeDomainServices.send(path, $scope.newL2BridgeObj, function(data){
2426 $scope.view.l2bridge = false;
2427 $scope.view.edit = "view";
2428 $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD');
2430 $scope.reloadTopo();
2437 $scope.delete = function() {
2438 if($scope.selectedTenant && $scope.selectedL2Bridge) {
2439 path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id, $scope.selectedL2Bridge.id);
2440 GBPL2BridgeDomainServices.delete(path, function(data){
2442 $scope.view.l2bridge = false;
2443 $scope.view.edit = "view";
2444 $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD');
2446 $scope.reloadTopo();
2453 $scope.reload = function(selectedObj) {
2454 $scope.selectedL2Bridge = selectedObj;
2456 $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view";
2458 $scope.view.l2bridge = true;
2461 $scope.view.l2bridge = false;
2462 $scope.view.edit = "view";
2465 if ($scope.view.l2bridge) {
2466 angular.copy(selectedObj, $scope.newL2BridgeObj);
2469 $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD');
2472 $scope.showForm = function() {
2473 $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj();
2474 $scope.selectedL2Bridge = null;
2475 $scope.view.l2bridge = true;
2476 $scope.view.edit = "add";
2479 $scope.close = function(){
2480 $scope.view.l2bridge = false;
2483 $scope.$on('PGN_EDIT_ELEM', function(event){
2484 if (!event.defaultPrevented) {
2485 if ( $scope.selectedL2Bridge ) {
2486 $scope.view.l2bridge = true;
2487 $scope.view.edit = "edit";
2488 angular.copy($scope.selectedL2Bridge, $scope.newL2BridgeObj);
2490 event.defaultPrevented = true;
2494 $scope.$on('GBP_TENANT_RELOAD',function(){
2498 $scope.$on('GBP_L3CONTEXT_RELOAD',function(){
2499 loadL3ContextList();
2502 $scope.$on('GBP_L2BRIDGE_LABEL', function(event, obj){
2503 obj.labels = $scope.displayLabel;
2507 gbpOld.register.controller('l3ContextCtrl', ['$scope', 'GBPL3ContextServices', '$filter', function($scope, GBPL3ContextServices, $filter){ //GBPContractServices
2509 $scope.selectedL3Context = null;
2510 $scope.newL3ContextObj = GBPL3ContextServices.createObj();
2511 $scope.displayLabel = ['name', 'id'];
2512 $scope.crudLabel = 'L3 Context list';
2527 $scope.selectedL3Context = null;
2528 $scope.newL3ContextObj = GBPL3ContextServices.createObj();
2531 $scope.init = function() {
2532 if ( $scope.selectedTenant ) {
2533 path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id);
2535 GBPL3ContextServices.load(path, function(data){
2537 $scope.newL3ContextObj = GBPL3ContextServices.createObj();
2538 $scope.selectedL3Context = null;
2547 $scope.save = function(){
2548 if($scope.validateForm($scope.l3ContextForm)){
2549 path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id, $scope.newL3ContextObj.id);
2550 GBPL3ContextServices.send(path, $scope.newL3ContextObj, function(data){
2552 $scope.view.l3context = false;
2553 $scope.view.edit = "view";
2554 $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD');
2556 $scope.reloadTopo();
2563 $scope.delete = function() {
2564 if($scope.selectedTenant && $scope.selectedL3Context) {
2565 path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id, $scope.selectedL3Context.id);
2566 GBPL3ContextServices.delete(path, function(data){
2568 $scope.view.l3context = false;
2569 $scope.view.edit = "view";
2570 $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD');
2572 $scope.reloadTopo();
2579 $scope.reload = function(selectedObj) {
2580 $scope.selectedL3Context = selectedObj;
2582 $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view";
2584 $scope.view.l3context = true;
2587 $scope.view.l3context = false;
2588 $scope.view.edit = "view";
2591 if($scope.view.l3context) {
2592 angular.copy(selectedObj, $scope.newL3ContextObj);
2595 $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD');
2598 $scope.showForm = function() {
2599 $scope.newL3ContextObj = GBPL3ContextServices.createObj();
2600 $scope.selectedL3Context = null;
2601 $scope.view.l3context = true;
2602 $scope.view.edit = "add";
2605 $scope.close = function(){
2606 $scope.view.l3context = false;
2609 $scope.$on('PGN_EDIT_ELEM', function(event){
2610 if (!event.defaultPrevented) {
2611 if ( $scope.selectedL3Context ) {
2612 $scope.view.l3context = true;
2613 $scope.view.edit = "edit";
2614 angular.copy($scope.selectedL3Context, $scope.newL3ContextObj);
2616 event.defaultPrevented = true;
2620 $scope.$on('GBP_TENANT_RELOAD',function(){
2624 $scope.$on('GBP_L3CONTEXT_LABEL', function(event, obj){
2625 obj.labels = $scope.displayLabel;
2629 gbpOld.register.controller('subnetCtrl', ['$scope', 'GBPSubnetServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', '$filter', function($scope, GBPSubnetServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, GBPL3ContextServices, $filter){
2631 $scope.selectedSubnet = null;
2632 $scope.newSubnetObj = GBPSubnetServices.createObj();
2633 $scope.displayLabel = ['name', 'id'];
2634 $scope.crudLabel = 'Subnet list';
2636 $scope.l2L3List = {'options' : [], 'labels' : null};
2637 $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2L3List);
2647 loadL2L3List = function() {
2648 $scope.l2L3List.options = [];
2650 GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(l3ContextData){
2651 $scope.l2L3List.options = $scope.l2L3List.options.concat(l3ContextData);
2656 GBPL2FloodDomainServices.load(GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id), function(l2FloodData){
2657 $scope.l2L3List.options = $scope.l2L3List.options.concat(l2FloodData);
2662 GBPL2BridgeDomainServices.load(GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id), function(l2BridgeData){
2663 $scope.l2L3List.options = $scope.l2L3List.options.concat(l2BridgeData);
2675 $scope.selectedSubnet = null;
2676 $scope.newSubnetObj = GBPSubnetServices.createObj();
2679 $scope.init = function() {
2680 if ( $scope.selectedTenant ) {
2681 path = GBPSubnetServices.createPathObj($scope.selectedTenant.id);
2683 GBPSubnetServices.load(path, function(data){
2685 $scope.newSubnetObj = GBPSubnetServices.createObj();
2686 $scope.selectedSubnet = null;
2688 $scope.view.subnet = false;
2689 $scope.view.edit = "view";
2690 //$scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD');
2701 $scope.save = function(){
2702 if($scope.validateForm($scope.subnetForm)){
2703 path = GBPSubnetServices.createPathObj($scope.selectedTenant.id, $scope.newSubnetObj.id);
2704 GBPSubnetServices.send(path, $scope.newSubnetObj, function(data){
2706 $scope.view.subnet = false;
2707 $scope.view.edit = "view";
2709 $scope.reloadTopo();
2716 $scope.delete = function() {
2717 if($scope.selectedTenant && $scope.selectedSubnet) {
2718 path = GBPSubnetServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id);
2719 GBPSubnetServices.delete(path, function(data){
2721 $scope.view.subnet = false;
2722 $scope.view.edit = "view";
2724 $scope.reloadTopo();
2731 $scope.reload = function(selectedObj) {
2732 $scope.selectedSubnet = selectedObj;
2734 $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view";
2736 $scope.view.subnet = true;
2739 $scope.view.subnet = false;
2740 $scope.view.edit = "view";
2743 if($scope.view.subnet) {
2744 angular.copy(selectedObj, $scope.newSubnetObj);
2747 $scope.sendReloadEventFromRoot('GBP_SUBNET_RELOAD');
2750 $scope.showForm = function() {
2751 $scope.newSubnetObj = GBPSubnetServices.createObj();
2752 $scope.selectedSubnet = null;
2753 $scope.view.subnet = true;
2754 $scope.view.edit = "add";
2757 $scope.close = function(){
2758 $scope.view.subnet = false;
2761 $scope.$on('PGN_EDIT_ELEM', function(event){
2762 if (!event.defaultPrevented) {
2763 if ( $scope.selectedSubnet ) {
2764 $scope.view.subnet = true;
2765 $scope.view.edit = "edit";
2766 angular.copy($scope.selectedSubnet, $scope.newSubnetObj);
2768 event.defaultPrevented = true;
2772 $scope.$on('GBP_TENANT_RELOAD',function(){
2776 $scope.$on('GBP_GATEWAY_RELOAD',function(){
2780 $scope.$on('GBP_L3CONTEXT_RELOAD',function(){
2784 $scope.$on('GBP_L2BRIDGE_RELOAD',function(){
2788 $scope.$on('GBP_L2FLOOD_RELOAD',function(){
2792 $scope.$on('GBP_PREFIX_RELOAD',function(){
2797 gbpOld.register.controller('gatewayCtrl', ['$scope', 'GBPGatewayServices', function($scope, GBPGatewayServices){
2799 $scope.gatewayView = false;
2800 $scope.selectedGateway = null;
2801 $scope.newGatewayObj = GBPGatewayServices.createObj();
2802 $scope.displayLabel = 'gateway';
2803 $scope.crudLabel = 'Gateway list';
2804 $scope.internalView = {
2813 $scope.gatewayView = false;
2814 $scope.selectedGateway = null;
2815 $scope.newGatewayObj = GBPGatewayServices.createObj();
2818 $scope.init = function() {
2819 if ( $scope.selectedTenant && $scope.selectedSubnet ) {
2820 path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id);
2822 GBPGatewayServices.load(path, function(data){
2824 $scope.newGatewayObj = GBPGatewayServices.createObj();
2825 $scope.internalView.gateway = false;
2826 $scope.selectedGateway = null;
2835 $scope.save = function(){
2836 if($scope.validateForm($scope.gatewayForm)){
2837 path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.newGatewayObj.gateway);
2838 GBPGatewayServices.send(path, $scope.newGatewayObj, function(data){
2840 $scope.internalView.gateway = false;
2841 $scope.internalView.edit = "view";
2842 $scope.sendReloadEventFromRoot('GBP_GATEWAY_RELOAD');
2849 $scope.delete = function() {
2850 if($scope.selectedTenant && $scope.selectedSubnet && $scope.selectedGateway) {
2851 path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway);
2852 GBPGatewayServices.delete(path, function(data){
2854 $scope.internalView.gateway = false;
2855 $scope.sendReloadEventFromRoot('GBP_GATEWAY_RELOAD');
2862 $scope.reload = function(selectedObj) {
2863 $scope.selectedGateway = selectedObj;
2864 angular.copy(selectedObj, $scope.newGatewayObj);
2865 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
2867 $scope.internalView.gateway = true;
2869 $scope.internalView.gateway = false;
2870 $scope.internalView.edit = "view";
2873 $scope.sendReloadEventFromRoot('GBP_GATEWAY_SET');
2876 $scope.showForm = function() {
2877 $scope.newGatewayObj = GBPGatewayServices.createObj();
2878 $scope.internalView.gateway = true;
2879 $scope.internalView.edit = "add";
2880 $scope.selectedGateway = null;
2883 $scope.close = function(){
2884 $scope.internalView.gateway = false;
2887 $scope.$on('PGN_EDIT_ELEM', function(event){
2888 if (!event.defaultPrevented) {
2889 if ( $scope.selectedGateway ) {
2890 $scope.internalView.gateway = true;
2891 $scope.internalView.edit = "edit";
2892 angular.copy($scope.selectedGateway, $scope.newGatewayObj);
2894 event.defaultPrevented = true;
2898 $scope.$on('GBP_SUBNET_RELOAD',function(){
2902 $scope.$on('GBP_PREFIX_RELOAD',function(){
2907 gbpOld.register.controller('prefixCtrl', ['$scope', 'GBPPrefixServices', function($scope, GBPPrefixServices){
2909 $scope.selectedPrefix = null;
2910 $scope.newPrefixObj = GBPPrefixServices.createObj();
2911 $scope.displayLabel = 'prefix';
2912 $scope.crudLabel = 'Prefix list';
2913 $scope.internalView = {
2922 $scope.selectedPrefix = null;
2923 $scope.newPrefixObj = GBPPrefixServices.createObj();
2924 $scope.internalView = {
2930 $scope.init = function() {
2931 if ( $scope.selectedTenant && $scope.selectedSubnet && $scope.selectedGateway) {
2932 path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway);
2934 GBPPrefixServices.load(path, function(data){
2936 $scope.newPrefixObj = GBPPrefixServices.createObj();
2937 $scope.internalView.prefix = false;
2938 $scope.selectedPrefix = null;
2947 $scope.save = function(){
2948 if($scope.validateForm($scope.prefixForm)){
2949 path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway, $scope.newPrefixObj.prefix);
2950 GBPPrefixServices.send(path, $scope.newPrefixObj, function(data){
2952 $scope.internalView.prefix = false;
2953 $scope.internalView.edit = "view";
2954 $scope.sendReloadEventFromRoot('GBP_PREFIX_RELOAD');
2961 $scope.delete = function() {
2962 path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway, $scope.selectedPrefix.prefix);
2963 GBPPrefixServices.delete(path, function(data){
2965 $scope.internalView.prefix = false;
2966 $scope.sendReloadEventFromRoot('GBP_PREFIX_RELOAD');
2972 $scope.reload = function(selectedObj) {
2973 $scope.selectedPrefix = selectedObj;
2974 $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view";
2976 $scope.internalView.prefix = true;
2978 $scope.internalView.prefix = false;
2979 $scope.internalView.edit = "view";
2982 angular.copy(selectedObj, $scope.newPrefixObj);
2985 $scope.showForm = function() {
2986 $scope.newPrefixObj = GBPPrefixServices.createObj();
2987 $scope.internalView.prefix = true;
2988 $scope.internalView.edit = "add";
2989 $scope.selectedPrefix = null;
2992 $scope.close = function(){
2993 $scope.internalView.prefix = false;
2996 $scope.$on('PGN_EDIT_ELEM', function(event){
2997 if (!event.defaultPrevented) {
2998 if ( $scope.selectedPrefix ) {
2999 $scope.internalView.prefix = true;
3000 $scope.internalView.edit = "edit";
3001 angular.copy($scope.selectedPrefix, $scope.newPrefixObj);
3003 event.defaultPrevented = true;
3007 $scope.$on('GBP_GATEWAY_SET',function(){
3012 gbpOld.register.controller('renderersCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){ //GBPContractServices
3013 $scope.classifierDefinitions = {'options' : [], 'labels' : null};
3014 $scope.actionDefinitions = {'options' : [], 'labels' : null};
3018 var loadDefinitions = function() {
3019 GPBServices.getDefinitions(function(classifierDefs, actionDefs) {
3020 $scope.classifierDefinitions.options = classifierDefs;
3021 $scope.getDisplayLabelsFromCtrl('GBP_CLASSIFIERS_LABEL', $scope.classifierDefinitions);
3023 $scope.actionDefinitions.options = actionDefs;
3024 $scope.getDisplayLabelsFromCtrl('GBP_ACTIONS_LABEL', $scope.actionDefinitions);
3031 gbpOld.register.controller('paramCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){
3032 $scope.value = null;
3034 $scope.init = function(param, paramValues) {
3035 $scope.parameter = param;
3038 paramValues.forEach(function(p) {
3039 if($scope.parameter.name === p.name) {
3040 $scope.value = GPBServices.getInstanceParamValue(p);
3046 $scope.$on('GBP_SAVE_PARAM', function(event){
3047 if($scope.value !== '' && $scope.value !== null) {
3048 $scope.addParam($scope.parameter.name, $scope.parameter.type, $scope.value);
3052 $scope.$on('GBP_SET_PARAM_VALUE', function(event, name, intVal, strVal) {
3053 //console.info($scope.parameter, ' got GBP_SET_PARAM_VALUE', name, intVal, strVal, event);
3057 $scope.$on('GBP_RESET_PARAM', function(event){
3058 $scope.value = null;
3062 gbpOld.register.controller('classifiersCtrl', ['$scope', 'GBPClassifierInstanceServices', 'GPBServices', '$filter',
3063 function($scope, GBPClassifierInstanceServices, GPBServices, $filter){
3065 $scope.classifiersView = false;
3066 $scope.displayLabel = 'name';
3067 $scope.selectedClassifier = null;
3068 $scope.crudLabel = 'Classifiers';
3069 $scope.newClassifierObj = GBPClassifierInstanceServices.createObj();
3070 $scope.edit = "view";
3072 var mandatoryProperties = ['name'],
3076 $scope.classifiersView = false;
3077 $scope.selectedClassifier = null;
3078 $scope.newClassifierObj = GBPClassifierInstanceServices.createObj();
3079 $scope.edit = "view";
3082 $scope.getDefinitionObjParams = function(id){
3083 return GPBServices.getDefinitionObjParams($scope.classifierDefinitions.options, id);
3086 $scope.reloadDefs = function(){
3087 $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newClassifierObj['classifier-definition-id']));
3090 $scope.addParam = function(name, type, value) {
3091 $scope.newClassifierObj['parameter-value'].push(GPBServices.createParamObj(name, type, value));
3094 var saveParams = function() {
3095 $scope.newClassifierObj['parameter-value'] = [];
3096 $scope.$broadcast('GBP_SAVE_PARAM');
3100 $scope.init = function() {
3101 if ( $scope.selectedTenant ) {
3102 path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id);
3103 GBPClassifierInstanceServices.load(path, function(data){
3105 $scope.reloadDefs();
3114 $scope.save = function(){
3115 if($scope.validateForm($scope.classifierForm)){
3116 path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id, $scope.newClassifierObj.name);
3118 GBPClassifierInstanceServices.send(path, $scope.newClassifierObj, function(data){
3120 $scope.classifiersView = false;
3121 $scope.edit = "view";
3122 $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD');
3129 $scope.showForm = function() {
3130 $scope.newClassifierObj = GBPClassifierInstanceServices.createObj();
3131 $scope.selectedClassifier = null;
3132 $scope.classifiersView = true;
3133 $scope.edit = "add";
3134 $scope.reloadDefs();
3137 $scope.reload = function(selectedObj){
3138 $scope.selectedClassifier = selectedObj;
3139 $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD');
3141 $scope.edit = $scope.edit == "edit" ? $scope.edit : "view";
3143 $scope.classifiersView = true;
3146 $scope.classifiersView = false;
3147 $scope.edit = "view";
3150 if($scope.classifiersView) {
3151 angular.copy(selectedObj, $scope.newClassifierObj);
3154 $scope.reloadDefs();
3157 $scope.close = function(){
3158 $scope.classifiersView = false;
3159 $scope.edit = "view";
3162 $scope.$on('PGN_EDIT_ELEM', function(event){
3163 if (!event.defaultPrevented) {
3164 if ( $scope.selectedClassifier ) {
3165 $scope.classifiersView = true;
3166 angular.copy($scope.selectedClassifier, $scope.newClassifierObj);
3167 $scope.edit = "edit";
3168 $scope.reloadDefs();
3170 event.defaultPrevented = true;
3174 $scope.delete = function(){
3175 path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id, $scope.selectedClassifier.name);
3176 GBPClassifierInstanceServices.delete(path, function(data){
3178 $scope.classifiersView = false;
3179 $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD');
3185 $scope.$on('GBP_TENANT_RELOAD',function(){
3189 $scope.$on('GBP_CLASSIFIERS_LABEL', function(event, obj){
3190 obj.labels = $scope.displayLabel;
3194 gbpOld.register.controller('actionsCtrl', ['$scope', 'GBPActionInstanceServices', 'GPBServices', '$filter',
3195 function($scope, GBPActionInstanceServices, GPBServices, $filter){
3197 $scope.actionsView = false;
3198 $scope.displayLabel = 'name';
3199 $scope.selectedAction = null;
3200 $scope.crudLabel = 'Actions';
3201 $scope.newActionObj = GBPActionInstanceServices.createObj();
3202 $scope.edit = "view";
3204 var mandatoryProperties = ['name'],
3208 $scope.actionsView = false;
3209 $scope.selectedAction = null;
3210 $scope.newActionObj = GBPActionInstanceServices.createObj();
3211 $scope.edit = "view";
3214 $scope.getDefinitionObjParams = function(id){
3215 return GPBServices.getDefinitionObjParams($scope.actionDefinitions.options, id);
3218 $scope.reloadDefs = function(){
3219 $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newActionObj['action-definition-id']));
3222 $scope.addParam = function(name, type, value) {
3223 $scope.newActionObj['parameter-value'].push(GPBServices.createParamObj(name, type, value));
3226 var saveParams = function() {
3227 $scope.newActionObj['parameter-value'] = [];
3228 $scope.$broadcast('GBP_SAVE_PARAM');
3232 $scope.init = function() {
3233 if ( $scope.selectedTenant ) {
3234 path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id);
3235 GBPActionInstanceServices.load(path, function(data){
3237 $scope.reloadDefs();
3246 $scope.save = function(){
3247 if($scope.validateForm($scope.actionsForm)){
3248 path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id, $scope.newActionObj.name);
3251 GBPActionInstanceServices.send(path, $scope.newActionObj, function(data){
3253 $scope.actionsView = false;
3254 $scope.edit = "view";
3255 $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD');
3262 $scope.showForm = function() {
3263 $scope.newActionObj = GBPActionInstanceServices.createObj();
3264 $scope.selectedAction = null;
3265 $scope.actionsView = true;
3266 $scope.edit = "add";
3267 $scope.reloadDefs();
3270 $scope.reload = function(selectedObj){
3271 $scope.selectedAction = selectedObj;
3272 $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD');
3274 $scope.edit = $scope.edit == "edit" ? $scope.edit : "view";
3276 $scope.actionsView = true;
3279 $scope.actionsView = false;
3280 $scope.edit = "view";
3283 if($scope.actionsView) {
3284 angular.copy(selectedObj, $scope.newActionObj);
3287 $scope.reloadDefs();
3290 $scope.close = function(){
3291 $scope.actionsView = false;
3292 $scope.edit = "view";
3295 $scope.$on('PGN_EDIT_ELEM', function(event){
3296 if (!event.defaultPrevented) {
3297 if ( $scope.selectedAction ) {
3298 $scope.actionsView = true;
3299 angular.copy($scope.selectedAction, $scope.newActionObj);
3300 $scope.edit = "edit";
3301 $scope.reloadDefs();
3303 event.defaultPrevented = true;
3307 $scope.delete = function(){
3308 path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id, $scope.selectedAction.name);
3309 GBPActionInstanceServices.delete(path, function(data){
3311 $scope.actionsView = false;
3312 $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD');
3318 $scope.$on('GBP_TENANT_RELOAD',function(){
3322 $scope.$on('GBP_ACTIONS_LABEL', function(event, obj){
3323 obj.labels = $scope.displayLabel;
3327 gbpOld.register.controller('endpointCtrl', ['$scope', 'GBPEndpointServices', 'GPBServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', 'GBPEpgServices', '$filter', 'GBPSubnetServices',
3328 function($scope, GBPEndpointServices, GPBServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, GBPL3ContextServices, GBPEpgServices, $filter, GBPSubnetServices){
3330 $scope.selectedEndpoint = null;
3331 $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null);
3332 $scope.displayLabel = function(obj) {
3333 return obj['mac-address'] + ':' + obj['l2-context'];
3335 $scope.crudLabel = 'Endpoint list';
3337 $scope.l2context = {'options' : [], 'labels' : null};
3338 $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2context);
3340 $scope.l3context = {'options' : [], 'labels' : null};
3341 $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context);
3343 $scope.subnet = {'options' : [], 'labels' : null};
3344 $scope.getDisplayLabelsFromCtrl('GBP_SUBNET_LABEL', $scope.subnet);
3346 $scope.epg = {'options' : [], 'labels' : null};
3347 $scope.getDisplayLabelsFromCtrl('GBP_EPG_LABEL', $scope.epg);
3349 $scope.networkContainment = {'options' : [], 'labels' : null};
3350 $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.networkContainment);
3358 mandatoryProperties = [],
3360 loadEpgOptions = function() {
3361 $scope.epg.options = [];
3363 path = GBPEpgServices.createPathObj($scope.selectedTenant.id);
3364 GBPEpgServices.load(path, function(data){
3365 $scope.epg.options = data;
3371 loadL2ContextOptions = function() {
3372 removeL2ContextOptions($scope.networkContainment.options, $scope.l2context.options);
3373 $scope.l2context.options = [];
3375 path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id);
3377 GBPL2FloodDomainServices.load(path, function(data){
3378 $scope.l2context.options = $scope.l2context.options.concat(data);
3379 $scope.networkContainment.options = $scope.networkContainment.options.concat(data);
3384 path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id);
3385 GBPL2BridgeDomainServices.load(path, function(data){
3386 $scope.l2context.options = $scope.l2context.options.concat(data);
3387 $scope.networkContainment.options = $scope.networkContainment.options.concat(data);
3393 loadL3ContextOptions = function(){
3394 removeL2ContextOptions($scope.networkContainment.options, $scope.l3context.options);
3395 $scope.l3context.options = [];
3397 GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){
3398 $scope.l3context.options = data;
3399 $scope.networkContainment.options = $scope.networkContainment.options.concat(data);
3405 loadSubnetOptions = function(){
3406 $scope.subnet.options = [];
3408 GBPSubnetServices.load(GBPSubnetServices.createPathObj($scope.selectedTenant.id), function(data){
3409 $scope.subnet.options = data;
3410 $scope.networkContainment.options = $scope.networkContainment.options.concat(data);
3416 loadNetworkCotnaninemnt = function(){
3417 $scope.networkContainment.options = [];
3419 loadL2ContextOptions();
3420 loadL3ContextOptions();
3421 loadSubnetOptions();
3426 $scope.selectedEndpoint = null;
3427 $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null);
3433 removeL2ContextOptions = function(arr1, arr2) {
3434 arr1 = arr1.filter( function( el ) {
3435 return arr2.indexOf( el ) < 0;
3439 $scope.init = function() {
3440 if ($scope.selectedTenant) {
3442 GBPEndpointServices.load(path, function(data){
3449 /*loadL2ContextOptions();
3450 loadL3ContextOptions();
3451 loadSubnetOptions();*/
3452 loadNetworkCotnaninemnt();
3458 $scope.addNewL3address = function() {
3459 if($scope.newEndpointObj) {
3460 if(!$scope.newEndpointObj['l3-address']){
3461 $scope.newEndpointObj['l3-address'] = [];
3463 var objToPush = {'l3-context' : '', 'ip-address' : ''};
3464 $scope.newEndpointObj['l3-address'].push(objToPush);
3468 $scope.deleteNewL3address = function(index){
3469 if($scope.newEndpointObj) {
3470 $scope.newEndpointObj['l3-address'].splice(index, 1);
3474 $scope.addNewLeafListEl = function(prop) {
3475 if($scope.newEndpointObj) {
3476 if(!$scope.newEndpointObj[prop]){
3477 $scope.newEndpointObj[prop] = [];
3480 $scope.newEndpointObj[prop].push(objToPush);
3484 $scope.updateLeafListEl = function(index, value, prop) {
3485 if($scope.newEndpointObj && $scope.newEndpointObj[prop] && $scope.newEndpointObj[prop].length >= index) {
3486 $scope.newEndpointObj[prop][index] = value;
3490 $scope.deleteNewLeafListEl = function(index, prop){
3491 if($scope.newEndpointObj) {
3492 $scope.newEndpointObj[prop].splice(index, 1);
3496 $scope.save = function(){
3497 if($scope.validateForm($scope.endpointForm)){
3498 GBPEndpointServices.send(path, $scope.newEndpointObj, function(data){
3500 $scope.view.endpoint = false;
3501 $scope.reloadNewObj();
3502 $scope.view.edit = "view";
3509 $scope.delete = function() {
3510 if($scope.selectedTenant && $scope.selectedEndpoint) {
3511 GBPEndpointServices.delete(path, $scope.selectedEndpoint, function(data){
3513 $scope.view.endpoint = false;
3520 $scope.showForm = function() {
3521 $scope.view.endpoint = true;
3522 $scope.reloadNewObj();
3523 $scope.selectedEndpoint = null;
3525 $scope.view.edit = "add";
3528 $scope.reloadNewObj = function() {
3529 $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null);
3532 $scope.reload = function(selectedObj) {
3533 $scope.selectedEndpoint = selectedObj;
3534 $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view";
3536 $scope.view.endpoint = true;
3539 $scope.view.endpoint = false;
3540 $scope.view.edit = "view";
3543 if($scope.view.endpoint) {
3544 angular.copy(selectedObj, $scope.newEndpointObj);
3548 $scope.close = function(){
3549 $scope.view.endpoint = false;
3550 $scope.view.edit = "view";
3553 $scope.$on('PGN_EDIT_ELEM', function(event){
3554 if (!event.defaultPrevented) {
3555 if ( $scope.selectedEndpoint ) {
3556 $scope.view.endpoint = true;
3557 $scope.view.edit = "edit";
3558 angular.copy($scope.selectedEndpoint, $scope.newEndpointObj);
3560 event.defaultPrevented = true;
3564 $scope.$on('GBP_TENANT_RELOAD',function(){
3568 $scope.$on('GBP_EPG_RELOAD',function(){
3572 $scope.$on('GBP_L2BRIDGE_RELOAD',function(){
3573 //loadL2ContextOptions();
3574 loadNetworkCotnaninemnt();
3577 $scope.$on('GBP_L2FLOOD_RELOAD',function(){
3578 //loadL2ContextOptions();
3579 loadNetworkCotnaninemnt();
3582 $scope.$on('GBP_L3CONTEXT_RELOAD',function(){
3583 //loadL3ContextOptions();
3584 loadNetworkCotnaninemnt();
3587 $scope.$on('GBP_SUBNET_RELOAD',function(){
3588 //loadSubnetOptions();
3589 loadNetworkCotnaninemnt();
3593 gbpOld.register.controller('l3EndpointCtrl', ['$scope', 'GBPEndpointL3Services', 'GPBServices', 'GBPEpgServices', 'GBPL3ContextServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', '$filter',
3594 function($scope, GBPEndpointL3Services, GPBServices, GBPEpgServices, GBPL3ContextServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, $filter){
3596 $scope.selectedEndpoint = null;
3597 $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null);
3598 $scope.displayLabel = function(obj) {
3599 return obj['ip-prefix'] + ':' + obj['l3-context'];
3601 $scope.crudLabel = 'L3 Prefix endpoint list';
3603 $scope.l2context = {'options' : [], 'labels' : null};
3604 $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2context);
3606 $scope.l3context = {'options' : [], 'labels' : null};
3607 $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context);
3609 $scope.epg = {'options' : [], 'labels' : null};
3610 $scope.getDisplayLabelsFromCtrl('GBP_EPG_LABEL', $scope.epg);
3618 mandatoryProperties = [],
3620 loadEpgOptions = function() {
3621 $scope.epg.options = [];
3623 path = GBPEpgServices.createPathObj($scope.selectedTenant.id);
3624 GBPEpgServices.load(path, function(data){
3625 $scope.epg.options = data;
3631 loadL2ContextOptions = function() {
3632 $scope.l2context.options = [];
3634 path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id);
3636 GBPL2FloodDomainServices.load(path, function(data){
3637 $scope.l2context.options = $scope.l2context.options.concat(data);
3642 path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id);
3643 GBPL2BridgeDomainServices.load(path, function(data){
3644 $scope.l2context.options = $scope.l2context.options.concat(data);
3650 loadL3ContextOptions = function(){
3651 $scope.l3context.options = [];
3653 GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){
3654 $scope.l3context.options = data;
3662 $scope.selectedEndpoint = null;
3663 $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null);
3670 $scope.init = function() {
3671 if ($scope.selectedTenant) {
3673 GBPEndpointL3Services.load(path, function(data){
3680 loadL2ContextOptions();
3681 loadL3ContextOptions();
3687 $scope.addNewL2gateways = function() {
3688 if($scope.newEndpointObj) {
3689 if(!$scope.newEndpointObj['endpoint-l2-gateways']){
3690 $scope.newEndpointObj['endpoint-l2-gateways'] = [];
3692 var objToPush = {'l2-context' : '', 'mac-address' : ''};
3693 $scope.newEndpointObj['endpoint-l2-gateways'].push(objToPush);
3697 $scope.deleteNewL2gateways = function(index){
3698 if($scope.newEndpointObj) {
3699 $scope.newEndpointObj['endpoint-l2-gateways'].splice(index, 1);
3703 $scope.addNewL3gateways = function() {
3704 if($scope.newEndpointObj) {
3705 if(!$scope.newEndpointObj['endpoint-l3-gateways']){
3706 $scope.newEndpointObj['endpoint-l3-gateways'] = [];
3708 var objToPush = {'l3-context' : '', 'ip-address' : ''};
3709 $scope.newEndpointObj['endpoint-l3-gateways'].push(objToPush);
3713 $scope.deleteNewL3gateways = function(index){
3714 if($scope.newEndpointObj) {
3715 $scope.newEndpointObj['endpoint-l3-gateways'].splice(index, 1);
3719 $scope.addNewLeafListEl = function(prop) {
3720 if($scope.newEndpointObj) {
3721 if(!$scope.newEndpointObj[prop]){
3722 $scope.newEndpointObj[prop] = [];
3725 $scope.newEndpointObj[prop].push(objToPush);
3729 $scope.updateLeafListEl = function(index, value, prop) {
3730 if($scope.newEndpointObj && $scope.newEndpointObj[prop] && $scope.newEndpointObj[prop].length >= index) {
3731 $scope.newEndpointObj[prop][index] = value;
3735 $scope.deleteNewLeafListEl = function(index, prop){
3736 if($scope.newEndpointObj) {
3737 $scope.newEndpointObj[prop].splice(index, 1);
3741 $scope.save = function(){
3742 if($scope.validateForm($scope.l3EndpointForm)){
3743 GBPEndpointL3Services.send(path, $scope.newEndpointObj, function(data){
3745 $scope.view.endpoint = false;
3746 $scope.reloadNewObj();
3747 $scope.view.edit = "view";
3754 $scope.delete = function() {
3755 if($scope.selectedTenant && $scope.selectedEndpoint) {
3756 GBPEndpointL3Services.delete(path, $scope.selectedEndpoint, function(data){
3764 $scope.showForm = function() {
3765 $scope.view.endpoint = true;
3766 $scope.reloadNewObj();
3767 $scope.selectedEndpoint = null;
3768 $scope.view.edit = "add";
3771 $scope.reloadNewObj = function() {
3772 $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null);
3775 $scope.reload = function(selectedObj) {
3776 $scope.selectedEndpoint = selectedObj;
3777 angular.copy(selectedObj, $scope.newEndpointObj);
3778 $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view";
3780 $scope.view.endpoint = true;
3783 $scope.view.endpoint = false;
3784 $scope.view.edit = "view";
3788 $scope.close = function(){
3789 $scope.view.endpoint = false;
3790 $scope.view.edit = "view";
3793 $scope.$on('PGN_EDIT_ELEM', function(event){
3794 if (!event.defaultPrevented) {
3795 if ( $scope.selectedEndpoint ) {
3796 $scope.view.endpoint = true;
3797 $scope.view.edit = "edit";
3798 angular.copy($scope.selectedEndpoint, $scope.newEndpointObj);
3800 event.defaultPrevented = true;
3804 $scope.$on('GBP_TENANT_RELOAD',function(){
3808 $scope.$on('GBP_EPG_RELOAD',function(){
3812 $scope.$on('GBP_L2BRIDGE_RELOAD',function(){
3813 loadL2ContextOptions();
3816 $scope.$on('GBP_L2FLOOD_RELOAD',function(){
3817 loadL2ContextOptions();
3820 $scope.$on('GBP_L3CONTEXT_RELOAD',function(){
3821 loadL3ContextOptions();
3825 gbpOld.register.controller('accessModelWizardCtrl', ['$scope', '$filter', 'GBPTenantServices', 'GBPEpgServices', 'GBPContractServices', 'GPBServices', function($scope, $filter, GBPTenantServices, GBPEpgServices, GBPContractServices, GPBServices){
3826 $scope.wizardPage = null;
3828 $scope.selectedTenant = null;
3829 $scope.tenant = null;
3830 //$scope.epgList = [];
3831 $scope.newContractObj = null;
3833 $scope.init = function() {
3834 $scope.setPage('tenants');
3837 $scope.setPage = function(pageName, object) {
3838 $scope.wizardPage = pageName;
3843 $scope.tenant = object;
3849 $scope.tenant['endpoint-group'] = $scope.tenant['endpoint-group'] ? $scope.tenant['endpoint-group'] : [];
3852 object.forEach(function(o) {
3853 $scope.tenant['endpoint-group'].push(GPBServices.stripNullValues(o));
3860 $scope.tenant['contract'] = $scope.tenant['contract'] ? $scope.tenant['contract'] : [];
3863 object.forEach(function(o) {
3864 $scope.tenant['contract'].push(GPBServices.stripNullValues(o));
3872 $scope.submit = function(object) {
3873 $scope.tenant['endpoint-group'] = $scope.tenant['endpoint-group'] ? $scope.tenant['endpoint-group'] : [];
3876 object.forEach(function(o) {
3877 $scope.tenant['endpoint-group'].push(GPBServices.stripNullValues(o));
3882 path = GBPTenantServices.createPathObj($scope.tenant.id);
3883 GBPTenantServices.send(path, $scope.tenant, function(data){
3884 $scope.wizards.accessModelWizard = false;
3885 $scope.sendReloadEventFromRoot('GBP_GLOBAL_TENANT_RELOAD');
3886 $scope.reloadTopo();
3892 // $scope.updateList = function(list, object, key) {
3893 // var elementPos = list.map(function(x) {return x[key]; }).indexOf(object[key]);
3895 // if(elementPos < 0) {
3896 // list.push(object);
3899 // list[elementPos] = object;
3904 gbpOld.register.controller('wizardTenantCtrl', ['$scope', '$filter', 'GBPTenantServices', function($scope, $filter, GBPTenantServices){
3905 // $scope.tenantList = [];
3906 $scope.newTenantObj = GBPTenantServices.createObj();
3907 $scope.displayLabel = ['name' , 'id'];
3913 // $scope.init = function() {
3914 // $scope.getTenants();
3917 // $scope.getTenants = function() {
3918 // GBPTenantServices.load(
3920 // $scope.tenantList = data;
3921 // $scope.newTenantObj = GBPTenantServices.createObj();
3929 $scope.reloadTenants = function(selectedObject) {
3930 if(!selectedObject) {
3931 selectedObject = GBPTenantServices.createObj();
3932 $scope.view.tenantEdit = false;
3935 $scope.view.tenantEdit = true;
3938 $scope.selectedTenant = selectedObject;
3939 $scope.newTenantObj = selectedObject;
3942 $scope.getNewTenantObject = function() {
3943 return GBPTenantServices.createObj();
3947 gbpOld.register.controller('wizardEpgCtrl', ['$scope', '$filter', 'GBPEpgServices', function($scope, $filter, GBPEpgServices){
3949 $scope.newEpgObj = GBPEpgServices.createObj();
3950 $scope.selectedEpg = null;
3951 $scope.epgFormView = true;
3953 $scope.displayLabel = ['name', 'id'];
3954 $scope.crudLabel = 'Group list';
3956 $scope.igpOpts = ['allow', 'require-contract'];
3958 $scope.init = function() {
3962 $scope.showForm = function() {
3963 $scope.epgFormView = true;
3964 $scope.newEpgObj = GBPEpgServices.createObj();
3967 $scope.save = function() {
3968 $scope.updateList($scope.list, $scope.newEpgObj, "id");
3969 $scope.reload($scope.newEpgObj);
3970 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newEpgObj);
3973 $scope.delete = function() {
3974 if($scope.selectedEpg) {
3975 var index = $scope.list.indexOf($scope.selectedEpg);
3976 $scope.list.splice(index, 1);
3977 $scope.epgFormView = false;
3979 //$scope.newEpgObj = GBPEpgServices.createObj();
3982 $scope.reload = function(selectedObj) {
3983 $scope.selectedEpg = selectedObj;
3984 $scope.newEpgObj = selectedObj;
3985 $scope.epgFormView = true;
3986 $scope.$broadcast('WIZARD_EPG_RELOAD');
3989 $scope.close = function() {
3990 $scope.epgFormView = false;
3991 $scope.newEpgObj = GBPEpgServices.createObj();
3992 $scope.selectedEpg = null;
3995 $scope.$on('PGN_EDIT_ELEM', function(event){
3996 if (!event.defaultPrevented) {
3997 if ( $scope.selectedEpg ) {
3998 $scope.epgFormView = true;
3999 angular.copy($scope.selectedEpg, $scope.newEpgObj);
4001 event.defaultPrevented = true;
4005 $scope.$on("WIZARD_CNS_RELOAD", function(event, args){
4006 //$scope.selectedEpg['consumer-named-selector'] = args;
4007 $scope.newEpgObj['consumer-named-selector'] = args;
4008 $scope.updateList($scope.list, $scope.newEpgObj, "id");
4011 $scope.$on("WIZARD_PNS_RELOAD", function(event, args){
4012 //$scope.selectedEpg['provider-named-selector'] = args;
4013 $scope.newEpgObj['provider-named-selector'] = args;
4014 $scope.updateList($scope.list, $scope.newEpgObj, "id");
4018 gbpOld.register.controller('wizardContractCtrl', ['$scope', '$filter', 'GBPContractServices', function($scope, $filter, GBPContractServices){
4020 $scope.newContractObj = GBPContractServices.createObj();
4021 $scope.selectedContract = null;
4023 $scope.displayLabel = ['description', 'id'];
4024 $scope.crudLabel = 'Contract list';
4026 $scope.contractFormView = true;
4028 $scope.init = function() {
4032 $scope.showForm = function() {
4033 $scope.contractFormView = true;
4034 $scope.newContractObj = GBPContractServices.createObj();
4037 $scope.save = function() {
4038 $scope.updateList($scope.list, $scope.newContractObj, "id");
4039 $scope.reload($scope.newContractObj);
4040 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newContractObj);
4043 $scope.delete = function() {
4044 if($scope.selectedContract) {
4045 var index = $scope.list.indexOf($scope.selectedContract);
4046 $scope.list.splice(index, 1);
4047 $scope.contractFormView = false;
4048 $scope.newContractObj = GBPContractServices.createObj();
4049 $scope.selectedContract = null;
4053 $scope.reload = function(selectedObj) {
4054 $scope.selectedContract = selectedObj;
4055 $scope.newContractObj = selectedObj;
4056 $scope.contractFormView = true;
4059 $scope.close = function() {
4060 $scope.contractFormView = false;
4061 //$scope.newContractObj = GBPContractServices.createObj();
4062 //$scope.selectedContract = null;
4065 $scope.$on('PGN_EDIT_ELEM', function(event){
4066 if (!event.defaultPrevented) {
4067 if ( $scope.selectedContract ) {
4068 $scope.contractFormView = true;
4069 angular.copy($scope.selectedContract, $scope.newContractObj);
4071 event.defaultPrevented = true;
4075 $scope.$on("WIZARD_SUBJECT_RELOAD", function(event, args){
4076 //$scope.selectedEpg['consumer-named-selector'] = args;
4077 $scope.newContractObj['subject'] = args;
4078 $scope.updateList($scope.list, $scope.newContractObj, "id");
4081 $scope.$on("WIZARD_CLAUSE_RELOAD", function(event, args){
4082 //$scope.selectedEpg['consumer-named-selector'] = args;
4083 $scope.newContractObj['clause'] = args;
4084 $scope.updateList($scope.list, $scope.newContractObj, "id");
4088 gbpOld.register.controller('wizardCnsCtrl',['$scope', 'GBPConNamedSelServices', function($scope, GBPConNamedSelServices){
4090 $scope.selectedCNS = null;
4091 $scope.newCNSObj = GBPConNamedSelServices.createObj();
4092 $scope.internalView = {
4096 $scope.displayLabel = 'name';
4097 $scope.crudLabel = 'Consumer named selectors list';
4099 $scope.contractList = {'options' : [], 'labels' : null};
4100 $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contractList);
4102 var clear = function(){
4104 $scope.selectedCNS = null;
4105 $scope.newCNSObj = GBPConNamedSelServices.createObj();
4106 $scope.internalView = {
4112 //move to separate ctrl \/
4113 $scope.addNewElem = function(templateObj) {
4114 if($scope.newCNSObj && $scope.newCNSObj.contract) {
4115 var objToPush = templateObj || "";
4116 $scope.newCNSObj.contract.push(objToPush);
4120 $scope.deleteElemAt = function(index) {
4121 if($scope.newCNSObj && $scope.newCNSObj.contract) {
4122 $scope.newCNSObj.contract.splice(index, 1);
4126 $scope.updateAt = function(index, value) {
4127 if($scope.newCNSObj && $scope.newCNSObj.contract && $scope.newCNSObj.contract.length >= index) {
4128 $scope.newCNSObj.contract[index] = value;
4131 //move to separate ctrl /\
4133 $scope.init = function() {
4136 if($scope.tenant && $scope.tenant['contract'].length>0) {
4137 $scope.contractList.options = $scope.tenant['contract'];
4140 if($scope.selectedEpg && $scope.selectedEpg['consumer-named-selector']) {
4141 $scope.list = $scope.selectedEpg['consumer-named-selector'];
4145 $scope.save = function(){
4146 $scope.updateList($scope.list, $scope.newCNSObj, "name");
4147 $scope.reload($scope.newCNSObj);
4148 $scope.$emit('WIZARD_CNS_RELOAD', $scope.list);
4149 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newCNSObj);
4152 $scope.delete = function() {
4153 if($scope.selectedCNS) {
4154 var index = $scope.list.indexOf($scope.selectedCNS);
4155 $scope.list.splice(index, 1);
4156 $scope.internalView = {
4160 $scope.$emit('WIZARD_CNS_RELOAD', $scope.list);
4164 $scope.showForm = function() {
4165 $scope.reloadNewObj();
4166 $scope.selectedCNS = null;
4167 $scope.internalView.cns = true;
4168 $scope.internalView.edit = "add";
4171 $scope.reloadNewObj = function() {
4172 $scope.newCNSObj = GBPConNamedSelServices.createObj();
4175 $scope.reload = function(selectedObj) {
4176 $scope.selectedCNS = selectedObj;
4177 $scope.newCNSObj = selectedObj;
4178 $scope.internalView.cns = true;
4181 $scope.close = function(){
4182 $scope.internalView.cns = false;
4183 //$scope.internalView.edit = "view";
4186 $scope.$on('PGN_EDIT_ELEM', function(event){
4187 if (!event.defaultPrevented) {
4188 if ( $scope.selectedEpg ) {
4189 $scope.internalView.cns = true;
4190 $scope.internalView.edit = "add";
4191 angular.copy($scope.selectedCNS, $scope.newCNSObj);
4193 event.defaultPrevented = true;
4197 $scope.$on('WIZARD_EPG_RELOAD',function(){
4202 gbpOld.register.controller('wizardPnsCtrl',['$scope', 'GBPProNamedSelServices', function($scope, GBPProNamedSelServices){
4204 $scope.selectedPNS = null;
4205 $scope.newPNSObj = GBPProNamedSelServices.createObj();
4206 $scope.displayLabel = 'name';
4207 $scope.crudLabel = 'Provider named selectors list';
4208 $scope.internalView = {
4213 $scope.contractList = {'options' : [], 'labels' : null};
4214 $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contractList);
4216 var clear = function(){
4218 $scope.selectedPNS = null;
4219 $scope.newPNSObj = GBPProNamedSelServices.createObj();
4220 $scope.internalView = {
4226 //move to separate ctrl \/
4227 $scope.addNewElem = function(templateObj) {
4228 if($scope.newPNSObj && $scope.newPNSObj.contract) {
4229 var objToPush = templateObj || "";
4230 $scope.newPNSObj.contract.push(objToPush);
4234 $scope.deleteElemAt = function(index) {
4235 if($scope.newPNSObj && $scope.newPNSObj.contract) {
4236 $scope.newPNSObj.contract.splice(index, 1);
4240 $scope.updateAt = function(index, value) {
4241 if($scope.newPNSObj && $scope.newPNSObj.contract && $scope.newPNSObj.contract.length >= index) {
4242 $scope.newPNSObj.contract[index] = value;
4245 //move to separate ctrl /\
4247 $scope.init = function() {
4250 if($scope.tenant && $scope.tenant['contract'].length>0) {
4251 $scope.contractList.options = $scope.tenant['contract'];
4254 if($scope.selectedEpg && $scope.selectedEpg['provider-named-selector']) {
4255 $scope.list = $scope.selectedEpg['provider-named-selector'];
4259 $scope.save = function(){
4260 $scope.updateList($scope.list, $scope.newPNSObj, "name");
4261 $scope.reload($scope.newPNSObj);
4262 $scope.$emit('WIZARD_PNS_RELOAD', $scope.list);
4263 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newPNSObj);
4266 $scope.delete = function() {
4267 if($scope.selectedPNS) {
4268 var index = $scope.list.indexOf($scope.selectedPNS);
4269 $scope.list.splice(index, 1);
4270 $scope.internalView = {
4274 $scope.$emit('WIZARD_PNS_RELOAD', $scope.list);
4278 $scope.showForm = function() {
4279 $scope.reloadNewObj();
4280 $scope.selectedPNS = null;
4281 $scope.internalView.pns = true;
4282 $scope.internalView.edit = "add";
4285 $scope.reloadNewObj = function() {
4286 $scope.newPNSObj = GBPProNamedSelServices.createObj();
4289 $scope.reload = function(selectedObj) {
4290 $scope.selectedPNS = selectedObj;
4291 $scope.newPNSObj = selectedObj;
4292 $scope.internalView.pns = true;
4295 $scope.close = function(){
4296 $scope.internalView.pns = false;
4297 $scope.internalView.edit = "view";
4299 $scope.$on('PGN_EDIT_ELEM', function(event){
4300 if (!event.defaultPrevented) {
4301 if ( $scope.selectedEpg ) {
4302 $scope.internalView.pns = true;
4303 $scope.internalView.edit = "edit";
4304 angular.copy($scope.selectedPNS, $scope.newPNSObj);
4306 event.defaultPrevented = true;
4310 $scope.$on('WIZARD_EPG_RELOAD',function(){
4315 gbpOld.register.controller('wizardSubjectCtrl', ['$scope','GBPSubjectServices', '$filter', function($scope, GBPSubjectServices, $filter){
4317 $scope.selectedSubject = null;
4318 $scope.newSubjectObj = GBPSubjectServices.createObj();
4319 $scope.displayLabel = 'name';
4320 $scope.internalView = {
4324 $scope.crudLabel = 'Subject list';
4329 mandatoryProperties = ['order'],
4333 $scope.selectedSubject = null;
4334 $scope.newSubjectObj = GBPSubjectServices.createObj();
4335 $scope.internalView = {
4341 $scope.init = function() {
4345 $scope.save = function(){
4346 $scope.updateList($scope.list, $scope.newSubjectObj, "name");
4347 $scope.reload($scope.newSubjectObj);
4348 $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list);
4349 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newSubjectObj);
4352 $scope.delete = function() {
4353 if($scope.selectedSubject) {
4354 var index = $scope.list.indexOf($scope.selectedSubject);
4355 $scope.list.splice(index, 1);
4356 $scope.internalView = {
4360 $scope.reloadNewObj();
4361 $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list);
4365 $scope.reloadNewObj = function() {
4366 $scope.newSubjectObj = GBPSubjectServices.createObj();
4369 $scope.reload = function(selectedObj) {
4370 $scope.selectedSubject = selectedObj;
4371 $scope.newSubjectObj = selectedObj;
4372 $scope.internalView.subject = true;
4375 $scope.showForm = function() {
4376 $scope.reloadNewObj();
4377 $scope.internalView.subject = true;
4378 $scope.internalView.edit = "add";
4379 $scope.selectedSubject = null;
4382 $scope.close = function(){
4383 $scope.internalView.subject = false;
4384 $scope.internalView.edit = "view";
4387 $scope.$on('PGN_EDIT_ELEM', function(event){
4388 if (!event.defaultPrevented) {
4389 if ( $scope.selectedSubject ) {
4390 $scope.internalView.subject = true;
4391 $scope.internalView.edit = "edit";
4392 angular.copy($scope.selectedSubject, $scope.newSubjectObj);
4394 event.defaultPrevented = true;
4398 $scope.$on('GBP_CONTRACT_RELOAD',function(){
4402 $scope.$on('GBP_SUBJECTS_LABEL', function(event, obj){
4403 obj.labels = $scope.displayLabel;
4406 $scope.$on("WIZARD_RULE_RELOAD", function(event, args){
4407 //$scope.selectedEpg['consumer-named-selector'] = args;
4408 $scope.newSubjectObj['rule'] = args;
4409 $scope.updateList($scope.list, $scope.newSubjectObj, "id");
4410 $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list);
4414 gbpOld.register.controller('wizardRuleCtrl', ['$scope','GBPRuleServices', '$filter', function($scope, GBPRuleServices, $filter){
4416 $scope.selectedRule = null;
4417 $scope.newRuleObj = GBPRuleServices.createObj();
4418 $scope.displayLabel = 'name';
4419 $scope.internalView = {
4423 $scope.crudLabel = 'Rule list';
4427 mandatoryProperties = ['order'],
4431 $scope.selectedRule = null;
4432 $scope.newRuleObj = GBPRuleServices.createObj();
4433 $scope.internalView = {
4439 $scope.init = function() {
4443 $scope.save = function(){
4444 $scope.updateList($scope.list, $scope.newRuleObj, "name");
4445 $scope.reload($scope.newRuleObj);
4446 $scope.$emit('WIZARD_RULE_RELOAD', $scope.list);
4447 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newRuleObj);
4450 $scope.delete = function() {
4451 if($scope.selectedRule) {
4452 var index = $scope.list.indexOf($scope.selectedRule);
4453 $scope.list.splice(index, 1);
4454 $scope.internalView = {
4458 $scope.reloadNewObj();
4459 $scope.$emit('WIZARD_RULE_RELOAD', $scope.list);
4463 $scope.reloadNewObj = function() {
4464 $scope.newRuleObj = GBPRuleServices.createObj();
4467 $scope.reload = function(selectedObj) {
4468 $scope.selectedRule = selectedObj;
4469 $scope.newRuleObj = selectedObj;
4470 $scope.internalView.rule = true;
4471 $scope.$broadcast('WIZARD_RULE_RELOAD');
4474 $scope.showForm = function() {
4475 $scope.reloadNewObj();
4476 $scope.internalView.rule = true;
4477 $scope.internalView.edit = "add";
4478 $scope.selectedRule = null;
4481 $scope.close = function(){
4482 $scope.internalView.rule = false;
4483 $scope.internalView.edit = "view";
4486 $scope.$on('PGN_EDIT_ELEM', function(event){
4487 if (!event.defaultPrevented) {
4488 if ( $scope.selectedRule ) {
4489 $scope.internalView.rule = true;
4490 $scope.internalView.edit = "edit";
4491 angular.copy($scope.selectedRule, $scope.newRuleObj);
4493 event.defaultPrevented = true;
4497 $scope.$on('GBP_SUBJECT_RELOAD',function(){
4501 $scope.$on("WIZARD_CLASREF_RELOAD", function(event, args){
4502 $scope.newRuleObj['classifier-ref'] = args;
4503 $scope.updateList($scope.list, $scope.newRuleObj, "name");
4504 $scope.$emit('WIZARD_RULE_RELOAD', $scope.list);
4507 $scope.$on("WIZARD_ACTIONREF_RELOAD", function(event, args){
4508 $scope.newRuleObj['action-ref'] = args;
4509 $scope.updateList($scope.list, $scope.newRuleObj, "name");
4510 $scope.$emit('WIZARD_RULE_RELOAD', $scope.list);
4514 gbpOld.register.controller('wizardClauseCtrl', ['$scope','GBPClauseServices', 'GBPSubjectServices',
4515 function($scope, GBPClauseServices, GBPSubjectServices){
4517 $scope.selectedClause = null;
4518 $scope.newClauseObj = GBPClauseServices.createObj();
4519 $scope.internalView = {
4523 $scope.displayLabel = 'name';
4524 $scope.crudLabel = 'Clause list';
4526 $scope.subjects = {'options' : [], 'labels' : null};
4527 $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects);
4533 $scope.selectedClause = null;
4534 $scope.newClauseObj = GBPClauseServices.createObj();
4535 $scope.internalView = {
4541 //move to separate ctrl \/
4542 $scope.addNewElem = function(templateObj) {
4543 if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) {
4545 var objToPush = templateObj || "";
4546 $scope.newClauseObj['subject-refs'].push(objToPush);
4550 $scope.deleteElemAt = function(index) {
4551 if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) {
4552 $scope.newClauseObj['subject-refs'].splice(index, 1);
4556 $scope.updateAt = function(index, value) {
4557 if($scope.newClauseObj && $scope.newClauseObj['subject-refs'] && $scope.newClauseObj['subject-refs'].length >= index) {
4558 $scope.newClauseObj['subject-refs'][index] = value;
4561 //move to separate ctrl /\
4563 $scope.init = function() {
4564 if($scope.selectedContract && $scope.selectedContract['subject'].length>0) {
4565 $scope.subjects.options = $scope.selectedContract['subject'];
4569 $scope.save = function(){
4570 $scope.updateList($scope.list, $scope.newClauseObj, "name");
4571 $scope.reload($scope.newClauseObj);
4572 $scope.$emit('WIZARD_CLAUSE_RELOAD', $scope.list);
4573 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newClauseObj);
4576 $scope.delete = function() {
4577 if($scope.selectedClause) {
4578 var index = $scope.list.indexOf($scope.selectedClause);
4579 $scope.list.splice(index, 1);
4580 $scope.internalView = {
4584 $scope.$emit('WIZARD_CLAUSE_RELOAD', $scope.list);
4588 $scope.reloadNewObj = function() {
4589 $scope.newClauseObj = GBPClauseServices.createObj();
4592 $scope.reload = function(selectedObj) {
4593 $scope.selectedClause = selectedObj;
4594 $scope.newClauseObj = selectedObj;
4595 $scope.internalView.clause = true;
4598 $scope.showForm = function() {
4599 $scope.reloadNewObj();
4600 $scope.internalView.clause = true;
4601 $scope.internalView.edit = "add";
4602 $scope.selectedClause = null;
4605 $scope.close = function(){
4606 $scope.internalView.clause = false;
4607 $scope.internalView.edit = "view";
4610 $scope.$on('PGN_EDIT_ELEM', function(event){
4611 if (!event.defaultPrevented) {
4612 if ( $scope.selectedClause ) {
4613 $scope.internalView.clause = true;
4614 $scope.internalView.edit = "edit";
4615 angular.copy($scope.selectedClause, $scope.newClauseObj);
4617 event.defaultPrevented = true;
4621 $scope.$on('WIZARD_SUBJECT_RELOAD',function(){
4626 gbpOld.register.controller('wizardActionRefCtrl', ['$scope','GBPActionRefsServices', 'GBPActionInstanceServices', '$filter', function($scope, GBPActionRefsServices, GBPActionInstanceServices, $filter){
4628 $scope.selectedActionRef = null;
4629 $scope.newActionRefObj = GBPActionRefsServices.createObj();
4630 $scope.displayLabel = 'name';
4631 $scope.internalView = {
4635 $scope.crudLabel = 'Action ref list';
4637 $scope.actionInstanceNames = {'options' : [], 'labels' : $scope.displayLabel};
4640 mandatoryProperties = ['order'],
4642 actionInstanceNamesLoad = function() {
4644 var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.tenant.id);
4645 GBPActionInstanceServices.load(actionInstancePath, function(data){
4646 $scope.actionInstanceNames.options = data;
4655 $scope.selectedActionRef = null;
4656 $scope.newActionRefObj = GBPActionRefsServices.createObj();
4657 $scope.internalView = {
4663 $scope.init = function() {
4664 actionInstanceNamesLoad();
4667 $scope.save = function(){
4668 $scope.updateList($scope.list, $scope.newActionRefObj, "name");
4669 $scope.reload($scope.newActionRefObj);
4670 $scope.$emit('WIZARD_ACTIONREF_RELOAD', $scope.list);
4671 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newActionRefObj);
4674 $scope.delete = function() {
4675 if($scope.selectedActionRef) {
4676 var index = $scope.list.indexOf($scope.selectedActionRef);
4677 $scope.list.splice(index, 1);
4678 $scope.internalView = {
4682 $scope.$emit('WIZARD_ACTIONREF_RELOAD', $scope.list);
4686 $scope.reloadNewObj = function() {
4687 $scope.newActionRefObj = GBPActionRefsServices.createObj();
4690 $scope.reload = function(selectedObj) {
4691 $scope.selectedActionRef = selectedObj;
4692 $scope.newActionRefObj = selectedObj;
4693 $scope.internalView.actionRef = true;
4696 $scope.showForm = function() {
4697 $scope.reloadNewObj();
4698 $scope.internalView.actionRef = true;
4699 $scope.internalView.edit = "add";
4700 $scope.selectedActionRef = null;
4703 $scope.close = function(){
4704 $scope.internalView.actionRef = false;
4705 $scope.internalView.edit = "view";
4708 $scope.$on('PGN_EDIT_ELEM', function(event){
4709 if (!event.defaultPrevented) {
4710 if ( $scope.selectedActionRef ) {
4711 $scope.internalView.actionRef = true;
4712 $scope.internalView.edit = "edit";
4713 angular.copy($scope.selectedActionRef, $scope.newActionRefObj);
4715 event.defaultPrevented = true;
4719 $scope.$on('WIZARD_RULE_RELOAD',function(){
4724 gbpOld.register.controller('wizardClassifierRefCtrl', ['$scope','GBPClassifierRefsServices', 'GBPClassifierInstanceServices', '$filter', function($scope, GBPClassifierRefsServices, GBPClassifierInstanceServices, $filter){
4726 $scope.selectedClassifierRef = null;
4727 $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj();
4728 $scope.displayLabel = 'name';
4729 $scope.internalView = {
4730 classifierRef : false,
4734 $scope.instanceNames = {'options' : [], 'labels' : $scope.displayLabel};
4736 $scope.formDirections = ['in', 'out', 'bidirectional'];
4737 $scope.formConnectionTracking = ['normal', 'reflexive'];
4739 $scope.crudLabel = 'Classifier ref list';
4743 instanceNamesLoad = function() {
4745 var classifierInstancePath = GBPClassifierInstanceServices.createPathObj($scope.tenant.id);
4746 GBPClassifierInstanceServices.load(classifierInstancePath, function(data){
4747 $scope.instanceNames.options = data;
4756 $scope.selectedClassifierRef = null;
4757 $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj();
4758 $scope.internalView = {
4759 classifierRef : false,
4764 $scope.init = function() {
4765 instanceNamesLoad();
4768 $scope.save = function(){
4769 $scope.updateList($scope.list, $scope.newClassifierRefObj, "name");
4770 $scope.reload($scope.newClassifierRefObj);
4771 $scope.$emit('WIZARD_CLASREF_RELOAD', $scope.list);
4772 $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newClassifierRefObj);
4775 $scope.delete = function() {
4776 if($scope.selectedClassifierRef) {
4777 var index = $scope.list.indexOf($scope.selectedClassifierRef);
4778 $scope.list.splice(index, 1);
4779 $scope.internalView = {
4780 classifierRef: false,
4783 $scope.$emit('WIZARD_CLASREF_RELOAD', $scope.list);
4787 $scope.reloadNewObj = function() {
4788 $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj();
4791 $scope.reload = function(selectedObj) {
4792 $scope.selectedClassifierRef = selectedObj;
4793 $scope.newClassifierRefObj = selectedObj;
4794 $scope.internalView.classifierRef = true;
4797 $scope.showForm = function() {
4798 $scope.reloadNewObj();
4799 $scope.internalView.classifierRef = true;
4800 $scope.internalView.edit = "add";
4801 $scope.selectedClassifierRef = null;
4804 $scope.close = function(){
4805 $scope.internalView.classifierRef = false;
4806 $scope.internalView.edit = "view";
4809 $scope.$on('PGN_EDIT_ELEM', function(event){
4810 if (!event.defaultPrevented) {
4811 if ( $scope.selectedClassifierRef ) {
4812 $scope.internalView.classifierRef = true;
4813 $scope.internalView.edit = "edit";
4814 angular.copy($scope.selectedClassifierRef, $scope.newClassifierRefObj);
4816 event.defaultPrevented = true;
4820 $scope.$on('WIZARD_RULE_RELOAD',function(){
4825 gbpOld.register.controller('rendererStateCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){
4826 $scope.data = {'subject-feature-definitions' : {}};
4827 $scope.view_path = 'src/app/gbp-old/views/governance';
4829 var init = function(){
4830 GPBServices.getDefinitions(function(classifiersDefs, actionsDefs){
4831 $scope.data['subject-feature-definitions']['classifier-definition'] = classifiersDefs;
4832 $scope.data['subject-feature-definitions']['action-definition'] = actionsDefs;
4841 gbpOld.register.controller('layerCtrl', ['$scope', function($scope){
4844 $scope.currentDisplayIndex = 1;
4845 $scope.displayOffsets = [-1, 0, 1];
4846 $scope.expanded = true;
4848 $scope.init = function(key, value){
4849 $scope.data = value;
4850 if($scope.checkData(value, 'Array')){
4851 $scope.setActData($scope.data[$scope.data.length - 1]);
4855 $scope.toggleExpanded = function(){
4856 $scope.expanded = !$scope.expanded;
4859 $scope.shiftDisplayNext = function() {
4860 $scope.currentDisplayIndex = Math.min($scope.currentDisplayIndex + moveOffset, $scope.data.length - 2);
4863 $scope.shiftDisplayPrev = function() {
4864 $scope.currentDisplayIndex = Math.max($scope.currentDisplayIndex - moveOffset, 1);
4867 $scope.showPrevButton = function() {
4868 return $scope.currentDisplayIndex > 1;
4871 $scope.showNextButton = function() {
4872 return $scope.data && $scope.currentDisplayIndex < $scope.data.length - 2;
4875 $scope.setActData = function(data) {
4876 $scope.actSelected = data;
4879 $scope.checkData = function(data, type){
4880 var result = {'Array' : data instanceof Array,
4881 'Object' : data instanceof Object};
4883 return result[type];
4887 gbpOld.register.controller('actionReferenceWizardCtrl', ['$scope', '$filter', 'GBPRuleServices', 'GBPActionInstanceServices', function($scope, $filter, GBPRuleServices, GBPActionInstanceServices){
4888 $scope.wizardPage = null;
4892 $scope.actionInstanceNames = {'options' : [], 'labels' : "name"};
4894 var actionInstanceNamesLoad = function() {
4895 var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id);
4896 GBPActionInstanceServices.load(actionInstancePath, function(data){
4897 $scope.actionInstanceNames.options = data;
4903 $scope.init = function() {
4904 $scope.setPage('reference');
4907 $scope.setPage = function(pageName, object) {
4908 $scope.wizardPage = pageName;
4911 $scope.submit = function() {
4912 //if($scope.validateForm($scope.actionsForm)){
4913 $scope.actionInstanceNames.options.forEach(function(i) {
4914 path = GBPActionInstanceServices.createPathObj($scope.path.tenantId, i.name);
4917 GBPActionInstanceServices.send(path, i, function(data){
4918 $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD');
4926 //if($scope.validateForm($scope.rulesForm)){
4927 path = GBPRuleServices.createPathObj($scope.path.tenantId, $scope.path.contractId, $scope.path.subjectId, $scope.path.ruleId);
4928 GBPRuleServices.send(path, $scope.rule, function(data){
4930 $scope.wizards.actionReferenceWizard = false;
4932 //$scope.sendReloadEventFromRoot('GBP_TENANT_RELOAD');
4940 $scope.$on('ACTION_RULE_WIZARD_LOAD', function(event, data){
4941 $scope.rule = angular.copy(data.data);
4942 $scope.path = data.path;
4945 $scope.$on('WIZARD_ACTIONREF_ADD', function(event, data){
4946 if(!$scope.rule['action-ref']) {
4947 $scope.rule['action-ref'] = [];
4949 $scope.updateList($scope.rule['action-ref'], data, "name");
4952 $scope.$on('WIZARD_ACTIONREF_DELETE', function(event, data){
4953 $scope.rule['action-ref'].splice(data, 1);
4956 $scope.$on('WIZARD_ACTIONINSTANCE_ADD', function(event, data){
4957 $scope.updateList($scope.actionInstanceNames.options, data, "name");
4959 $scope.setPage('reference');
4962 $scope.$on('GBP_TENANT_RELOAD',function(){
4963 actionInstanceNamesLoad();
4968 gbpOld.register.controller('actionsRefListCtrl', ['$scope', '$filter', function($scope, $filter){
4970 $scope.actionReferenceForm = false;
4972 $scope.showForm = function(object) {
4973 $scope.actionReferenceForm = true;
4974 $scope.newActionRefObj = object || null;
4977 $scope.closeForm = function() {
4978 $scope.actionReferenceForm = false;
4981 $scope.save = function(){
4982 $scope.$emit('WIZARD_ACTIONREF_ADD', $scope.newActionRefObj);
4983 $scope.resetObject();
4986 $scope.deleteElemAt = function(index) {
4987 $scope.$emit('WIZARD_ACTIONREF_DELETE', index);
4988 $scope.resetObject();
4991 $scope.resetObject = function() {
4992 $scope.newActionRefObj = null;
4999 gbpOld.register.controller('actionInstanceWizardCtrl', ['$scope', '$filter', 'GPBServices', 'GBPActionInstanceServices', function($scope, $filter, GPBServices, GBPActionInstanceServices){
5000 $scope.actionDefinitions = {'options' : [], 'labels' : "name"};
5001 $scope.newActionObj = GBPActionInstanceServices.createObj();
5003 var loadDefinitions = function() {
5004 GPBServices.getDefinitions(function(classifierDefs, actionDefs) {
5005 $scope.actionDefinitions.options = actionDefs;
5006 //$scope.getDisplayLabelsFromCtrl('GBP_ACTIONS_LABEL', $scope.actionDefinitions);
5010 $scope.reloadDefs = function(){
5011 $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newActionObj['action-definition-id']));
5014 if($scope.defs.length && $scope.defs[0].name === 'sfc-chain-name') {
5015 GPBServices.getServiceFunctionChains(function(data) {
5016 $scope.serviceFunctionChains = data;
5021 $scope.getDefinitionObjParams = function(id){
5022 return GPBServices.getDefinitionObjParams($scope.actionDefinitions.options, id);
5025 $scope.save = function(){
5026 $scope.newActionObj['parameter-value'] = [];
5027 $scope.$broadcast('GBP_SAVE_PARAM');
5028 $scope.$emit('WIZARD_ACTIONINSTANCE_ADD', $scope.newActionObj);
5029 $scope.resetObject();
5032 $scope.resetObject = function() {
5033 $scope.newActionObj = GBPActionInstanceServices.createObj();
5036 $scope.saveParam = function() {
5040 $scope.addParam = function(name, type, value) {
5041 $scope.newActionObj['parameter-value'].push(GPBServices.createParamObj(name, type, value));