From b34a3d6d22d971d0341fcb27079f61e5821bba55 Mon Sep 17 00:00:00 2001 From: Daniel Malachovsky Date: Thu, 28 Apr 2016 11:21:56 +0200 Subject: [PATCH] Move groupbasedpolicy-ui to groupbased-old-ui Preparation for new GBP UI. Moving all old ui files do *old* folder Change-Id: I054280f070d769fd3f4176a2179f2f1a9bdd4af3 Signed-off-by: Daniel Malachovsky --- artifacts/pom.xml | 2 +- features/pom.xml | 2 +- features/src/main/features/features.xml | 2 +- .../bundle/pom.xml | 172 +- .../OSGI-INF/blueprint/blueprint.xml | 38 +- .../module/pom.xml | 6 +- .../src/main/resources/gbp/gbp.controller.js | 10100 ++++++++-------- .../module/src/main/resources/gbp/gbp.css | 1480 +-- .../module/src/main/resources/gbp/gbp.less | 1516 +-- .../src/main/resources/gbp/gbp.module.js | 116 +- .../src/main/resources/gbp/gbp.services.js | 5738 ++++----- .../gbp/images/infinity-loop.tpl.html | Bin .../yang-ui-icons/icon-arrow-down.tpl.html | Bin .../yang-ui-icons/icon-arrow-right.tpl.html | Bin .../yang-ui-icons/icon-arrow-up.tpl.html | Bin .../images/yang-ui-icons/icon-close.tpl.html | Bin .../yang-ui-icons/icon-collapse-bits.tpl.html | Bin .../images/yang-ui-icons/icon-danger.tpl.html | Bin .../yang-ui-icons/icon-expand-bits.tpl.html | Bin .../yang-ui-icons/icon-fill-data.tpl.html | Bin .../yang-ui-icons/icon-filter-empty.tpl.html | Bin .../icon-filter-full-bck.tpl.html | Bin .../yang-ui-icons/icon-filter-full.tpl.html | Bin .../yang-ui-icons/icon-list-bck.tpl.html | Bin .../images/yang-ui-icons/icon-list.tpl.html | Bin .../images/yang-ui-icons/icon-next.tpl.html | Bin .../images/yang-ui-icons/icon-plus.tpl.html | Bin .../images/yang-ui-icons/icon-prev.tpl.html | Bin .../yang-ui-icons/icon-question.tpl.html | Bin .../images/yang-ui-icons/icon-view.tpl.html | Bin .../src/main/resources/gbp/js/backbone-min.js | 0 .../src/main/resources/gbp/js/geometry.js | 0 .../resources/gbp/js/joint.clean.build.js | 0 .../src/main/resources/gbp/js/joint.css | 0 .../src/main/resources/gbp/js/lodash.min.js | 0 .../src/main/resources/gbp/js/vectorizer.js | 0 .../resources/gbp/views/action-ref.tpl.html | 56 +- .../main/resources/gbp/views/actions.tpl.html | 98 +- .../box/contract-content-static.tpl.html | 0 .../gbp/views/box/ep-content-static.tpl.html | 0 .../gbp/views/box/epg-content-static.tpl.html | 0 .../views/box/rule-content-static.tpl.html | 0 .../views/box/subject-content-static.tpl.html | 0 .../gbp/views/classifier-ref.tpl.html | 80 +- .../resources/gbp/views/classifiers.tpl.html | 106 +- .../main/resources/gbp/views/clause.tpl.html | 0 .../src/main/resources/gbp/views/cns.tpl.html | 0 .../resources/gbp/views/contracts.tpl.html | 92 +- .../main/resources/gbp/views/docs.tpl.html | 10 +- .../resources/gbp/views/endpoint.tpl.html | 214 +- .../src/main/resources/gbp/views/epg.tpl.html | 126 +- .../main/resources/gbp/views/gateway.tpl.html | 0 .../governance/delivered-policy.tpl.html | 0 .../gbp/views/governance/epg-detail.tpl.html | 0 .../governance/expressed-policy.tpl.html | 0 .../gbp/views/governance/main.tpl.html | 114 +- .../views/governance/node-structure.tpl.html | 72 +- .../renderer-configuration.tpl.html | 0 .../views/governance/renderer-state.tpl.html | 14 +- .../views/governance/subject-detail.tpl.html | 0 .../main/resources/gbp/views/index.tpl.html | 20 +- .../main/resources/gbp/views/l2l3.tpl.html | 348 +- .../resources/gbp/views/l3-endpoint.tpl.html | 258 +- .../gbp/views/main/governance.tpl.html | 44 +- .../resources/gbp/views/main/main.tpl.html | 76 +- .../gbp/views/main/policy-renderer.tpl.html | 282 +- .../gbp/views/menu/main-menu.tpl.html | 62 +- .../gbp/views/parts/breadcrumbs.tpl.html | 0 .../gbp/views/parts/crud-endpoint.tpl.html | 62 +- .../resources/gbp/views/parts/crud.tpl.html | 28 +- .../resources/gbp/views/parts/param.tpl.html | 0 .../src/main/resources/gbp/views/pns.tpl.html | 0 .../main/resources/gbp/views/prefix.tpl.html | 0 .../main/resources/gbp/views/root.tpl.html | 0 .../main/resources/gbp/views/rules.tpl.html | 70 +- .../resources/gbp/views/subjects.tpl.html | 60 +- .../main/resources/gbp/views/tenants.tpl.html | 74 +- .../views/wizards/accessModelWizard.tpl.html | 0 .../wizards/actionReferenceWizard.tpl.html | 0 .../pom.xml | 4 +- pom.xml | 2 +- 81 files changed, 10772 insertions(+), 10772 deletions(-) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/bundle/pom.xml (88%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/pom.xml (82%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/gbp.controller.js (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/gbp.css (95%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/gbp.less (94%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/gbp.module.js (96%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/gbp.services.js (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/infinity-loop.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-down.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-right.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-up.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-close.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-collapse-bits.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-danger.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-expand-bits.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-fill-data.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-empty.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full-bck.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-list-bck.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-list.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-next.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-plus.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-prev.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-question.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/images/yang-ui-icons/icon-view.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/js/backbone-min.js (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/js/geometry.js (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/js/joint.clean.build.js (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/js/joint.css (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/js/lodash.min.js (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/js/vectorizer.js (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/action-ref.tpl.html (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/actions.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/box/contract-content-static.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/box/ep-content-static.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/box/epg-content-static.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/box/rule-content-static.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/box/subject-content-static.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/classifier-ref.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/classifiers.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/clause.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/cns.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/contracts.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/docs.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/endpoint.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/epg.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/gateway.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/delivered-policy.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/epg-detail.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/expressed-policy.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/main.tpl.html (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/node-structure.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/renderer-configuration.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/renderer-state.tpl.html (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/governance/subject-detail.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/index.tpl.html (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/l2l3.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/l3-endpoint.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/main/governance.tpl.html (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/main/main.tpl.html (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/main/policy-renderer.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/menu/main-menu.tpl.html (99%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/parts/breadcrumbs.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/parts/crud-endpoint.tpl.html (97%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/parts/crud.tpl.html (96%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/parts/param.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/pns.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/prefix.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/root.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/rules.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/subjects.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/tenants.tpl.html (98%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/wizards/accessModelWizard.tpl.html (100%) mode change 100755 => 100644 rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/module/src/main/resources/gbp/views/wizards/actionReferenceWizard.tpl.html (100%) rename {groupbasedpolicy-ui => groupbasedpolicy-old-ui}/pom.xml (90%) mode change 100755 => 100644 diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 07d2a4beb..d07f73538 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -63,7 +63,7 @@ ${project.groupId} - groupbasedpolicy-ui-bundle + groupbasedpolicy-old-ui-bundle ${project.version} diff --git a/features/pom.xml b/features/pom.xml index 037ab3154..24ddc10a2 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -267,7 +267,7 @@ org.opendaylight.groupbasedpolicy - groupbasedpolicy-ui-bundle + groupbasedpolicy-old-ui-bundle org.opendaylight.groupbasedpolicy diff --git a/features/src/main/features/features.xml b/features/src/main/features/features.xml index 4b77ef4c3..d24a6bcc7 100755 --- a/features/src/main/features/features.xml +++ b/features/src/main/features/features.xml @@ -157,7 +157,7 @@ odl-dlux-core odl-dlux-yangvisualizer odl-groupbasedpolicy-uibackend - mvn:org.opendaylight.groupbasedpolicy/groupbasedpolicy-ui-bundle/{{VERSION}} + mvn:org.opendaylight.groupbasedpolicy/groupbasedpolicy-old-ui-bundle/{{VERSION}} - - unpack-loader-resources - - unpack-dependencies - - generate-resources - - ${project.build.directory}/generated-resources - org.opendaylight.dlux - groupbasedpolicy-ui-module - META-INF\/** - true - false - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.osgi.service.http, - org.osgi.framework;version="1.0.0", - org.opendaylight.dlux.loader, - org.slf4j - - - - - - - - - scm:git:ssh://git.opendaylight.org:29418/dlux.git - scm:git:ssh://git.opendaylight.org:29418/dlux.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_dlux:Main - - + + + 4.0.0 + + org.opendaylight.groupbasedpolicy + groupbasedpolicy-old-ui + 0.4.0-SNAPSHOT + + + groupbasedpolicy-old-ui-bundle + groupbasedpolicy-old-ui-bundle + bundle + + + 0.4.0-SNAPSHOT + + + + + org.opendaylight.dlux + loader + ${dlux.version} + + + org.opendaylight.groupbasedpolicy + groupbasedpolicy-old-ui-module + ${project.version} + + + + + + target/generated-resources + + + src/main/resources + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + + unpack-loader-resources + + unpack-dependencies + + generate-resources + + ${project.build.directory}/generated-resources + org.opendaylight.dlux + groupbasedpolicy-old-ui-module + META-INF\/** + true + false + + + + + + org.apache.felix + maven-bundle-plugin + true + + + org.osgi.service.http, + org.osgi.framework;version="1.0.0", + org.opendaylight.dlux.loader, + org.slf4j + + + + + + + + + scm:git:ssh://git.opendaylight.org:29418/dlux.git + scm:git:ssh://git.opendaylight.org:29418/dlux.git + HEAD + https://wiki.opendaylight.org/view/OpenDaylight_dlux:Main + + diff --git a/groupbasedpolicy-ui/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/groupbasedpolicy-old-ui/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml rename to groupbasedpolicy-old-ui/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 76209287f..a62c9c42f --- a/groupbasedpolicy-ui/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/groupbasedpolicy-old-ui/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - src/app/gbp/gbp.css - src/app/gbp/js/joint.css - - - - + + + + + + + + + + + + + + src/app/gbp/gbp.css + src/app/gbp/js/joint.css + + + + diff --git a/groupbasedpolicy-ui/module/pom.xml b/groupbasedpolicy-old-ui/module/pom.xml old mode 100755 new mode 100644 similarity index 82% rename from groupbasedpolicy-ui/module/pom.xml rename to groupbasedpolicy-old-ui/module/pom.xml index 8060b1569..37da5b7bd --- a/groupbasedpolicy-ui/module/pom.xml +++ b/groupbasedpolicy-old-ui/module/pom.xml @@ -11,13 +11,13 @@ 4.0.0 org.opendaylight.groupbasedpolicy - groupbasedpolicy-ui + groupbasedpolicy-old-ui 0.4.0-SNAPSHOT - groupbasedpolicy-ui-module + groupbasedpolicy-old-ui-module ${project.artifactId} - GBP UI Module Resources + GBP Old UI Module Resources jar diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.controller.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.controller.js old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.controller.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.controller.js index d139f9cff..e492a3a76 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.controller.js +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.controller.js @@ -1,5050 +1,5050 @@ -var modules = ['app/gbp/gbp.module', - 'app/gbp/gbp.services' - ]; - - -define(modules, function(gbp) { - - gbp.register.controller('gbpCtrl', ['$scope', '$rootScope', 'GBPTenantServices','DesignGbpFactory', 'GBPConstants', - function ($scope, $rootScope, GBPTenantServices, DesignGbpFactory, GBPConstants) { - $rootScope['section_logo'] = 'logo_gbp'; - $scope.view_path = 'src/app/gbp/views/'; - - $scope.mainView = { - main: true, - 'policy-renderer': false, - governance: false - }; - - $scope.policyRendererView = { - slider : true, - basic : true, - policy: false, - tenants : false, - l2l3 : false, - epg : false, - contracts : false, - docs : false, - groupMenu: false, - classifiers: false, - actions: false, - registerEndpoint : false, - registerL3PrefixEndpoint : false - }; - - $scope.subMenuView = { - governance : false, - policy : false, - policySub : false, - renderers : false, - endpoints : false - }; - - $scope.breadcrumbs = {'l1' : null, - 'l2' : null, - 'l3' : null}; - - $scope.wizards = { - accessModelWizard: false, - actionReferenceWizard: false - }; - - $scope.setBreadcrumb = function(level, label, visible){ - $scope.breadcrumbs[level] = visible ? label : null; - if(level === 'l1'){ - $scope.breadcrumbs.l2 = null; - $scope.breadcrumbs.l3 = null; - } - if(level === 'l2'){ - $scope.breadcrumbs.l3 = null; - } - }; - - $scope.setViewExpand = function(menu, expand, show){ - $scope[menu][expand] = show ? true : !$scope[menu][expand]; - for ( var property in $scope[menu] ) { - $scope[menu][property] = expand !== property ? false : $scope[menu][expand]; - } - - }; - - $scope.toggleExpandedMM = function(expand, show, broadcast){ - $scope.setViewExpand('mainView',expand, show); - - if ( broadcast ) { - $scope.$broadcast(broadcast); - } - }; - - $scope.sliceLabel = function(label){ - return label.length > GBPConstants.numbers.displayLabelLength ? label.slice(0,GBPConstants.numbers.displayLabelLength)+'...' : label; - }; - - $scope.getDisplayLabel = function(obj, labelArray, dontSlice){ - var ret = ''; - - if((typeof labelArray) === 'string'){ - ret = obj[labelArray]; - } else if (angular.isFunction(labelArray)) { - ret = labelArray(obj); - } else { - labelArray.some(function(labelParam) { - if(angular.isFunction(labelParam)) { - ret = labelParam(obj); - } else if(obj.hasOwnProperty(labelParam)) { - ret = obj[labelParam]; - } - return ret; - }); - } - - return dontSlice ? ret : $scope.sliceLabel(ret); - }; - - // TENANTS - $scope.tenantList = []; - $scope.selectedTenant = null; - $scope.tenantDisplayLabel = ['name' , 'id']; - - $scope.loadTenants = function() { - GBPTenantServices.load( - function(tenants) { - $scope.tenantList = tenants; - console.log('$scope.tenantList', $scope.tenantList); - }, - function(){ - //TODO error - }); - - DesignGbpFactory.setMainClass(); - }; - - $scope.setTenant = function(selectedTenant) { - $scope.selectedTenant = selectedTenant; - $scope.$broadcast('GBP_TENANT_RELOAD', $scope.selectedTenant); - }; - - $scope.loadTenants(); - - $scope.$on('GBP_GLOBAL_TENANT_RELOAD',function(){ - $scope.loadTenants(); - }); - - $scope.sendReloadEventFromRoot = function(eventName, val) { - $scope.$broadcast(eventName, val); - }; - - - // TODO: rework, use $scope.setViewContent or something - $scope.showWizard = function(wizardName, broadcast, broadcastedData, path) { - $scope.wizards[wizardName] = true; - - if ( broadcast ) { - $scope.sendReloadEventFromRoot(broadcast, {data: broadcastedData, path: path}); - } - }; - - $scope.closeWizard = function(wizardName) { - $scope.wizards[wizardName] = false; - }; - - $scope.updateList = function(list, object, key) { - var elementPos = list.map(function(x) {return x[key]; }).indexOf(object[key]); - - if(elementPos < 0) { - list.push(object); - } - else { - list[elementPos] = object; - } - }; - - }]); - - gbp.register.controller('governanceCtrl', ['$rootScope','$scope', - function ($rootScope, $scope) { - $scope.menuTpl = 'main-menu'; - $scope.menuBox = null; - $scope.contentTpl = 'main'; - // $scope.selectedTenant = null; - $scope.rendererList = []; - var broadcastObj = {}; - - $scope.rendererList.push({'name' : 'of_overlay', 'id' : 0}); - - $scope.toggleExpanded = function(expand, menu, tplType){ - var type = tplType ? tplType : 'contentTpl'; - $scope.menuBox = null; - - $scope[type] = expand; - - if ( menu && menu === false ) { - $scope.menuTpl = !menu ? null : menu; - } - }; - - - - $scope.setViewContent = function(tplName, data, broadcast, tplType) { - - if ( $scope[tplType] === tplName ) { - $scope.$broadcast(broadcast, data, true); - } else { - - broadcastObj[tplType] = {}; - broadcastObj[tplType].name = broadcast; - broadcastObj[tplType].data = data; - - $scope.toggleExpanded(tplName, null, tplType); - $scope.$apply(); - - } - }; - - $scope.broadcastCalling = function(tplType){ - $scope.$broadcast(broadcastObj[tplType].name, broadcastObj[tplType].data); - }; - - $scope.checkBroadcastCalling = function(tplName){ - var objClickAction = { - 'epg-detail': function(){ - $scope.broadcastCalling('contentTpl'); - }, - 'subject-detail': function(){ - $scope.broadcastCalling('contentTpl'); - } - }; - - if ( angular.isFunction(objClickAction[tplName]) ) { - objClickAction[tplName](); - } - - }; - - - $scope.$on('GOV_INIT', function(){ - $scope.menuTpl = 'main-menu'; - $scope.contentTpl = 'main'; - // $scope.$emit('GBP_GLOBAL_TENANT_RELOAD'); - $scope.menuBox = null; - }); - - $scope.$on('GBP_TENANT_RELOAD', function(e, obj){ - $scope.selectedTenant = obj; - }); - - - }]); - - gbp.register.controller('boxStaticCtrl',['$scope', - function($scope){ - - $scope.selectedObj = null; - - $scope.getLabel = function(id, type){ - var objAction = { - providerItems: function(){ - var name = $scope.selectedObj[type][id].attributes.objData['name']; - return name ? name + ' : ' + id : id; - }, - consumerItems: function(){ - var name = $scope.selectedObj[type][id].attributes.objData['name']; - return name ? name + ' : ' + id : id; - } - }; - - if ( angular.isFunction(objAction[type]) ) { - return objAction[type](); - } - }; - - $scope.$on('SET_SEL_STA_OBJ', function(obj, data, apply){ - $scope.selectedObj = data; - - if ( apply ) { - $scope.$apply(); - } - - }); - - }]); - - gbp.register.controller('graphCtrl', ['$scope', function($scope){ - var paper = null, - paperScale = 1; - - $scope.init = function(paperInstance){ - paper = paperInstance; - $scope.loadMouseScrollEvent(); - }; - - - $scope.zoom = function(out){ - paperScale = out ? paperScale - 0.1 : paperScale >= 1 ? 1 : paperScale + 0.1; - paper.scale(paperScale, paperScale); - }; - - - - $scope.loadMouseScrollEvent = function(){ - /*mouse wheel event for zooming*/ - var graph = document.getElementById('graph'), - MouseWheelHandler = function(e){ - var mouseEvent = window.event || e; // old IE support - var delta = Math.max(-1, Math.min(1, (mouseEvent.wheelDelta || -mouseEvent.detail))); - $scope.zoom(delta === 1 ? false : true); - }; - - if (graph.addEventListener) { - // IE9, Chrome, Safari, Opera - graph.addEventListener("mousewheel", MouseWheelHandler, false); - // Firefox - graph.addEventListener("DOMMouseScroll", MouseWheelHandler, false); - } - // IE 6/7/8 - else {graph.attachEvent("onmousewheel", MouseWheelHandler);} - /*mouse wheel event for zooming - end*/ - }; - - }]); - - gbp.register.controller('expressedPolicyCtrl', ['$scope', 'JointGraphFactory', 'JointGraphOffsetFactory', 'GBPConstants', - function ($scope, JointGraphFactory, JointGraphOffsetFactory, GBPConstants) { - var paper = JointGraphFactory.createGraph(), - epgItems = [], - contractItems = [], - linkItems = []; - - var objClickAction = { - epg: function(data){ - $scope.setViewContent('epg-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); - }, - contract: function(data){ - $scope.setViewContent('contract-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); - } - }; - - paper.on('cell:pointerdown', function(cell) { - if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { - objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); - } - }); - - var createEpgLinks = function(epg, epgItem, contracts) { - var providers = epg['provider-named-selector'] && epg['provider-named-selector'].length>0 ? epg['provider-named-selector'] : []; - var consumers = epg['consumer-named-selector'] && epg['consumer-named-selector'].length>0 ? epg['consumer-named-selector'] : []; - var consumerLinkItems = []; - var providerLinkItems = []; - - consumers.forEach(function(c) { - c.contract.forEach(function(con) { - consumerLinkItems.push(JointGraphFactory.createLink(contracts[con].id, epgItem.id, 'green')); - }); - }); - - providers.forEach(function(p) { - p.contract.forEach(function(con) { - providerLinkItems.push(JointGraphFactory.createLink(epgItem.id, contracts[con].id, 'blue')); - }); - }); - - JointGraphFactory.addItemList(paper.model, providerLinkItems); - JointGraphFactory.addItemList(paper.model, consumerLinkItems); - - }; - - var loadData = function() { - if($scope.selectedTenant) { - var offsetObj = { - ow: 100, - oh: 100, - w: 100, - h: 100 - }, - marginObj = { - w: 50, - h: 80 - }, - offsetHobj = { - contract: 0, - epg: 0 - }, - itemsArray = { - contract: [], - epg: [] - }; - - JointGraphFactory.reloadGraph(paper.model); - - if ( $scope.selectedTenant && $scope.selectedTenant.contract ) { - - $scope.selectedTenant.contract.forEach(function(c, i) { - var label = c.description ? $scope.sliceLabel(c.description) : c.id, - width = JointGraphFactory.getLabelLength(label.length); - item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.contract, c, 'Click to see contract info', GBPConstants.colors.graph['subject'], 'Contract'); - - itemsArray.contract.push(item); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - contractItems[c.id] = item; - }); - - offsetHobj.contract = offsetObj.h; - - } - - if ( $scope.selectedTenant && $scope.selectedTenant['endpoint-group'] ) { - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h > 400 ? offsetObj.h : 400); - $scope.selectedTenant['endpoint-group'].forEach(function(e, i) { - var label = e.name || e.id, - width = JointGraphFactory.getLabelLength(label.length); - 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'); - - itemsArray.epg.push(item); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - epgItems[e.id] = item; - - createEpgLinks(e, item, contractItems); - }); - - } - - offsetHobj.epg = JointGraphOffsetFactory.getCurrentOffset(itemsArray.contract, 'y'); - JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.epg ,offsetHobj.epg, paper); - } - - }; - - $scope.getPaperObj = function(){ - return paper; - }; - - $scope.$on('GBP_TENANT_RELOAD',function(){ - if ($scope.selectedTenant) { - loadData(); - } - else { - JointGraphFactory.reloadGraph(paper.model); - } - }); - - loadData(); - }]); - - gbp.register.controller('deliveredPolicyCtrl', ['$scope', 'GPBServices', 'JointGraphFactory', 'GBPGovernanceServices', 'JointGraphOffsetFactory', 'GBPConstants', - function ($scope, GPBServices, JointGraphFactory, GBPGovernanceServices, JointGraphOffsetFactory, GBPConstants) { - var paper = JointGraphFactory.createGraph(), - providerItems = {}, - consumerItems = {}, - subjectItems = {}; - - var getEpList = function() { - var providerEpKeys = Object.keys(providerItems), - consumerEpKeys = Object.keys(consumerItems), - epList = providerEpKeys.map(function (k) { - return providerItems[k].attributes.objData; - }); - - consumerEpKeys.forEach(function(k) { - if(providerEpKeys.indexOf(k) === -1) { - epList.push(consumerItems[k].attributes.objData); - } - }); - - return epList; - }; - - var getSubjList = function() { - return Object.keys(subjectItems).map(function (k) { - return subjectItems[k].attributes.objData; - }); - }; - - var objClickAction = { - subject: function(data){ - data.providerItems = providerItems; - data.consumerItems = consumerItems; - $scope.setViewContent('subject-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); - }, - consumer: function(data) { - $scope.setViewContent('epg-content-static', data, 'SET_SEL_STA_OBJ', 'menuBox'); - }, - provider: function(data) { - $scope.setViewContent('epg-content-static', data, 'SET_SEL_STA_OBJ', 'menuBox'); - } - }; - - var objDblClickAction = { - consumer: function(data){ - $scope.setBreadcrumb('l3', 'Endpoint group detail', true); - $scope.setViewContent('epg-detail', { ep: data, epList: getEpList() }, 'SET_SELECTED_EPG','contentTpl'); - }, - provider: function(data){ - $scope.setBreadcrumb('l3', 'Endpoint group detail', true); - $scope.setViewContent('epg-detail', { ep: data, epList: getEpList() }, 'SET_SELECTED_EPG','contentTpl'); - }, - subject: function(data) { - var obj = { subject: data, - subjList: Object.keys(subjectItems).map(function (k) { - return subjectItems[k].attributes.objData; - }), - providerItems: providerItems, - consumerItems: consumerItems - }; - $scope.setBreadcrumb('l3', 'Subject detail', true); - $scope.setViewContent('subject-detail', obj, 'SET_SELECTED_SUBJECT','contentTpl'); - } - }; - - paper.on('cell:pointerdown', function(cell) { - if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { - objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); - } - }); - - paper.on('cell:pointerdblclick', function(cell) { - objDblClickAction[cell.model.attributes.objType](cell.model.attributes.objData); - }); - - var createSubjectLinks = function(subject, subjectItem, providerItems, consumerItems) { - var providerLinkItems = subject.providers.map(function(p) { - return JointGraphFactory.createLink(providerItems[p].id, subjectItem.id, 'green'); - }); - consumerLinkItems = subject.consumers.map(function(c) { - return JointGraphFactory.createLink(subjectItem.id, consumerItems[c].id, 'blue'); - }); - - JointGraphFactory.addItemList(paper.model, providerLinkItems); - JointGraphFactory.addItemList(paper.model, consumerLinkItems); - }; - - var loadData = function() { - if($scope.selectedTenant) { - providerItems = {}; - consumerItems = {}; - subjectItems = {}; - - var classifierInstances = $scope.selectedTenant['subject-feature-instances'] && - $scope.selectedTenant['subject-feature-instances']['classifier-instance'] && - $scope.selectedTenant['subject-feature-instances']['classifier-instance'].length > 0 ? $scope.selectedTenant['subject-feature-instances']['classifier-instance'] : []; - - var offsetObj = { - ow: 100, - oh: 100, - w: 100, - h: 100 - }, - marginObj = { - w: 50, - h: 80 - }, - offsetHobj = { - pEpg: 0, - cEpg: 0, - subject: 0 - }, - itemsArray = { - pEpg: [], - cEpg: [], - subject: [] - }; - - JointGraphFactory.reloadGraph(paper.model); - - GBPGovernanceServices.getEPGsAndSubjects($scope.selectedTenant.id, classifierInstances, function(data){ - data.providers.forEach(function(p, i) { - var relatedObj = GPBServices.getPropFromListByProp($scope.selectedTenant['endpoint-group'], 'id', p.id), - label = relatedObj.name || p.id, - width = JointGraphFactory.getLabelLength(label.length); - - relatedObj.rules = p.rules; - 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'); - - itemsArray.pEpg.push(item); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - providerItems[p.id] = item; - }); - - offsetHobj.pEpg = offsetObj.h; - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 500); - data.consumers.forEach(function(c, i) { - var relatedObj = GPBServices.getPropFromListByProp($scope.selectedTenant['endpoint-group'], 'id', c.id), - label = relatedObj.name || c.id, - width = JointGraphFactory.getLabelLength(label.length); - - relatedObj.rules = c.rules; - 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'); - - itemsArray.cEpg.push(item); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - consumerItems[c.id] = item; - }); - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetHobj.pEpg > 300 ? offsetHobj.pEpg : 300); - data.subjects.forEach(function(s, i) { - var label = s.name, - width = JointGraphFactory.getLabelLength(label.length), - 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'); - - itemsArray.subject.push(item); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - subjectItems[s.name] = item; - createSubjectLinks(s, item, providerItems, consumerItems); - }); - - offsetHobj.pEpg = JointGraphOffsetFactory.getCurrentOffset(itemsArray.pEpg, 'y'); - JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.subject ,offsetHobj.pEpg, paper); - offsetHobj.subject = JointGraphOffsetFactory.getCurrentOffset(itemsArray.subject, 'y'); - JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.cEpg ,offsetHobj.subject, paper); - - }, function(){}); - - } - - - // paper.scaleContentToFit(); - // paper.fitToContent(); - }; - - $scope.getPaperObj = function(){ - return paper; - }; - - - $scope.$on('GBP_TENANT_RELOAD',function(){ - if ($scope.selectedTenant) { - loadData(); - } - else { - JointGraphFactory.reloadGraph(paper.model); - } - }); - - loadData(); - }]); - - gbp.register.controller('subjectDetailCtrl', ['$scope', 'GPBServices', 'JointGraphFactory', 'GBPGovernanceServices', 'JointGraphOffsetFactory', 'GBPConstants', - function ($scope, GPBServices, JointGraphFactory, GBPGovernanceServices, JointGraphOffsetFactory, GBPConstants) { - $scope.selectedSubject = null; - $scope.subjectList = []; - - var paper = JointGraphFactory.createGraph(), - subjectItem = null, - ruleItems = {}, - subjectItems = {}; - - var createSubjectLinks = function(subjectItem, ruleItem) { - var linkItem = JointGraphFactory.createLink(subjectItem.id, ruleItem.id, 'blue'); - JointGraphFactory.addItem(paper.model, linkItem); - }; - - paper.on('cell:pointerdown', function(cell) { - var objClickAction = { - subject: function(data){ - $scope.setViewContent('subject-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); - }, - rule: function(data){ - $scope.setViewContent('rule-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); - } - }; - - // console.log('cell.model.attributes.objType', cell.model.attributes.objType, cell.model.attributes.objData); - if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { - objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); - } - }); - - var loadData = function() { - if($scope.selectedSubject) { - subjectItem = null; - ruleItems = {}; - - var offsetObj = { - ow: 100, - oh: 100, - w: 100, - h: 100 - }, - marginObj = { - w: 50, - h: 80 - }; - - JointGraphFactory.reloadGraph(paper.model); - - var label = $scope.selectedSubject.name || $scope.selectedSubject.id, - width = JointGraphFactory.getLabelLength(label.length); - 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'); - - JointGraphFactory.addItem(paper.model, subjectItem); - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 300); - $scope.selectedSubject.rules.forEach(function(r, i) { - var label = r.name, - width = JointGraphFactory.getLabelLength(label.length); - item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.rule, r, 'Click to see rule info', GBPConstants.colors.graph['cns'], 'Rule'); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper); - JointGraphFactory.addItem(paper.model, item); - ruleItems[r.name] = item; - - createSubjectLinks(subjectItem, item); - }); - } - }; - - $scope.getPaperObj = function(){ - return paper; - }; - - $scope.$on('SET_SELECTED_SUBJECT', function(event, data){ - $scope.selectedSubject = data.subject; - $scope.subjectList = data.subjList; - loadData(); - }); - - $scope.setSubject = function(subject) { - $scope.selectedSubject = subject; - loadData(); - }; - - loadData(); - }]); - - gbp.register.controller('epgDetailCtrl', ['$scope', 'JointGraphFactory', 'TopologyDataLoaders', 'GBPEpgServices', 'JointGraphOffsetFactory', 'GBPConstants', - function ($scope, JointGraphFactory, TopologyDataLoaders, GBPEpgServices, JointGraphOffsetFactory, GBPConstants) { - var paper = JointGraphFactory.createGraph(), - epgItem = {}, - epItems = {}; - - $scope.epgDisplayLabel = ['name', 'id']; - $scope.epgList = []; - $scope.selectedEpg = null; - - $scope.$on('SET_SELECTED_EPG', function(event, epg){ - $scope.selectedEpg = epg.ep; - $scope.epgList = epg.epList; - loadData(); - }); - - $scope.setEpg = function(epg){ - selectedEpg = epg; - loadData(); - }; - - paper.on('cell:pointerdown', function(cell) { - var objClickAction = { - ep: function(data){ - $scope.setViewContent('ep-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); - }, - epg: function(data){ - $scope.setViewContent('epg-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); - }, - }; - - if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { - objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); - } - }); - - var loadData = function() { - if($scope.selectedTenant && $scope.selectedEpg) { - epgItem = {}; - epItems = {}; - links = []; - - JointGraphFactory.reloadGraph(paper.model); - - TopologyDataLoaders.getEndpointsFromEndpointGroup($scope.selectedTenant.id, $scope.selectedEpg.id, function(data){ - var offsetObj = { - ow: 100, - oh: 100, - w: 100, - h: 100 - }, - marginObj = { - w: 50, - h: 80 - }; - - var label = $scope.selectedEpg.name || $scope.selectedEpg.id, - width = JointGraphFactory.getLabelLength(label.length); - epgItem = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, 'epg', $scope.selectedEpg, 'Click to see epg info', GBPConstants.colors.graph['subject'], 'EPG'); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper); - JointGraphFactory.addItem(paper.model, epgItem); - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 500); - if(data && data.output && data.output['ui-endpoint'] && data.output['ui-endpoint'].length){ - data.output['ui-endpoint'].forEach(function(ep, i){ - var label = ep['mac-address'] + ':' + ep['l2-context'], - width = JointGraphFactory.getLabelLength(label.length); - item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, 'ep', ep, 'Click to see ep info', GBPConstants.colors.graph['pns'], 'Endpoint'); - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper); - JointGraphFactory.addItem(paper.model, item); - epItems[label] = item; - links.push(JointGraphFactory.createLink(item.id, epgItem.id, 'green')); - }); - - JointGraphFactory.addItemList(paper.model, links); - } - }, function(){}); - } - }; - - $scope.getPaperObj = function(){ - return paper; - }; - - // init(); - }]); - - gbp.register.controller('policyRendererCtrl', ['$scope', '$http', '$timeout', 'PGNServices', 'TopoServices', 'GBPTenantServices', 'GBPConstants', 'JointGraphFactory','GBPJointGraphBuilder', - function ($scope, $http, $timeout, PGNServices, TopoServices, GBPTenantServices, GBPConstants, JointGraphFactory, GBPJointGraphBuilder) { - - $scope.topologyData = { nodes: [], links: [] }; - $scope.topologyType = null; - $scope.topologyArgs = {}; - $scope.legend = {}; - $scope.showLegend = false; - - var paper = JointGraphFactory.createGraph(); - - var reloadShowLegend = function() { - $scope.showLegend = !$.isEmptyObject($scope.legend); - }; - - $scope.settingsSigma = { - defaultLabelColor: '#fff', - doubleClickEnabled: false, - labelThreshold: 8 - }; - - $scope.settingsAtlas = { - adjustSizes: true, - gravity: 0.2 - }; - - $scope.viewTopo = { - box: false, - button: false - }; - - paper.on('cell:pointerdown', function(cellView, evt) { - if (cellView.model.isLink() && cellView.model.attributes.objData) { - $scope.$broadcast('SET_LINK_DATA', cellView.model.attributes.objData); - } - }); - - $scope.mandatoryProperties = []; - $scope.loadTopology = function(type, args) { - if ($scope.selectedTenant) { - $scope.topologyType = type; - $scope.topologyArgs = args; - GBPJointGraphBuilder.loadTopology(args, paper, type); - } - }; - $scope.toggleExpanded = function(expand, show) { - $scope.setViewExpand('policyRendererView',expand, show, 'l2'); - - if($scope.policyRendererView[expand] && $scope.selectedTenant) { - $scope.topologyArgs.tenantId = $scope.selectedTenant.id; - - if((expand === 'epg' || expand === 'contracts' || expand === 'classifiers' || expand === 'actions' || expand === 'renderers') && ($scope.topologyType !== GBPConstants.strings.config)) { - $scope.loadTopology(GBPConstants.strings.config, $scope.topologyArgs); - } else if((expand === 'l2l3' || expand === 'registerEndpoint' || expand === 'registerL3PrefixEndpoint') && ($scope.topologyType !== GBPConstants.strings.l2l3)) { - $scope.loadTopology(GBPConstants.strings.l2l3, $scope.topologyArgs); - } - } - }; - - $scope.reloadTopo = function() { - if($scope.selectedTenant) { - $scope.topologyArgs.tenantId = $scope.selectedTenant.id; - GBPJointGraphBuilder.loadTopology($scope.topologyArgs, paper, $scope.topologyType); - } - }; - - $scope.getDisplayLabelsFromCtrl = function(eventName, val) { - $scope.$broadcast(eventName, val); - }; - - $scope.validateMandatory = function(newObj, mandatoryProps){ - var ret = true, - notFilledProps = []; - - mandatoryProps.forEach(function(el){ - if(newObj[el] === '' || newObj[el] === null || newObj[el] === undefined){ - notFilledProps.push(el); - ret = false; - } - }); - - return {'status' : ret, 'notFilledProps' : notFilledProps}; - }; - - $scope.validate = function(value, errors){ - errors.int32 = !(parseInt(value) >= -2147483648 && parseInt(value) <= 2147483647); - }; - - - - $scope.validateForm = function(form) { - return form.$valid; - }; - - $scope.$on('GBP_TENANT_RELOAD', function(e, obj){ - $scope.selectedTenant = obj; - }); - - }]); - - gbp.register.controller('linkDataCtrl',['$scope', function($scope){ - $scope.showTable = false; - - $scope.show = function(){ - $scope.showTable = true; - }; - - $scope.close = function(){ - $scope.showTable = false; - }; - - $scope.$on('SET_LINK_DATA', function(e, obj){ - $scope.linkData = obj; - $scope.show(); - $scope.$apply(); - }); - }]); - - gbp.register.controller('crudCtrl',['$scope', function($scope){ - $scope.selectedObj = null; - $scope.label = ''; - $scope.q = {}; - - $scope.add = function() { - $scope.selectedObj = null; - $scope.showForm(); - }; - - $scope.modify = function() { - $scope.$emit('PGN_EDIT_ELEM'); - }; - - $scope.init = function(label) { - $scope.label = label; - }; - - - $scope.$on('EV_SET_SEL_CLASS', function(event, selObj){ - $scope.selectedObj = selObj; - }); - }]); - - gbp.register.controller('contractCtrl', ['$scope','GBPContractServices', '$filter', function($scope, GBPContractServices, $filter){ - $scope.list = []; - $scope.selectedContract = null; - $scope.newContractObj = GBPContractServices.createObj(); - $scope.displayLabel = ['description','id']; - $scope.crudLabel = 'Contract list'; - - $scope.internalView = { - contract: false, - edit: "view" - }; - - var path = null, - mandatoryProperties = [], - clear = function(){ - $scope.list = []; - $scope.internalView = { - contract: false, - edit: "view" - }; - $scope.selectedContract = null; - $scope.newContractObj = GBPContractServices.createObj(); - }; - - $scope.init = function() { - if ( $scope.selectedTenant ) { - $scope.selectedContract = null; - path = GBPContractServices.createPathObj($scope.selectedTenant.id); - - GBPContractServices.load(path, function(data){ - $scope.list = data; - // $scope.$broadcast('GBP_CONTRACT_RELOAD'); - $scope.sendReloadEventFromRoot('GBP_CONTRACT_RELOAD'); - }, function(){ - - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - var resp = $scope.validateMandatory($scope.newContractObj, mandatoryProperties); - if(resp.status){ - path = GBPContractServices.createPathObj($scope.selectedTenant.id, $scope.newContractObj.id); - GBPContractServices.send(path, $scope.newContractObj, function(data){ - $scope.init(); - $scope.internalView.contract = false; - $scope.reloadNewObj(); - $scope.internalView.edit = "view"; - }, function(){ - //TODO: error cbk - }); - }else{ - alert($filter('translate')('GBP_MANDATORY_NOT_FILLED')+': '+resp.notFilledProps.join(', ')); - } - }; - - $scope.delete = function() { - if ( $scope.selectedContract ) { - path = GBPContractServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id); - GBPContractServices.delete(path, function(data){ - $scope.init(); - $scope.selectedContract = null; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reloadNewObj = function() { - $scope.newContractObj = GBPContractServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedContract = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.contract = true; - }else { - $scope.internalView.contract = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.contract) { - angular.copy(selectedObj, $scope.newContractObj); - } - $scope.sendReloadEventFromRoot('GBP_CONTRACT_RELOAD'); - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.contract = true; - $scope.selectedContract = null; - $scope.internalView.edit = "add"; - }; - - $scope.close = function(){ - $scope.internalView.contract = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if(!event.defaultPrevented) { - if ( $scope.selectedContract ) { - $scope.internalView.contract = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedContract, $scope.newContractObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(event){ - $scope.init(); - }); - - $scope.$on('GBP_CONTRACTS_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('clauseCtrl', ['$scope','GBPClauseServices', 'GBPSubjectServices', - function($scope, GBPClauseServices, GBPSubjectServices){ - $scope.list = []; - $scope.selectedClause = null; - $scope.newClauseObj = GBPClauseServices.createObj(); - $scope.internalView = { - clause: false, - edit: "view" - }; - $scope.displayLabel = 'name'; - $scope.crudLabel = 'Clause list'; - - $scope.subjects = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects); - - var path = null, - - clear = function(){ - $scope.list = []; - $scope.selectedClause = null; - $scope.newClauseObj = GBPClauseServices.createObj(); - $scope.internalView = { - clause: false, - edit: "view" - }; - }; - - //move to separate ctrl \/ - $scope.addNewElem = function(templateObj) { - if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { - var objToPush = templateObj || ""; - $scope.newClauseObj['subject-refs'].push(objToPush); - } - }; - - $scope.deleteElemAt = function(index) { - if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { - $scope.newClauseObj['subject-refs'].splice(index, 1); - } - }; - - $scope.updateAt = function(index, value) { - if($scope.newClauseObj && $scope.newClauseObj['subject-refs'] && $scope.newClauseObj['subject-refs'].length >= index) { - $scope.newClauseObj['subject-refs'][index] = value; - } - }; - //move to separate ctrl /\ - - var loadSubjects = function() { - $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects); - - GBPSubjectServices.load(path, function(data){ - $scope.subjects.options = data; - }, function(){ - //TODO: error cbk - }); - }; - - $scope.init = function() { - if ( $scope.selectedContract ) { - path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id); - - GBPClauseServices.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.clauseForm)){ - path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.newClauseObj.name); - GBPClauseServices.send(path, $scope.newClauseObj, function(data){ - $scope.init(); - $scope.internalView.clause = false; - $scope.reloadNewObj(); - $scope.internalView.clause = "view"; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if ( $scope.selectedClause ) { - path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedClause.name); - GBPClauseServices.delete(path, function(data){ - $scope.init(); - $scope.selectedClause = null; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reloadNewObj = function() { - $scope.newClauseObj = GBPClauseServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedClause = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.clause = true; - }else { - $scope.internalView.clause = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.clause) { - angular.copy(selectedObj, $scope.newClauseObj); - } - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.clause = true; - $scope.internalView.edit = "add"; - $scope.selectedClause = null; - }; - - $scope.close = function(){ - $scope.internalView.clause = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedClause ) { - $scope.internalView.clause = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedClause, $scope.newClauseObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_CONTRACT_RELOAD',function(){ - $scope.internalView.clause = false; - $scope.init(); - }); - - $scope.$on('GBP_SUBJECT_RELOAD',function(){ - loadSubjects(); - }); - }]); - - gbp.register.controller('subjectCtrl', ['$scope','GBPSubjectServices', '$filter', function($scope, GBPSubjectServices, $filter){ - $scope.list = []; - $scope.selectedSubject = null; - $scope.newSubjectObj = GBPSubjectServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - subject : false, - edit : "view" - }; - $scope.crudLabel = 'Subject list'; - $scope.errors = {}; - - var path = null, - mandatoryProperties = ['order'], - - clear = function(){ - $scope.list = []; - $scope.selectedSubject = null; - $scope.newSubjectObj = GBPSubjectServices.createObj(); - $scope.internalView = { - subject : false, - edit : "view" - }; - }; - - $scope.init = function() { - if ( $scope.selectedContract ) { - $scope.selectedSubject = null; - path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id); - - GBPSubjectServices.load(path, function(data){ - $scope.list = data; - $scope.sendReloadEventFromRoot('GBP_SUBJECT_RELOAD'); - }, function(){ - //TODO: error cbk - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.subjectForm)){ - path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.newSubjectObj.name); - GBPSubjectServices.send(path, $scope.newSubjectObj, function(data){ - $scope.init(); - $scope.internalView.subject = false; - $scope.reloadNewObj(); - $scope.internalView.edit = "view"; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if ( $scope.selectedSubject ) { - path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name); - GBPSubjectServices.delete(path, function(data){ - $scope.init(); - $scope.selectedSubject = null; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reloadNewObj = function() { - $scope.newSubjectObj = GBPSubjectServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedSubject = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.subject = true; - }else { - $scope.internalView.subject = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.subject) { - angular.copy(selectedObj, $scope.newSubjectObj); - } - $scope.sendReloadEventFromRoot('GBP_SUBJECT_RELOAD'); - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.subject = true; - $scope.internalView.edit = "add"; - $scope.selectedSubject = null; - }; - - $scope.close = function(){ - $scope.internalView.subject = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedSubject ) { - $scope.internalView.subject = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedSubject, $scope.newSubjectObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_CONTRACT_RELOAD',function(){ - $scope.internalView.subject = false; - $scope.init(); - }); - - $scope.$on('GBP_SUBJECTS_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('ruleCtrl', ['$scope','GBPRuleServices', '$filter', function($scope, GBPRuleServices, $filter){ - $scope.list = []; - $scope.selectedRule = null; - $scope.newRuleObj = GBPRuleServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - rule : false, - edit : "view" - }; - $scope.crudLabel = 'Rule list'; - $scope.errors = {}; - - var path = null, - mandatoryProperties = ['order'], - - clear = function(){ - $scope.list = []; - $scope.selectedRule = null; - $scope.newRuleObj = GBPRuleServices.createObj(); - $scope.internalView = { - rule : false, - edit : "view" - }; - }; - - $scope.init = function() { - if ( $scope.selectedSubject ) { - $scope.selectedRule = null; - path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name); - - GBPRuleServices.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.rulesForm)){ - path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.newRuleObj.name); - GBPRuleServices.send(path, $scope.newRuleObj, function(data){ - $scope.init(); - $scope.internalView.rule = false; - $scope.reloadNewObj(); - $scope.internalView.edit = "view"; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if ( $scope.selectedRule ) { - path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name); - GBPRuleServices.delete(path, function(data){ - $scope.init(); - $scope.selectedRule = null; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reloadNewObj = function() { - $scope.newRuleObj = GBPRuleServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedRule = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.rule = true; - }else { - $scope.internalView.rule = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.rule) { - angular.copy(selectedObj, $scope.newRuleObj); - } - $scope.$broadcast('GBP_RULE_RELOAD'); - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.rule = true; - $scope.internalView.edit = "add"; - $scope.selectedRule = null; - }; - - $scope.close = function(){ - $scope.internalView.rule = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedRule ) { - $scope.internalView.rule = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedRule, $scope.newRuleObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_SUBJECT_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('actionRefCtrl', ['$scope','GBPActionRefsServices', 'GBPActionInstanceServices', '$filter', function($scope, GBPActionRefsServices, GBPActionInstanceServices, $filter){ - $scope.list = []; - $scope.selectedActionRef = null; - $scope.newActionRefObj = GBPActionRefsServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - actionRef : false, - edit : "view" - }; - $scope.crudLabel = 'Action ref list'; - $scope.errors = {}; - - $scope.actionInstanceNames = {'options' : [], 'labels' : $scope.displayLabel}; - - var path = null, - mandatoryProperties = ['order'], - - actionInstanceNamesLoad = function() { - var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id); - GBPActionInstanceServices.load(actionInstancePath, function(data){ - $scope.actionInstanceNames.options = data; - },function(){ - //TODO: error cbk - }); - }, - - clear = function(){ - $scope.list = []; - $scope.selectedActionRef = null; - $scope.newActionRefObj = GBPActionRefsServices.createObj(); - $scope.internalView = { - actionRef : false, - edit : "view" - }; - }; - - $scope.init = function() { - if ( $scope.selectedRule ) { - $scope.selectedActionRef = null; - path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name); - - GBPActionRefsServices.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - - actionInstanceNamesLoad(); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.actionRefForm)){ - path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.newActionRefObj.name); - GBPActionRefsServices.send(path, $scope.newActionRefObj, function(data){ - $scope.init(); - $scope.internalView.actionRef = false; - $scope.reloadNewObj(); - $scope.internalView.edit = "view"; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if ( $scope.selectedActionRef ) { - path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.selectedActionRef.name); - GBPActionRefsServices.delete(path, function(data){ - $scope.init(); - $scope.selectedActionRef = null; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reloadNewObj = function() { - $scope.newActionRefObj = GBPActionRefsServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedActionRef = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.actionRef = true; - }else { - $scope.internalView.actionRef = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.actionRef) { - angular.copy(selectedObj, $scope.newActionRefObj); - } - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.actionRef = true; - $scope.internalView.edit = "add"; - $scope.selectedActionRef = null; - }; - - $scope.close = function(){ - $scope.internalView.actionRef = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedActionRef ) { - $scope.internalView.actionRef = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedActionRef, $scope.newActionRefObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_RULE_RELOAD',function(){ - $scope.internalView.actionRef = false; - $scope.init(); - }); - - $scope.$on('GBP_ACTION_INSTANCE_RELOAD',function(){ - actionInstanceNamesLoad(); - }); - }]); - - gbp.register.controller('classifierRefCtrl', ['$scope','GBPClassifierRefsServices', 'GBPClassifierInstanceServices', '$filter', function($scope, GBPClassifierRefsServices, GBPClassifierInstanceServices, $filter){ - $scope.list = []; - $scope.selectedClassifierRef = null; - $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - classifierRef : false, - edit : "view" - }; - - $scope.instanceNames = {'options' : [], 'labels' : $scope.displayLabel}; - - $scope.formDirections = ['in', 'out', 'bidirectional']; - $scope.formConnectionTracking = ['normal', 'reflexive']; - - $scope.crudLabel = 'Classifier ref list'; - - var path = null, - - instanceNamesLoad = function() { - var classifierInstancePath = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id); - GBPClassifierInstanceServices.load(classifierInstancePath, function(data){ - $scope.instanceNames.options = data; - },function(){ - //TODO: error cbk - }); - }, - - clear = function(){ - $scope.list = []; - $scope.selectedClassifierRef = null; - $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); - $scope.internalView = { - classifierRef : false, - edit : "view" - }; - }; - - $scope.init = function() { - if ( $scope.selectedRule ) { - $scope.selectedClassifierRef = null; - path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name); - - - - GBPClassifierRefsServices.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - - instanceNamesLoad(); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.classifierRefForm)){ - path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.newClassifierRefObj.name); - GBPClassifierRefsServices.send(path, $scope.newClassifierRefObj, function(data){ - $scope.init(); - $scope.internalView.classifierRef = false; - $scope.reloadNewObj(); - $scope.internalView.edit = "view"; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if ( $scope.selectedClassifierRef ) { - path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.selectedClassifierRef.name); - GBPClassifierRefsServices.delete(path, function(data){ - $scope.init(); - $scope.selectedClassifierRef = null; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reloadNewObj = function() { - $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedClassifierRef = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.classifierRef = true; - }else { - $scope.internalView.classifierRef = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.classifierRef) { - angular.copy(selectedObj, $scope.newClassifierRefObj); - } - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.classifierRef = true; - $scope.internalView.edit = "add"; - $scope.selectedClassifierRef = null; - }; - - $scope.close = function(){ - $scope.internalView.classifierRef = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedClassifierRef ) { - $scope.internalView.classifierRef = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedClassifierRef, $scope.newClassifierRefObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_RULE_RELOAD',function(){ - $scope.internalView.classifierRef = false; - $scope.init(); - }); - - $scope.$on('GBP_CLASSIFIER_INSTANCE_RELOAD',function(){ - instanceNamesLoad(); - }); - }]); - - gbp.register.controller('tenantCtrl', ['$scope', 'GBPTenantServices', '$filter', function($scope, GBPTenantServices, $filter){ - $scope.list = []; - $scope.selectedTenantObj = null; - $scope.newTenantObj = GBPTenantServices.createObj(); - $scope.displayLabel = ['name' , 'id']; - $scope.crudLabel = 'Tenants list'; - - $scope.view = { - tenant: false, - edit: "view" - }; - - $scope.init = function() { - GBPTenantServices.load( - function(data) { - $scope.list = data; - $scope.newTenantObj = GBPTenantServices.createObj(); - $scope.selectedTenantObj = null; - }, - function(){ - //TODO error - }); - }; - - $scope.save = function(){ - if($scope.validateForm($scope.tenantForm)){ - path = GBPTenantServices.createPathObj($scope.newTenantObj.id); - GBPTenantServices.send(path, $scope.newTenantObj, function(data){ - $scope.init(); - $scope.view.tenant = false; - $scope.view.edit = "view"; - $scope.$emit('GBP_GLOBAL_TENANT_RELOAD'); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenantObj) { - path = GBPTenantServices.createPathObj($scope.selectedTenantObj.id); - - GBPTenantServices.delete(path, function(data){ - $scope.init(); - $scope.view.tenant = false; - $scope.$emit('GBP_GLOBAL_TENANT_RELOAD'); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reload = function(selectedObj) { - $scope.selectedTenantObj = selectedObj; - - $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; - if(selectedObj){ - $scope.view.tenant = true; - } - else { - $scope.view.tenant = false; - $scope.view.edit = "view"; - } - - if ($scope.view.tenant) { - angular.copy(selectedObj, $scope.newTenantObj); - } - }; - - $scope.showForm = function() { - $scope.newTenantObj = GBPTenantServices.createObj(); - $scope.selectedTenantObj = null; - $scope.view.tenant = true; - $scope.view.edit = "add"; - }; - - $scope.close = function(){ - $scope.view.tenant = false; - $scope.view.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedTenantObj ) { - $scope.view.tenant = true; - $scope.view.edit = "edit"; - angular.copy($scope.selectedTenantObj, $scope.newTenantObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_GLOBAL_TENANT_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('epgCtrl',['$scope', 'GBPEpgServices', 'GBPContractServices', '$filter', - function($scope, GBPEpgServices, GBPContractServices, $filter){ - $scope.selectedEpg = null; - $scope.newEpgObj = GBPEpgServices.createObj(); - $scope.displayLabel = ['name', 'id']; - $scope.crudLabel = 'Group list'; - - $scope.igpOpts = ['allow', 'require-contract']; - - $scope.contracts = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contracts); - - $scope.list = []; - - $scope.internalView = { - epg: false, - edit: "view" - }; - - var loadContracts = function() { - GBPContractServices.load(path, function(data){ - $scope.contracts.options = data; - }, function(){ - //TODO: error cbk - }); - }, - - mandatoryProperties = ['name'], - - clear = function(){ - $scope.list = []; - $scope.selectedEpg = null; - $scope.newEpgObj = GBPEpgServices.createObj(); - $scope.internalView = { - epg: false, - edit: "view" - }; - }; - - $scope.init = function() { - if ($scope.selectedTenant) { - path = GBPEpgServices.createPathObj($scope.selectedTenant.id); - - GBPEpgServices.load(path, function(data){ - $scope.list = data; - // $scope.$broadcast('GBP_EPG_RELOAD'); - $scope.sendReloadEventFromRoot('GBP_EPG_RELOAD'); - }, function(){ - //TODO: error cbk - }); - - loadContracts(); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.epgForm)){ - path = GBPEpgServices.createPathObj($scope.selectedTenant.id, $scope.newEpgObj.id); - GBPEpgServices.send(path, $scope.newEpgObj, function(data){ - $scope.init(); - $scope.internalView.epg = false; - $scope.reloadNewObj(); - $scope.internalView.edit = "view"; - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedEpg) { - path = GBPEpgServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id); - GBPEpgServices.delete(path, function(data){ - $scope.init(); - $scope.internalView.epg = false; - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.showForm = function() { - $scope.internalView.epg = true; - $scope.reloadNewObj(); - $scope.selectedEpg = null; - $scope.internalView.edit = "add"; - }; - - $scope.reloadNewObj = function() { - $scope.newEpgObj = GBPEpgServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedEpg = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.epg = true; - }else { - $scope.internalView.epg = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.epg) { - angular.copy(selectedObj, $scope.newEpgObj); - } - $scope.sendReloadEventFromRoot('GBP_EPG_RELOAD'); - }; - - $scope.close = function(){ - $scope.internalView.epg = false; - $scope.internalView.edit = "view"; - }; - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEpg ) { - $scope.internalView.epg = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedEpg, $scope.newEpgObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_CONTRACT_RELOAD',function(){ - loadContracts(); - }); - - $scope.$on('GBP_EPG_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('cnsCtrl',['$scope', 'GBPConNamedSelServices', function($scope, GBPConNamedSelServices){ - $scope.list = []; - $scope.selectedCNS = null; - $scope.newCNSObj = GBPConNamedSelServices.createObj(); - $scope.internalView = { - cns: false, - edit: "view" - }; - $scope.displayLabel = 'name'; - $scope.crudLabel = 'Consumer named selectors list'; - - var clear = function(){ - $scope.list = []; - $scope.selectedCNS = null; - $scope.newCNSObj = GBPConNamedSelServices.createObj(); - $scope.internalView = { - cns: false, - edit: "view" - }; - }; - - //move to separate ctrl \/ - $scope.addNewElem = function(templateObj) { - if($scope.newCNSObj && $scope.newCNSObj.contract) { - var objToPush = templateObj || ""; - $scope.newCNSObj.contract.push(objToPush); - } - }; - - $scope.deleteElemAt = function(index) { - if($scope.newCNSObj && $scope.newCNSObj.contract) { - $scope.newCNSObj.contract.splice(index, 1); - } - }; - - $scope.updateAt = function(index, value) { - if($scope.newCNSObj && $scope.newCNSObj.contract && $scope.newCNSObj.contract.length >= index) { - $scope.newCNSObj.contract[index] = value; - } - }; - //move to separate ctrl /\ - - $scope.init = function() { - if ($scope.selectedTenant && $scope.selectedEpg) { - path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id); - - GBPConNamedSelServices.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.cnsForm)){ - path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.newCNSObj.name); - GBPConNamedSelServices.send(path, $scope.newCNSObj, function(data){ - $scope.init(); - $scope.internalView.cns = false; - $scope.internalView.cns = "view"; - $scope.reloadNewObj(); - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedEpg && $scope.selectedCNS) { - path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedCNS.name); - GBPConNamedSelServices.delete(path, function(data){ - $scope.init(); - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.selectedCNS = null; - $scope.internalView.cns = true; - $scope.internalView.edit = "add"; - }; - - $scope.reloadNewObj = function() { - $scope.newCNSObj = GBPConNamedSelServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedCNS = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.cns = true; - }else { - $scope.internalView.cns = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.cns) { - angular.copy(selectedObj, $scope.newCNSObj); - } - }; - - $scope.close = function(){ - $scope.internalView.cns = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEpg ) { - $scope.internalView.cns = true; - $scope.internalView.edit = "add"; - angular.copy($scope.selectedCNS, $scope.newCNSObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_EPG_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('pnsCtrl',['$scope', 'GBPProNamedSelServices', function($scope, GBPProNamedSelServices){ - $scope.list = []; - $scope.selectedPNS = null; - $scope.newPNSObj = GBPProNamedSelServices.createObj(); - $scope.displayLabel = 'name'; - $scope.crudLabel = 'Provider named selectors list'; - $scope.internalView = { - pns: false, - edit: "view" - }; - - var clear = function(){ - $scope.list = []; - $scope.selectedPNS = null; - $scope.newPNSObj = GBPProNamedSelServices.createObj(); - $scope.internalView = { - pns: false, - edit: "view" - }; - }; - - //move to separate ctrl \/ - $scope.addNewElem = function(templateObj) { - if($scope.newPNSObj && $scope.newPNSObj.contract) { - var objToPush = templateObj || ""; - $scope.newPNSObj.contract.push(objToPush); - } - }; - - $scope.deleteElemAt = function(index) { - if($scope.newPNSObj && $scope.newPNSObj.contract) { - $scope.newPNSObj.contract.splice(index, 1); - } - }; - - $scope.updateAt = function(index, value) { - if($scope.newPNSObj && $scope.newPNSObj.contract && $scope.newPNSObj.contract.length >= index) { - $scope.newPNSObj.contract[index] = value; - } - }; - //move to separate ctrl /\ - - $scope.init = function() { - if ($scope.selectedTenant && $scope.selectedEpg) { - path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id); - - GBPProNamedSelServices.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.pnsForm)){ - path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.newPNSObj.name); - GBPProNamedSelServices.send(path, $scope.newPNSObj, function(data){ - $scope.init(); - $scope.internalView.pns = false; - $scope.reloadNewObj(); - $scope.internalView.cns = "view"; - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedEpg && $scope.selectedPNS) { - path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedPNS.name); - GBPProNamedSelServices.delete(path, function(data){ - $scope.init(); - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.pns = true; - $scope.internalView.edit = "add"; - $scope.selectedPNS = null; - }; - - $scope.reloadNewObj = function() { - $scope.newPNSObj = GBPProNamedSelServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedPNS = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.pns = true; - }else { - $scope.internalView.pns = false; - $scope.internalView.edit = "view"; - } - - if($scope.internalView.pns) { - angular.copy(selectedObj, $scope.newPNSObj); - } - }; - - $scope.close = function(){ - $scope.internalView.pns = false; - $scope.internalView.edit = "view"; - }; - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEpg ) { - $scope.internalView.pns = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedPNS, $scope.newPNSObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_EPG_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('l2FloodCtrl', ['$scope', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', '$filter', function($scope, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, $filter){ - $scope.list = []; - $scope.selectedL2Flood = null; - $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); - $scope.displayLabel = ['name', 'id']; - $scope.crudLabel = 'L2 Flood Domain list'; - - $scope.l2bridge = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L2BRIDGE_LABEL', $scope.l2bridge); - - $scope.view = { - l2flood: false, - edit: "view" - }; - - var path = null, - - loadL2BridgeList = function() { - GBPL2BridgeDomainServices.load(GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id), function(data){ - $scope.l2bridge.options = data; - }, function(){ - - }); - }, - - clear = function(){ - $scope.list = []; - $scope.selectedL2Flood = null; - $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); - $scope.view = { - l2flood: false, - edit: "view" - }; - }; - - $scope.init = function() { - if ( $scope.selectedTenant ) { - path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id); - - GBPL2FloodDomainServices.load(path, function(data){ - $scope.list = data; - // clear objects - $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); - $scope.selectedL2Flood = null; - }, function(){ - - }); - - loadL2BridgeList(); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.l2FloodForm)){ - path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id, $scope.newL2FloodObj.id); - GBPL2FloodDomainServices.send(path, $scope.newL2FloodObj, function(data){ - $scope.init(); - $scope.view.l2flood = false; - $scope.view.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD'); - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedL2Flood) { - path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id, $scope.selectedL2Flood.id); - GBPL2FloodDomainServices.delete(path, function(data){ - $scope.init(); - $scope.view.l2flood = false; - $scope.view.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD'); - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reload = function(selectedObj) { - $scope.selectedL2Flood = selectedObj; - - $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; - if(selectedObj){ - $scope.view.l2flood = true; - } - else { - $scope.view.l2flood = false; - $scope.view.edit = "view"; - } - - if ($scope.view.l2flood) { - angular.copy(selectedObj, $scope.newL2FloodObj); - } - - $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD'); - }; - - $scope.showForm = function() { - $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); - $scope.selectedL2Flood = null; - $scope.view.l2flood = true; - $scope.view.edit = "add"; - }; - - $scope.close = function(){ - $scope.view.l2flood = false; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedL2Flood ) { - $scope.view.l2flood = true; - $scope.view.edit = "edit"; - angular.copy($scope.selectedL2Flood, $scope.newL2FloodObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ - loadL2BridgeList(); - }); - - $scope.$on('GBP_L2FLOOD_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('l2BridgeCtrl', ['$scope', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', '$filter', function($scope, GBPL2BridgeDomainServices, GBPL3ContextServices, $filter){ - $scope.list = []; - $scope.selectedL2Bridge = null; - $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); - $scope.displayLabel = ['name', 'id']; - $scope.crudLabel = 'L2 Bridge Domain list'; - - $scope.l3context = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context); - - $scope.view = { - l2bridge: false, - edit: "view" - }; - - var path = null, - - loadL3ContextList = function() { - GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){ - $scope.l3context.options = data; - //$scope.$broadcast('GBP_L2BRIDGE_RELOAD'); - }, function(){ - - }); - }, - - clear = function(){ - $scope.list = []; - $scope.selectedL2Bridge = null; - $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); - $scope.view = { - l2bridge: false, - edit: "view" - }; - }; - - $scope.init = function() { - if ( $scope.selectedTenant ) { - path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id); - - GBPL2BridgeDomainServices.load(path, function(data){ - $scope.list = data; - $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); - $scope.selectedL2Bridge = null; - // $scope.$broadcast('GBP_L2BRIDGE_RELOAD'); - }, function(){ - - }); - - loadL3ContextList(); - }else{ - clear(); - } - }; - - - - $scope.save = function(){ - if($scope.validateForm($scope.l2BridgeForm)){ - path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id, $scope.newL2BridgeObj.id); - GBPL2BridgeDomainServices.send(path, $scope.newL2BridgeObj, function(data){ - $scope.init(); - $scope.view.l2bridge = false; - $scope.view.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedL2Bridge) { - path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id, $scope.selectedL2Bridge.id); - GBPL2BridgeDomainServices.delete(path, function(data){ - $scope.init(); - $scope.view.l2bridge = false; - $scope.view.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reload = function(selectedObj) { - $scope.selectedL2Bridge = selectedObj; - - $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; - if(selectedObj){ - $scope.view.l2bridge = true; - } - else { - $scope.view.l2bridge = false; - $scope.view.edit = "view"; - } - - if ($scope.view.l2bridge) { - angular.copy(selectedObj, $scope.newL2BridgeObj); - } - - $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); - }; - - $scope.showForm = function() { - $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); - $scope.selectedL2Bridge = null; - $scope.view.l2bridge = true; - $scope.view.edit = "add"; - }; - - $scope.close = function(){ - $scope.view.l2bridge = false; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedL2Bridge ) { - $scope.view.l2bridge = true; - $scope.view.edit = "edit"; - angular.copy($scope.selectedL2Bridge, $scope.newL2BridgeObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ - loadL3ContextList(); - }); - - $scope.$on('GBP_L2BRIDGE_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('l3ContextCtrl', ['$scope', 'GBPL3ContextServices', '$filter', function($scope, GBPL3ContextServices, $filter){ //GBPContractServices - $scope.list = []; - $scope.selectedL3Context = null; - $scope.newL3ContextObj = GBPL3ContextServices.createObj(); - $scope.displayLabel = ['name', 'id']; - $scope.crudLabel = 'L3 Context list'; - - $scope.view = { - l3context: false, - edit: "view" - }; - - var path = null, - - clear = function(){ - $scope.list = []; - $scope.view = { - l3context: false, - edit: "view" - }; - $scope.selectedL3Context = null; - $scope.newL3ContextObj = GBPL3ContextServices.createObj(); - }; - - $scope.init = function() { - if ( $scope.selectedTenant ) { - path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id); - - GBPL3ContextServices.load(path, function(data){ - $scope.list = data; - $scope.newL3ContextObj = GBPL3ContextServices.createObj(); - $scope.selectedL3Context = null; - }, function(){ - - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.l3ContextForm)){ - path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id, $scope.newL3ContextObj.id); - GBPL3ContextServices.send(path, $scope.newL3ContextObj, function(data){ - $scope.init(); - $scope.view.l3context = false; - $scope.view.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD'); - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedL3Context) { - path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id, $scope.selectedL3Context.id); - GBPL3ContextServices.delete(path, function(data){ - $scope.init(); - $scope.view.l3context = false; - $scope.view.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD'); - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reload = function(selectedObj) { - $scope.selectedL3Context = selectedObj; - - $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; - if(selectedObj){ - $scope.view.l3context = true; - } - else { - $scope.view.l3context = false; - $scope.view.edit = "view"; - } - - if($scope.view.l3context) { - angular.copy(selectedObj, $scope.newL3ContextObj); - } - - $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD'); - }; - - $scope.showForm = function() { - $scope.newL3ContextObj = GBPL3ContextServices.createObj(); - $scope.selectedL3Context = null; - $scope.view.l3context = true; - $scope.view.edit = "add"; - }; - - $scope.close = function(){ - $scope.view.l3context = false; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedL3Context ) { - $scope.view.l3context = true; - $scope.view.edit = "edit"; - angular.copy($scope.selectedL3Context, $scope.newL3ContextObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_L3CONTEXT_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('subnetCtrl', ['$scope', 'GBPSubnetServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', '$filter', function($scope, GBPSubnetServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, GBPL3ContextServices, $filter){ - $scope.list = []; - $scope.selectedSubnet = null; - $scope.newSubnetObj = GBPSubnetServices.createObj(); - $scope.displayLabel = ['name', 'id']; - $scope.crudLabel = 'Subnet list'; - - $scope.l2L3List = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2L3List); - - $scope.view = { - subnet: false, - edit: "view" - }; - - - var path = null, - - loadL2L3List = function() { - $scope.l2L3List.options = []; - - GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(l3ContextData){ - $scope.l2L3List.options = $scope.l2L3List.options.concat(l3ContextData); - }, function(){ - - }); - - GBPL2FloodDomainServices.load(GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id), function(l2FloodData){ - $scope.l2L3List.options = $scope.l2L3List.options.concat(l2FloodData); - }, function(){ - - }); - - GBPL2BridgeDomainServices.load(GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id), function(l2BridgeData){ - $scope.l2L3List.options = $scope.l2L3List.options.concat(l2BridgeData); - }, function(){ - - }); - }, - - clear = function(){ - $scope.list = []; - $scope.view = { - subnet: false, - edit: "view" - }; - $scope.selectedSubnet = null; - $scope.newSubnetObj = GBPSubnetServices.createObj(); - }; - - $scope.init = function() { - if ( $scope.selectedTenant ) { - path = GBPSubnetServices.createPathObj($scope.selectedTenant.id); - - GBPSubnetServices.load(path, function(data){ - $scope.list = data; - $scope.newSubnetObj = GBPSubnetServices.createObj(); - $scope.selectedSubnet = null; - - $scope.view.subnet = false; - $scope.view.edit = "view"; - //$scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); - }, function(){ - - }); - - loadL2L3List(); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.subnetForm)){ - path = GBPSubnetServices.createPathObj($scope.selectedTenant.id, $scope.newSubnetObj.id); - GBPSubnetServices.send(path, $scope.newSubnetObj, function(data){ - $scope.init(); - $scope.view.subnet = false; - $scope.view.edit = "view"; - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedSubnet) { - path = GBPSubnetServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id); - GBPSubnetServices.delete(path, function(data){ - $scope.init(); - $scope.view.subnet = false; - $scope.view.edit = "view"; - - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reload = function(selectedObj) { - $scope.selectedSubnet = selectedObj; - - $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; - if(selectedObj){ - $scope.view.subnet = true; - } - else { - $scope.view.subnet = false; - $scope.view.edit = "view"; - } - - if($scope.view.subnet) { - angular.copy(selectedObj, $scope.newSubnetObj); - } - - $scope.sendReloadEventFromRoot('GBP_SUBNET_RELOAD'); - }; - - $scope.showForm = function() { - $scope.newSubnetObj = GBPSubnetServices.createObj(); - $scope.selectedSubnet = null; - $scope.view.subnet = true; - $scope.view.edit = "add"; - }; - - $scope.close = function(){ - $scope.view.subnet = false; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedSubnet ) { - $scope.view.subnet = true; - $scope.view.edit = "edit"; - angular.copy($scope.selectedSubnet, $scope.newSubnetObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_GATEWAY_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ - loadL2L3List(); - }); - - $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ - loadL2L3List(); - }); - - $scope.$on('GBP_L2FLOOD_RELOAD',function(){ - loadL2L3List(); - }); - - $scope.$on('GBP_PREFIX_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('gatewayCtrl', ['$scope', 'GBPGatewayServices', function($scope, GBPGatewayServices){ - $scope.list = []; - $scope.gatewayView = false; - $scope.selectedGateway = null; - $scope.newGatewayObj = GBPGatewayServices.createObj(); - $scope.displayLabel = 'gateway'; - $scope.crudLabel = 'Gateway list'; - $scope.internalView = { - gateway: false, - edit: "view" - }; - - var path = null, - - clear = function(){ - $scope.list = []; - $scope.gatewayView = false; - $scope.selectedGateway = null; - $scope.newGatewayObj = GBPGatewayServices.createObj(); - }; - - $scope.init = function() { - if ( $scope.selectedTenant && $scope.selectedSubnet ) { - path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id); - - GBPGatewayServices.load(path, function(data){ - $scope.list = data; - $scope.newGatewayObj = GBPGatewayServices.createObj(); - $scope.internalView.gateway = false; - $scope.selectedGateway = null; - }, function(){ - - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.gatewayForm)){ - path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.newGatewayObj.gateway); - GBPGatewayServices.send(path, $scope.newGatewayObj, function(data){ - $scope.init(); - $scope.internalView.gateway = false; - $scope.internalView.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_GATEWAY_RELOAD'); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedSubnet && $scope.selectedGateway) { - path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway); - GBPGatewayServices.delete(path, function(data){ - $scope.init(); - $scope.internalView.gateway = false; - $scope.sendReloadEventFromRoot('GBP_GATEWAY_RELOAD'); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.reload = function(selectedObj) { - $scope.selectedGateway = selectedObj; - angular.copy(selectedObj, $scope.newGatewayObj); - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.gateway = true; - }else { - $scope.internalView.gateway = false; - $scope.internalView.edit = "view"; - } - - $scope.sendReloadEventFromRoot('GBP_GATEWAY_SET'); - }; - - $scope.showForm = function() { - $scope.newGatewayObj = GBPGatewayServices.createObj(); - $scope.internalView.gateway = true; - $scope.internalView.edit = "add"; - $scope.selectedGateway = null; - }; - - $scope.close = function(){ - $scope.internalView.gateway = false; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedGateway ) { - $scope.internalView.gateway = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedGateway, $scope.newGatewayObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_SUBNET_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_PREFIX_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('prefixCtrl', ['$scope', 'GBPPrefixServices', function($scope, GBPPrefixServices){ - $scope.list = []; - $scope.selectedPrefix = null; - $scope.newPrefixObj = GBPPrefixServices.createObj(); - $scope.displayLabel = 'prefix'; - $scope.crudLabel = 'Prefix list'; - $scope.internalView = { - prefix: false, - edit: "view" - }; - - var path = null, - - clear = function(){ - $scope.list = []; - $scope.selectedPrefix = null; - $scope.newPrefixObj = GBPPrefixServices.createObj(); - $scope.internalView = { - prefix: false, - edit: "view" - }; - }; - - $scope.init = function() { - if ( $scope.selectedTenant && $scope.selectedSubnet && $scope.selectedGateway) { - path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway); - - GBPPrefixServices.load(path, function(data){ - $scope.list = data; - $scope.newPrefixObj = GBPPrefixServices.createObj(); - $scope.internalView.prefix = false; - $scope.selectedPrefix = null; - }, function(){ - - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.prefixForm)){ - path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway, $scope.newPrefixObj.prefix); - GBPPrefixServices.send(path, $scope.newPrefixObj, function(data){ - $scope.init(); - $scope.internalView.prefix = false; - $scope.internalView.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_PREFIX_RELOAD'); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway, $scope.selectedPrefix.prefix); - GBPPrefixServices.delete(path, function(data){ - $scope.init(); - $scope.internalView.prefix = false; - $scope.sendReloadEventFromRoot('GBP_PREFIX_RELOAD'); - }, function(){ - //TODO: error cbk - }); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedPrefix = selectedObj; - $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; - if(selectedObj){ - $scope.internalView.prefix = true; - }else { - $scope.internalView.prefix = false; - $scope.internalView.edit = "view"; - } - - angular.copy(selectedObj, $scope.newPrefixObj); - }; - - $scope.showForm = function() { - $scope.newPrefixObj = GBPPrefixServices.createObj(); - $scope.internalView.prefix = true; - $scope.internalView.edit = "add"; - $scope.selectedPrefix = null; - }; - - $scope.close = function(){ - $scope.internalView.prefix = false; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedPrefix ) { - $scope.internalView.prefix = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedPrefix, $scope.newPrefixObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_GATEWAY_SET',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('renderersCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){ //GBPContractServices - $scope.classifierDefinitions = {'options' : [], 'labels' : null}; - $scope.actionDefinitions = {'options' : [], 'labels' : null}; - - //reload on event? - - var loadDefinitions = function() { - GPBServices.getDefinitions(function(classifierDefs, actionDefs) { - $scope.classifierDefinitions.options = classifierDefs; - $scope.getDisplayLabelsFromCtrl('GBP_CLASSIFIERS_LABEL', $scope.classifierDefinitions); - - $scope.actionDefinitions.options = actionDefs; - $scope.getDisplayLabelsFromCtrl('GBP_ACTIONS_LABEL', $scope.actionDefinitions); - }); - }; - - loadDefinitions(); - }]); - - gbp.register.controller('paramCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){ - $scope.value = null; - - $scope.init = function(param, paramValues) { - $scope.parameter = param; - - if(paramValues) { - paramValues.forEach(function(p) { - if($scope.parameter.name === p.name) { - $scope.value = GPBServices.getInstanceParamValue(p); - } - }); - } - }; - - $scope.$on('GBP_SAVE_PARAM', function(event){ - if($scope.value !== '' && $scope.value !== null) { - $scope.addParam($scope.parameter.name, $scope.parameter.type, $scope.value); - } - }); - - $scope.$on('GBP_SET_PARAM_VALUE', function(event, name, intVal, strVal) { - //console.info($scope.parameter, ' got GBP_SET_PARAM_VALUE', name, intVal, strVal, event); - - }); - - $scope.$on('GBP_RESET_PARAM', function(event){ - $scope.value = null; - }); - }]); - - gbp.register.controller('classifiersCtrl', ['$scope', 'GBPClassifierInstanceServices', 'GPBServices', '$filter', - function($scope, GBPClassifierInstanceServices, GPBServices, $filter){ - $scope.list = []; - $scope.classifiersView = false; - $scope.displayLabel = 'name'; - $scope.selectedClassifier = null; - $scope.crudLabel = 'Classifiers'; - $scope.newClassifierObj = GBPClassifierInstanceServices.createObj(); - $scope.edit = "view"; - - var mandatoryProperties = ['name'], - - clear = function(){ - $scope.list = []; - $scope.classifiersView = false; - $scope.selectedClassifier = null; - $scope.newClassifierObj = GBPClassifierInstanceServices.createObj(); - $scope.edit = "view"; - }; - - $scope.getDefinitionObjParams = function(id){ - return GPBServices.getDefinitionObjParams($scope.classifierDefinitions.options, id); - }; - - $scope.reloadDefs = function(){ - $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newClassifierObj['classifier-definition-id'])); - }; - - $scope.addParam = function(name, type, value) { - $scope.newClassifierObj['parameter-value'].push(GPBServices.createParamObj(name, type, value)); - }; - - var saveParams = function() { - $scope.newClassifierObj['parameter-value'] = []; - $scope.$broadcast('GBP_SAVE_PARAM'); - }; - - - $scope.init = function() { - if ( $scope.selectedTenant ) { - path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id); - GBPClassifierInstanceServices.load(path, function(data){ - $scope.list = data; - $scope.reloadDefs(); - }, function(){ - //TODO: error cbk - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.classifierForm)){ - path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id, $scope.newClassifierObj.name); - saveParams(); - GBPClassifierInstanceServices.send(path, $scope.newClassifierObj, function(data){ - $scope.init(); - $scope.classifiersView = false; - $scope.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD'); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.showForm = function() { - $scope.newClassifierObj = GBPClassifierInstanceServices.createObj(); - $scope.selectedClassifier = null; - $scope.classifiersView = true; - $scope.edit = "add"; - $scope.reloadDefs(); - }; - - $scope.reload = function(selectedObj){ - $scope.selectedClassifier = selectedObj; - $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD'); - - $scope.edit = $scope.edit == "edit" ? $scope.edit : "view"; - if(selectedObj){ - $scope.classifiersView = true; - } - else { - $scope.classifiersView = false; - $scope.edit = "view"; - } - - if($scope.classifiersView) { - angular.copy(selectedObj, $scope.newClassifierObj); - } - - $scope.reloadDefs(); - }; - - $scope.close = function(){ - $scope.classifiersView = false; - $scope.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedClassifier ) { - $scope.classifiersView = true; - angular.copy($scope.selectedClassifier, $scope.newClassifierObj); - $scope.edit = "edit"; - $scope.reloadDefs(); - } - event.defaultPrevented = true; - } - }); - - $scope.delete = function(){ - path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id, $scope.selectedClassifier.name); - GBPClassifierInstanceServices.delete(path, function(data){ - $scope.init(); - $scope.classifiersView = false; - $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD'); - }, function(){ - //TODO: error cbk - }); - }; - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_CLASSIFIERS_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('actionsCtrl', ['$scope', 'GBPActionInstanceServices', 'GPBServices', '$filter', - function($scope, GBPActionInstanceServices, GPBServices, $filter){ - $scope.list = []; - $scope.actionsView = false; - $scope.displayLabel = 'name'; - $scope.selectedAction = null; - $scope.crudLabel = 'Actions'; - $scope.newActionObj = GBPActionInstanceServices.createObj(); - $scope.edit = "view"; - - var mandatoryProperties = ['name'], - - clear = function(){ - $scope.list = []; - $scope.actionsView = false; - $scope.selectedAction = null; - $scope.newActionObj = GBPActionInstanceServices.createObj(); - $scope.edit = "view"; - }; - - $scope.getDefinitionObjParams = function(id){ - return GPBServices.getDefinitionObjParams($scope.actionDefinitions.options, id); - }; - - $scope.reloadDefs = function(){ - $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newActionObj['action-definition-id'])); - }; - - $scope.addParam = function(name, type, value) { - $scope.newActionObj['parameter-value'].push(GPBServices.createParamObj(name, type, value)); - }; - - var saveParams = function() { - $scope.newActionObj['parameter-value'] = []; - $scope.$broadcast('GBP_SAVE_PARAM'); - }; - - - $scope.init = function() { - if ( $scope.selectedTenant ) { - path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id); - GBPActionInstanceServices.load(path, function(data){ - $scope.list = data; - $scope.reloadDefs(); - }, function(){ - //TODO: error cbk - }); - }else{ - clear(); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.actionsForm)){ - path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id, $scope.newActionObj.name); - saveParams(); - - GBPActionInstanceServices.send(path, $scope.newActionObj, function(data){ - $scope.init(); - $scope.actionsView = false; - $scope.edit = "view"; - $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.showForm = function() { - $scope.newActionObj = GBPActionInstanceServices.createObj(); - $scope.selectedAction = null; - $scope.actionsView = true; - $scope.edit = "add"; - $scope.reloadDefs(); - }; - - $scope.reload = function(selectedObj){ - $scope.selectedAction = selectedObj; - $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); - - $scope.edit = $scope.edit == "edit" ? $scope.edit : "view"; - if(selectedObj){ - $scope.actionsView = true; - } - else { - $scope.actionsView = false; - $scope.edit = "view"; - } - - if($scope.actionsView) { - angular.copy(selectedObj, $scope.newActionObj); - } - - $scope.reloadDefs(); - }; - - $scope.close = function(){ - $scope.actionsView = false; - $scope.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedAction ) { - $scope.actionsView = true; - angular.copy($scope.selectedAction, $scope.newActionObj); - $scope.edit = "edit"; - $scope.reloadDefs(); - } - event.defaultPrevented = true; - } - }); - - $scope.delete = function(){ - path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id, $scope.selectedAction.name); - GBPActionInstanceServices.delete(path, function(data){ - $scope.init(); - $scope.actionsView = false; - $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); - }, function(){ - //TODO: error cbk - }); - }; - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_ACTIONS_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - }]); - - gbp.register.controller('endpointCtrl', ['$scope', 'GBPEndpointServices', 'GPBServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', 'GBPEpgServices', '$filter', 'GBPSubnetServices', - function($scope, GBPEndpointServices, GPBServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, GBPL3ContextServices, GBPEpgServices, $filter, GBPSubnetServices){ - $scope.list = []; - $scope.selectedEndpoint = null; - $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); - $scope.displayLabel = function(obj) { - return obj['mac-address'] + ':' + obj['l2-context']; - }; - $scope.crudLabel = 'Endpoint list'; - - $scope.l2context = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2context); - - $scope.l3context = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context); - - $scope.subnet = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_SUBNET_LABEL', $scope.subnet); - - $scope.epg = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_EPG_LABEL', $scope.epg); - - $scope.networkContainment = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.networkContainment); - - $scope.view = { - endpoint: false, - edit: "view" - }; - - var path = null, - mandatoryProperties = [], - - loadEpgOptions = function() { - $scope.epg.options = []; - - path = GBPEpgServices.createPathObj($scope.selectedTenant.id); - GBPEpgServices.load(path, function(data){ - $scope.epg.options = data; - }, function(){ - //TODO: error cbk - }); - }, - - loadL2ContextOptions = function() { - removeL2ContextOptions($scope.networkContainment.options, $scope.l2context.options); - $scope.l2context.options = []; - - path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id); - - GBPL2FloodDomainServices.load(path, function(data){ - $scope.l2context.options = $scope.l2context.options.concat(data); - $scope.networkContainment.options = $scope.networkContainment.options.concat(data); - }, function(){ - - }); - - path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id); - GBPL2BridgeDomainServices.load(path, function(data){ - $scope.l2context.options = $scope.l2context.options.concat(data); - $scope.networkContainment.options = $scope.networkContainment.options.concat(data); - }, function(){ - - }); - }, - - loadL3ContextOptions = function(){ - removeL2ContextOptions($scope.networkContainment.options, $scope.l3context.options); - $scope.l3context.options = []; - - GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){ - $scope.l3context.options = data; - $scope.networkContainment.options = $scope.networkContainment.options.concat(data); - }, function(){ - - }); - }, - - loadSubnetOptions = function(){ - $scope.subnet.options = []; - - GBPSubnetServices.load(GBPSubnetServices.createPathObj($scope.selectedTenant.id), function(data){ - $scope.subnet.options = data; - $scope.networkContainment.options = $scope.networkContainment.options.concat(data); - }, function(){ - - }); - }, - - loadNetworkCotnaninemnt = function(){ - $scope.networkContainment.options = []; - - loadL2ContextOptions(); - loadL3ContextOptions(); - loadSubnetOptions(); - }, - - clear = function(){ - $scope.list = []; - $scope.selectedEndpoint = null; - $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); - $scope.view = { - endpoint: false, - edit: "view" - }; - }, - removeL2ContextOptions = function(arr1, arr2) { - arr1 = arr1.filter( function( el ) { - return arr2.indexOf( el ) < 0; - }); - }; - - $scope.init = function() { - if ($scope.selectedTenant) { - - GBPEndpointServices.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - - loadEpgOptions(); - /*loadL2ContextOptions(); - loadL3ContextOptions(); - loadSubnetOptions();*/ - loadNetworkCotnaninemnt(); - }else{ - clear(); - } - }; - - $scope.addNewL3address = function() { - if($scope.newEndpointObj) { - if(!$scope.newEndpointObj['l3-address']){ - $scope.newEndpointObj['l3-address'] = []; - } - var objToPush = {'l3-context' : '', 'ip-address' : ''}; - $scope.newEndpointObj['l3-address'].push(objToPush); - } - }; - - $scope.deleteNewL3address = function(index){ - if($scope.newEndpointObj) { - $scope.newEndpointObj['l3-address'].splice(index, 1); - } - }; - - $scope.addNewLeafListEl = function(prop) { - if($scope.newEndpointObj) { - if(!$scope.newEndpointObj[prop]){ - $scope.newEndpointObj[prop] = []; - } - var objToPush = ""; - $scope.newEndpointObj[prop].push(objToPush); - } - }; - - $scope.updateLeafListEl = function(index, value, prop) { - if($scope.newEndpointObj && $scope.newEndpointObj[prop] && $scope.newEndpointObj[prop].length >= index) { - $scope.newEndpointObj[prop][index] = value; - } - }; - - $scope.deleteNewLeafListEl = function(index, prop){ - if($scope.newEndpointObj) { - $scope.newEndpointObj[prop].splice(index, 1); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.endpointForm)){ - GBPEndpointServices.send(path, $scope.newEndpointObj, function(data){ - $scope.init(); - $scope.view.endpoint = false; - $scope.reloadNewObj(); - $scope.view.edit = "view"; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedEndpoint) { - GBPEndpointServices.delete(path, $scope.selectedEndpoint, function(data){ - $scope.init(); - $scope.view.endpoint = false; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.showForm = function() { - $scope.view.endpoint = true; - $scope.reloadNewObj(); - $scope.selectedEndpoint = null; - - $scope.view.edit = "add"; - }; - - $scope.reloadNewObj = function() { - $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedEndpoint = selectedObj; - $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; - if(selectedObj){ - $scope.view.endpoint = true; - } - else { - $scope.view.endpoint = false; - $scope.view.edit = "view"; - } - - if($scope.view.endpoint) { - angular.copy(selectedObj, $scope.newEndpointObj); - } - }; - - $scope.close = function(){ - $scope.view.endpoint = false; - $scope.view.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEndpoint ) { - $scope.view.endpoint = true; - $scope.view.edit = "edit"; - angular.copy($scope.selectedEndpoint, $scope.newEndpointObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_EPG_RELOAD',function(){ - loadEpgOptions(); - }); - - $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ - //loadL2ContextOptions(); - loadNetworkCotnaninemnt(); - }); - - $scope.$on('GBP_L2FLOOD_RELOAD',function(){ - //loadL2ContextOptions(); - loadNetworkCotnaninemnt(); - }); - - $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ - //loadL3ContextOptions(); - loadNetworkCotnaninemnt(); - }); - - $scope.$on('GBP_SUBNET_RELOAD',function(){ - //loadSubnetOptions(); - loadNetworkCotnaninemnt(); - }); - }]); - - gbp.register.controller('l3EndpointCtrl', ['$scope', 'GBPEndpointL3Services', 'GPBServices', 'GBPEpgServices', 'GBPL3ContextServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', '$filter', - function($scope, GBPEndpointL3Services, GPBServices, GBPEpgServices, GBPL3ContextServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, $filter){ - $scope.list = []; - $scope.selectedEndpoint = null; - $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); - $scope.displayLabel = function(obj) { - return obj['ip-prefix'] + ':' + obj['l3-context']; - }; - $scope.crudLabel = 'L3 Prefix endpoint list'; - - $scope.l2context = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2context); - - $scope.l3context = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context); - - $scope.epg = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_EPG_LABEL', $scope.epg); - - $scope.view = { - endpoint: false, - edit: "view" - }; - - var path = null, - mandatoryProperties = [], - - loadEpgOptions = function() { - $scope.epg.options = []; - - path = GBPEpgServices.createPathObj($scope.selectedTenant.id); - GBPEpgServices.load(path, function(data){ - $scope.epg.options = data; - }, function(){ - //TODO: error cbk - }); - }, - - loadL2ContextOptions = function() { - $scope.l2context.options = []; - - path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id); - - GBPL2FloodDomainServices.load(path, function(data){ - $scope.l2context.options = $scope.l2context.options.concat(data); - }, function(){ - - }); - - path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id); - GBPL2BridgeDomainServices.load(path, function(data){ - $scope.l2context.options = $scope.l2context.options.concat(data); - }, function(){ - - }); - }, - - loadL3ContextOptions = function(){ - $scope.l3context.options = []; - - GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){ - $scope.l3context.options = data; - }, function(){ - - }); - }, - - clear = function(){ - $scope.list = []; - $scope.selectedEndpoint = null; - $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); - $scope.view = { - endpoint: false, - edit: "view" - }; - }; - - $scope.init = function() { - if ($scope.selectedTenant) { - - GBPEndpointL3Services.load(path, function(data){ - $scope.list = data; - }, function(){ - //TODO: error cbk - }); - - loadEpgOptions(); - loadL2ContextOptions(); - loadL3ContextOptions(); - }else{ - clear(); - } - }; - - $scope.addNewL2gateways = function() { - if($scope.newEndpointObj) { - if(!$scope.newEndpointObj['endpoint-l2-gateways']){ - $scope.newEndpointObj['endpoint-l2-gateways'] = []; - } - var objToPush = {'l2-context' : '', 'mac-address' : ''}; - $scope.newEndpointObj['endpoint-l2-gateways'].push(objToPush); - } - }; - - $scope.deleteNewL2gateways = function(index){ - if($scope.newEndpointObj) { - $scope.newEndpointObj['endpoint-l2-gateways'].splice(index, 1); - } - }; - - $scope.addNewL3gateways = function() { - if($scope.newEndpointObj) { - if(!$scope.newEndpointObj['endpoint-l3-gateways']){ - $scope.newEndpointObj['endpoint-l3-gateways'] = []; - } - var objToPush = {'l3-context' : '', 'ip-address' : ''}; - $scope.newEndpointObj['endpoint-l3-gateways'].push(objToPush); - } - }; - - $scope.deleteNewL3gateways = function(index){ - if($scope.newEndpointObj) { - $scope.newEndpointObj['endpoint-l3-gateways'].splice(index, 1); - } - }; - - $scope.addNewLeafListEl = function(prop) { - if($scope.newEndpointObj) { - if(!$scope.newEndpointObj[prop]){ - $scope.newEndpointObj[prop] = []; - } - var objToPush = ""; - $scope.newEndpointObj[prop].push(objToPush); - } - }; - - $scope.updateLeafListEl = function(index, value, prop) { - if($scope.newEndpointObj && $scope.newEndpointObj[prop] && $scope.newEndpointObj[prop].length >= index) { - $scope.newEndpointObj[prop][index] = value; - } - }; - - $scope.deleteNewLeafListEl = function(index, prop){ - if($scope.newEndpointObj) { - $scope.newEndpointObj[prop].splice(index, 1); - } - }; - - $scope.save = function(){ - if($scope.validateForm($scope.l3EndpointForm)){ - GBPEndpointL3Services.send(path, $scope.newEndpointObj, function(data){ - $scope.init(); - $scope.view.endpoint = false; - $scope.reloadNewObj(); - $scope.view.edit = "view"; - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.delete = function() { - if($scope.selectedTenant && $scope.selectedEndpoint) { - GBPEndpointL3Services.delete(path, $scope.selectedEndpoint, function(data){ - $scope.init(); - }, function(){ - //TODO: error cbk - }); - } - }; - - $scope.showForm = function() { - $scope.view.endpoint = true; - $scope.reloadNewObj(); - $scope.selectedEndpoint = null; - $scope.view.edit = "add"; - }; - - $scope.reloadNewObj = function() { - $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedEndpoint = selectedObj; - angular.copy(selectedObj, $scope.newEndpointObj); - $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; - if(selectedObj){ - $scope.view.endpoint = true; - } - else { - $scope.view.endpoint = false; - $scope.view.edit = "view"; - } - }; - - $scope.close = function(){ - $scope.view.endpoint = false; - $scope.view.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEndpoint ) { - $scope.view.endpoint = true; - $scope.view.edit = "edit"; - angular.copy($scope.selectedEndpoint, $scope.newEndpointObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_EPG_RELOAD',function(){ - loadEpgOptions(); - }); - - $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ - loadL2ContextOptions(); - }); - - $scope.$on('GBP_L2FLOOD_RELOAD',function(){ - loadL2ContextOptions(); - }); - - $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ - loadL3ContextOptions(); - }); - }]); - - gbp.register.controller('accessModelWizardCtrl', ['$scope', '$filter', 'GBPTenantServices', 'GBPEpgServices', 'GBPContractServices', 'GPBServices', function($scope, $filter, GBPTenantServices, GBPEpgServices, GBPContractServices, GPBServices){ - $scope.wizardPage = null; - - $scope.selectedTenant = null; - $scope.tenant = null; - //$scope.epgList = []; - $scope.newContractObj = null; - - $scope.init = function() { - $scope.setPage('tenants'); - }; - - $scope.setPage = function(pageName, object) { - $scope.wizardPage = pageName; - - switch(pageName) { - case 'contracts': - if(object) { - $scope.tenant = object; - } - - break; - - case 'summary': - $scope.tenant['endpoint-group'] = $scope.tenant['endpoint-group'] ? $scope.tenant['endpoint-group'] : []; - - if(object) { - object.forEach(function(o) { - $scope.tenant['endpoint-group'].push(GPBServices.stripNullValues(o)); - }); - } - - break; - - case 'epgs': - $scope.tenant['contract'] = $scope.tenant['contract'] ? $scope.tenant['contract'] : []; - - if(object) { - object.forEach(function(o) { - $scope.tenant['contract'].push(GPBServices.stripNullValues(o)); - }); - } - - break; - } - }; - - $scope.submit = function(object) { - $scope.tenant['endpoint-group'] = $scope.tenant['endpoint-group'] ? $scope.tenant['endpoint-group'] : []; - - if(object) { - object.forEach(function(o) { - $scope.tenant['endpoint-group'].push(GPBServices.stripNullValues(o)); - }); - } - - - path = GBPTenantServices.createPathObj($scope.tenant.id); - GBPTenantServices.send(path, $scope.tenant, function(data){ - $scope.wizards.accessModelWizard = false; - $scope.sendReloadEventFromRoot('GBP_GLOBAL_TENANT_RELOAD'); - $scope.reloadTopo(); - }, function(){ - //TODO: error cbk - }); - }; - - // $scope.updateList = function(list, object, key) { - // var elementPos = list.map(function(x) {return x[key]; }).indexOf(object[key]); - - // if(elementPos < 0) { - // list.push(object); - // } - // else { - // list[elementPos] = object; - // } - // }; - }]); - - gbp.register.controller('wizardTenantCtrl', ['$scope', '$filter', 'GBPTenantServices', function($scope, $filter, GBPTenantServices){ - // $scope.tenantList = []; - $scope.newTenantObj = GBPTenantServices.createObj(); - $scope.displayLabel = ['name' , 'id']; - - $scope.view = { - tenantEdit: false - }; - - // $scope.init = function() { - // $scope.getTenants(); - // }; - - // $scope.getTenants = function() { - // GBPTenantServices.load( - // function(data) { - // $scope.tenantList = data; - // $scope.newTenantObj = GBPTenantServices.createObj(); - // }, - // function(){ - // //TODO error - // } - // ); - // }; - - $scope.reloadTenants = function(selectedObject) { - if(!selectedObject) { - selectedObject = GBPTenantServices.createObj(); - $scope.view.tenantEdit = false; - } - else { - $scope.view.tenantEdit = true; - } - - $scope.selectedTenant = selectedObject; - $scope.newTenantObj = selectedObject; - }; - - $scope.getNewTenantObject = function() { - return GBPTenantServices.createObj(); - }; - }]); - - gbp.register.controller('wizardEpgCtrl', ['$scope', '$filter', 'GBPEpgServices', function($scope, $filter, GBPEpgServices){ - $scope.list = []; - $scope.newEpgObj = GBPEpgServices.createObj(); - $scope.selectedEpg = null; - $scope.epgFormView = true; - - $scope.displayLabel = ['name', 'id']; - $scope.crudLabel = 'Group list'; - - $scope.igpOpts = ['allow', 'require-contract']; - - $scope.init = function() { - - }; - - $scope.showForm = function() { - $scope.epgFormView = true; - $scope.newEpgObj = GBPEpgServices.createObj(); - }; - - $scope.save = function() { - $scope.updateList($scope.list, $scope.newEpgObj, "id"); - $scope.reload($scope.newEpgObj); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newEpgObj); - }; - - $scope.delete = function() { - if($scope.selectedEpg) { - var index = $scope.list.indexOf($scope.selectedEpg); - $scope.list.splice(index, 1); - $scope.epgFormView = false; - } - //$scope.newEpgObj = GBPEpgServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedEpg = selectedObj; - $scope.newEpgObj = selectedObj; - $scope.epgFormView = true; - $scope.$broadcast('WIZARD_EPG_RELOAD'); - }; - - $scope.close = function() { - $scope.epgFormView = false; - $scope.newEpgObj = GBPEpgServices.createObj(); - $scope.selectedEpg = null; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEpg ) { - $scope.epgFormView = true; - angular.copy($scope.selectedEpg, $scope.newEpgObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on("WIZARD_CNS_RELOAD", function(event, args){ - //$scope.selectedEpg['consumer-named-selector'] = args; - $scope.newEpgObj['consumer-named-selector'] = args; - $scope.updateList($scope.list, $scope.newEpgObj, "id"); - }); - - $scope.$on("WIZARD_PNS_RELOAD", function(event, args){ - //$scope.selectedEpg['provider-named-selector'] = args; - $scope.newEpgObj['provider-named-selector'] = args; - $scope.updateList($scope.list, $scope.newEpgObj, "id"); - }); - }]); - - gbp.register.controller('wizardContractCtrl', ['$scope', '$filter', 'GBPContractServices', function($scope, $filter, GBPContractServices){ - $scope.list = []; - $scope.newContractObj = GBPContractServices.createObj(); - $scope.selectedContract = null; - - $scope.displayLabel = ['description', 'id']; - $scope.crudLabel = 'Contract list'; - - $scope.contractFormView = true; - - $scope.init = function() { - - }; - - $scope.showForm = function() { - $scope.contractFormView = true; - $scope.newContractObj = GBPContractServices.createObj(); - }; - - $scope.save = function() { - $scope.updateList($scope.list, $scope.newContractObj, "id"); - $scope.reload($scope.newContractObj); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newContractObj); - }; - - $scope.delete = function() { - if($scope.selectedContract) { - var index = $scope.list.indexOf($scope.selectedContract); - $scope.list.splice(index, 1); - $scope.contractFormView = false; - $scope.newContractObj = GBPContractServices.createObj(); - $scope.selectedContract = null; - } - }; - - $scope.reload = function(selectedObj) { - $scope.selectedContract = selectedObj; - $scope.newContractObj = selectedObj; - $scope.contractFormView = true; - }; - - $scope.close = function() { - $scope.contractFormView = false; - //$scope.newContractObj = GBPContractServices.createObj(); - //$scope.selectedContract = null; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedContract ) { - $scope.contractFormView = true; - angular.copy($scope.selectedContract, $scope.newContractObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on("WIZARD_SUBJECT_RELOAD", function(event, args){ - //$scope.selectedEpg['consumer-named-selector'] = args; - $scope.newContractObj['subject'] = args; - $scope.updateList($scope.list, $scope.newContractObj, "id"); - }); - - $scope.$on("WIZARD_CLAUSE_RELOAD", function(event, args){ - //$scope.selectedEpg['consumer-named-selector'] = args; - $scope.newContractObj['clause'] = args; - $scope.updateList($scope.list, $scope.newContractObj, "id"); - }); - }]); - - gbp.register.controller('wizardCnsCtrl',['$scope', 'GBPConNamedSelServices', function($scope, GBPConNamedSelServices){ - $scope.list = []; - $scope.selectedCNS = null; - $scope.newCNSObj = GBPConNamedSelServices.createObj(); - $scope.internalView = { - cns: false, - edit: "view" - }; - $scope.displayLabel = 'name'; - $scope.crudLabel = 'Consumer named selectors list'; - - $scope.contractList = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contractList); - - var clear = function(){ - $scope.list = []; - $scope.selectedCNS = null; - $scope.newCNSObj = GBPConNamedSelServices.createObj(); - $scope.internalView = { - cns: false, - edit: "add" - }; - }; - - //move to separate ctrl \/ - $scope.addNewElem = function(templateObj) { - if($scope.newCNSObj && $scope.newCNSObj.contract) { - var objToPush = templateObj || ""; - $scope.newCNSObj.contract.push(objToPush); - } - }; - - $scope.deleteElemAt = function(index) { - if($scope.newCNSObj && $scope.newCNSObj.contract) { - $scope.newCNSObj.contract.splice(index, 1); - } - }; - - $scope.updateAt = function(index, value) { - if($scope.newCNSObj && $scope.newCNSObj.contract && $scope.newCNSObj.contract.length >= index) { - $scope.newCNSObj.contract[index] = value; - } - }; - //move to separate ctrl /\ - - $scope.init = function() { - clear(); - - if($scope.tenant && $scope.tenant['contract'].length>0) { - $scope.contractList.options = $scope.tenant['contract']; - } - - if($scope.selectedEpg && $scope.selectedEpg['consumer-named-selector']) { - $scope.list = $scope.selectedEpg['consumer-named-selector']; - } - }; - - $scope.save = function(){ - $scope.updateList($scope.list, $scope.newCNSObj, "name"); - $scope.reload($scope.newCNSObj); - $scope.$emit('WIZARD_CNS_RELOAD', $scope.list); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newCNSObj); - }; - - $scope.delete = function() { - if($scope.selectedCNS) { - var index = $scope.list.indexOf($scope.selectedCNS); - $scope.list.splice(index, 1); - $scope.internalView = { - cns: false, - edit: "add" - }; - $scope.$emit('WIZARD_CNS_RELOAD', $scope.list); - } - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.selectedCNS = null; - $scope.internalView.cns = true; - $scope.internalView.edit = "add"; - }; - - $scope.reloadNewObj = function() { - $scope.newCNSObj = GBPConNamedSelServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedCNS = selectedObj; - $scope.newCNSObj = selectedObj; - $scope.internalView.cns = true; - }; - - $scope.close = function(){ - $scope.internalView.cns = false; - //$scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEpg ) { - $scope.internalView.cns = true; - $scope.internalView.edit = "add"; - angular.copy($scope.selectedCNS, $scope.newCNSObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('WIZARD_EPG_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('wizardPnsCtrl',['$scope', 'GBPProNamedSelServices', function($scope, GBPProNamedSelServices){ - $scope.list = []; - $scope.selectedPNS = null; - $scope.newPNSObj = GBPProNamedSelServices.createObj(); - $scope.displayLabel = 'name'; - $scope.crudLabel = 'Provider named selectors list'; - $scope.internalView = { - pns: false, - edit: "view" - }; - - $scope.contractList = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contractList); - - var clear = function(){ - $scope.list = []; - $scope.selectedPNS = null; - $scope.newPNSObj = GBPProNamedSelServices.createObj(); - $scope.internalView = { - pns: false, - edit: "view" - }; - }; - - //move to separate ctrl \/ - $scope.addNewElem = function(templateObj) { - if($scope.newPNSObj && $scope.newPNSObj.contract) { - var objToPush = templateObj || ""; - $scope.newPNSObj.contract.push(objToPush); - } - }; - - $scope.deleteElemAt = function(index) { - if($scope.newPNSObj && $scope.newPNSObj.contract) { - $scope.newPNSObj.contract.splice(index, 1); - } - }; - - $scope.updateAt = function(index, value) { - if($scope.newPNSObj && $scope.newPNSObj.contract && $scope.newPNSObj.contract.length >= index) { - $scope.newPNSObj.contract[index] = value; - } - }; - //move to separate ctrl /\ - - $scope.init = function() { - clear(); - - if($scope.tenant && $scope.tenant['contract'].length>0) { - $scope.contractList.options = $scope.tenant['contract']; - } - - if($scope.selectedEpg && $scope.selectedEpg['provider-named-selector']) { - $scope.list = $scope.selectedEpg['provider-named-selector']; - } - }; - - $scope.save = function(){ - $scope.updateList($scope.list, $scope.newPNSObj, "name"); - $scope.reload($scope.newPNSObj); - $scope.$emit('WIZARD_PNS_RELOAD', $scope.list); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newPNSObj); - }; - - $scope.delete = function() { - if($scope.selectedPNS) { - var index = $scope.list.indexOf($scope.selectedPNS); - $scope.list.splice(index, 1); - $scope.internalView = { - pns: false, - edit: "add" - }; - $scope.$emit('WIZARD_PNS_RELOAD', $scope.list); - } - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.selectedPNS = null; - $scope.internalView.pns = true; - $scope.internalView.edit = "add"; - }; - - $scope.reloadNewObj = function() { - $scope.newPNSObj = GBPProNamedSelServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedPNS = selectedObj; - $scope.newPNSObj = selectedObj; - $scope.internalView.pns = true; - }; - - $scope.close = function(){ - $scope.internalView.pns = false; - $scope.internalView.edit = "view"; - }; - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedEpg ) { - $scope.internalView.pns = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedPNS, $scope.newPNSObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('WIZARD_EPG_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('wizardSubjectCtrl', ['$scope','GBPSubjectServices', '$filter', function($scope, GBPSubjectServices, $filter){ - $scope.list = []; - $scope.selectedSubject = null; - $scope.newSubjectObj = GBPSubjectServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - subject : false, - edit : "view" - }; - $scope.crudLabel = 'Subject list'; - $scope.errors = {}; - - - var path = null, - mandatoryProperties = ['order'], - - clear = function(){ - $scope.list = []; - $scope.selectedSubject = null; - $scope.newSubjectObj = GBPSubjectServices.createObj(); - $scope.internalView = { - subject : false, - edit : "view" - }; - }; - - $scope.init = function() { - - }; - - $scope.save = function(){ - $scope.updateList($scope.list, $scope.newSubjectObj, "name"); - $scope.reload($scope.newSubjectObj); - $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newSubjectObj); - }; - - $scope.delete = function() { - if($scope.selectedSubject) { - var index = $scope.list.indexOf($scope.selectedSubject); - $scope.list.splice(index, 1); - $scope.internalView = { - subject: false, - edit: "add" - }; - $scope.reloadNewObj(); - $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list); - } - }; - - $scope.reloadNewObj = function() { - $scope.newSubjectObj = GBPSubjectServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedSubject = selectedObj; - $scope.newSubjectObj = selectedObj; - $scope.internalView.subject = true; - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.subject = true; - $scope.internalView.edit = "add"; - $scope.selectedSubject = null; - }; - - $scope.close = function(){ - $scope.internalView.subject = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedSubject ) { - $scope.internalView.subject = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedSubject, $scope.newSubjectObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_CONTRACT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on('GBP_SUBJECTS_LABEL', function(event, obj){ - obj.labels = $scope.displayLabel; - }); - - $scope.$on("WIZARD_RULE_RELOAD", function(event, args){ - //$scope.selectedEpg['consumer-named-selector'] = args; - $scope.newSubjectObj['rule'] = args; - $scope.updateList($scope.list, $scope.newSubjectObj, "id"); - $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list); - }); - }]); - - gbp.register.controller('wizardRuleCtrl', ['$scope','GBPRuleServices', '$filter', function($scope, GBPRuleServices, $filter){ - $scope.list = []; - $scope.selectedRule = null; - $scope.newRuleObj = GBPRuleServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - rule : false, - edit : "view" - }; - $scope.crudLabel = 'Rule list'; - $scope.errors = {}; - - var path = null, - mandatoryProperties = ['order'], - - clear = function(){ - $scope.list = []; - $scope.selectedRule = null; - $scope.newRuleObj = GBPRuleServices.createObj(); - $scope.internalView = { - rule : false, - edit : "view" - }; - }; - - $scope.init = function() { - - }; - - $scope.save = function(){ - $scope.updateList($scope.list, $scope.newRuleObj, "name"); - $scope.reload($scope.newRuleObj); - $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newRuleObj); - }; - - $scope.delete = function() { - if($scope.selectedRule) { - var index = $scope.list.indexOf($scope.selectedRule); - $scope.list.splice(index, 1); - $scope.internalView = { - rule: false, - edit: "add" - }; - $scope.reloadNewObj(); - $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); - } - }; - - $scope.reloadNewObj = function() { - $scope.newRuleObj = GBPRuleServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedRule = selectedObj; - $scope.newRuleObj = selectedObj; - $scope.internalView.rule = true; - $scope.$broadcast('WIZARD_RULE_RELOAD'); - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.rule = true; - $scope.internalView.edit = "add"; - $scope.selectedRule = null; - }; - - $scope.close = function(){ - $scope.internalView.rule = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedRule ) { - $scope.internalView.rule = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedRule, $scope.newRuleObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('GBP_SUBJECT_RELOAD',function(){ - $scope.init(); - }); - - $scope.$on("WIZARD_CLASREF_RELOAD", function(event, args){ - $scope.newRuleObj['classifier-ref'] = args; - $scope.updateList($scope.list, $scope.newRuleObj, "name"); - $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); - }); - - $scope.$on("WIZARD_ACTIONREF_RELOAD", function(event, args){ - $scope.newRuleObj['action-ref'] = args; - $scope.updateList($scope.list, $scope.newRuleObj, "name"); - $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); - }); - }]); - - gbp.register.controller('wizardClauseCtrl', ['$scope','GBPClauseServices', 'GBPSubjectServices', - function($scope, GBPClauseServices, GBPSubjectServices){ - $scope.list = []; - $scope.selectedClause = null; - $scope.newClauseObj = GBPClauseServices.createObj(); - $scope.internalView = { - clause: false, - edit: "view" - }; - $scope.displayLabel = 'name'; - $scope.crudLabel = 'Clause list'; - - $scope.subjects = {'options' : [], 'labels' : null}; - $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects); - - var path = null, - - clear = function(){ - $scope.list = []; - $scope.selectedClause = null; - $scope.newClauseObj = GBPClauseServices.createObj(); - $scope.internalView = { - clause: false, - edit: "view" - }; - }; - - //move to separate ctrl \/ - $scope.addNewElem = function(templateObj) { - if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { - $scope.init(); - var objToPush = templateObj || ""; - $scope.newClauseObj['subject-refs'].push(objToPush); - } - }; - - $scope.deleteElemAt = function(index) { - if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { - $scope.newClauseObj['subject-refs'].splice(index, 1); - } - }; - - $scope.updateAt = function(index, value) { - if($scope.newClauseObj && $scope.newClauseObj['subject-refs'] && $scope.newClauseObj['subject-refs'].length >= index) { - $scope.newClauseObj['subject-refs'][index] = value; - } - }; - //move to separate ctrl /\ - - $scope.init = function() { - if($scope.selectedContract && $scope.selectedContract['subject'].length>0) { - $scope.subjects.options = $scope.selectedContract['subject']; - } - }; - - $scope.save = function(){ - $scope.updateList($scope.list, $scope.newClauseObj, "name"); - $scope.reload($scope.newClauseObj); - $scope.$emit('WIZARD_CLAUSE_RELOAD', $scope.list); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newClauseObj); - }; - - $scope.delete = function() { - if($scope.selectedClause) { - var index = $scope.list.indexOf($scope.selectedClause); - $scope.list.splice(index, 1); - $scope.internalView = { - clause: false, - edit: "add" - }; - $scope.$emit('WIZARD_CLAUSE_RELOAD', $scope.list); - } - }; - - $scope.reloadNewObj = function() { - $scope.newClauseObj = GBPClauseServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedClause = selectedObj; - $scope.newClauseObj = selectedObj; - $scope.internalView.clause = true; - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.clause = true; - $scope.internalView.edit = "add"; - $scope.selectedClause = null; - }; - - $scope.close = function(){ - $scope.internalView.clause = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedClause ) { - $scope.internalView.clause = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedClause, $scope.newClauseObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('WIZARD_SUBJECT_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('wizardActionRefCtrl', ['$scope','GBPActionRefsServices', 'GBPActionInstanceServices', '$filter', function($scope, GBPActionRefsServices, GBPActionInstanceServices, $filter){ - $scope.list = []; - $scope.selectedActionRef = null; - $scope.newActionRefObj = GBPActionRefsServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - actionRef : false, - edit : "view" - }; - $scope.crudLabel = 'Action ref list'; - - $scope.actionInstanceNames = {'options' : [], 'labels' : $scope.displayLabel}; - - var path = null, - mandatoryProperties = ['order'], - - actionInstanceNamesLoad = function() { - if($scope.tenant) { - var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.tenant.id); - GBPActionInstanceServices.load(actionInstancePath, function(data){ - $scope.actionInstanceNames.options = data; - },function(){ - //TODO: error cbk - }); - } - }, - - clear = function(){ - $scope.list = []; - $scope.selectedActionRef = null; - $scope.newActionRefObj = GBPActionRefsServices.createObj(); - $scope.internalView = { - actionRef : false, - edit : "view" - }; - }; - - $scope.init = function() { - actionInstanceNamesLoad(); - }; - - $scope.save = function(){ - $scope.updateList($scope.list, $scope.newActionRefObj, "name"); - $scope.reload($scope.newActionRefObj); - $scope.$emit('WIZARD_ACTIONREF_RELOAD', $scope.list); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newActionRefObj); - }; - - $scope.delete = function() { - if($scope.selectedActionRef) { - var index = $scope.list.indexOf($scope.selectedActionRef); - $scope.list.splice(index, 1); - $scope.internalView = { - actionRef: false, - edit: "add" - }; - $scope.$emit('WIZARD_ACTIONREF_RELOAD', $scope.list); - } - }; - - $scope.reloadNewObj = function() { - $scope.newActionRefObj = GBPActionRefsServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedActionRef = selectedObj; - $scope.newActionRefObj = selectedObj; - $scope.internalView.actionRef = true; - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.actionRef = true; - $scope.internalView.edit = "add"; - $scope.selectedActionRef = null; - }; - - $scope.close = function(){ - $scope.internalView.actionRef = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedActionRef ) { - $scope.internalView.actionRef = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedActionRef, $scope.newActionRefObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('WIZARD_RULE_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('wizardClassifierRefCtrl', ['$scope','GBPClassifierRefsServices', 'GBPClassifierInstanceServices', '$filter', function($scope, GBPClassifierRefsServices, GBPClassifierInstanceServices, $filter){ - $scope.list = []; - $scope.selectedClassifierRef = null; - $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); - $scope.displayLabel = 'name'; - $scope.internalView = { - classifierRef : false, - edit : "view" - }; - - $scope.instanceNames = {'options' : [], 'labels' : $scope.displayLabel}; - - $scope.formDirections = ['in', 'out', 'bidirectional']; - $scope.formConnectionTracking = ['normal', 'reflexive']; - - $scope.crudLabel = 'Classifier ref list'; - - var path = null, - - instanceNamesLoad = function() { - if($scope.tenant) { - var classifierInstancePath = GBPClassifierInstanceServices.createPathObj($scope.tenant.id); - GBPClassifierInstanceServices.load(classifierInstancePath, function(data){ - $scope.instanceNames.options = data; - },function(){ - //TODO: error cbk - }); - } - }, - - clear = function(){ - $scope.list = []; - $scope.selectedClassifierRef = null; - $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); - $scope.internalView = { - classifierRef : false, - edit : "view" - }; - }; - - $scope.init = function() { - instanceNamesLoad(); - }; - - $scope.save = function(){ - $scope.updateList($scope.list, $scope.newClassifierRefObj, "name"); - $scope.reload($scope.newClassifierRefObj); - $scope.$emit('WIZARD_CLASREF_RELOAD', $scope.list); - $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newClassifierRefObj); - }; - - $scope.delete = function() { - if($scope.selectedClassifierRef) { - var index = $scope.list.indexOf($scope.selectedClassifierRef); - $scope.list.splice(index, 1); - $scope.internalView = { - classifierRef: false, - edit: "add" - }; - $scope.$emit('WIZARD_CLASREF_RELOAD', $scope.list); - } - }; - - $scope.reloadNewObj = function() { - $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); - }; - - $scope.reload = function(selectedObj) { - $scope.selectedClassifierRef = selectedObj; - $scope.newClassifierRefObj = selectedObj; - $scope.internalView.classifierRef = true; - }; - - $scope.showForm = function() { - $scope.reloadNewObj(); - $scope.internalView.classifierRef = true; - $scope.internalView.edit = "add"; - $scope.selectedClassifierRef = null; - }; - - $scope.close = function(){ - $scope.internalView.classifierRef = false; - $scope.internalView.edit = "view"; - }; - - $scope.$on('PGN_EDIT_ELEM', function(event){ - if (!event.defaultPrevented) { - if ( $scope.selectedClassifierRef ) { - $scope.internalView.classifierRef = true; - $scope.internalView.edit = "edit"; - angular.copy($scope.selectedClassifierRef, $scope.newClassifierRefObj); - } - event.defaultPrevented = true; - } - }); - - $scope.$on('WIZARD_RULE_RELOAD',function(){ - $scope.init(); - }); - }]); - - gbp.register.controller('rendererStateCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){ - $scope.data = {'subject-feature-definitions' : {}}; - $scope.view_path = 'src/app/gbp/views/governance'; - - var init = function(){ - GPBServices.getDefinitions(function(classifiersDefs, actionsDefs){ - $scope.data['subject-feature-definitions']['classifier-definition'] = classifiersDefs; - $scope.data['subject-feature-definitions']['action-definition'] = actionsDefs; - }, function(){ - //error - }); - }; - - init(); - }]); - - gbp.register.controller('layerCtrl', ['$scope', function($scope){ - - var moveOffset = 1; - $scope.currentDisplayIndex = 1; - $scope.displayOffsets = [-1, 0, 1]; - $scope.expanded = true; - - $scope.init = function(key, value){ - $scope.data = value; - if($scope.checkData(value, 'Array')){ - $scope.setActData($scope.data[$scope.data.length - 1]); - } - }; - - $scope.toggleExpanded = function(){ - $scope.expanded = !$scope.expanded; - }; - - $scope.shiftDisplayNext = function() { - $scope.currentDisplayIndex = Math.min($scope.currentDisplayIndex + moveOffset, $scope.data.length - 2); - }; - - $scope.shiftDisplayPrev = function() { - $scope.currentDisplayIndex = Math.max($scope.currentDisplayIndex - moveOffset, 1); - }; - - $scope.showPrevButton = function() { - return $scope.currentDisplayIndex > 1; - }; - - $scope.showNextButton = function() { - return $scope.data && $scope.currentDisplayIndex < $scope.data.length - 2; - }; - - $scope.setActData = function(data) { - $scope.actSelected = data; - }; - - $scope.checkData = function(data, type){ - var result = {'Array' : data instanceof Array, - 'Object' : data instanceof Object}; - - return result[type]; - }; - }]); - - gbp.register.controller('actionReferenceWizardCtrl', ['$scope', '$filter', 'GBPRuleServices', 'GBPActionInstanceServices', function($scope, $filter, GBPRuleServices, GBPActionInstanceServices){ - $scope.wizardPage = null; - $scope.path = {}; - $scope.rule = {}; - - $scope.actionInstanceNames = {'options' : [], 'labels' : "name"}; - - var actionInstanceNamesLoad = function() { - var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id); - GBPActionInstanceServices.load(actionInstancePath, function(data){ - $scope.actionInstanceNames.options = data; - },function(){ - //TODO: error cbk - }); - }; - - $scope.init = function() { - $scope.setPage('reference'); - }; - - $scope.setPage = function(pageName, object) { - $scope.wizardPage = pageName; - }; - - $scope.submit = function() { - //if($scope.validateForm($scope.actionsForm)){ - $scope.actionInstanceNames.options.forEach(function(i) { - path = GBPActionInstanceServices.createPathObj($scope.path.tenantId, i.name); - //saveParams(); - - GBPActionInstanceServices.send(path, i, function(data){ - $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); - }, function(){ - //TODO: error cbk - }); - }); - - //} - - //if($scope.validateForm($scope.rulesForm)){ - path = GBPRuleServices.createPathObj($scope.path.tenantId, $scope.path.contractId, $scope.path.subjectId, $scope.path.ruleId); - GBPRuleServices.send(path, $scope.rule, function(data){ - - $scope.wizards.actionReferenceWizard = false; - - //$scope.sendReloadEventFromRoot('GBP_TENANT_RELOAD'); - }, function(){ - //TODO: error cbk - }); - //} - //$scope. - }; - - $scope.$on('ACTION_RULE_WIZARD_LOAD', function(event, data){ - $scope.rule = angular.copy(data.data); - $scope.path = data.path; - }); - - $scope.$on('WIZARD_ACTIONREF_ADD', function(event, data){ - if(!$scope.rule['action-ref']) { - $scope.rule['action-ref'] = []; - } - $scope.updateList($scope.rule['action-ref'], data, "name"); - }); - - $scope.$on('WIZARD_ACTIONREF_DELETE', function(event, data){ - $scope.rule['action-ref'].splice(data, 1); - }); - - $scope.$on('WIZARD_ACTIONINSTANCE_ADD', function(event, data){ - $scope.updateList($scope.actionInstanceNames.options, data, "name"); - - $scope.setPage('reference'); - }); - - $scope.$on('GBP_TENANT_RELOAD',function(){ - actionInstanceNamesLoad(); - }); - - }]); - - gbp.register.controller('actionsRefListCtrl', ['$scope', '$filter', function($scope, $filter){ - - $scope.actionReferenceForm = false; - - $scope.showForm = function(object) { - $scope.actionReferenceForm = true; - $scope.newActionRefObj = object || null; - }; - - $scope.closeForm = function() { - $scope.actionReferenceForm = false; - }; - - $scope.save = function(){ - $scope.$emit('WIZARD_ACTIONREF_ADD', $scope.newActionRefObj); - $scope.resetObject(); - }; - - $scope.deleteElemAt = function(index) { - $scope.$emit('WIZARD_ACTIONREF_DELETE', index); - $scope.resetObject(); - }; - - $scope.resetObject = function() { - $scope.newActionRefObj = null; - }; - - - - }]); - - gbp.register.controller('actionInstanceWizardCtrl', ['$scope', '$filter', 'GPBServices', 'GBPActionInstanceServices', function($scope, $filter, GPBServices, GBPActionInstanceServices){ - $scope.actionDefinitions = {'options' : [], 'labels' : "name"}; - $scope.newActionObj = GBPActionInstanceServices.createObj(); - - var loadDefinitions = function() { - GPBServices.getDefinitions(function(classifierDefs, actionDefs) { - $scope.actionDefinitions.options = actionDefs; - //$scope.getDisplayLabelsFromCtrl('GBP_ACTIONS_LABEL', $scope.actionDefinitions); - }); - }; - - $scope.reloadDefs = function(){ - $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newActionObj['action-definition-id'])); - - //TODO: rework - if($scope.defs.length && $scope.defs[0].name === 'sfc-chain-name') { - GPBServices.getServiceFunctionChains(function(data) { - $scope.serviceFunctionChains = data; - }); - } - }; - - $scope.getDefinitionObjParams = function(id){ - return GPBServices.getDefinitionObjParams($scope.actionDefinitions.options, id); - }; - - $scope.save = function(){ - $scope.newActionObj['parameter-value'] = []; - $scope.$broadcast('GBP_SAVE_PARAM'); - $scope.$emit('WIZARD_ACTIONINSTANCE_ADD', $scope.newActionObj); - $scope.resetObject(); - }; - - $scope.resetObject = function() { - $scope.newActionObj = GBPActionInstanceServices.createObj(); - }; - - $scope.saveParam = function() { - - }; - - $scope.addParam = function(name, type, value) { - $scope.newActionObj['parameter-value'].push(GPBServices.createParamObj(name, type, value)); - }; - - loadDefinitions(); - - }]); - -}); - - +var modules = ['app/gbp/gbp.module', + 'app/gbp/gbp.services' + ]; + + +define(modules, function(gbp) { + + gbp.register.controller('gbpCtrl', ['$scope', '$rootScope', 'GBPTenantServices','DesignGbpFactory', 'GBPConstants', + function ($scope, $rootScope, GBPTenantServices, DesignGbpFactory, GBPConstants) { + $rootScope['section_logo'] = 'logo_gbp'; + $scope.view_path = 'src/app/gbp/views/'; + + $scope.mainView = { + main: true, + 'policy-renderer': false, + governance: false + }; + + $scope.policyRendererView = { + slider : true, + basic : true, + policy: false, + tenants : false, + l2l3 : false, + epg : false, + contracts : false, + docs : false, + groupMenu: false, + classifiers: false, + actions: false, + registerEndpoint : false, + registerL3PrefixEndpoint : false + }; + + $scope.subMenuView = { + governance : false, + policy : false, + policySub : false, + renderers : false, + endpoints : false + }; + + $scope.breadcrumbs = {'l1' : null, + 'l2' : null, + 'l3' : null}; + + $scope.wizards = { + accessModelWizard: false, + actionReferenceWizard: false + }; + + $scope.setBreadcrumb = function(level, label, visible){ + $scope.breadcrumbs[level] = visible ? label : null; + if(level === 'l1'){ + $scope.breadcrumbs.l2 = null; + $scope.breadcrumbs.l3 = null; + } + if(level === 'l2'){ + $scope.breadcrumbs.l3 = null; + } + }; + + $scope.setViewExpand = function(menu, expand, show){ + $scope[menu][expand] = show ? true : !$scope[menu][expand]; + for ( var property in $scope[menu] ) { + $scope[menu][property] = expand !== property ? false : $scope[menu][expand]; + } + + }; + + $scope.toggleExpandedMM = function(expand, show, broadcast){ + $scope.setViewExpand('mainView',expand, show); + + if ( broadcast ) { + $scope.$broadcast(broadcast); + } + }; + + $scope.sliceLabel = function(label){ + return label.length > GBPConstants.numbers.displayLabelLength ? label.slice(0,GBPConstants.numbers.displayLabelLength)+'...' : label; + }; + + $scope.getDisplayLabel = function(obj, labelArray, dontSlice){ + var ret = ''; + + if((typeof labelArray) === 'string'){ + ret = obj[labelArray]; + } else if (angular.isFunction(labelArray)) { + ret = labelArray(obj); + } else { + labelArray.some(function(labelParam) { + if(angular.isFunction(labelParam)) { + ret = labelParam(obj); + } else if(obj.hasOwnProperty(labelParam)) { + ret = obj[labelParam]; + } + return ret; + }); + } + + return dontSlice ? ret : $scope.sliceLabel(ret); + }; + + // TENANTS + $scope.tenantList = []; + $scope.selectedTenant = null; + $scope.tenantDisplayLabel = ['name' , 'id']; + + $scope.loadTenants = function() { + GBPTenantServices.load( + function(tenants) { + $scope.tenantList = tenants; + console.log('$scope.tenantList', $scope.tenantList); + }, + function(){ + //TODO error + }); + + DesignGbpFactory.setMainClass(); + }; + + $scope.setTenant = function(selectedTenant) { + $scope.selectedTenant = selectedTenant; + $scope.$broadcast('GBP_TENANT_RELOAD', $scope.selectedTenant); + }; + + $scope.loadTenants(); + + $scope.$on('GBP_GLOBAL_TENANT_RELOAD',function(){ + $scope.loadTenants(); + }); + + $scope.sendReloadEventFromRoot = function(eventName, val) { + $scope.$broadcast(eventName, val); + }; + + + // TODO: rework, use $scope.setViewContent or something + $scope.showWizard = function(wizardName, broadcast, broadcastedData, path) { + $scope.wizards[wizardName] = true; + + if ( broadcast ) { + $scope.sendReloadEventFromRoot(broadcast, {data: broadcastedData, path: path}); + } + }; + + $scope.closeWizard = function(wizardName) { + $scope.wizards[wizardName] = false; + }; + + $scope.updateList = function(list, object, key) { + var elementPos = list.map(function(x) {return x[key]; }).indexOf(object[key]); + + if(elementPos < 0) { + list.push(object); + } + else { + list[elementPos] = object; + } + }; + + }]); + + gbp.register.controller('governanceCtrl', ['$rootScope','$scope', + function ($rootScope, $scope) { + $scope.menuTpl = 'main-menu'; + $scope.menuBox = null; + $scope.contentTpl = 'main'; + // $scope.selectedTenant = null; + $scope.rendererList = []; + var broadcastObj = {}; + + $scope.rendererList.push({'name' : 'of_overlay', 'id' : 0}); + + $scope.toggleExpanded = function(expand, menu, tplType){ + var type = tplType ? tplType : 'contentTpl'; + $scope.menuBox = null; + + $scope[type] = expand; + + if ( menu && menu === false ) { + $scope.menuTpl = !menu ? null : menu; + } + }; + + + + $scope.setViewContent = function(tplName, data, broadcast, tplType) { + + if ( $scope[tplType] === tplName ) { + $scope.$broadcast(broadcast, data, true); + } else { + + broadcastObj[tplType] = {}; + broadcastObj[tplType].name = broadcast; + broadcastObj[tplType].data = data; + + $scope.toggleExpanded(tplName, null, tplType); + $scope.$apply(); + + } + }; + + $scope.broadcastCalling = function(tplType){ + $scope.$broadcast(broadcastObj[tplType].name, broadcastObj[tplType].data); + }; + + $scope.checkBroadcastCalling = function(tplName){ + var objClickAction = { + 'epg-detail': function(){ + $scope.broadcastCalling('contentTpl'); + }, + 'subject-detail': function(){ + $scope.broadcastCalling('contentTpl'); + } + }; + + if ( angular.isFunction(objClickAction[tplName]) ) { + objClickAction[tplName](); + } + + }; + + + $scope.$on('GOV_INIT', function(){ + $scope.menuTpl = 'main-menu'; + $scope.contentTpl = 'main'; + // $scope.$emit('GBP_GLOBAL_TENANT_RELOAD'); + $scope.menuBox = null; + }); + + $scope.$on('GBP_TENANT_RELOAD', function(e, obj){ + $scope.selectedTenant = obj; + }); + + + }]); + + gbp.register.controller('boxStaticCtrl',['$scope', + function($scope){ + + $scope.selectedObj = null; + + $scope.getLabel = function(id, type){ + var objAction = { + providerItems: function(){ + var name = $scope.selectedObj[type][id].attributes.objData['name']; + return name ? name + ' : ' + id : id; + }, + consumerItems: function(){ + var name = $scope.selectedObj[type][id].attributes.objData['name']; + return name ? name + ' : ' + id : id; + } + }; + + if ( angular.isFunction(objAction[type]) ) { + return objAction[type](); + } + }; + + $scope.$on('SET_SEL_STA_OBJ', function(obj, data, apply){ + $scope.selectedObj = data; + + if ( apply ) { + $scope.$apply(); + } + + }); + + }]); + + gbp.register.controller('graphCtrl', ['$scope', function($scope){ + var paper = null, + paperScale = 1; + + $scope.init = function(paperInstance){ + paper = paperInstance; + $scope.loadMouseScrollEvent(); + }; + + + $scope.zoom = function(out){ + paperScale = out ? paperScale - 0.1 : paperScale >= 1 ? 1 : paperScale + 0.1; + paper.scale(paperScale, paperScale); + }; + + + + $scope.loadMouseScrollEvent = function(){ + /*mouse wheel event for zooming*/ + var graph = document.getElementById('graph'), + MouseWheelHandler = function(e){ + var mouseEvent = window.event || e; // old IE support + var delta = Math.max(-1, Math.min(1, (mouseEvent.wheelDelta || -mouseEvent.detail))); + $scope.zoom(delta === 1 ? false : true); + }; + + if (graph.addEventListener) { + // IE9, Chrome, Safari, Opera + graph.addEventListener("mousewheel", MouseWheelHandler, false); + // Firefox + graph.addEventListener("DOMMouseScroll", MouseWheelHandler, false); + } + // IE 6/7/8 + else {graph.attachEvent("onmousewheel", MouseWheelHandler);} + /*mouse wheel event for zooming - end*/ + }; + + }]); + + gbp.register.controller('expressedPolicyCtrl', ['$scope', 'JointGraphFactory', 'JointGraphOffsetFactory', 'GBPConstants', + function ($scope, JointGraphFactory, JointGraphOffsetFactory, GBPConstants) { + var paper = JointGraphFactory.createGraph(), + epgItems = [], + contractItems = [], + linkItems = []; + + var objClickAction = { + epg: function(data){ + $scope.setViewContent('epg-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); + }, + contract: function(data){ + $scope.setViewContent('contract-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); + } + }; + + paper.on('cell:pointerdown', function(cell) { + if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { + objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); + } + }); + + var createEpgLinks = function(epg, epgItem, contracts) { + var providers = epg['provider-named-selector'] && epg['provider-named-selector'].length>0 ? epg['provider-named-selector'] : []; + var consumers = epg['consumer-named-selector'] && epg['consumer-named-selector'].length>0 ? epg['consumer-named-selector'] : []; + var consumerLinkItems = []; + var providerLinkItems = []; + + consumers.forEach(function(c) { + c.contract.forEach(function(con) { + consumerLinkItems.push(JointGraphFactory.createLink(contracts[con].id, epgItem.id, 'green')); + }); + }); + + providers.forEach(function(p) { + p.contract.forEach(function(con) { + providerLinkItems.push(JointGraphFactory.createLink(epgItem.id, contracts[con].id, 'blue')); + }); + }); + + JointGraphFactory.addItemList(paper.model, providerLinkItems); + JointGraphFactory.addItemList(paper.model, consumerLinkItems); + + }; + + var loadData = function() { + if($scope.selectedTenant) { + var offsetObj = { + ow: 100, + oh: 100, + w: 100, + h: 100 + }, + marginObj = { + w: 50, + h: 80 + }, + offsetHobj = { + contract: 0, + epg: 0 + }, + itemsArray = { + contract: [], + epg: [] + }; + + JointGraphFactory.reloadGraph(paper.model); + + if ( $scope.selectedTenant && $scope.selectedTenant.contract ) { + + $scope.selectedTenant.contract.forEach(function(c, i) { + var label = c.description ? $scope.sliceLabel(c.description) : c.id, + width = JointGraphFactory.getLabelLength(label.length); + item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.contract, c, 'Click to see contract info', GBPConstants.colors.graph['subject'], 'Contract'); + + itemsArray.contract.push(item); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + contractItems[c.id] = item; + }); + + offsetHobj.contract = offsetObj.h; + + } + + if ( $scope.selectedTenant && $scope.selectedTenant['endpoint-group'] ) { + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h > 400 ? offsetObj.h : 400); + $scope.selectedTenant['endpoint-group'].forEach(function(e, i) { + var label = e.name || e.id, + width = JointGraphFactory.getLabelLength(label.length); + 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'); + + itemsArray.epg.push(item); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + epgItems[e.id] = item; + + createEpgLinks(e, item, contractItems); + }); + + } + + offsetHobj.epg = JointGraphOffsetFactory.getCurrentOffset(itemsArray.contract, 'y'); + JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.epg ,offsetHobj.epg, paper); + } + + }; + + $scope.getPaperObj = function(){ + return paper; + }; + + $scope.$on('GBP_TENANT_RELOAD',function(){ + if ($scope.selectedTenant) { + loadData(); + } + else { + JointGraphFactory.reloadGraph(paper.model); + } + }); + + loadData(); + }]); + + gbp.register.controller('deliveredPolicyCtrl', ['$scope', 'GPBServices', 'JointGraphFactory', 'GBPGovernanceServices', 'JointGraphOffsetFactory', 'GBPConstants', + function ($scope, GPBServices, JointGraphFactory, GBPGovernanceServices, JointGraphOffsetFactory, GBPConstants) { + var paper = JointGraphFactory.createGraph(), + providerItems = {}, + consumerItems = {}, + subjectItems = {}; + + var getEpList = function() { + var providerEpKeys = Object.keys(providerItems), + consumerEpKeys = Object.keys(consumerItems), + epList = providerEpKeys.map(function (k) { + return providerItems[k].attributes.objData; + }); + + consumerEpKeys.forEach(function(k) { + if(providerEpKeys.indexOf(k) === -1) { + epList.push(consumerItems[k].attributes.objData); + } + }); + + return epList; + }; + + var getSubjList = function() { + return Object.keys(subjectItems).map(function (k) { + return subjectItems[k].attributes.objData; + }); + }; + + var objClickAction = { + subject: function(data){ + data.providerItems = providerItems; + data.consumerItems = consumerItems; + $scope.setViewContent('subject-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); + }, + consumer: function(data) { + $scope.setViewContent('epg-content-static', data, 'SET_SEL_STA_OBJ', 'menuBox'); + }, + provider: function(data) { + $scope.setViewContent('epg-content-static', data, 'SET_SEL_STA_OBJ', 'menuBox'); + } + }; + + var objDblClickAction = { + consumer: function(data){ + $scope.setBreadcrumb('l3', 'Endpoint group detail', true); + $scope.setViewContent('epg-detail', { ep: data, epList: getEpList() }, 'SET_SELECTED_EPG','contentTpl'); + }, + provider: function(data){ + $scope.setBreadcrumb('l3', 'Endpoint group detail', true); + $scope.setViewContent('epg-detail', { ep: data, epList: getEpList() }, 'SET_SELECTED_EPG','contentTpl'); + }, + subject: function(data) { + var obj = { subject: data, + subjList: Object.keys(subjectItems).map(function (k) { + return subjectItems[k].attributes.objData; + }), + providerItems: providerItems, + consumerItems: consumerItems + }; + $scope.setBreadcrumb('l3', 'Subject detail', true); + $scope.setViewContent('subject-detail', obj, 'SET_SELECTED_SUBJECT','contentTpl'); + } + }; + + paper.on('cell:pointerdown', function(cell) { + if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { + objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); + } + }); + + paper.on('cell:pointerdblclick', function(cell) { + objDblClickAction[cell.model.attributes.objType](cell.model.attributes.objData); + }); + + var createSubjectLinks = function(subject, subjectItem, providerItems, consumerItems) { + var providerLinkItems = subject.providers.map(function(p) { + return JointGraphFactory.createLink(providerItems[p].id, subjectItem.id, 'green'); + }); + consumerLinkItems = subject.consumers.map(function(c) { + return JointGraphFactory.createLink(subjectItem.id, consumerItems[c].id, 'blue'); + }); + + JointGraphFactory.addItemList(paper.model, providerLinkItems); + JointGraphFactory.addItemList(paper.model, consumerLinkItems); + }; + + var loadData = function() { + if($scope.selectedTenant) { + providerItems = {}; + consumerItems = {}; + subjectItems = {}; + + var classifierInstances = $scope.selectedTenant['subject-feature-instances'] && + $scope.selectedTenant['subject-feature-instances']['classifier-instance'] && + $scope.selectedTenant['subject-feature-instances']['classifier-instance'].length > 0 ? $scope.selectedTenant['subject-feature-instances']['classifier-instance'] : []; + + var offsetObj = { + ow: 100, + oh: 100, + w: 100, + h: 100 + }, + marginObj = { + w: 50, + h: 80 + }, + offsetHobj = { + pEpg: 0, + cEpg: 0, + subject: 0 + }, + itemsArray = { + pEpg: [], + cEpg: [], + subject: [] + }; + + JointGraphFactory.reloadGraph(paper.model); + + GBPGovernanceServices.getEPGsAndSubjects($scope.selectedTenant.id, classifierInstances, function(data){ + data.providers.forEach(function(p, i) { + var relatedObj = GPBServices.getPropFromListByProp($scope.selectedTenant['endpoint-group'], 'id', p.id), + label = relatedObj.name || p.id, + width = JointGraphFactory.getLabelLength(label.length); + + relatedObj.rules = p.rules; + 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'); + + itemsArray.pEpg.push(item); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + providerItems[p.id] = item; + }); + + offsetHobj.pEpg = offsetObj.h; + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 500); + data.consumers.forEach(function(c, i) { + var relatedObj = GPBServices.getPropFromListByProp($scope.selectedTenant['endpoint-group'], 'id', c.id), + label = relatedObj.name || c.id, + width = JointGraphFactory.getLabelLength(label.length); + + relatedObj.rules = c.rules; + 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'); + + itemsArray.cEpg.push(item); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + consumerItems[c.id] = item; + }); + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetHobj.pEpg > 300 ? offsetHobj.pEpg : 300); + data.subjects.forEach(function(s, i) { + var label = s.name, + width = JointGraphFactory.getLabelLength(label.length), + 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'); + + itemsArray.subject.push(item); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + subjectItems[s.name] = item; + createSubjectLinks(s, item, providerItems, consumerItems); + }); + + offsetHobj.pEpg = JointGraphOffsetFactory.getCurrentOffset(itemsArray.pEpg, 'y'); + JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.subject ,offsetHobj.pEpg, paper); + offsetHobj.subject = JointGraphOffsetFactory.getCurrentOffset(itemsArray.subject, 'y'); + JointGraphOffsetFactory.checkObjsHoffsets(itemsArray.cEpg ,offsetHobj.subject, paper); + + }, function(){}); + + } + + + // paper.scaleContentToFit(); + // paper.fitToContent(); + }; + + $scope.getPaperObj = function(){ + return paper; + }; + + + $scope.$on('GBP_TENANT_RELOAD',function(){ + if ($scope.selectedTenant) { + loadData(); + } + else { + JointGraphFactory.reloadGraph(paper.model); + } + }); + + loadData(); + }]); + + gbp.register.controller('subjectDetailCtrl', ['$scope', 'GPBServices', 'JointGraphFactory', 'GBPGovernanceServices', 'JointGraphOffsetFactory', 'GBPConstants', + function ($scope, GPBServices, JointGraphFactory, GBPGovernanceServices, JointGraphOffsetFactory, GBPConstants) { + $scope.selectedSubject = null; + $scope.subjectList = []; + + var paper = JointGraphFactory.createGraph(), + subjectItem = null, + ruleItems = {}, + subjectItems = {}; + + var createSubjectLinks = function(subjectItem, ruleItem) { + var linkItem = JointGraphFactory.createLink(subjectItem.id, ruleItem.id, 'blue'); + JointGraphFactory.addItem(paper.model, linkItem); + }; + + paper.on('cell:pointerdown', function(cell) { + var objClickAction = { + subject: function(data){ + $scope.setViewContent('subject-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); + }, + rule: function(data){ + $scope.setViewContent('rule-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); + } + }; + + // console.log('cell.model.attributes.objType', cell.model.attributes.objType, cell.model.attributes.objData); + if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { + objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); + } + }); + + var loadData = function() { + if($scope.selectedSubject) { + subjectItem = null; + ruleItems = {}; + + var offsetObj = { + ow: 100, + oh: 100, + w: 100, + h: 100 + }, + marginObj = { + w: 50, + h: 80 + }; + + JointGraphFactory.reloadGraph(paper.model); + + var label = $scope.selectedSubject.name || $scope.selectedSubject.id, + width = JointGraphFactory.getLabelLength(label.length); + 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'); + + JointGraphFactory.addItem(paper.model, subjectItem); + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 300); + $scope.selectedSubject.rules.forEach(function(r, i) { + var label = r.name, + width = JointGraphFactory.getLabelLength(label.length); + item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.objType.rule, r, 'Click to see rule info', GBPConstants.colors.graph['cns'], 'Rule'); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper); + JointGraphFactory.addItem(paper.model, item); + ruleItems[r.name] = item; + + createSubjectLinks(subjectItem, item); + }); + } + }; + + $scope.getPaperObj = function(){ + return paper; + }; + + $scope.$on('SET_SELECTED_SUBJECT', function(event, data){ + $scope.selectedSubject = data.subject; + $scope.subjectList = data.subjList; + loadData(); + }); + + $scope.setSubject = function(subject) { + $scope.selectedSubject = subject; + loadData(); + }; + + loadData(); + }]); + + gbp.register.controller('epgDetailCtrl', ['$scope', 'JointGraphFactory', 'TopologyDataLoaders', 'GBPEpgServices', 'JointGraphOffsetFactory', 'GBPConstants', + function ($scope, JointGraphFactory, TopologyDataLoaders, GBPEpgServices, JointGraphOffsetFactory, GBPConstants) { + var paper = JointGraphFactory.createGraph(), + epgItem = {}, + epItems = {}; + + $scope.epgDisplayLabel = ['name', 'id']; + $scope.epgList = []; + $scope.selectedEpg = null; + + $scope.$on('SET_SELECTED_EPG', function(event, epg){ + $scope.selectedEpg = epg.ep; + $scope.epgList = epg.epList; + loadData(); + }); + + $scope.setEpg = function(epg){ + selectedEpg = epg; + loadData(); + }; + + paper.on('cell:pointerdown', function(cell) { + var objClickAction = { + ep: function(data){ + $scope.setViewContent('ep-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); + }, + epg: function(data){ + $scope.setViewContent('epg-content-static',data, 'SET_SEL_STA_OBJ', 'menuBox'); + }, + }; + + if ( angular.isFunction(objClickAction[cell.model.attributes.objType]) ) { + objClickAction[cell.model.attributes.objType](cell.model.attributes.objData); + } + }); + + var loadData = function() { + if($scope.selectedTenant && $scope.selectedEpg) { + epgItem = {}; + epItems = {}; + links = []; + + JointGraphFactory.reloadGraph(paper.model); + + TopologyDataLoaders.getEndpointsFromEndpointGroup($scope.selectedTenant.id, $scope.selectedEpg.id, function(data){ + var offsetObj = { + ow: 100, + oh: 100, + w: 100, + h: 100 + }, + marginObj = { + w: 50, + h: 80 + }; + + var label = $scope.selectedEpg.name || $scope.selectedEpg.id, + width = JointGraphFactory.getLabelLength(label.length); + epgItem = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, 'epg', $scope.selectedEpg, 'Click to see epg info', GBPConstants.colors.graph['subject'], 'EPG'); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper); + JointGraphFactory.addItem(paper.model, epgItem); + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, 500); + if(data && data.output && data.output['ui-endpoint'] && data.output['ui-endpoint'].length){ + data.output['ui-endpoint'].forEach(function(ep, i){ + var label = ep['mac-address'] + ':' + ep['l2-context'], + width = JointGraphFactory.getLabelLength(label.length); + item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, 'ep', ep, 'Click to see ep info', GBPConstants.colors.graph['pns'], 'Endpoint'); + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width), paper); + JointGraphFactory.addItem(paper.model, item); + epItems[label] = item; + links.push(JointGraphFactory.createLink(item.id, epgItem.id, 'green')); + }); + + JointGraphFactory.addItemList(paper.model, links); + } + }, function(){}); + } + }; + + $scope.getPaperObj = function(){ + return paper; + }; + + // init(); + }]); + + gbp.register.controller('policyRendererCtrl', ['$scope', '$http', '$timeout', 'PGNServices', 'TopoServices', 'GBPTenantServices', 'GBPConstants', 'JointGraphFactory','GBPJointGraphBuilder', + function ($scope, $http, $timeout, PGNServices, TopoServices, GBPTenantServices, GBPConstants, JointGraphFactory, GBPJointGraphBuilder) { + + $scope.topologyData = { nodes: [], links: [] }; + $scope.topologyType = null; + $scope.topologyArgs = {}; + $scope.legend = {}; + $scope.showLegend = false; + + var paper = JointGraphFactory.createGraph(); + + var reloadShowLegend = function() { + $scope.showLegend = !$.isEmptyObject($scope.legend); + }; + + $scope.settingsSigma = { + defaultLabelColor: '#fff', + doubleClickEnabled: false, + labelThreshold: 8 + }; + + $scope.settingsAtlas = { + adjustSizes: true, + gravity: 0.2 + }; + + $scope.viewTopo = { + box: false, + button: false + }; + + paper.on('cell:pointerdown', function(cellView, evt) { + if (cellView.model.isLink() && cellView.model.attributes.objData) { + $scope.$broadcast('SET_LINK_DATA', cellView.model.attributes.objData); + } + }); + + $scope.mandatoryProperties = []; + $scope.loadTopology = function(type, args) { + if ($scope.selectedTenant) { + $scope.topologyType = type; + $scope.topologyArgs = args; + GBPJointGraphBuilder.loadTopology(args, paper, type); + } + }; + $scope.toggleExpanded = function(expand, show) { + $scope.setViewExpand('policyRendererView',expand, show, 'l2'); + + if($scope.policyRendererView[expand] && $scope.selectedTenant) { + $scope.topologyArgs.tenantId = $scope.selectedTenant.id; + + if((expand === 'epg' || expand === 'contracts' || expand === 'classifiers' || expand === 'actions' || expand === 'renderers') && ($scope.topologyType !== GBPConstants.strings.config)) { + $scope.loadTopology(GBPConstants.strings.config, $scope.topologyArgs); + } else if((expand === 'l2l3' || expand === 'registerEndpoint' || expand === 'registerL3PrefixEndpoint') && ($scope.topologyType !== GBPConstants.strings.l2l3)) { + $scope.loadTopology(GBPConstants.strings.l2l3, $scope.topologyArgs); + } + } + }; + + $scope.reloadTopo = function() { + if($scope.selectedTenant) { + $scope.topologyArgs.tenantId = $scope.selectedTenant.id; + GBPJointGraphBuilder.loadTopology($scope.topologyArgs, paper, $scope.topologyType); + } + }; + + $scope.getDisplayLabelsFromCtrl = function(eventName, val) { + $scope.$broadcast(eventName, val); + }; + + $scope.validateMandatory = function(newObj, mandatoryProps){ + var ret = true, + notFilledProps = []; + + mandatoryProps.forEach(function(el){ + if(newObj[el] === '' || newObj[el] === null || newObj[el] === undefined){ + notFilledProps.push(el); + ret = false; + } + }); + + return {'status' : ret, 'notFilledProps' : notFilledProps}; + }; + + $scope.validate = function(value, errors){ + errors.int32 = !(parseInt(value) >= -2147483648 && parseInt(value) <= 2147483647); + }; + + + + $scope.validateForm = function(form) { + return form.$valid; + }; + + $scope.$on('GBP_TENANT_RELOAD', function(e, obj){ + $scope.selectedTenant = obj; + }); + + }]); + + gbp.register.controller('linkDataCtrl',['$scope', function($scope){ + $scope.showTable = false; + + $scope.show = function(){ + $scope.showTable = true; + }; + + $scope.close = function(){ + $scope.showTable = false; + }; + + $scope.$on('SET_LINK_DATA', function(e, obj){ + $scope.linkData = obj; + $scope.show(); + $scope.$apply(); + }); + }]); + + gbp.register.controller('crudCtrl',['$scope', function($scope){ + $scope.selectedObj = null; + $scope.label = ''; + $scope.q = {}; + + $scope.add = function() { + $scope.selectedObj = null; + $scope.showForm(); + }; + + $scope.modify = function() { + $scope.$emit('PGN_EDIT_ELEM'); + }; + + $scope.init = function(label) { + $scope.label = label; + }; + + + $scope.$on('EV_SET_SEL_CLASS', function(event, selObj){ + $scope.selectedObj = selObj; + }); + }]); + + gbp.register.controller('contractCtrl', ['$scope','GBPContractServices', '$filter', function($scope, GBPContractServices, $filter){ + $scope.list = []; + $scope.selectedContract = null; + $scope.newContractObj = GBPContractServices.createObj(); + $scope.displayLabel = ['description','id']; + $scope.crudLabel = 'Contract list'; + + $scope.internalView = { + contract: false, + edit: "view" + }; + + var path = null, + mandatoryProperties = [], + clear = function(){ + $scope.list = []; + $scope.internalView = { + contract: false, + edit: "view" + }; + $scope.selectedContract = null; + $scope.newContractObj = GBPContractServices.createObj(); + }; + + $scope.init = function() { + if ( $scope.selectedTenant ) { + $scope.selectedContract = null; + path = GBPContractServices.createPathObj($scope.selectedTenant.id); + + GBPContractServices.load(path, function(data){ + $scope.list = data; + // $scope.$broadcast('GBP_CONTRACT_RELOAD'); + $scope.sendReloadEventFromRoot('GBP_CONTRACT_RELOAD'); + }, function(){ + + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + var resp = $scope.validateMandatory($scope.newContractObj, mandatoryProperties); + if(resp.status){ + path = GBPContractServices.createPathObj($scope.selectedTenant.id, $scope.newContractObj.id); + GBPContractServices.send(path, $scope.newContractObj, function(data){ + $scope.init(); + $scope.internalView.contract = false; + $scope.reloadNewObj(); + $scope.internalView.edit = "view"; + }, function(){ + //TODO: error cbk + }); + }else{ + alert($filter('translate')('GBP_MANDATORY_NOT_FILLED')+': '+resp.notFilledProps.join(', ')); + } + }; + + $scope.delete = function() { + if ( $scope.selectedContract ) { + path = GBPContractServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id); + GBPContractServices.delete(path, function(data){ + $scope.init(); + $scope.selectedContract = null; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reloadNewObj = function() { + $scope.newContractObj = GBPContractServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedContract = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.contract = true; + }else { + $scope.internalView.contract = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.contract) { + angular.copy(selectedObj, $scope.newContractObj); + } + $scope.sendReloadEventFromRoot('GBP_CONTRACT_RELOAD'); + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.contract = true; + $scope.selectedContract = null; + $scope.internalView.edit = "add"; + }; + + $scope.close = function(){ + $scope.internalView.contract = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if(!event.defaultPrevented) { + if ( $scope.selectedContract ) { + $scope.internalView.contract = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedContract, $scope.newContractObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(event){ + $scope.init(); + }); + + $scope.$on('GBP_CONTRACTS_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('clauseCtrl', ['$scope','GBPClauseServices', 'GBPSubjectServices', + function($scope, GBPClauseServices, GBPSubjectServices){ + $scope.list = []; + $scope.selectedClause = null; + $scope.newClauseObj = GBPClauseServices.createObj(); + $scope.internalView = { + clause: false, + edit: "view" + }; + $scope.displayLabel = 'name'; + $scope.crudLabel = 'Clause list'; + + $scope.subjects = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects); + + var path = null, + + clear = function(){ + $scope.list = []; + $scope.selectedClause = null; + $scope.newClauseObj = GBPClauseServices.createObj(); + $scope.internalView = { + clause: false, + edit: "view" + }; + }; + + //move to separate ctrl \/ + $scope.addNewElem = function(templateObj) { + if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { + var objToPush = templateObj || ""; + $scope.newClauseObj['subject-refs'].push(objToPush); + } + }; + + $scope.deleteElemAt = function(index) { + if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { + $scope.newClauseObj['subject-refs'].splice(index, 1); + } + }; + + $scope.updateAt = function(index, value) { + if($scope.newClauseObj && $scope.newClauseObj['subject-refs'] && $scope.newClauseObj['subject-refs'].length >= index) { + $scope.newClauseObj['subject-refs'][index] = value; + } + }; + //move to separate ctrl /\ + + var loadSubjects = function() { + $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects); + + GBPSubjectServices.load(path, function(data){ + $scope.subjects.options = data; + }, function(){ + //TODO: error cbk + }); + }; + + $scope.init = function() { + if ( $scope.selectedContract ) { + path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id); + + GBPClauseServices.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.clauseForm)){ + path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.newClauseObj.name); + GBPClauseServices.send(path, $scope.newClauseObj, function(data){ + $scope.init(); + $scope.internalView.clause = false; + $scope.reloadNewObj(); + $scope.internalView.clause = "view"; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if ( $scope.selectedClause ) { + path = GBPClauseServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedClause.name); + GBPClauseServices.delete(path, function(data){ + $scope.init(); + $scope.selectedClause = null; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reloadNewObj = function() { + $scope.newClauseObj = GBPClauseServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedClause = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.clause = true; + }else { + $scope.internalView.clause = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.clause) { + angular.copy(selectedObj, $scope.newClauseObj); + } + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.clause = true; + $scope.internalView.edit = "add"; + $scope.selectedClause = null; + }; + + $scope.close = function(){ + $scope.internalView.clause = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedClause ) { + $scope.internalView.clause = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedClause, $scope.newClauseObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_CONTRACT_RELOAD',function(){ + $scope.internalView.clause = false; + $scope.init(); + }); + + $scope.$on('GBP_SUBJECT_RELOAD',function(){ + loadSubjects(); + }); + }]); + + gbp.register.controller('subjectCtrl', ['$scope','GBPSubjectServices', '$filter', function($scope, GBPSubjectServices, $filter){ + $scope.list = []; + $scope.selectedSubject = null; + $scope.newSubjectObj = GBPSubjectServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + subject : false, + edit : "view" + }; + $scope.crudLabel = 'Subject list'; + $scope.errors = {}; + + var path = null, + mandatoryProperties = ['order'], + + clear = function(){ + $scope.list = []; + $scope.selectedSubject = null; + $scope.newSubjectObj = GBPSubjectServices.createObj(); + $scope.internalView = { + subject : false, + edit : "view" + }; + }; + + $scope.init = function() { + if ( $scope.selectedContract ) { + $scope.selectedSubject = null; + path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id); + + GBPSubjectServices.load(path, function(data){ + $scope.list = data; + $scope.sendReloadEventFromRoot('GBP_SUBJECT_RELOAD'); + }, function(){ + //TODO: error cbk + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.subjectForm)){ + path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.newSubjectObj.name); + GBPSubjectServices.send(path, $scope.newSubjectObj, function(data){ + $scope.init(); + $scope.internalView.subject = false; + $scope.reloadNewObj(); + $scope.internalView.edit = "view"; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if ( $scope.selectedSubject ) { + path = GBPSubjectServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name); + GBPSubjectServices.delete(path, function(data){ + $scope.init(); + $scope.selectedSubject = null; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reloadNewObj = function() { + $scope.newSubjectObj = GBPSubjectServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedSubject = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.subject = true; + }else { + $scope.internalView.subject = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.subject) { + angular.copy(selectedObj, $scope.newSubjectObj); + } + $scope.sendReloadEventFromRoot('GBP_SUBJECT_RELOAD'); + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.subject = true; + $scope.internalView.edit = "add"; + $scope.selectedSubject = null; + }; + + $scope.close = function(){ + $scope.internalView.subject = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedSubject ) { + $scope.internalView.subject = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedSubject, $scope.newSubjectObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_CONTRACT_RELOAD',function(){ + $scope.internalView.subject = false; + $scope.init(); + }); + + $scope.$on('GBP_SUBJECTS_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('ruleCtrl', ['$scope','GBPRuleServices', '$filter', function($scope, GBPRuleServices, $filter){ + $scope.list = []; + $scope.selectedRule = null; + $scope.newRuleObj = GBPRuleServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + rule : false, + edit : "view" + }; + $scope.crudLabel = 'Rule list'; + $scope.errors = {}; + + var path = null, + mandatoryProperties = ['order'], + + clear = function(){ + $scope.list = []; + $scope.selectedRule = null; + $scope.newRuleObj = GBPRuleServices.createObj(); + $scope.internalView = { + rule : false, + edit : "view" + }; + }; + + $scope.init = function() { + if ( $scope.selectedSubject ) { + $scope.selectedRule = null; + path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name); + + GBPRuleServices.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.rulesForm)){ + path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.newRuleObj.name); + GBPRuleServices.send(path, $scope.newRuleObj, function(data){ + $scope.init(); + $scope.internalView.rule = false; + $scope.reloadNewObj(); + $scope.internalView.edit = "view"; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if ( $scope.selectedRule ) { + path = GBPRuleServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name); + GBPRuleServices.delete(path, function(data){ + $scope.init(); + $scope.selectedRule = null; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reloadNewObj = function() { + $scope.newRuleObj = GBPRuleServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedRule = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.rule = true; + }else { + $scope.internalView.rule = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.rule) { + angular.copy(selectedObj, $scope.newRuleObj); + } + $scope.$broadcast('GBP_RULE_RELOAD'); + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.rule = true; + $scope.internalView.edit = "add"; + $scope.selectedRule = null; + }; + + $scope.close = function(){ + $scope.internalView.rule = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedRule ) { + $scope.internalView.rule = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedRule, $scope.newRuleObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_SUBJECT_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('actionRefCtrl', ['$scope','GBPActionRefsServices', 'GBPActionInstanceServices', '$filter', function($scope, GBPActionRefsServices, GBPActionInstanceServices, $filter){ + $scope.list = []; + $scope.selectedActionRef = null; + $scope.newActionRefObj = GBPActionRefsServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + actionRef : false, + edit : "view" + }; + $scope.crudLabel = 'Action ref list'; + $scope.errors = {}; + + $scope.actionInstanceNames = {'options' : [], 'labels' : $scope.displayLabel}; + + var path = null, + mandatoryProperties = ['order'], + + actionInstanceNamesLoad = function() { + var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id); + GBPActionInstanceServices.load(actionInstancePath, function(data){ + $scope.actionInstanceNames.options = data; + },function(){ + //TODO: error cbk + }); + }, + + clear = function(){ + $scope.list = []; + $scope.selectedActionRef = null; + $scope.newActionRefObj = GBPActionRefsServices.createObj(); + $scope.internalView = { + actionRef : false, + edit : "view" + }; + }; + + $scope.init = function() { + if ( $scope.selectedRule ) { + $scope.selectedActionRef = null; + path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name); + + GBPActionRefsServices.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + + actionInstanceNamesLoad(); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.actionRefForm)){ + path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.newActionRefObj.name); + GBPActionRefsServices.send(path, $scope.newActionRefObj, function(data){ + $scope.init(); + $scope.internalView.actionRef = false; + $scope.reloadNewObj(); + $scope.internalView.edit = "view"; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if ( $scope.selectedActionRef ) { + path = GBPActionRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.selectedActionRef.name); + GBPActionRefsServices.delete(path, function(data){ + $scope.init(); + $scope.selectedActionRef = null; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reloadNewObj = function() { + $scope.newActionRefObj = GBPActionRefsServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedActionRef = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.actionRef = true; + }else { + $scope.internalView.actionRef = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.actionRef) { + angular.copy(selectedObj, $scope.newActionRefObj); + } + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.actionRef = true; + $scope.internalView.edit = "add"; + $scope.selectedActionRef = null; + }; + + $scope.close = function(){ + $scope.internalView.actionRef = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedActionRef ) { + $scope.internalView.actionRef = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedActionRef, $scope.newActionRefObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_RULE_RELOAD',function(){ + $scope.internalView.actionRef = false; + $scope.init(); + }); + + $scope.$on('GBP_ACTION_INSTANCE_RELOAD',function(){ + actionInstanceNamesLoad(); + }); + }]); + + gbp.register.controller('classifierRefCtrl', ['$scope','GBPClassifierRefsServices', 'GBPClassifierInstanceServices', '$filter', function($scope, GBPClassifierRefsServices, GBPClassifierInstanceServices, $filter){ + $scope.list = []; + $scope.selectedClassifierRef = null; + $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + classifierRef : false, + edit : "view" + }; + + $scope.instanceNames = {'options' : [], 'labels' : $scope.displayLabel}; + + $scope.formDirections = ['in', 'out', 'bidirectional']; + $scope.formConnectionTracking = ['normal', 'reflexive']; + + $scope.crudLabel = 'Classifier ref list'; + + var path = null, + + instanceNamesLoad = function() { + var classifierInstancePath = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id); + GBPClassifierInstanceServices.load(classifierInstancePath, function(data){ + $scope.instanceNames.options = data; + },function(){ + //TODO: error cbk + }); + }, + + clear = function(){ + $scope.list = []; + $scope.selectedClassifierRef = null; + $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); + $scope.internalView = { + classifierRef : false, + edit : "view" + }; + }; + + $scope.init = function() { + if ( $scope.selectedRule ) { + $scope.selectedClassifierRef = null; + path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name); + + + + GBPClassifierRefsServices.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + + instanceNamesLoad(); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.classifierRefForm)){ + path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.newClassifierRefObj.name); + GBPClassifierRefsServices.send(path, $scope.newClassifierRefObj, function(data){ + $scope.init(); + $scope.internalView.classifierRef = false; + $scope.reloadNewObj(); + $scope.internalView.edit = "view"; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if ( $scope.selectedClassifierRef ) { + path = GBPClassifierRefsServices.createPathObj($scope.selectedTenant.id, $scope.selectedContract.id, $scope.selectedSubject.name, $scope.selectedRule.name, $scope.selectedClassifierRef.name); + GBPClassifierRefsServices.delete(path, function(data){ + $scope.init(); + $scope.selectedClassifierRef = null; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reloadNewObj = function() { + $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedClassifierRef = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.classifierRef = true; + }else { + $scope.internalView.classifierRef = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.classifierRef) { + angular.copy(selectedObj, $scope.newClassifierRefObj); + } + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.classifierRef = true; + $scope.internalView.edit = "add"; + $scope.selectedClassifierRef = null; + }; + + $scope.close = function(){ + $scope.internalView.classifierRef = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedClassifierRef ) { + $scope.internalView.classifierRef = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedClassifierRef, $scope.newClassifierRefObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_RULE_RELOAD',function(){ + $scope.internalView.classifierRef = false; + $scope.init(); + }); + + $scope.$on('GBP_CLASSIFIER_INSTANCE_RELOAD',function(){ + instanceNamesLoad(); + }); + }]); + + gbp.register.controller('tenantCtrl', ['$scope', 'GBPTenantServices', '$filter', function($scope, GBPTenantServices, $filter){ + $scope.list = []; + $scope.selectedTenantObj = null; + $scope.newTenantObj = GBPTenantServices.createObj(); + $scope.displayLabel = ['name' , 'id']; + $scope.crudLabel = 'Tenants list'; + + $scope.view = { + tenant: false, + edit: "view" + }; + + $scope.init = function() { + GBPTenantServices.load( + function(data) { + $scope.list = data; + $scope.newTenantObj = GBPTenantServices.createObj(); + $scope.selectedTenantObj = null; + }, + function(){ + //TODO error + }); + }; + + $scope.save = function(){ + if($scope.validateForm($scope.tenantForm)){ + path = GBPTenantServices.createPathObj($scope.newTenantObj.id); + GBPTenantServices.send(path, $scope.newTenantObj, function(data){ + $scope.init(); + $scope.view.tenant = false; + $scope.view.edit = "view"; + $scope.$emit('GBP_GLOBAL_TENANT_RELOAD'); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenantObj) { + path = GBPTenantServices.createPathObj($scope.selectedTenantObj.id); + + GBPTenantServices.delete(path, function(data){ + $scope.init(); + $scope.view.tenant = false; + $scope.$emit('GBP_GLOBAL_TENANT_RELOAD'); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reload = function(selectedObj) { + $scope.selectedTenantObj = selectedObj; + + $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; + if(selectedObj){ + $scope.view.tenant = true; + } + else { + $scope.view.tenant = false; + $scope.view.edit = "view"; + } + + if ($scope.view.tenant) { + angular.copy(selectedObj, $scope.newTenantObj); + } + }; + + $scope.showForm = function() { + $scope.newTenantObj = GBPTenantServices.createObj(); + $scope.selectedTenantObj = null; + $scope.view.tenant = true; + $scope.view.edit = "add"; + }; + + $scope.close = function(){ + $scope.view.tenant = false; + $scope.view.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedTenantObj ) { + $scope.view.tenant = true; + $scope.view.edit = "edit"; + angular.copy($scope.selectedTenantObj, $scope.newTenantObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_GLOBAL_TENANT_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('epgCtrl',['$scope', 'GBPEpgServices', 'GBPContractServices', '$filter', + function($scope, GBPEpgServices, GBPContractServices, $filter){ + $scope.selectedEpg = null; + $scope.newEpgObj = GBPEpgServices.createObj(); + $scope.displayLabel = ['name', 'id']; + $scope.crudLabel = 'Group list'; + + $scope.igpOpts = ['allow', 'require-contract']; + + $scope.contracts = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contracts); + + $scope.list = []; + + $scope.internalView = { + epg: false, + edit: "view" + }; + + var loadContracts = function() { + GBPContractServices.load(path, function(data){ + $scope.contracts.options = data; + }, function(){ + //TODO: error cbk + }); + }, + + mandatoryProperties = ['name'], + + clear = function(){ + $scope.list = []; + $scope.selectedEpg = null; + $scope.newEpgObj = GBPEpgServices.createObj(); + $scope.internalView = { + epg: false, + edit: "view" + }; + }; + + $scope.init = function() { + if ($scope.selectedTenant) { + path = GBPEpgServices.createPathObj($scope.selectedTenant.id); + + GBPEpgServices.load(path, function(data){ + $scope.list = data; + // $scope.$broadcast('GBP_EPG_RELOAD'); + $scope.sendReloadEventFromRoot('GBP_EPG_RELOAD'); + }, function(){ + //TODO: error cbk + }); + + loadContracts(); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.epgForm)){ + path = GBPEpgServices.createPathObj($scope.selectedTenant.id, $scope.newEpgObj.id); + GBPEpgServices.send(path, $scope.newEpgObj, function(data){ + $scope.init(); + $scope.internalView.epg = false; + $scope.reloadNewObj(); + $scope.internalView.edit = "view"; + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedEpg) { + path = GBPEpgServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id); + GBPEpgServices.delete(path, function(data){ + $scope.init(); + $scope.internalView.epg = false; + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.showForm = function() { + $scope.internalView.epg = true; + $scope.reloadNewObj(); + $scope.selectedEpg = null; + $scope.internalView.edit = "add"; + }; + + $scope.reloadNewObj = function() { + $scope.newEpgObj = GBPEpgServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedEpg = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.epg = true; + }else { + $scope.internalView.epg = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.epg) { + angular.copy(selectedObj, $scope.newEpgObj); + } + $scope.sendReloadEventFromRoot('GBP_EPG_RELOAD'); + }; + + $scope.close = function(){ + $scope.internalView.epg = false; + $scope.internalView.edit = "view"; + }; + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEpg ) { + $scope.internalView.epg = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedEpg, $scope.newEpgObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_CONTRACT_RELOAD',function(){ + loadContracts(); + }); + + $scope.$on('GBP_EPG_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('cnsCtrl',['$scope', 'GBPConNamedSelServices', function($scope, GBPConNamedSelServices){ + $scope.list = []; + $scope.selectedCNS = null; + $scope.newCNSObj = GBPConNamedSelServices.createObj(); + $scope.internalView = { + cns: false, + edit: "view" + }; + $scope.displayLabel = 'name'; + $scope.crudLabel = 'Consumer named selectors list'; + + var clear = function(){ + $scope.list = []; + $scope.selectedCNS = null; + $scope.newCNSObj = GBPConNamedSelServices.createObj(); + $scope.internalView = { + cns: false, + edit: "view" + }; + }; + + //move to separate ctrl \/ + $scope.addNewElem = function(templateObj) { + if($scope.newCNSObj && $scope.newCNSObj.contract) { + var objToPush = templateObj || ""; + $scope.newCNSObj.contract.push(objToPush); + } + }; + + $scope.deleteElemAt = function(index) { + if($scope.newCNSObj && $scope.newCNSObj.contract) { + $scope.newCNSObj.contract.splice(index, 1); + } + }; + + $scope.updateAt = function(index, value) { + if($scope.newCNSObj && $scope.newCNSObj.contract && $scope.newCNSObj.contract.length >= index) { + $scope.newCNSObj.contract[index] = value; + } + }; + //move to separate ctrl /\ + + $scope.init = function() { + if ($scope.selectedTenant && $scope.selectedEpg) { + path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id); + + GBPConNamedSelServices.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.cnsForm)){ + path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.newCNSObj.name); + GBPConNamedSelServices.send(path, $scope.newCNSObj, function(data){ + $scope.init(); + $scope.internalView.cns = false; + $scope.internalView.cns = "view"; + $scope.reloadNewObj(); + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedEpg && $scope.selectedCNS) { + path = GBPConNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedCNS.name); + GBPConNamedSelServices.delete(path, function(data){ + $scope.init(); + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.selectedCNS = null; + $scope.internalView.cns = true; + $scope.internalView.edit = "add"; + }; + + $scope.reloadNewObj = function() { + $scope.newCNSObj = GBPConNamedSelServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedCNS = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.cns = true; + }else { + $scope.internalView.cns = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.cns) { + angular.copy(selectedObj, $scope.newCNSObj); + } + }; + + $scope.close = function(){ + $scope.internalView.cns = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEpg ) { + $scope.internalView.cns = true; + $scope.internalView.edit = "add"; + angular.copy($scope.selectedCNS, $scope.newCNSObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_EPG_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('pnsCtrl',['$scope', 'GBPProNamedSelServices', function($scope, GBPProNamedSelServices){ + $scope.list = []; + $scope.selectedPNS = null; + $scope.newPNSObj = GBPProNamedSelServices.createObj(); + $scope.displayLabel = 'name'; + $scope.crudLabel = 'Provider named selectors list'; + $scope.internalView = { + pns: false, + edit: "view" + }; + + var clear = function(){ + $scope.list = []; + $scope.selectedPNS = null; + $scope.newPNSObj = GBPProNamedSelServices.createObj(); + $scope.internalView = { + pns: false, + edit: "view" + }; + }; + + //move to separate ctrl \/ + $scope.addNewElem = function(templateObj) { + if($scope.newPNSObj && $scope.newPNSObj.contract) { + var objToPush = templateObj || ""; + $scope.newPNSObj.contract.push(objToPush); + } + }; + + $scope.deleteElemAt = function(index) { + if($scope.newPNSObj && $scope.newPNSObj.contract) { + $scope.newPNSObj.contract.splice(index, 1); + } + }; + + $scope.updateAt = function(index, value) { + if($scope.newPNSObj && $scope.newPNSObj.contract && $scope.newPNSObj.contract.length >= index) { + $scope.newPNSObj.contract[index] = value; + } + }; + //move to separate ctrl /\ + + $scope.init = function() { + if ($scope.selectedTenant && $scope.selectedEpg) { + path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id); + + GBPProNamedSelServices.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.pnsForm)){ + path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.newPNSObj.name); + GBPProNamedSelServices.send(path, $scope.newPNSObj, function(data){ + $scope.init(); + $scope.internalView.pns = false; + $scope.reloadNewObj(); + $scope.internalView.cns = "view"; + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedEpg && $scope.selectedPNS) { + path = GBPProNamedSelServices.createPathObj($scope.selectedTenant.id, $scope.selectedEpg.id, $scope.selectedPNS.name); + GBPProNamedSelServices.delete(path, function(data){ + $scope.init(); + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.pns = true; + $scope.internalView.edit = "add"; + $scope.selectedPNS = null; + }; + + $scope.reloadNewObj = function() { + $scope.newPNSObj = GBPProNamedSelServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedPNS = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.pns = true; + }else { + $scope.internalView.pns = false; + $scope.internalView.edit = "view"; + } + + if($scope.internalView.pns) { + angular.copy(selectedObj, $scope.newPNSObj); + } + }; + + $scope.close = function(){ + $scope.internalView.pns = false; + $scope.internalView.edit = "view"; + }; + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEpg ) { + $scope.internalView.pns = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedPNS, $scope.newPNSObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_EPG_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('l2FloodCtrl', ['$scope', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', '$filter', function($scope, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, $filter){ + $scope.list = []; + $scope.selectedL2Flood = null; + $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); + $scope.displayLabel = ['name', 'id']; + $scope.crudLabel = 'L2 Flood Domain list'; + + $scope.l2bridge = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L2BRIDGE_LABEL', $scope.l2bridge); + + $scope.view = { + l2flood: false, + edit: "view" + }; + + var path = null, + + loadL2BridgeList = function() { + GBPL2BridgeDomainServices.load(GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id), function(data){ + $scope.l2bridge.options = data; + }, function(){ + + }); + }, + + clear = function(){ + $scope.list = []; + $scope.selectedL2Flood = null; + $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); + $scope.view = { + l2flood: false, + edit: "view" + }; + }; + + $scope.init = function() { + if ( $scope.selectedTenant ) { + path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id); + + GBPL2FloodDomainServices.load(path, function(data){ + $scope.list = data; + // clear objects + $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); + $scope.selectedL2Flood = null; + }, function(){ + + }); + + loadL2BridgeList(); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.l2FloodForm)){ + path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id, $scope.newL2FloodObj.id); + GBPL2FloodDomainServices.send(path, $scope.newL2FloodObj, function(data){ + $scope.init(); + $scope.view.l2flood = false; + $scope.view.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD'); + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedL2Flood) { + path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id, $scope.selectedL2Flood.id); + GBPL2FloodDomainServices.delete(path, function(data){ + $scope.init(); + $scope.view.l2flood = false; + $scope.view.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD'); + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reload = function(selectedObj) { + $scope.selectedL2Flood = selectedObj; + + $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; + if(selectedObj){ + $scope.view.l2flood = true; + } + else { + $scope.view.l2flood = false; + $scope.view.edit = "view"; + } + + if ($scope.view.l2flood) { + angular.copy(selectedObj, $scope.newL2FloodObj); + } + + $scope.sendReloadEventFromRoot('GBP_L2FLOOD_RELOAD'); + }; + + $scope.showForm = function() { + $scope.newL2FloodObj = GBPL2FloodDomainServices.createObj(); + $scope.selectedL2Flood = null; + $scope.view.l2flood = true; + $scope.view.edit = "add"; + }; + + $scope.close = function(){ + $scope.view.l2flood = false; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedL2Flood ) { + $scope.view.l2flood = true; + $scope.view.edit = "edit"; + angular.copy($scope.selectedL2Flood, $scope.newL2FloodObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ + loadL2BridgeList(); + }); + + $scope.$on('GBP_L2FLOOD_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('l2BridgeCtrl', ['$scope', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', '$filter', function($scope, GBPL2BridgeDomainServices, GBPL3ContextServices, $filter){ + $scope.list = []; + $scope.selectedL2Bridge = null; + $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); + $scope.displayLabel = ['name', 'id']; + $scope.crudLabel = 'L2 Bridge Domain list'; + + $scope.l3context = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context); + + $scope.view = { + l2bridge: false, + edit: "view" + }; + + var path = null, + + loadL3ContextList = function() { + GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){ + $scope.l3context.options = data; + //$scope.$broadcast('GBP_L2BRIDGE_RELOAD'); + }, function(){ + + }); + }, + + clear = function(){ + $scope.list = []; + $scope.selectedL2Bridge = null; + $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); + $scope.view = { + l2bridge: false, + edit: "view" + }; + }; + + $scope.init = function() { + if ( $scope.selectedTenant ) { + path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id); + + GBPL2BridgeDomainServices.load(path, function(data){ + $scope.list = data; + $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); + $scope.selectedL2Bridge = null; + // $scope.$broadcast('GBP_L2BRIDGE_RELOAD'); + }, function(){ + + }); + + loadL3ContextList(); + }else{ + clear(); + } + }; + + + + $scope.save = function(){ + if($scope.validateForm($scope.l2BridgeForm)){ + path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id, $scope.newL2BridgeObj.id); + GBPL2BridgeDomainServices.send(path, $scope.newL2BridgeObj, function(data){ + $scope.init(); + $scope.view.l2bridge = false; + $scope.view.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedL2Bridge) { + path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id, $scope.selectedL2Bridge.id); + GBPL2BridgeDomainServices.delete(path, function(data){ + $scope.init(); + $scope.view.l2bridge = false; + $scope.view.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reload = function(selectedObj) { + $scope.selectedL2Bridge = selectedObj; + + $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; + if(selectedObj){ + $scope.view.l2bridge = true; + } + else { + $scope.view.l2bridge = false; + $scope.view.edit = "view"; + } + + if ($scope.view.l2bridge) { + angular.copy(selectedObj, $scope.newL2BridgeObj); + } + + $scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); + }; + + $scope.showForm = function() { + $scope.newL2BridgeObj = GBPL2BridgeDomainServices.createObj(); + $scope.selectedL2Bridge = null; + $scope.view.l2bridge = true; + $scope.view.edit = "add"; + }; + + $scope.close = function(){ + $scope.view.l2bridge = false; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedL2Bridge ) { + $scope.view.l2bridge = true; + $scope.view.edit = "edit"; + angular.copy($scope.selectedL2Bridge, $scope.newL2BridgeObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ + loadL3ContextList(); + }); + + $scope.$on('GBP_L2BRIDGE_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('l3ContextCtrl', ['$scope', 'GBPL3ContextServices', '$filter', function($scope, GBPL3ContextServices, $filter){ //GBPContractServices + $scope.list = []; + $scope.selectedL3Context = null; + $scope.newL3ContextObj = GBPL3ContextServices.createObj(); + $scope.displayLabel = ['name', 'id']; + $scope.crudLabel = 'L3 Context list'; + + $scope.view = { + l3context: false, + edit: "view" + }; + + var path = null, + + clear = function(){ + $scope.list = []; + $scope.view = { + l3context: false, + edit: "view" + }; + $scope.selectedL3Context = null; + $scope.newL3ContextObj = GBPL3ContextServices.createObj(); + }; + + $scope.init = function() { + if ( $scope.selectedTenant ) { + path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id); + + GBPL3ContextServices.load(path, function(data){ + $scope.list = data; + $scope.newL3ContextObj = GBPL3ContextServices.createObj(); + $scope.selectedL3Context = null; + }, function(){ + + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.l3ContextForm)){ + path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id, $scope.newL3ContextObj.id); + GBPL3ContextServices.send(path, $scope.newL3ContextObj, function(data){ + $scope.init(); + $scope.view.l3context = false; + $scope.view.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD'); + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedL3Context) { + path = GBPL3ContextServices.createPathObj($scope.selectedTenant.id, $scope.selectedL3Context.id); + GBPL3ContextServices.delete(path, function(data){ + $scope.init(); + $scope.view.l3context = false; + $scope.view.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD'); + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reload = function(selectedObj) { + $scope.selectedL3Context = selectedObj; + + $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; + if(selectedObj){ + $scope.view.l3context = true; + } + else { + $scope.view.l3context = false; + $scope.view.edit = "view"; + } + + if($scope.view.l3context) { + angular.copy(selectedObj, $scope.newL3ContextObj); + } + + $scope.sendReloadEventFromRoot('GBP_L3CONTEXT_RELOAD'); + }; + + $scope.showForm = function() { + $scope.newL3ContextObj = GBPL3ContextServices.createObj(); + $scope.selectedL3Context = null; + $scope.view.l3context = true; + $scope.view.edit = "add"; + }; + + $scope.close = function(){ + $scope.view.l3context = false; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedL3Context ) { + $scope.view.l3context = true; + $scope.view.edit = "edit"; + angular.copy($scope.selectedL3Context, $scope.newL3ContextObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_L3CONTEXT_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('subnetCtrl', ['$scope', 'GBPSubnetServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', '$filter', function($scope, GBPSubnetServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, GBPL3ContextServices, $filter){ + $scope.list = []; + $scope.selectedSubnet = null; + $scope.newSubnetObj = GBPSubnetServices.createObj(); + $scope.displayLabel = ['name', 'id']; + $scope.crudLabel = 'Subnet list'; + + $scope.l2L3List = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2L3List); + + $scope.view = { + subnet: false, + edit: "view" + }; + + + var path = null, + + loadL2L3List = function() { + $scope.l2L3List.options = []; + + GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(l3ContextData){ + $scope.l2L3List.options = $scope.l2L3List.options.concat(l3ContextData); + }, function(){ + + }); + + GBPL2FloodDomainServices.load(GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id), function(l2FloodData){ + $scope.l2L3List.options = $scope.l2L3List.options.concat(l2FloodData); + }, function(){ + + }); + + GBPL2BridgeDomainServices.load(GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id), function(l2BridgeData){ + $scope.l2L3List.options = $scope.l2L3List.options.concat(l2BridgeData); + }, function(){ + + }); + }, + + clear = function(){ + $scope.list = []; + $scope.view = { + subnet: false, + edit: "view" + }; + $scope.selectedSubnet = null; + $scope.newSubnetObj = GBPSubnetServices.createObj(); + }; + + $scope.init = function() { + if ( $scope.selectedTenant ) { + path = GBPSubnetServices.createPathObj($scope.selectedTenant.id); + + GBPSubnetServices.load(path, function(data){ + $scope.list = data; + $scope.newSubnetObj = GBPSubnetServices.createObj(); + $scope.selectedSubnet = null; + + $scope.view.subnet = false; + $scope.view.edit = "view"; + //$scope.sendReloadEventFromRoot('GBP_L2BRIDGE_RELOAD'); + }, function(){ + + }); + + loadL2L3List(); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.subnetForm)){ + path = GBPSubnetServices.createPathObj($scope.selectedTenant.id, $scope.newSubnetObj.id); + GBPSubnetServices.send(path, $scope.newSubnetObj, function(data){ + $scope.init(); + $scope.view.subnet = false; + $scope.view.edit = "view"; + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedSubnet) { + path = GBPSubnetServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id); + GBPSubnetServices.delete(path, function(data){ + $scope.init(); + $scope.view.subnet = false; + $scope.view.edit = "view"; + + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reload = function(selectedObj) { + $scope.selectedSubnet = selectedObj; + + $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; + if(selectedObj){ + $scope.view.subnet = true; + } + else { + $scope.view.subnet = false; + $scope.view.edit = "view"; + } + + if($scope.view.subnet) { + angular.copy(selectedObj, $scope.newSubnetObj); + } + + $scope.sendReloadEventFromRoot('GBP_SUBNET_RELOAD'); + }; + + $scope.showForm = function() { + $scope.newSubnetObj = GBPSubnetServices.createObj(); + $scope.selectedSubnet = null; + $scope.view.subnet = true; + $scope.view.edit = "add"; + }; + + $scope.close = function(){ + $scope.view.subnet = false; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedSubnet ) { + $scope.view.subnet = true; + $scope.view.edit = "edit"; + angular.copy($scope.selectedSubnet, $scope.newSubnetObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_GATEWAY_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ + loadL2L3List(); + }); + + $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ + loadL2L3List(); + }); + + $scope.$on('GBP_L2FLOOD_RELOAD',function(){ + loadL2L3List(); + }); + + $scope.$on('GBP_PREFIX_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('gatewayCtrl', ['$scope', 'GBPGatewayServices', function($scope, GBPGatewayServices){ + $scope.list = []; + $scope.gatewayView = false; + $scope.selectedGateway = null; + $scope.newGatewayObj = GBPGatewayServices.createObj(); + $scope.displayLabel = 'gateway'; + $scope.crudLabel = 'Gateway list'; + $scope.internalView = { + gateway: false, + edit: "view" + }; + + var path = null, + + clear = function(){ + $scope.list = []; + $scope.gatewayView = false; + $scope.selectedGateway = null; + $scope.newGatewayObj = GBPGatewayServices.createObj(); + }; + + $scope.init = function() { + if ( $scope.selectedTenant && $scope.selectedSubnet ) { + path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id); + + GBPGatewayServices.load(path, function(data){ + $scope.list = data; + $scope.newGatewayObj = GBPGatewayServices.createObj(); + $scope.internalView.gateway = false; + $scope.selectedGateway = null; + }, function(){ + + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.gatewayForm)){ + path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.newGatewayObj.gateway); + GBPGatewayServices.send(path, $scope.newGatewayObj, function(data){ + $scope.init(); + $scope.internalView.gateway = false; + $scope.internalView.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_GATEWAY_RELOAD'); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedSubnet && $scope.selectedGateway) { + path = GBPGatewayServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway); + GBPGatewayServices.delete(path, function(data){ + $scope.init(); + $scope.internalView.gateway = false; + $scope.sendReloadEventFromRoot('GBP_GATEWAY_RELOAD'); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.reload = function(selectedObj) { + $scope.selectedGateway = selectedObj; + angular.copy(selectedObj, $scope.newGatewayObj); + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.gateway = true; + }else { + $scope.internalView.gateway = false; + $scope.internalView.edit = "view"; + } + + $scope.sendReloadEventFromRoot('GBP_GATEWAY_SET'); + }; + + $scope.showForm = function() { + $scope.newGatewayObj = GBPGatewayServices.createObj(); + $scope.internalView.gateway = true; + $scope.internalView.edit = "add"; + $scope.selectedGateway = null; + }; + + $scope.close = function(){ + $scope.internalView.gateway = false; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedGateway ) { + $scope.internalView.gateway = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedGateway, $scope.newGatewayObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_SUBNET_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_PREFIX_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('prefixCtrl', ['$scope', 'GBPPrefixServices', function($scope, GBPPrefixServices){ + $scope.list = []; + $scope.selectedPrefix = null; + $scope.newPrefixObj = GBPPrefixServices.createObj(); + $scope.displayLabel = 'prefix'; + $scope.crudLabel = 'Prefix list'; + $scope.internalView = { + prefix: false, + edit: "view" + }; + + var path = null, + + clear = function(){ + $scope.list = []; + $scope.selectedPrefix = null; + $scope.newPrefixObj = GBPPrefixServices.createObj(); + $scope.internalView = { + prefix: false, + edit: "view" + }; + }; + + $scope.init = function() { + if ( $scope.selectedTenant && $scope.selectedSubnet && $scope.selectedGateway) { + path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway); + + GBPPrefixServices.load(path, function(data){ + $scope.list = data; + $scope.newPrefixObj = GBPPrefixServices.createObj(); + $scope.internalView.prefix = false; + $scope.selectedPrefix = null; + }, function(){ + + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.prefixForm)){ + path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway, $scope.newPrefixObj.prefix); + GBPPrefixServices.send(path, $scope.newPrefixObj, function(data){ + $scope.init(); + $scope.internalView.prefix = false; + $scope.internalView.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_PREFIX_RELOAD'); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + path = GBPPrefixServices.createPathObj($scope.selectedTenant.id, $scope.selectedSubnet.id, $scope.selectedGateway.gateway, $scope.selectedPrefix.prefix); + GBPPrefixServices.delete(path, function(data){ + $scope.init(); + $scope.internalView.prefix = false; + $scope.sendReloadEventFromRoot('GBP_PREFIX_RELOAD'); + }, function(){ + //TODO: error cbk + }); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedPrefix = selectedObj; + $scope.internalView.edit = $scope.internalView.edit == "edit" ? $scope.internalView.edit : "view"; + if(selectedObj){ + $scope.internalView.prefix = true; + }else { + $scope.internalView.prefix = false; + $scope.internalView.edit = "view"; + } + + angular.copy(selectedObj, $scope.newPrefixObj); + }; + + $scope.showForm = function() { + $scope.newPrefixObj = GBPPrefixServices.createObj(); + $scope.internalView.prefix = true; + $scope.internalView.edit = "add"; + $scope.selectedPrefix = null; + }; + + $scope.close = function(){ + $scope.internalView.prefix = false; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedPrefix ) { + $scope.internalView.prefix = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedPrefix, $scope.newPrefixObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_GATEWAY_SET',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('renderersCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){ //GBPContractServices + $scope.classifierDefinitions = {'options' : [], 'labels' : null}; + $scope.actionDefinitions = {'options' : [], 'labels' : null}; + + //reload on event? + + var loadDefinitions = function() { + GPBServices.getDefinitions(function(classifierDefs, actionDefs) { + $scope.classifierDefinitions.options = classifierDefs; + $scope.getDisplayLabelsFromCtrl('GBP_CLASSIFIERS_LABEL', $scope.classifierDefinitions); + + $scope.actionDefinitions.options = actionDefs; + $scope.getDisplayLabelsFromCtrl('GBP_ACTIONS_LABEL', $scope.actionDefinitions); + }); + }; + + loadDefinitions(); + }]); + + gbp.register.controller('paramCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){ + $scope.value = null; + + $scope.init = function(param, paramValues) { + $scope.parameter = param; + + if(paramValues) { + paramValues.forEach(function(p) { + if($scope.parameter.name === p.name) { + $scope.value = GPBServices.getInstanceParamValue(p); + } + }); + } + }; + + $scope.$on('GBP_SAVE_PARAM', function(event){ + if($scope.value !== '' && $scope.value !== null) { + $scope.addParam($scope.parameter.name, $scope.parameter.type, $scope.value); + } + }); + + $scope.$on('GBP_SET_PARAM_VALUE', function(event, name, intVal, strVal) { + //console.info($scope.parameter, ' got GBP_SET_PARAM_VALUE', name, intVal, strVal, event); + + }); + + $scope.$on('GBP_RESET_PARAM', function(event){ + $scope.value = null; + }); + }]); + + gbp.register.controller('classifiersCtrl', ['$scope', 'GBPClassifierInstanceServices', 'GPBServices', '$filter', + function($scope, GBPClassifierInstanceServices, GPBServices, $filter){ + $scope.list = []; + $scope.classifiersView = false; + $scope.displayLabel = 'name'; + $scope.selectedClassifier = null; + $scope.crudLabel = 'Classifiers'; + $scope.newClassifierObj = GBPClassifierInstanceServices.createObj(); + $scope.edit = "view"; + + var mandatoryProperties = ['name'], + + clear = function(){ + $scope.list = []; + $scope.classifiersView = false; + $scope.selectedClassifier = null; + $scope.newClassifierObj = GBPClassifierInstanceServices.createObj(); + $scope.edit = "view"; + }; + + $scope.getDefinitionObjParams = function(id){ + return GPBServices.getDefinitionObjParams($scope.classifierDefinitions.options, id); + }; + + $scope.reloadDefs = function(){ + $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newClassifierObj['classifier-definition-id'])); + }; + + $scope.addParam = function(name, type, value) { + $scope.newClassifierObj['parameter-value'].push(GPBServices.createParamObj(name, type, value)); + }; + + var saveParams = function() { + $scope.newClassifierObj['parameter-value'] = []; + $scope.$broadcast('GBP_SAVE_PARAM'); + }; + + + $scope.init = function() { + if ( $scope.selectedTenant ) { + path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id); + GBPClassifierInstanceServices.load(path, function(data){ + $scope.list = data; + $scope.reloadDefs(); + }, function(){ + //TODO: error cbk + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.classifierForm)){ + path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id, $scope.newClassifierObj.name); + saveParams(); + GBPClassifierInstanceServices.send(path, $scope.newClassifierObj, function(data){ + $scope.init(); + $scope.classifiersView = false; + $scope.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD'); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.showForm = function() { + $scope.newClassifierObj = GBPClassifierInstanceServices.createObj(); + $scope.selectedClassifier = null; + $scope.classifiersView = true; + $scope.edit = "add"; + $scope.reloadDefs(); + }; + + $scope.reload = function(selectedObj){ + $scope.selectedClassifier = selectedObj; + $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD'); + + $scope.edit = $scope.edit == "edit" ? $scope.edit : "view"; + if(selectedObj){ + $scope.classifiersView = true; + } + else { + $scope.classifiersView = false; + $scope.edit = "view"; + } + + if($scope.classifiersView) { + angular.copy(selectedObj, $scope.newClassifierObj); + } + + $scope.reloadDefs(); + }; + + $scope.close = function(){ + $scope.classifiersView = false; + $scope.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedClassifier ) { + $scope.classifiersView = true; + angular.copy($scope.selectedClassifier, $scope.newClassifierObj); + $scope.edit = "edit"; + $scope.reloadDefs(); + } + event.defaultPrevented = true; + } + }); + + $scope.delete = function(){ + path = GBPClassifierInstanceServices.createPathObj($scope.selectedTenant.id, $scope.selectedClassifier.name); + GBPClassifierInstanceServices.delete(path, function(data){ + $scope.init(); + $scope.classifiersView = false; + $scope.sendReloadEventFromRoot('GBP_CLASSIFIER_INSTANCE_RELOAD'); + }, function(){ + //TODO: error cbk + }); + }; + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_CLASSIFIERS_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('actionsCtrl', ['$scope', 'GBPActionInstanceServices', 'GPBServices', '$filter', + function($scope, GBPActionInstanceServices, GPBServices, $filter){ + $scope.list = []; + $scope.actionsView = false; + $scope.displayLabel = 'name'; + $scope.selectedAction = null; + $scope.crudLabel = 'Actions'; + $scope.newActionObj = GBPActionInstanceServices.createObj(); + $scope.edit = "view"; + + var mandatoryProperties = ['name'], + + clear = function(){ + $scope.list = []; + $scope.actionsView = false; + $scope.selectedAction = null; + $scope.newActionObj = GBPActionInstanceServices.createObj(); + $scope.edit = "view"; + }; + + $scope.getDefinitionObjParams = function(id){ + return GPBServices.getDefinitionObjParams($scope.actionDefinitions.options, id); + }; + + $scope.reloadDefs = function(){ + $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newActionObj['action-definition-id'])); + }; + + $scope.addParam = function(name, type, value) { + $scope.newActionObj['parameter-value'].push(GPBServices.createParamObj(name, type, value)); + }; + + var saveParams = function() { + $scope.newActionObj['parameter-value'] = []; + $scope.$broadcast('GBP_SAVE_PARAM'); + }; + + + $scope.init = function() { + if ( $scope.selectedTenant ) { + path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id); + GBPActionInstanceServices.load(path, function(data){ + $scope.list = data; + $scope.reloadDefs(); + }, function(){ + //TODO: error cbk + }); + }else{ + clear(); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.actionsForm)){ + path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id, $scope.newActionObj.name); + saveParams(); + + GBPActionInstanceServices.send(path, $scope.newActionObj, function(data){ + $scope.init(); + $scope.actionsView = false; + $scope.edit = "view"; + $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.showForm = function() { + $scope.newActionObj = GBPActionInstanceServices.createObj(); + $scope.selectedAction = null; + $scope.actionsView = true; + $scope.edit = "add"; + $scope.reloadDefs(); + }; + + $scope.reload = function(selectedObj){ + $scope.selectedAction = selectedObj; + $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); + + $scope.edit = $scope.edit == "edit" ? $scope.edit : "view"; + if(selectedObj){ + $scope.actionsView = true; + } + else { + $scope.actionsView = false; + $scope.edit = "view"; + } + + if($scope.actionsView) { + angular.copy(selectedObj, $scope.newActionObj); + } + + $scope.reloadDefs(); + }; + + $scope.close = function(){ + $scope.actionsView = false; + $scope.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedAction ) { + $scope.actionsView = true; + angular.copy($scope.selectedAction, $scope.newActionObj); + $scope.edit = "edit"; + $scope.reloadDefs(); + } + event.defaultPrevented = true; + } + }); + + $scope.delete = function(){ + path = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id, $scope.selectedAction.name); + GBPActionInstanceServices.delete(path, function(data){ + $scope.init(); + $scope.actionsView = false; + $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); + }, function(){ + //TODO: error cbk + }); + }; + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_ACTIONS_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + }]); + + gbp.register.controller('endpointCtrl', ['$scope', 'GBPEndpointServices', 'GPBServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', 'GBPL3ContextServices', 'GBPEpgServices', '$filter', 'GBPSubnetServices', + function($scope, GBPEndpointServices, GPBServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, GBPL3ContextServices, GBPEpgServices, $filter, GBPSubnetServices){ + $scope.list = []; + $scope.selectedEndpoint = null; + $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); + $scope.displayLabel = function(obj) { + return obj['mac-address'] + ':' + obj['l2-context']; + }; + $scope.crudLabel = 'Endpoint list'; + + $scope.l2context = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2context); + + $scope.l3context = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context); + + $scope.subnet = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_SUBNET_LABEL', $scope.subnet); + + $scope.epg = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_EPG_LABEL', $scope.epg); + + $scope.networkContainment = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.networkContainment); + + $scope.view = { + endpoint: false, + edit: "view" + }; + + var path = null, + mandatoryProperties = [], + + loadEpgOptions = function() { + $scope.epg.options = []; + + path = GBPEpgServices.createPathObj($scope.selectedTenant.id); + GBPEpgServices.load(path, function(data){ + $scope.epg.options = data; + }, function(){ + //TODO: error cbk + }); + }, + + loadL2ContextOptions = function() { + removeL2ContextOptions($scope.networkContainment.options, $scope.l2context.options); + $scope.l2context.options = []; + + path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id); + + GBPL2FloodDomainServices.load(path, function(data){ + $scope.l2context.options = $scope.l2context.options.concat(data); + $scope.networkContainment.options = $scope.networkContainment.options.concat(data); + }, function(){ + + }); + + path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id); + GBPL2BridgeDomainServices.load(path, function(data){ + $scope.l2context.options = $scope.l2context.options.concat(data); + $scope.networkContainment.options = $scope.networkContainment.options.concat(data); + }, function(){ + + }); + }, + + loadL3ContextOptions = function(){ + removeL2ContextOptions($scope.networkContainment.options, $scope.l3context.options); + $scope.l3context.options = []; + + GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){ + $scope.l3context.options = data; + $scope.networkContainment.options = $scope.networkContainment.options.concat(data); + }, function(){ + + }); + }, + + loadSubnetOptions = function(){ + $scope.subnet.options = []; + + GBPSubnetServices.load(GBPSubnetServices.createPathObj($scope.selectedTenant.id), function(data){ + $scope.subnet.options = data; + $scope.networkContainment.options = $scope.networkContainment.options.concat(data); + }, function(){ + + }); + }, + + loadNetworkCotnaninemnt = function(){ + $scope.networkContainment.options = []; + + loadL2ContextOptions(); + loadL3ContextOptions(); + loadSubnetOptions(); + }, + + clear = function(){ + $scope.list = []; + $scope.selectedEndpoint = null; + $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); + $scope.view = { + endpoint: false, + edit: "view" + }; + }, + removeL2ContextOptions = function(arr1, arr2) { + arr1 = arr1.filter( function( el ) { + return arr2.indexOf( el ) < 0; + }); + }; + + $scope.init = function() { + if ($scope.selectedTenant) { + + GBPEndpointServices.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + + loadEpgOptions(); + /*loadL2ContextOptions(); + loadL3ContextOptions(); + loadSubnetOptions();*/ + loadNetworkCotnaninemnt(); + }else{ + clear(); + } + }; + + $scope.addNewL3address = function() { + if($scope.newEndpointObj) { + if(!$scope.newEndpointObj['l3-address']){ + $scope.newEndpointObj['l3-address'] = []; + } + var objToPush = {'l3-context' : '', 'ip-address' : ''}; + $scope.newEndpointObj['l3-address'].push(objToPush); + } + }; + + $scope.deleteNewL3address = function(index){ + if($scope.newEndpointObj) { + $scope.newEndpointObj['l3-address'].splice(index, 1); + } + }; + + $scope.addNewLeafListEl = function(prop) { + if($scope.newEndpointObj) { + if(!$scope.newEndpointObj[prop]){ + $scope.newEndpointObj[prop] = []; + } + var objToPush = ""; + $scope.newEndpointObj[prop].push(objToPush); + } + }; + + $scope.updateLeafListEl = function(index, value, prop) { + if($scope.newEndpointObj && $scope.newEndpointObj[prop] && $scope.newEndpointObj[prop].length >= index) { + $scope.newEndpointObj[prop][index] = value; + } + }; + + $scope.deleteNewLeafListEl = function(index, prop){ + if($scope.newEndpointObj) { + $scope.newEndpointObj[prop].splice(index, 1); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.endpointForm)){ + GBPEndpointServices.send(path, $scope.newEndpointObj, function(data){ + $scope.init(); + $scope.view.endpoint = false; + $scope.reloadNewObj(); + $scope.view.edit = "view"; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedEndpoint) { + GBPEndpointServices.delete(path, $scope.selectedEndpoint, function(data){ + $scope.init(); + $scope.view.endpoint = false; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.showForm = function() { + $scope.view.endpoint = true; + $scope.reloadNewObj(); + $scope.selectedEndpoint = null; + + $scope.view.edit = "add"; + }; + + $scope.reloadNewObj = function() { + $scope.newEndpointObj = GBPEndpointServices.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedEndpoint = selectedObj; + $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; + if(selectedObj){ + $scope.view.endpoint = true; + } + else { + $scope.view.endpoint = false; + $scope.view.edit = "view"; + } + + if($scope.view.endpoint) { + angular.copy(selectedObj, $scope.newEndpointObj); + } + }; + + $scope.close = function(){ + $scope.view.endpoint = false; + $scope.view.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEndpoint ) { + $scope.view.endpoint = true; + $scope.view.edit = "edit"; + angular.copy($scope.selectedEndpoint, $scope.newEndpointObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_EPG_RELOAD',function(){ + loadEpgOptions(); + }); + + $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ + //loadL2ContextOptions(); + loadNetworkCotnaninemnt(); + }); + + $scope.$on('GBP_L2FLOOD_RELOAD',function(){ + //loadL2ContextOptions(); + loadNetworkCotnaninemnt(); + }); + + $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ + //loadL3ContextOptions(); + loadNetworkCotnaninemnt(); + }); + + $scope.$on('GBP_SUBNET_RELOAD',function(){ + //loadSubnetOptions(); + loadNetworkCotnaninemnt(); + }); + }]); + + gbp.register.controller('l3EndpointCtrl', ['$scope', 'GBPEndpointL3Services', 'GPBServices', 'GBPEpgServices', 'GBPL3ContextServices', 'GBPL2FloodDomainServices', 'GBPL2BridgeDomainServices', '$filter', + function($scope, GBPEndpointL3Services, GPBServices, GBPEpgServices, GBPL3ContextServices, GBPL2FloodDomainServices, GBPL2BridgeDomainServices, $filter){ + $scope.list = []; + $scope.selectedEndpoint = null; + $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); + $scope.displayLabel = function(obj) { + return obj['ip-prefix'] + ':' + obj['l3-context']; + }; + $scope.crudLabel = 'L3 Prefix endpoint list'; + + $scope.l2context = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L2FLOOD_LABEL', $scope.l2context); + + $scope.l3context = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_L3CONTEXT_LABEL', $scope.l3context); + + $scope.epg = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_EPG_LABEL', $scope.epg); + + $scope.view = { + endpoint: false, + edit: "view" + }; + + var path = null, + mandatoryProperties = [], + + loadEpgOptions = function() { + $scope.epg.options = []; + + path = GBPEpgServices.createPathObj($scope.selectedTenant.id); + GBPEpgServices.load(path, function(data){ + $scope.epg.options = data; + }, function(){ + //TODO: error cbk + }); + }, + + loadL2ContextOptions = function() { + $scope.l2context.options = []; + + path = GBPL2FloodDomainServices.createPathObj($scope.selectedTenant.id); + + GBPL2FloodDomainServices.load(path, function(data){ + $scope.l2context.options = $scope.l2context.options.concat(data); + }, function(){ + + }); + + path = GBPL2BridgeDomainServices.createPathObj($scope.selectedTenant.id); + GBPL2BridgeDomainServices.load(path, function(data){ + $scope.l2context.options = $scope.l2context.options.concat(data); + }, function(){ + + }); + }, + + loadL3ContextOptions = function(){ + $scope.l3context.options = []; + + GBPL3ContextServices.load(GBPL3ContextServices.createPathObj($scope.selectedTenant.id), function(data){ + $scope.l3context.options = data; + }, function(){ + + }); + }, + + clear = function(){ + $scope.list = []; + $scope.selectedEndpoint = null; + $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); + $scope.view = { + endpoint: false, + edit: "view" + }; + }; + + $scope.init = function() { + if ($scope.selectedTenant) { + + GBPEndpointL3Services.load(path, function(data){ + $scope.list = data; + }, function(){ + //TODO: error cbk + }); + + loadEpgOptions(); + loadL2ContextOptions(); + loadL3ContextOptions(); + }else{ + clear(); + } + }; + + $scope.addNewL2gateways = function() { + if($scope.newEndpointObj) { + if(!$scope.newEndpointObj['endpoint-l2-gateways']){ + $scope.newEndpointObj['endpoint-l2-gateways'] = []; + } + var objToPush = {'l2-context' : '', 'mac-address' : ''}; + $scope.newEndpointObj['endpoint-l2-gateways'].push(objToPush); + } + }; + + $scope.deleteNewL2gateways = function(index){ + if($scope.newEndpointObj) { + $scope.newEndpointObj['endpoint-l2-gateways'].splice(index, 1); + } + }; + + $scope.addNewL3gateways = function() { + if($scope.newEndpointObj) { + if(!$scope.newEndpointObj['endpoint-l3-gateways']){ + $scope.newEndpointObj['endpoint-l3-gateways'] = []; + } + var objToPush = {'l3-context' : '', 'ip-address' : ''}; + $scope.newEndpointObj['endpoint-l3-gateways'].push(objToPush); + } + }; + + $scope.deleteNewL3gateways = function(index){ + if($scope.newEndpointObj) { + $scope.newEndpointObj['endpoint-l3-gateways'].splice(index, 1); + } + }; + + $scope.addNewLeafListEl = function(prop) { + if($scope.newEndpointObj) { + if(!$scope.newEndpointObj[prop]){ + $scope.newEndpointObj[prop] = []; + } + var objToPush = ""; + $scope.newEndpointObj[prop].push(objToPush); + } + }; + + $scope.updateLeafListEl = function(index, value, prop) { + if($scope.newEndpointObj && $scope.newEndpointObj[prop] && $scope.newEndpointObj[prop].length >= index) { + $scope.newEndpointObj[prop][index] = value; + } + }; + + $scope.deleteNewLeafListEl = function(index, prop){ + if($scope.newEndpointObj) { + $scope.newEndpointObj[prop].splice(index, 1); + } + }; + + $scope.save = function(){ + if($scope.validateForm($scope.l3EndpointForm)){ + GBPEndpointL3Services.send(path, $scope.newEndpointObj, function(data){ + $scope.init(); + $scope.view.endpoint = false; + $scope.reloadNewObj(); + $scope.view.edit = "view"; + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.delete = function() { + if($scope.selectedTenant && $scope.selectedEndpoint) { + GBPEndpointL3Services.delete(path, $scope.selectedEndpoint, function(data){ + $scope.init(); + }, function(){ + //TODO: error cbk + }); + } + }; + + $scope.showForm = function() { + $scope.view.endpoint = true; + $scope.reloadNewObj(); + $scope.selectedEndpoint = null; + $scope.view.edit = "add"; + }; + + $scope.reloadNewObj = function() { + $scope.newEndpointObj = GBPEndpointL3Services.createObj($scope.selectedTenant ? $scope.selectedTenant.id : null); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedEndpoint = selectedObj; + angular.copy(selectedObj, $scope.newEndpointObj); + $scope.view.edit = $scope.view.edit == "edit" ? $scope.view.edit : "view"; + if(selectedObj){ + $scope.view.endpoint = true; + } + else { + $scope.view.endpoint = false; + $scope.view.edit = "view"; + } + }; + + $scope.close = function(){ + $scope.view.endpoint = false; + $scope.view.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEndpoint ) { + $scope.view.endpoint = true; + $scope.view.edit = "edit"; + angular.copy($scope.selectedEndpoint, $scope.newEndpointObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_EPG_RELOAD',function(){ + loadEpgOptions(); + }); + + $scope.$on('GBP_L2BRIDGE_RELOAD',function(){ + loadL2ContextOptions(); + }); + + $scope.$on('GBP_L2FLOOD_RELOAD',function(){ + loadL2ContextOptions(); + }); + + $scope.$on('GBP_L3CONTEXT_RELOAD',function(){ + loadL3ContextOptions(); + }); + }]); + + gbp.register.controller('accessModelWizardCtrl', ['$scope', '$filter', 'GBPTenantServices', 'GBPEpgServices', 'GBPContractServices', 'GPBServices', function($scope, $filter, GBPTenantServices, GBPEpgServices, GBPContractServices, GPBServices){ + $scope.wizardPage = null; + + $scope.selectedTenant = null; + $scope.tenant = null; + //$scope.epgList = []; + $scope.newContractObj = null; + + $scope.init = function() { + $scope.setPage('tenants'); + }; + + $scope.setPage = function(pageName, object) { + $scope.wizardPage = pageName; + + switch(pageName) { + case 'contracts': + if(object) { + $scope.tenant = object; + } + + break; + + case 'summary': + $scope.tenant['endpoint-group'] = $scope.tenant['endpoint-group'] ? $scope.tenant['endpoint-group'] : []; + + if(object) { + object.forEach(function(o) { + $scope.tenant['endpoint-group'].push(GPBServices.stripNullValues(o)); + }); + } + + break; + + case 'epgs': + $scope.tenant['contract'] = $scope.tenant['contract'] ? $scope.tenant['contract'] : []; + + if(object) { + object.forEach(function(o) { + $scope.tenant['contract'].push(GPBServices.stripNullValues(o)); + }); + } + + break; + } + }; + + $scope.submit = function(object) { + $scope.tenant['endpoint-group'] = $scope.tenant['endpoint-group'] ? $scope.tenant['endpoint-group'] : []; + + if(object) { + object.forEach(function(o) { + $scope.tenant['endpoint-group'].push(GPBServices.stripNullValues(o)); + }); + } + + + path = GBPTenantServices.createPathObj($scope.tenant.id); + GBPTenantServices.send(path, $scope.tenant, function(data){ + $scope.wizards.accessModelWizard = false; + $scope.sendReloadEventFromRoot('GBP_GLOBAL_TENANT_RELOAD'); + $scope.reloadTopo(); + }, function(){ + //TODO: error cbk + }); + }; + + // $scope.updateList = function(list, object, key) { + // var elementPos = list.map(function(x) {return x[key]; }).indexOf(object[key]); + + // if(elementPos < 0) { + // list.push(object); + // } + // else { + // list[elementPos] = object; + // } + // }; + }]); + + gbp.register.controller('wizardTenantCtrl', ['$scope', '$filter', 'GBPTenantServices', function($scope, $filter, GBPTenantServices){ + // $scope.tenantList = []; + $scope.newTenantObj = GBPTenantServices.createObj(); + $scope.displayLabel = ['name' , 'id']; + + $scope.view = { + tenantEdit: false + }; + + // $scope.init = function() { + // $scope.getTenants(); + // }; + + // $scope.getTenants = function() { + // GBPTenantServices.load( + // function(data) { + // $scope.tenantList = data; + // $scope.newTenantObj = GBPTenantServices.createObj(); + // }, + // function(){ + // //TODO error + // } + // ); + // }; + + $scope.reloadTenants = function(selectedObject) { + if(!selectedObject) { + selectedObject = GBPTenantServices.createObj(); + $scope.view.tenantEdit = false; + } + else { + $scope.view.tenantEdit = true; + } + + $scope.selectedTenant = selectedObject; + $scope.newTenantObj = selectedObject; + }; + + $scope.getNewTenantObject = function() { + return GBPTenantServices.createObj(); + }; + }]); + + gbp.register.controller('wizardEpgCtrl', ['$scope', '$filter', 'GBPEpgServices', function($scope, $filter, GBPEpgServices){ + $scope.list = []; + $scope.newEpgObj = GBPEpgServices.createObj(); + $scope.selectedEpg = null; + $scope.epgFormView = true; + + $scope.displayLabel = ['name', 'id']; + $scope.crudLabel = 'Group list'; + + $scope.igpOpts = ['allow', 'require-contract']; + + $scope.init = function() { + + }; + + $scope.showForm = function() { + $scope.epgFormView = true; + $scope.newEpgObj = GBPEpgServices.createObj(); + }; + + $scope.save = function() { + $scope.updateList($scope.list, $scope.newEpgObj, "id"); + $scope.reload($scope.newEpgObj); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newEpgObj); + }; + + $scope.delete = function() { + if($scope.selectedEpg) { + var index = $scope.list.indexOf($scope.selectedEpg); + $scope.list.splice(index, 1); + $scope.epgFormView = false; + } + //$scope.newEpgObj = GBPEpgServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedEpg = selectedObj; + $scope.newEpgObj = selectedObj; + $scope.epgFormView = true; + $scope.$broadcast('WIZARD_EPG_RELOAD'); + }; + + $scope.close = function() { + $scope.epgFormView = false; + $scope.newEpgObj = GBPEpgServices.createObj(); + $scope.selectedEpg = null; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEpg ) { + $scope.epgFormView = true; + angular.copy($scope.selectedEpg, $scope.newEpgObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on("WIZARD_CNS_RELOAD", function(event, args){ + //$scope.selectedEpg['consumer-named-selector'] = args; + $scope.newEpgObj['consumer-named-selector'] = args; + $scope.updateList($scope.list, $scope.newEpgObj, "id"); + }); + + $scope.$on("WIZARD_PNS_RELOAD", function(event, args){ + //$scope.selectedEpg['provider-named-selector'] = args; + $scope.newEpgObj['provider-named-selector'] = args; + $scope.updateList($scope.list, $scope.newEpgObj, "id"); + }); + }]); + + gbp.register.controller('wizardContractCtrl', ['$scope', '$filter', 'GBPContractServices', function($scope, $filter, GBPContractServices){ + $scope.list = []; + $scope.newContractObj = GBPContractServices.createObj(); + $scope.selectedContract = null; + + $scope.displayLabel = ['description', 'id']; + $scope.crudLabel = 'Contract list'; + + $scope.contractFormView = true; + + $scope.init = function() { + + }; + + $scope.showForm = function() { + $scope.contractFormView = true; + $scope.newContractObj = GBPContractServices.createObj(); + }; + + $scope.save = function() { + $scope.updateList($scope.list, $scope.newContractObj, "id"); + $scope.reload($scope.newContractObj); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newContractObj); + }; + + $scope.delete = function() { + if($scope.selectedContract) { + var index = $scope.list.indexOf($scope.selectedContract); + $scope.list.splice(index, 1); + $scope.contractFormView = false; + $scope.newContractObj = GBPContractServices.createObj(); + $scope.selectedContract = null; + } + }; + + $scope.reload = function(selectedObj) { + $scope.selectedContract = selectedObj; + $scope.newContractObj = selectedObj; + $scope.contractFormView = true; + }; + + $scope.close = function() { + $scope.contractFormView = false; + //$scope.newContractObj = GBPContractServices.createObj(); + //$scope.selectedContract = null; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedContract ) { + $scope.contractFormView = true; + angular.copy($scope.selectedContract, $scope.newContractObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on("WIZARD_SUBJECT_RELOAD", function(event, args){ + //$scope.selectedEpg['consumer-named-selector'] = args; + $scope.newContractObj['subject'] = args; + $scope.updateList($scope.list, $scope.newContractObj, "id"); + }); + + $scope.$on("WIZARD_CLAUSE_RELOAD", function(event, args){ + //$scope.selectedEpg['consumer-named-selector'] = args; + $scope.newContractObj['clause'] = args; + $scope.updateList($scope.list, $scope.newContractObj, "id"); + }); + }]); + + gbp.register.controller('wizardCnsCtrl',['$scope', 'GBPConNamedSelServices', function($scope, GBPConNamedSelServices){ + $scope.list = []; + $scope.selectedCNS = null; + $scope.newCNSObj = GBPConNamedSelServices.createObj(); + $scope.internalView = { + cns: false, + edit: "view" + }; + $scope.displayLabel = 'name'; + $scope.crudLabel = 'Consumer named selectors list'; + + $scope.contractList = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contractList); + + var clear = function(){ + $scope.list = []; + $scope.selectedCNS = null; + $scope.newCNSObj = GBPConNamedSelServices.createObj(); + $scope.internalView = { + cns: false, + edit: "add" + }; + }; + + //move to separate ctrl \/ + $scope.addNewElem = function(templateObj) { + if($scope.newCNSObj && $scope.newCNSObj.contract) { + var objToPush = templateObj || ""; + $scope.newCNSObj.contract.push(objToPush); + } + }; + + $scope.deleteElemAt = function(index) { + if($scope.newCNSObj && $scope.newCNSObj.contract) { + $scope.newCNSObj.contract.splice(index, 1); + } + }; + + $scope.updateAt = function(index, value) { + if($scope.newCNSObj && $scope.newCNSObj.contract && $scope.newCNSObj.contract.length >= index) { + $scope.newCNSObj.contract[index] = value; + } + }; + //move to separate ctrl /\ + + $scope.init = function() { + clear(); + + if($scope.tenant && $scope.tenant['contract'].length>0) { + $scope.contractList.options = $scope.tenant['contract']; + } + + if($scope.selectedEpg && $scope.selectedEpg['consumer-named-selector']) { + $scope.list = $scope.selectedEpg['consumer-named-selector']; + } + }; + + $scope.save = function(){ + $scope.updateList($scope.list, $scope.newCNSObj, "name"); + $scope.reload($scope.newCNSObj); + $scope.$emit('WIZARD_CNS_RELOAD', $scope.list); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newCNSObj); + }; + + $scope.delete = function() { + if($scope.selectedCNS) { + var index = $scope.list.indexOf($scope.selectedCNS); + $scope.list.splice(index, 1); + $scope.internalView = { + cns: false, + edit: "add" + }; + $scope.$emit('WIZARD_CNS_RELOAD', $scope.list); + } + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.selectedCNS = null; + $scope.internalView.cns = true; + $scope.internalView.edit = "add"; + }; + + $scope.reloadNewObj = function() { + $scope.newCNSObj = GBPConNamedSelServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedCNS = selectedObj; + $scope.newCNSObj = selectedObj; + $scope.internalView.cns = true; + }; + + $scope.close = function(){ + $scope.internalView.cns = false; + //$scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEpg ) { + $scope.internalView.cns = true; + $scope.internalView.edit = "add"; + angular.copy($scope.selectedCNS, $scope.newCNSObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('WIZARD_EPG_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('wizardPnsCtrl',['$scope', 'GBPProNamedSelServices', function($scope, GBPProNamedSelServices){ + $scope.list = []; + $scope.selectedPNS = null; + $scope.newPNSObj = GBPProNamedSelServices.createObj(); + $scope.displayLabel = 'name'; + $scope.crudLabel = 'Provider named selectors list'; + $scope.internalView = { + pns: false, + edit: "view" + }; + + $scope.contractList = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_CONTRACTS_LABEL', $scope.contractList); + + var clear = function(){ + $scope.list = []; + $scope.selectedPNS = null; + $scope.newPNSObj = GBPProNamedSelServices.createObj(); + $scope.internalView = { + pns: false, + edit: "view" + }; + }; + + //move to separate ctrl \/ + $scope.addNewElem = function(templateObj) { + if($scope.newPNSObj && $scope.newPNSObj.contract) { + var objToPush = templateObj || ""; + $scope.newPNSObj.contract.push(objToPush); + } + }; + + $scope.deleteElemAt = function(index) { + if($scope.newPNSObj && $scope.newPNSObj.contract) { + $scope.newPNSObj.contract.splice(index, 1); + } + }; + + $scope.updateAt = function(index, value) { + if($scope.newPNSObj && $scope.newPNSObj.contract && $scope.newPNSObj.contract.length >= index) { + $scope.newPNSObj.contract[index] = value; + } + }; + //move to separate ctrl /\ + + $scope.init = function() { + clear(); + + if($scope.tenant && $scope.tenant['contract'].length>0) { + $scope.contractList.options = $scope.tenant['contract']; + } + + if($scope.selectedEpg && $scope.selectedEpg['provider-named-selector']) { + $scope.list = $scope.selectedEpg['provider-named-selector']; + } + }; + + $scope.save = function(){ + $scope.updateList($scope.list, $scope.newPNSObj, "name"); + $scope.reload($scope.newPNSObj); + $scope.$emit('WIZARD_PNS_RELOAD', $scope.list); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newPNSObj); + }; + + $scope.delete = function() { + if($scope.selectedPNS) { + var index = $scope.list.indexOf($scope.selectedPNS); + $scope.list.splice(index, 1); + $scope.internalView = { + pns: false, + edit: "add" + }; + $scope.$emit('WIZARD_PNS_RELOAD', $scope.list); + } + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.selectedPNS = null; + $scope.internalView.pns = true; + $scope.internalView.edit = "add"; + }; + + $scope.reloadNewObj = function() { + $scope.newPNSObj = GBPProNamedSelServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedPNS = selectedObj; + $scope.newPNSObj = selectedObj; + $scope.internalView.pns = true; + }; + + $scope.close = function(){ + $scope.internalView.pns = false; + $scope.internalView.edit = "view"; + }; + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedEpg ) { + $scope.internalView.pns = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedPNS, $scope.newPNSObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('WIZARD_EPG_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('wizardSubjectCtrl', ['$scope','GBPSubjectServices', '$filter', function($scope, GBPSubjectServices, $filter){ + $scope.list = []; + $scope.selectedSubject = null; + $scope.newSubjectObj = GBPSubjectServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + subject : false, + edit : "view" + }; + $scope.crudLabel = 'Subject list'; + $scope.errors = {}; + + + var path = null, + mandatoryProperties = ['order'], + + clear = function(){ + $scope.list = []; + $scope.selectedSubject = null; + $scope.newSubjectObj = GBPSubjectServices.createObj(); + $scope.internalView = { + subject : false, + edit : "view" + }; + }; + + $scope.init = function() { + + }; + + $scope.save = function(){ + $scope.updateList($scope.list, $scope.newSubjectObj, "name"); + $scope.reload($scope.newSubjectObj); + $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newSubjectObj); + }; + + $scope.delete = function() { + if($scope.selectedSubject) { + var index = $scope.list.indexOf($scope.selectedSubject); + $scope.list.splice(index, 1); + $scope.internalView = { + subject: false, + edit: "add" + }; + $scope.reloadNewObj(); + $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list); + } + }; + + $scope.reloadNewObj = function() { + $scope.newSubjectObj = GBPSubjectServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedSubject = selectedObj; + $scope.newSubjectObj = selectedObj; + $scope.internalView.subject = true; + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.subject = true; + $scope.internalView.edit = "add"; + $scope.selectedSubject = null; + }; + + $scope.close = function(){ + $scope.internalView.subject = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedSubject ) { + $scope.internalView.subject = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedSubject, $scope.newSubjectObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_CONTRACT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on('GBP_SUBJECTS_LABEL', function(event, obj){ + obj.labels = $scope.displayLabel; + }); + + $scope.$on("WIZARD_RULE_RELOAD", function(event, args){ + //$scope.selectedEpg['consumer-named-selector'] = args; + $scope.newSubjectObj['rule'] = args; + $scope.updateList($scope.list, $scope.newSubjectObj, "id"); + $scope.$emit('WIZARD_SUBJECT_RELOAD', $scope.list); + }); + }]); + + gbp.register.controller('wizardRuleCtrl', ['$scope','GBPRuleServices', '$filter', function($scope, GBPRuleServices, $filter){ + $scope.list = []; + $scope.selectedRule = null; + $scope.newRuleObj = GBPRuleServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + rule : false, + edit : "view" + }; + $scope.crudLabel = 'Rule list'; + $scope.errors = {}; + + var path = null, + mandatoryProperties = ['order'], + + clear = function(){ + $scope.list = []; + $scope.selectedRule = null; + $scope.newRuleObj = GBPRuleServices.createObj(); + $scope.internalView = { + rule : false, + edit : "view" + }; + }; + + $scope.init = function() { + + }; + + $scope.save = function(){ + $scope.updateList($scope.list, $scope.newRuleObj, "name"); + $scope.reload($scope.newRuleObj); + $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newRuleObj); + }; + + $scope.delete = function() { + if($scope.selectedRule) { + var index = $scope.list.indexOf($scope.selectedRule); + $scope.list.splice(index, 1); + $scope.internalView = { + rule: false, + edit: "add" + }; + $scope.reloadNewObj(); + $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); + } + }; + + $scope.reloadNewObj = function() { + $scope.newRuleObj = GBPRuleServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedRule = selectedObj; + $scope.newRuleObj = selectedObj; + $scope.internalView.rule = true; + $scope.$broadcast('WIZARD_RULE_RELOAD'); + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.rule = true; + $scope.internalView.edit = "add"; + $scope.selectedRule = null; + }; + + $scope.close = function(){ + $scope.internalView.rule = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedRule ) { + $scope.internalView.rule = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedRule, $scope.newRuleObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('GBP_SUBJECT_RELOAD',function(){ + $scope.init(); + }); + + $scope.$on("WIZARD_CLASREF_RELOAD", function(event, args){ + $scope.newRuleObj['classifier-ref'] = args; + $scope.updateList($scope.list, $scope.newRuleObj, "name"); + $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); + }); + + $scope.$on("WIZARD_ACTIONREF_RELOAD", function(event, args){ + $scope.newRuleObj['action-ref'] = args; + $scope.updateList($scope.list, $scope.newRuleObj, "name"); + $scope.$emit('WIZARD_RULE_RELOAD', $scope.list); + }); + }]); + + gbp.register.controller('wizardClauseCtrl', ['$scope','GBPClauseServices', 'GBPSubjectServices', + function($scope, GBPClauseServices, GBPSubjectServices){ + $scope.list = []; + $scope.selectedClause = null; + $scope.newClauseObj = GBPClauseServices.createObj(); + $scope.internalView = { + clause: false, + edit: "view" + }; + $scope.displayLabel = 'name'; + $scope.crudLabel = 'Clause list'; + + $scope.subjects = {'options' : [], 'labels' : null}; + $scope.getDisplayLabelsFromCtrl('GBP_SUBJECTS_LABEL', $scope.subjects); + + var path = null, + + clear = function(){ + $scope.list = []; + $scope.selectedClause = null; + $scope.newClauseObj = GBPClauseServices.createObj(); + $scope.internalView = { + clause: false, + edit: "view" + }; + }; + + //move to separate ctrl \/ + $scope.addNewElem = function(templateObj) { + if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { + $scope.init(); + var objToPush = templateObj || ""; + $scope.newClauseObj['subject-refs'].push(objToPush); + } + }; + + $scope.deleteElemAt = function(index) { + if($scope.newClauseObj && $scope.newClauseObj['subject-refs']) { + $scope.newClauseObj['subject-refs'].splice(index, 1); + } + }; + + $scope.updateAt = function(index, value) { + if($scope.newClauseObj && $scope.newClauseObj['subject-refs'] && $scope.newClauseObj['subject-refs'].length >= index) { + $scope.newClauseObj['subject-refs'][index] = value; + } + }; + //move to separate ctrl /\ + + $scope.init = function() { + if($scope.selectedContract && $scope.selectedContract['subject'].length>0) { + $scope.subjects.options = $scope.selectedContract['subject']; + } + }; + + $scope.save = function(){ + $scope.updateList($scope.list, $scope.newClauseObj, "name"); + $scope.reload($scope.newClauseObj); + $scope.$emit('WIZARD_CLAUSE_RELOAD', $scope.list); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newClauseObj); + }; + + $scope.delete = function() { + if($scope.selectedClause) { + var index = $scope.list.indexOf($scope.selectedClause); + $scope.list.splice(index, 1); + $scope.internalView = { + clause: false, + edit: "add" + }; + $scope.$emit('WIZARD_CLAUSE_RELOAD', $scope.list); + } + }; + + $scope.reloadNewObj = function() { + $scope.newClauseObj = GBPClauseServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedClause = selectedObj; + $scope.newClauseObj = selectedObj; + $scope.internalView.clause = true; + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.clause = true; + $scope.internalView.edit = "add"; + $scope.selectedClause = null; + }; + + $scope.close = function(){ + $scope.internalView.clause = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedClause ) { + $scope.internalView.clause = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedClause, $scope.newClauseObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('WIZARD_SUBJECT_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('wizardActionRefCtrl', ['$scope','GBPActionRefsServices', 'GBPActionInstanceServices', '$filter', function($scope, GBPActionRefsServices, GBPActionInstanceServices, $filter){ + $scope.list = []; + $scope.selectedActionRef = null; + $scope.newActionRefObj = GBPActionRefsServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + actionRef : false, + edit : "view" + }; + $scope.crudLabel = 'Action ref list'; + + $scope.actionInstanceNames = {'options' : [], 'labels' : $scope.displayLabel}; + + var path = null, + mandatoryProperties = ['order'], + + actionInstanceNamesLoad = function() { + if($scope.tenant) { + var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.tenant.id); + GBPActionInstanceServices.load(actionInstancePath, function(data){ + $scope.actionInstanceNames.options = data; + },function(){ + //TODO: error cbk + }); + } + }, + + clear = function(){ + $scope.list = []; + $scope.selectedActionRef = null; + $scope.newActionRefObj = GBPActionRefsServices.createObj(); + $scope.internalView = { + actionRef : false, + edit : "view" + }; + }; + + $scope.init = function() { + actionInstanceNamesLoad(); + }; + + $scope.save = function(){ + $scope.updateList($scope.list, $scope.newActionRefObj, "name"); + $scope.reload($scope.newActionRefObj); + $scope.$emit('WIZARD_ACTIONREF_RELOAD', $scope.list); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newActionRefObj); + }; + + $scope.delete = function() { + if($scope.selectedActionRef) { + var index = $scope.list.indexOf($scope.selectedActionRef); + $scope.list.splice(index, 1); + $scope.internalView = { + actionRef: false, + edit: "add" + }; + $scope.$emit('WIZARD_ACTIONREF_RELOAD', $scope.list); + } + }; + + $scope.reloadNewObj = function() { + $scope.newActionRefObj = GBPActionRefsServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedActionRef = selectedObj; + $scope.newActionRefObj = selectedObj; + $scope.internalView.actionRef = true; + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.actionRef = true; + $scope.internalView.edit = "add"; + $scope.selectedActionRef = null; + }; + + $scope.close = function(){ + $scope.internalView.actionRef = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedActionRef ) { + $scope.internalView.actionRef = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedActionRef, $scope.newActionRefObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('WIZARD_RULE_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('wizardClassifierRefCtrl', ['$scope','GBPClassifierRefsServices', 'GBPClassifierInstanceServices', '$filter', function($scope, GBPClassifierRefsServices, GBPClassifierInstanceServices, $filter){ + $scope.list = []; + $scope.selectedClassifierRef = null; + $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); + $scope.displayLabel = 'name'; + $scope.internalView = { + classifierRef : false, + edit : "view" + }; + + $scope.instanceNames = {'options' : [], 'labels' : $scope.displayLabel}; + + $scope.formDirections = ['in', 'out', 'bidirectional']; + $scope.formConnectionTracking = ['normal', 'reflexive']; + + $scope.crudLabel = 'Classifier ref list'; + + var path = null, + + instanceNamesLoad = function() { + if($scope.tenant) { + var classifierInstancePath = GBPClassifierInstanceServices.createPathObj($scope.tenant.id); + GBPClassifierInstanceServices.load(classifierInstancePath, function(data){ + $scope.instanceNames.options = data; + },function(){ + //TODO: error cbk + }); + } + }, + + clear = function(){ + $scope.list = []; + $scope.selectedClassifierRef = null; + $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); + $scope.internalView = { + classifierRef : false, + edit : "view" + }; + }; + + $scope.init = function() { + instanceNamesLoad(); + }; + + $scope.save = function(){ + $scope.updateList($scope.list, $scope.newClassifierRefObj, "name"); + $scope.reload($scope.newClassifierRefObj); + $scope.$emit('WIZARD_CLASREF_RELOAD', $scope.list); + $scope.$broadcast('EV_SET_SEL_CLASS', $scope.newClassifierRefObj); + }; + + $scope.delete = function() { + if($scope.selectedClassifierRef) { + var index = $scope.list.indexOf($scope.selectedClassifierRef); + $scope.list.splice(index, 1); + $scope.internalView = { + classifierRef: false, + edit: "add" + }; + $scope.$emit('WIZARD_CLASREF_RELOAD', $scope.list); + } + }; + + $scope.reloadNewObj = function() { + $scope.newClassifierRefObj = GBPClassifierRefsServices.createObj(); + }; + + $scope.reload = function(selectedObj) { + $scope.selectedClassifierRef = selectedObj; + $scope.newClassifierRefObj = selectedObj; + $scope.internalView.classifierRef = true; + }; + + $scope.showForm = function() { + $scope.reloadNewObj(); + $scope.internalView.classifierRef = true; + $scope.internalView.edit = "add"; + $scope.selectedClassifierRef = null; + }; + + $scope.close = function(){ + $scope.internalView.classifierRef = false; + $scope.internalView.edit = "view"; + }; + + $scope.$on('PGN_EDIT_ELEM', function(event){ + if (!event.defaultPrevented) { + if ( $scope.selectedClassifierRef ) { + $scope.internalView.classifierRef = true; + $scope.internalView.edit = "edit"; + angular.copy($scope.selectedClassifierRef, $scope.newClassifierRefObj); + } + event.defaultPrevented = true; + } + }); + + $scope.$on('WIZARD_RULE_RELOAD',function(){ + $scope.init(); + }); + }]); + + gbp.register.controller('rendererStateCtrl', ['$scope', 'GPBServices', function($scope, GPBServices){ + $scope.data = {'subject-feature-definitions' : {}}; + $scope.view_path = 'src/app/gbp/views/governance'; + + var init = function(){ + GPBServices.getDefinitions(function(classifiersDefs, actionsDefs){ + $scope.data['subject-feature-definitions']['classifier-definition'] = classifiersDefs; + $scope.data['subject-feature-definitions']['action-definition'] = actionsDefs; + }, function(){ + //error + }); + }; + + init(); + }]); + + gbp.register.controller('layerCtrl', ['$scope', function($scope){ + + var moveOffset = 1; + $scope.currentDisplayIndex = 1; + $scope.displayOffsets = [-1, 0, 1]; + $scope.expanded = true; + + $scope.init = function(key, value){ + $scope.data = value; + if($scope.checkData(value, 'Array')){ + $scope.setActData($scope.data[$scope.data.length - 1]); + } + }; + + $scope.toggleExpanded = function(){ + $scope.expanded = !$scope.expanded; + }; + + $scope.shiftDisplayNext = function() { + $scope.currentDisplayIndex = Math.min($scope.currentDisplayIndex + moveOffset, $scope.data.length - 2); + }; + + $scope.shiftDisplayPrev = function() { + $scope.currentDisplayIndex = Math.max($scope.currentDisplayIndex - moveOffset, 1); + }; + + $scope.showPrevButton = function() { + return $scope.currentDisplayIndex > 1; + }; + + $scope.showNextButton = function() { + return $scope.data && $scope.currentDisplayIndex < $scope.data.length - 2; + }; + + $scope.setActData = function(data) { + $scope.actSelected = data; + }; + + $scope.checkData = function(data, type){ + var result = {'Array' : data instanceof Array, + 'Object' : data instanceof Object}; + + return result[type]; + }; + }]); + + gbp.register.controller('actionReferenceWizardCtrl', ['$scope', '$filter', 'GBPRuleServices', 'GBPActionInstanceServices', function($scope, $filter, GBPRuleServices, GBPActionInstanceServices){ + $scope.wizardPage = null; + $scope.path = {}; + $scope.rule = {}; + + $scope.actionInstanceNames = {'options' : [], 'labels' : "name"}; + + var actionInstanceNamesLoad = function() { + var actionInstancePath = GBPActionInstanceServices.createPathObj($scope.selectedTenant.id); + GBPActionInstanceServices.load(actionInstancePath, function(data){ + $scope.actionInstanceNames.options = data; + },function(){ + //TODO: error cbk + }); + }; + + $scope.init = function() { + $scope.setPage('reference'); + }; + + $scope.setPage = function(pageName, object) { + $scope.wizardPage = pageName; + }; + + $scope.submit = function() { + //if($scope.validateForm($scope.actionsForm)){ + $scope.actionInstanceNames.options.forEach(function(i) { + path = GBPActionInstanceServices.createPathObj($scope.path.tenantId, i.name); + //saveParams(); + + GBPActionInstanceServices.send(path, i, function(data){ + $scope.sendReloadEventFromRoot('GBP_ACTION_INSTANCE_RELOAD'); + }, function(){ + //TODO: error cbk + }); + }); + + //} + + //if($scope.validateForm($scope.rulesForm)){ + path = GBPRuleServices.createPathObj($scope.path.tenantId, $scope.path.contractId, $scope.path.subjectId, $scope.path.ruleId); + GBPRuleServices.send(path, $scope.rule, function(data){ + + $scope.wizards.actionReferenceWizard = false; + + //$scope.sendReloadEventFromRoot('GBP_TENANT_RELOAD'); + }, function(){ + //TODO: error cbk + }); + //} + //$scope. + }; + + $scope.$on('ACTION_RULE_WIZARD_LOAD', function(event, data){ + $scope.rule = angular.copy(data.data); + $scope.path = data.path; + }); + + $scope.$on('WIZARD_ACTIONREF_ADD', function(event, data){ + if(!$scope.rule['action-ref']) { + $scope.rule['action-ref'] = []; + } + $scope.updateList($scope.rule['action-ref'], data, "name"); + }); + + $scope.$on('WIZARD_ACTIONREF_DELETE', function(event, data){ + $scope.rule['action-ref'].splice(data, 1); + }); + + $scope.$on('WIZARD_ACTIONINSTANCE_ADD', function(event, data){ + $scope.updateList($scope.actionInstanceNames.options, data, "name"); + + $scope.setPage('reference'); + }); + + $scope.$on('GBP_TENANT_RELOAD',function(){ + actionInstanceNamesLoad(); + }); + + }]); + + gbp.register.controller('actionsRefListCtrl', ['$scope', '$filter', function($scope, $filter){ + + $scope.actionReferenceForm = false; + + $scope.showForm = function(object) { + $scope.actionReferenceForm = true; + $scope.newActionRefObj = object || null; + }; + + $scope.closeForm = function() { + $scope.actionReferenceForm = false; + }; + + $scope.save = function(){ + $scope.$emit('WIZARD_ACTIONREF_ADD', $scope.newActionRefObj); + $scope.resetObject(); + }; + + $scope.deleteElemAt = function(index) { + $scope.$emit('WIZARD_ACTIONREF_DELETE', index); + $scope.resetObject(); + }; + + $scope.resetObject = function() { + $scope.newActionRefObj = null; + }; + + + + }]); + + gbp.register.controller('actionInstanceWizardCtrl', ['$scope', '$filter', 'GPBServices', 'GBPActionInstanceServices', function($scope, $filter, GPBServices, GBPActionInstanceServices){ + $scope.actionDefinitions = {'options' : [], 'labels' : "name"}; + $scope.newActionObj = GBPActionInstanceServices.createObj(); + + var loadDefinitions = function() { + GPBServices.getDefinitions(function(classifierDefs, actionDefs) { + $scope.actionDefinitions.options = actionDefs; + //$scope.getDisplayLabelsFromCtrl('GBP_ACTIONS_LABEL', $scope.actionDefinitions); + }); + }; + + $scope.reloadDefs = function(){ + $scope.defs = angular.copy($scope.getDefinitionObjParams($scope.newActionObj['action-definition-id'])); + + //TODO: rework + if($scope.defs.length && $scope.defs[0].name === 'sfc-chain-name') { + GPBServices.getServiceFunctionChains(function(data) { + $scope.serviceFunctionChains = data; + }); + } + }; + + $scope.getDefinitionObjParams = function(id){ + return GPBServices.getDefinitionObjParams($scope.actionDefinitions.options, id); + }; + + $scope.save = function(){ + $scope.newActionObj['parameter-value'] = []; + $scope.$broadcast('GBP_SAVE_PARAM'); + $scope.$emit('WIZARD_ACTIONINSTANCE_ADD', $scope.newActionObj); + $scope.resetObject(); + }; + + $scope.resetObject = function() { + $scope.newActionObj = GBPActionInstanceServices.createObj(); + }; + + $scope.saveParam = function() { + + }; + + $scope.addParam = function(name, type, value) { + $scope.newActionObj['parameter-value'].push(GPBServices.createParamObj(name, type, value)); + }; + + loadDefinitions(); + + }]); + +}); + + diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.css b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.css old mode 100755 new mode 100644 similarity index 95% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.css rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.css index fb2b1f772..ecd0d7507 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.css +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.css @@ -1,740 +1,740 @@ -.pl0 { - padding-left: 0 !important; -} -.pr0 { - padding-right: 0 !important; -} -.mt10 { - margin-top: 10px; -} -.mt20 { - margin-top: 20px; -} -.mt30 { - margin-top: 30px; -} -.mt40 { - margin-top: 40px; -} -.mb50 { - margin-bottom: 50px; -} -.mb0 { - margin-bottom: 0px !important; -} -.ml10 { - margin-left: 10px !important; -} -.ml20 { - margin-left: 20px !important; -} -.ml30 { - margin-left: 30px !important; -} -.maxHeight500 { - max-height: 500px; - overflow-y: scroll; -} -.gbpGlobalWrapper { - background: #f5f5f5; - margin-bottom: 0!important; - min-height: 100%; - padding-bottom: 60px; -} -.gbpGlobalWrapper span, -.gbpGlobalWrapper label { - color: #393939; -} -.gbpGlobalWrapper h2 { - color: #666; -} -.gbpGlobalWrapper .form-control, -.gbpGlobalWrapper .main input[type="text"] { - background: #fff; - color: #858585; -} -.gbpGlobalWrapper .form-control[disabled], -.gbpGlobalWrapper .main input[type="text"][disabled] { - background: #eeeeee; -} -.gbpGlobalWrapper .form-control.narrow-input-left { - width: 45%; - float: left; -} -.gbpGlobalWrapper .form-control.narrow-input-right { - width: 45%; - float: right; -} -.gbpGlobalWrapper .row-param { - margin-bottom: 15px; - float: left; -} -.gbpGlobalWrapper .param-label { - width: 100%; - float: left; -} -.gbpGlobalWrapper .ep-filter { - margin-bottom: 20px; -} -.gbpGlobalWrapper .ep-filter DIV { - width: 48%; -} -.gbpGlobalWrapper .float-left { - float: left; -} -.gbpGlobalWrapper .float-right { - float: right; -} -.gbpGlobalWrapper .full-width { - width: 100%; -} -.gbpGlobalWrapper .full-width .btn { - width: 50px; -} -.gbpGlobalWrapper .full-width label { - margin-top: 10px; -} -.gbpWrapper .btn-primary { - color: #ffffff; - background-color: #428bca; - border-color: #357ebd; - font-weight: normal; -} -.gbpWrapper .btn-primary:hover { - background-color: #1BAAFD; - border-color: #1BAAFD; -} -.gbpWrapper .btn-primary.bottom-buttons { - bottom: 0; - position: absolute; - margin-bottom: 0 !important; - background-color: #FF7300; - border-color: #FF7300; - width: 45%; -} -.gbpWrapper .btn-primary.bottom-buttons.back { - right: 0; - margin-right: 15px; -} -.gbpWrapper .btn-primary.bottom-buttons.home { - left: 0; - margin-left: 15px; -} -.gbpWrapper .btn-primary.bottom-buttons:hover { - background-color: #FF8f33; - border-color: #FF8f33; -} -.gbpWrapper .btn-primary.bottom-buttons.full-width { - width: calc(100% - 30px); - left: 0; - margin-left: 15px; -} -.gbpWrapper .btn-primary.bottom-buttons.wizard-button { - bottom: 40px; -} -.gbpWrapper .btn-primary.btn-big { - padding: 20px; - font-size: 1.5em; - white-space: normal; -} -.gbpWrapper .noPadding { - padding: 0!important; -} -.gbpWrapper .basicLabel { - padding: 0; - font-weight: normal; -} -.gbpWrapper .rowWrapper { - margin-bottom: 5px; -} -.gbpWrapper .inline-block { - display: inline-block; -} -.gbpWrapper #graph { - overflow: auto; - width: 100%; - height: 100%; -} -.gbpWrapper .graphWrapper { - position: relative; -} -.gbpWrapper .graphWrapper .controlPanelButtons { - position: absolute; - top: 50px; - right: 0px; -} -.gbpWrapper .graphWrapper .controlPanelButtons .line { - margin: 5px 0; -} -.gbpWrapper .graphWrapper .btn { - min-width: 22px; - line-height: 22px; - text-align: center; - padding: 0!important; -} -.gbpWrapper .simpleBox { - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; - border: 1px solid #e5e5e5; - background: #fff; - padding: 20px; -} -.gbpWrapper .simpleBox h2 { - margin-top: 0; -} -.gbpWrapper .sectionTitle { - padding: 20px; -} -.gbpWrapper .sectionTitle label { - font-size: 25px; -} -.gbpWrapper .legendBox { - position: absolute; - top: 50px; - right: 50px; - z-index: 10; -} -.gbpWrapper .legendBox ul { - padding: 0; - list-style: none; -} -.gbpWrapper .legendBox ul .item { - padding-top: 5px; - margin-bottom: 10px; -} -.gbpWrapper .legendBox ul .line { - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; - margin: 9px 5px 0 0; - width: 50px; -} -.gbpWrapper .legendBox ul .line.blue { - border-top: 2px solid blue; -} -.gbpWrapper .legendBox ul .line.green { - border-top: 2px solid green; -} -.gbpWrapper .mainNavigationWrapper { - padding-bottom: 50px; - overflow-x: scroll; -} -.gbpWrapper .mainNavigation { - padding-top: 5%; - min-width: 1450px; -} -.gbpWrapper .mainNavigation .topButtonsWrapper, -.gbpWrapper .mainNavigation .bottomButtonsWrapper { - text-align: center; - width: 400px; - margin: 0 auto 15px; - padding: 0 0 20px; - border-bottom: 5px solid #393939; -} -.gbpWrapper .mainNavigation .bottomButtonsWrapper { - border-bottom: 0; - border-top: 5px solid #393939; - padding: 20px 0 0; - margin: 15px auto 0; -} -.gbpWrapper .mainNavigation .middleButtonsWrapper { - text-align: center; -} -.gbpWrapper .mainNavigation .middleButtonsWrapper .buttonWrapper { - margin-top: 25px; -} -.gbpWrapper .mainNavigation .middleButtonsWrapper .iconWrapper { - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; - padding-top: 10px; -} -.gbpWrapper .mainNavigation .middleBox { - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; - width: 500px; - height: 150px; - border-left: 5px solid #393939; - border-right: 5px solid #393939; -} -.gbpWrapper .mainNavigation .middleBox .infinityIcon { - background: transparent url('../../src/app/gbp/images/infinity-loop.tpl.html') no-repeat center center; - width: 128px; - height: 128px; - margin: 11px auto 0; - cursor: pointer; -} -.gbpWrapper .mainNavigation .buttonWrapper { - text-align: center; - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; -} -.gbpWrapper .mainNavigation .buttonWrapper .btn-primary { - font-size: 2em; - padding: 25px 0; - width: 350px; - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; -} -.gbpWrapper .mainNavigation .buttonWrapper .icon-large:before { - font-size: 5em; -} -.gbpWrapper aside.col-md-3 { - min-height: 800px; -} -.gbpWrapper aside.col-md-3 .inWrapper { - height: 100%; -} -.gbpWrapper .panelWrapper { - padding: 20px 0 50px; - height: calc(100% - 109px); -} -.gbpWrapper .panelWrapper.no-padd-top { - padding-top: 0px; -} -.gbpWrapper .panelWrapper button.btn { - margin-bottom: 5px; -} -.gbpWrapper .panelWrapper button.btn-list { - margin-top: 25px; -} -.gbpWrapper .panelWrapper button.btn-default:hover { - background-color: #e6e6e6 !important; -} -.gbpWrapper .panelWrapper button.btn-default:focus { - background-color: #fff; -} -.gbpWrapper .panelWrapper button.activated, -.gbpWrapper .panelWrapper button.activated:focus { - background-color: #e6e6e6 !important; -} -.gbpWrapper .breadcrumbs { - padding: 10px 0px; - font-weight: bold; - border: 0; - line-height: initial; -} -.gbpWrapper section.sigmaWrapper div.legend { - margin-bottom: 25px; -} -.gbpWrapper section.sigmaWrapper div.legend span, -.gbpWrapper section.sigmaWrapper div.legend .text { - color: #fff; -} -.gbpWrapper section.sigmaWrapper div.legend ul { - padding: 0; - margin: 0; - list-style: none; -} -.gbpWrapper section.sigmaWrapper div.legend li { - margin-bottom: 5px; -} -.gbpWrapper section.sigmaWrapper div.legend li .textHidden { - display: none; -} -.gbpWrapper section.sigmaWrapper div.legend li .text { - margin-left: 10px; - line-height: 18px; -} -.gbpWrapper section.sigmaWrapper div.legend li .showChckbx { - position: relative; - top: 2px; - left: 5px; -} -.gbpWrapper section.sigmaWrapper div.legend li .itemWrapper:hover .text { - display: block !important; -} -.gbpWrapper section.sigmaWrapper div.legend div.color { - /*margin-right: 15px;*/ - width: 18px; - height: 18px; - -webkit-border-radius: 9px; - border-radius: 9px; - cursor: pointer; -} -.gbpWrapper #graph-container { - padding: 0; - height: 800px; -} -.gbpWrapper .selectWrapper { - padding-left: 0; -} -.gbpWrapper .selectWrapper.col-md-12 { - padding: 0; - margin-bottom: 5px; -} -.gbpWrapper .inputWrapper.leftInput { - padding-left: 0; -} -.gbpWrapper .inputWrapper.rightInput { - padding-right: 0; -} -.gbpWrapper .separator { - padding-bottom: 10px; - margin-top: 15px; - height: 1px; - padding-left: 0px; - padding-right: 15px; -} -.gbpWrapper .inner-separator { - border-bottom: 1px solid #858585; - width: 100%; - float: left; -} -.gbpWrapper .btn-group { - padding: 0; -} -.gbpWrapper .formWrapper { - margin: 20px 0; -} -.gbpWrapper .icon-remove.align-right { - float: right; -} -.gbpWrapper .icon-remove.align-right.padding { - margin: 5px 5px 0 0; -} -.gbpWrapper .icon-exclamation-sign.red { - color: red; -} -.gbpWrapper .sigmaWrapper { - position: relative; -} -.gbpWrapper .sigmaWrapper .sigmaModalWrapper { - position: absolute; - top: 30px; - left: 45px; - z-index: 1; -} -.gbpWrapper .sigmaWrapper .sigmaModalWrapper .icon-remove { - position: absolute; - top: 5px; - right: 5px; -} -.gbpWrapper .sigmaWrapper .sigmaModalWrapper .tableWrapper { - position: relative; - background: #f5f5f5; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; - min-width: 400px; - min-height: 100px; - margin-top: 20px; - padding: 20px; -} -.gbpWrapper .sigmaWrapper .sigmaModalWrapper .tableWrapper .dataWrapper { - overflow-y: scroll; - max-height: 350px; -} -.gbpWrapper .sigmaWrapper .sigmaModalWrapper .tableWrapper .rowWrapper { - padding: 10px; - margin-bottom: 10px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; - border: 1px solid #d5d5d5; -} -.modal-dialog { - z-index: 100; - height: 700px; - width: 700px; - background-color: white; - position: fixed; - opacity: 1; - top: 50%; - left: 50%; - margin: -350px 0 0 -400px; -} -.modal-dialog .modal-header { - height: 70px; - padding: 10px 15px; -} -.modal-dialog .modal-navigation { - float: left; - width: 150px; - height: 630px; - border-right: 1px solid #e5e5e5; - background-color: #eeeeee; -} -.modal-dialog .modal-navigation ul { - -webkit-padding-start: 0; - list-style-type: none; -} -.modal-dialog .modal-navigation ul li.navigation-item { - height: 54px; - width: 100%; - background-color: #eeeeee; - color: #666; - font-weight: bold; - padding: 20px; -} -.modal-dialog .modal-navigation ul li.navigation-item.selected { - background-color: #428bca; - border-color: #357ebd; - color: #ffffff; -} -.modal-dialog .modal-content-container { - float: right; - width: 550px; - height: 630px; -} -.modal-dialog .modal-content-container .content { - overflow-y: scroll; - padding: 0 50px 0 20px; - height: 580px; -} -.modal-dialog .modal-content-container .bottom-navigation { - height: 50px; - bottom: 0; - float: right; - margin: 8px 30px; -} -.modal-canvas { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 10; - background-color: #000; - opacity: .15; -} -.link-tools .tool-remove { - display: none; -} -.link-tools .tool-options { - display: none; -} -.connection-wrap, -.marker-arrowheads { - display: none; -}/*-------------------YangUI import START-------------------*/ -.gbpWrapper .customContainer { - border-left: 1px solid #7a7a7a; - margin: 35px 5px 5px 15px; - padding: 5px; - /*z-index: 10;*/ - width: auto; - position: relative; -} -.gbpWrapper .customContainer.withoutBorder { - border-left: 0; - padding-bottom: 0; -} -.gbpWrapper .customContainer.withoutBorder .treeBullet.containerBullet { - left: -25px; - top: -25px; -} -.gbpWrapper .topContainerPart { - margin-left: -19px; - margin-top: -28px; - margin-bottom: 10px; -} -.gbpWrapper .treeBullet { - font-size: 25px; - color: #7a7a7a; - position: absolute; - left: -15px; - top: 0; -} -.gbpWrapper .treeBullet.containerBullet { - top: -25px; - left: -25px; -} -.gbpWrapper .btn-name { - -webkit-border-radius: 5px; - border-radius: 5px; - background: transparent; - font-weight: bold; - color: #393939; - border: 2px solid #393939; - cursor: auto; -} -.gbpWrapper button.yangButton, -.gbpWrapper div.yangButton { - cursor: pointer; - position: relative; - width: 24px; - height: 24px; - border: 0; - margin: 2px; - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; -} -.gbpWrapper button.yangButton.iconArrowDown, -.gbpWrapper div.yangButton.iconArrowDown { - background: transparent url('images/yang-ui-icons/icon-arrow-down.tpl.html') no-repeat center top; -} -.gbpWrapper button.yangButton.iconArrowRight, -.gbpWrapper div.yangButton.iconArrowRight { - background: transparent url('images/yang-ui-icons/icon-arrow-right.tpl.html') no-repeat center top; -} -.gbpWrapper button.yangButton.iconNext, -.gbpWrapper div.yangButton.iconNext { - background: transparent url('images/yang-ui-icons/icon-next.tpl.html') no-repeat center top; -} -.gbpWrapper button.yangButton.iconPrev, -.gbpWrapper div.yangButton.iconPrev { - background: transparent url('images/yang-ui-icons/icon-prev.tpl.html') no-repeat center top; -} -.gbpWrapper button.yangButton:hover, -.gbpWrapper div.yangButton:hover { - background-position: center -24px; -} -.gbpWrapper button.yangButton.disabled, -.gbpWrapper div.yangButton.disabled { - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity= 40 )' !important; - filter: alpha(opacity= 40 ) !important; - -moz-opacity: 0.4 !important; - -khtml-opacity: 0.4 !important; - opacity: 0.4 !important; -} -.gbpWrapper button.yangButton.disabled:hover, -.gbpWrapper div.yangButton.disabled:hover { - background-position: center top; -} -.gbpWrapper .btn-slim { - padding-top: 2px; - padding-bottom: 2px; -} -.gbpWrapper .inlineBlock { - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; -} -.gbpWrapper .leaf { - margin: 5px; - padding-left: 5px; - position: relative; -} -.gbpWrapper .leaf-label { - margin-right: 10px; - font-weight: bold; - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; - /*width: 170px;*/ - padding-top: 6px; -} -.gbpWrapper .leaf-label button.iconQuestion { - margin-top: -2px; -} -.gbpWrapper .leaf-label i.icon-key { - font-size: 1.3em; - padding-left: 5px; -} -.gbpWrapper .clear { - clear: both; -} -.gbpWrapper .borderArrow { - color: #393939; - position: absolute; - bottom: -6px; - left: -6px; - font-size: 1.3em; -} -.gbpWrapper .tooltip-inner { - color: #fff; - white-space: pre-wrap; - /* CSS3 */ - white-space: -moz-pre-wrap; - /* Firefox */ - white-space: -pre-wrap; - /* Opera <7 */ - white-space: -o-pre-wrap; - /* Opera 7 */ - word-wrap: break-word; - /* IE */ -} -/*-------------------YangUI import END-------------------*/ -/* --------------------JointJS Graph START------------------- -.html-element { - position: absolute; - background: #3498DB; - pointer-events: none; - -webkit-user-select: none; - border-radius: 4px; - border: 2px solid #2980B9; - box-shadow: inset 0 0 5px black, 2px 2px 1px gray; - padding: 5px; - box-sizing: border-box; - z-index: 2; - pointer-events: auto; - bottom: 0; - left: 0; - right: 0; - color: #333; - height: 16px; - margin-top: 107px; - margin-left: 16px; - width: 50px !important; - height: 20px !important; -} --------------------JointJS Graph END------------------- -*/ -/*GBP END*/ - -.gbpWrapper .btn-like-tab { - text-decoration: none; - color: #464646; - border: 0; - line-height: 32px; - padding: 0 15px; - background: transparent !important; - border-bottom: 3px solid transparent; - margin: 0 10px; - -webkit-border-radius: 0; - -moz-border-radius: 0; - -ms-border-radius: 0; - -o-border-radius: 0; - border-radius: 0; - -webkit-transition: 150ms; - transition: 150ms; - -webkit-transition: all 150ms linear; - -moz-transition: all 150ms linear; - -ms-transition: all 150ms linear; - -o-transition: all 150ms linear; - transition: all 150ms linear; -} -.gbpWrapper .btn-like-tab.btn-selected, -.gbpWrapper .btn-like-tab:hover { - border-bottom: 3px solid #1baafd; - background: transparent !important; -} - -.gbpWrapper h1, .gbpWrapper h2, .gbpWrapper h3 { - color: #393939; -} - -#page_logo { - display:none; -} - - +.pl0 { + padding-left: 0 !important; +} +.pr0 { + padding-right: 0 !important; +} +.mt10 { + margin-top: 10px; +} +.mt20 { + margin-top: 20px; +} +.mt30 { + margin-top: 30px; +} +.mt40 { + margin-top: 40px; +} +.mb50 { + margin-bottom: 50px; +} +.mb0 { + margin-bottom: 0px !important; +} +.ml10 { + margin-left: 10px !important; +} +.ml20 { + margin-left: 20px !important; +} +.ml30 { + margin-left: 30px !important; +} +.maxHeight500 { + max-height: 500px; + overflow-y: scroll; +} +.gbpGlobalWrapper { + background: #f5f5f5; + margin-bottom: 0!important; + min-height: 100%; + padding-bottom: 60px; +} +.gbpGlobalWrapper span, +.gbpGlobalWrapper label { + color: #393939; +} +.gbpGlobalWrapper h2 { + color: #666; +} +.gbpGlobalWrapper .form-control, +.gbpGlobalWrapper .main input[type="text"] { + background: #fff; + color: #858585; +} +.gbpGlobalWrapper .form-control[disabled], +.gbpGlobalWrapper .main input[type="text"][disabled] { + background: #eeeeee; +} +.gbpGlobalWrapper .form-control.narrow-input-left { + width: 45%; + float: left; +} +.gbpGlobalWrapper .form-control.narrow-input-right { + width: 45%; + float: right; +} +.gbpGlobalWrapper .row-param { + margin-bottom: 15px; + float: left; +} +.gbpGlobalWrapper .param-label { + width: 100%; + float: left; +} +.gbpGlobalWrapper .ep-filter { + margin-bottom: 20px; +} +.gbpGlobalWrapper .ep-filter DIV { + width: 48%; +} +.gbpGlobalWrapper .float-left { + float: left; +} +.gbpGlobalWrapper .float-right { + float: right; +} +.gbpGlobalWrapper .full-width { + width: 100%; +} +.gbpGlobalWrapper .full-width .btn { + width: 50px; +} +.gbpGlobalWrapper .full-width label { + margin-top: 10px; +} +.gbpWrapper .btn-primary { + color: #ffffff; + background-color: #428bca; + border-color: #357ebd; + font-weight: normal; +} +.gbpWrapper .btn-primary:hover { + background-color: #1BAAFD; + border-color: #1BAAFD; +} +.gbpWrapper .btn-primary.bottom-buttons { + bottom: 0; + position: absolute; + margin-bottom: 0 !important; + background-color: #FF7300; + border-color: #FF7300; + width: 45%; +} +.gbpWrapper .btn-primary.bottom-buttons.back { + right: 0; + margin-right: 15px; +} +.gbpWrapper .btn-primary.bottom-buttons.home { + left: 0; + margin-left: 15px; +} +.gbpWrapper .btn-primary.bottom-buttons:hover { + background-color: #FF8f33; + border-color: #FF8f33; +} +.gbpWrapper .btn-primary.bottom-buttons.full-width { + width: calc(100% - 30px); + left: 0; + margin-left: 15px; +} +.gbpWrapper .btn-primary.bottom-buttons.wizard-button { + bottom: 40px; +} +.gbpWrapper .btn-primary.btn-big { + padding: 20px; + font-size: 1.5em; + white-space: normal; +} +.gbpWrapper .noPadding { + padding: 0!important; +} +.gbpWrapper .basicLabel { + padding: 0; + font-weight: normal; +} +.gbpWrapper .rowWrapper { + margin-bottom: 5px; +} +.gbpWrapper .inline-block { + display: inline-block; +} +.gbpWrapper #graph { + overflow: auto; + width: 100%; + height: 100%; +} +.gbpWrapper .graphWrapper { + position: relative; +} +.gbpWrapper .graphWrapper .controlPanelButtons { + position: absolute; + top: 50px; + right: 0px; +} +.gbpWrapper .graphWrapper .controlPanelButtons .line { + margin: 5px 0; +} +.gbpWrapper .graphWrapper .btn { + min-width: 22px; + line-height: 22px; + text-align: center; + padding: 0!important; +} +.gbpWrapper .simpleBox { + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + border: 1px solid #e5e5e5; + background: #fff; + padding: 20px; +} +.gbpWrapper .simpleBox h2 { + margin-top: 0; +} +.gbpWrapper .sectionTitle { + padding: 20px; +} +.gbpWrapper .sectionTitle label { + font-size: 25px; +} +.gbpWrapper .legendBox { + position: absolute; + top: 50px; + right: 50px; + z-index: 10; +} +.gbpWrapper .legendBox ul { + padding: 0; + list-style: none; +} +.gbpWrapper .legendBox ul .item { + padding-top: 5px; + margin-bottom: 10px; +} +.gbpWrapper .legendBox ul .line { + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; + margin: 9px 5px 0 0; + width: 50px; +} +.gbpWrapper .legendBox ul .line.blue { + border-top: 2px solid blue; +} +.gbpWrapper .legendBox ul .line.green { + border-top: 2px solid green; +} +.gbpWrapper .mainNavigationWrapper { + padding-bottom: 50px; + overflow-x: scroll; +} +.gbpWrapper .mainNavigation { + padding-top: 5%; + min-width: 1450px; +} +.gbpWrapper .mainNavigation .topButtonsWrapper, +.gbpWrapper .mainNavigation .bottomButtonsWrapper { + text-align: center; + width: 400px; + margin: 0 auto 15px; + padding: 0 0 20px; + border-bottom: 5px solid #393939; +} +.gbpWrapper .mainNavigation .bottomButtonsWrapper { + border-bottom: 0; + border-top: 5px solid #393939; + padding: 20px 0 0; + margin: 15px auto 0; +} +.gbpWrapper .mainNavigation .middleButtonsWrapper { + text-align: center; +} +.gbpWrapper .mainNavigation .middleButtonsWrapper .buttonWrapper { + margin-top: 25px; +} +.gbpWrapper .mainNavigation .middleButtonsWrapper .iconWrapper { + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; + padding-top: 10px; +} +.gbpWrapper .mainNavigation .middleBox { + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; + width: 500px; + height: 150px; + border-left: 5px solid #393939; + border-right: 5px solid #393939; +} +.gbpWrapper .mainNavigation .middleBox .infinityIcon { + background: transparent url('../../src/app/gbp/images/infinity-loop.tpl.html') no-repeat center center; + width: 128px; + height: 128px; + margin: 11px auto 0; + cursor: pointer; +} +.gbpWrapper .mainNavigation .buttonWrapper { + text-align: center; + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; +} +.gbpWrapper .mainNavigation .buttonWrapper .btn-primary { + font-size: 2em; + padding: 25px 0; + width: 350px; + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; +} +.gbpWrapper .mainNavigation .buttonWrapper .icon-large:before { + font-size: 5em; +} +.gbpWrapper aside.col-md-3 { + min-height: 800px; +} +.gbpWrapper aside.col-md-3 .inWrapper { + height: 100%; +} +.gbpWrapper .panelWrapper { + padding: 20px 0 50px; + height: calc(100% - 109px); +} +.gbpWrapper .panelWrapper.no-padd-top { + padding-top: 0px; +} +.gbpWrapper .panelWrapper button.btn { + margin-bottom: 5px; +} +.gbpWrapper .panelWrapper button.btn-list { + margin-top: 25px; +} +.gbpWrapper .panelWrapper button.btn-default:hover { + background-color: #e6e6e6 !important; +} +.gbpWrapper .panelWrapper button.btn-default:focus { + background-color: #fff; +} +.gbpWrapper .panelWrapper button.activated, +.gbpWrapper .panelWrapper button.activated:focus { + background-color: #e6e6e6 !important; +} +.gbpWrapper .breadcrumbs { + padding: 10px 0px; + font-weight: bold; + border: 0; + line-height: initial; +} +.gbpWrapper section.sigmaWrapper div.legend { + margin-bottom: 25px; +} +.gbpWrapper section.sigmaWrapper div.legend span, +.gbpWrapper section.sigmaWrapper div.legend .text { + color: #fff; +} +.gbpWrapper section.sigmaWrapper div.legend ul { + padding: 0; + margin: 0; + list-style: none; +} +.gbpWrapper section.sigmaWrapper div.legend li { + margin-bottom: 5px; +} +.gbpWrapper section.sigmaWrapper div.legend li .textHidden { + display: none; +} +.gbpWrapper section.sigmaWrapper div.legend li .text { + margin-left: 10px; + line-height: 18px; +} +.gbpWrapper section.sigmaWrapper div.legend li .showChckbx { + position: relative; + top: 2px; + left: 5px; +} +.gbpWrapper section.sigmaWrapper div.legend li .itemWrapper:hover .text { + display: block !important; +} +.gbpWrapper section.sigmaWrapper div.legend div.color { + /*margin-right: 15px;*/ + width: 18px; + height: 18px; + -webkit-border-radius: 9px; + border-radius: 9px; + cursor: pointer; +} +.gbpWrapper #graph-container { + padding: 0; + height: 800px; +} +.gbpWrapper .selectWrapper { + padding-left: 0; +} +.gbpWrapper .selectWrapper.col-md-12 { + padding: 0; + margin-bottom: 5px; +} +.gbpWrapper .inputWrapper.leftInput { + padding-left: 0; +} +.gbpWrapper .inputWrapper.rightInput { + padding-right: 0; +} +.gbpWrapper .separator { + padding-bottom: 10px; + margin-top: 15px; + height: 1px; + padding-left: 0px; + padding-right: 15px; +} +.gbpWrapper .inner-separator { + border-bottom: 1px solid #858585; + width: 100%; + float: left; +} +.gbpWrapper .btn-group { + padding: 0; +} +.gbpWrapper .formWrapper { + margin: 20px 0; +} +.gbpWrapper .icon-remove.align-right { + float: right; +} +.gbpWrapper .icon-remove.align-right.padding { + margin: 5px 5px 0 0; +} +.gbpWrapper .icon-exclamation-sign.red { + color: red; +} +.gbpWrapper .sigmaWrapper { + position: relative; +} +.gbpWrapper .sigmaWrapper .sigmaModalWrapper { + position: absolute; + top: 30px; + left: 45px; + z-index: 1; +} +.gbpWrapper .sigmaWrapper .sigmaModalWrapper .icon-remove { + position: absolute; + top: 5px; + right: 5px; +} +.gbpWrapper .sigmaWrapper .sigmaModalWrapper .tableWrapper { + position: relative; + background: #f5f5f5; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + min-width: 400px; + min-height: 100px; + margin-top: 20px; + padding: 20px; +} +.gbpWrapper .sigmaWrapper .sigmaModalWrapper .tableWrapper .dataWrapper { + overflow-y: scroll; + max-height: 350px; +} +.gbpWrapper .sigmaWrapper .sigmaModalWrapper .tableWrapper .rowWrapper { + padding: 10px; + margin-bottom: 10px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + border: 1px solid #d5d5d5; +} +.modal-dialog { + z-index: 100; + height: 700px; + width: 700px; + background-color: white; + position: fixed; + opacity: 1; + top: 50%; + left: 50%; + margin: -350px 0 0 -400px; +} +.modal-dialog .modal-header { + height: 70px; + padding: 10px 15px; +} +.modal-dialog .modal-navigation { + float: left; + width: 150px; + height: 630px; + border-right: 1px solid #e5e5e5; + background-color: #eeeeee; +} +.modal-dialog .modal-navigation ul { + -webkit-padding-start: 0; + list-style-type: none; +} +.modal-dialog .modal-navigation ul li.navigation-item { + height: 54px; + width: 100%; + background-color: #eeeeee; + color: #666; + font-weight: bold; + padding: 20px; +} +.modal-dialog .modal-navigation ul li.navigation-item.selected { + background-color: #428bca; + border-color: #357ebd; + color: #ffffff; +} +.modal-dialog .modal-content-container { + float: right; + width: 550px; + height: 630px; +} +.modal-dialog .modal-content-container .content { + overflow-y: scroll; + padding: 0 50px 0 20px; + height: 580px; +} +.modal-dialog .modal-content-container .bottom-navigation { + height: 50px; + bottom: 0; + float: right; + margin: 8px 30px; +} +.modal-canvas { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 10; + background-color: #000; + opacity: .15; +} +.link-tools .tool-remove { + display: none; +} +.link-tools .tool-options { + display: none; +} +.connection-wrap, +.marker-arrowheads { + display: none; +}/*-------------------YangUI import START-------------------*/ +.gbpWrapper .customContainer { + border-left: 1px solid #7a7a7a; + margin: 35px 5px 5px 15px; + padding: 5px; + /*z-index: 10;*/ + width: auto; + position: relative; +} +.gbpWrapper .customContainer.withoutBorder { + border-left: 0; + padding-bottom: 0; +} +.gbpWrapper .customContainer.withoutBorder .treeBullet.containerBullet { + left: -25px; + top: -25px; +} +.gbpWrapper .topContainerPart { + margin-left: -19px; + margin-top: -28px; + margin-bottom: 10px; +} +.gbpWrapper .treeBullet { + font-size: 25px; + color: #7a7a7a; + position: absolute; + left: -15px; + top: 0; +} +.gbpWrapper .treeBullet.containerBullet { + top: -25px; + left: -25px; +} +.gbpWrapper .btn-name { + -webkit-border-radius: 5px; + border-radius: 5px; + background: transparent; + font-weight: bold; + color: #393939; + border: 2px solid #393939; + cursor: auto; +} +.gbpWrapper button.yangButton, +.gbpWrapper div.yangButton { + cursor: pointer; + position: relative; + width: 24px; + height: 24px; + border: 0; + margin: 2px; + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; +} +.gbpWrapper button.yangButton.iconArrowDown, +.gbpWrapper div.yangButton.iconArrowDown { + background: transparent url('images/yang-ui-icons/icon-arrow-down.tpl.html') no-repeat center top; +} +.gbpWrapper button.yangButton.iconArrowRight, +.gbpWrapper div.yangButton.iconArrowRight { + background: transparent url('images/yang-ui-icons/icon-arrow-right.tpl.html') no-repeat center top; +} +.gbpWrapper button.yangButton.iconNext, +.gbpWrapper div.yangButton.iconNext { + background: transparent url('images/yang-ui-icons/icon-next.tpl.html') no-repeat center top; +} +.gbpWrapper button.yangButton.iconPrev, +.gbpWrapper div.yangButton.iconPrev { + background: transparent url('images/yang-ui-icons/icon-prev.tpl.html') no-repeat center top; +} +.gbpWrapper button.yangButton:hover, +.gbpWrapper div.yangButton:hover { + background-position: center -24px; +} +.gbpWrapper button.yangButton.disabled, +.gbpWrapper div.yangButton.disabled { + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity= 40 )' !important; + filter: alpha(opacity= 40 ) !important; + -moz-opacity: 0.4 !important; + -khtml-opacity: 0.4 !important; + opacity: 0.4 !important; +} +.gbpWrapper button.yangButton.disabled:hover, +.gbpWrapper div.yangButton.disabled:hover { + background-position: center top; +} +.gbpWrapper .btn-slim { + padding-top: 2px; + padding-bottom: 2px; +} +.gbpWrapper .inlineBlock { + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; +} +.gbpWrapper .leaf { + margin: 5px; + padding-left: 5px; + position: relative; +} +.gbpWrapper .leaf-label { + margin-right: 10px; + font-weight: bold; + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; + /*width: 170px;*/ + padding-top: 6px; +} +.gbpWrapper .leaf-label button.iconQuestion { + margin-top: -2px; +} +.gbpWrapper .leaf-label i.icon-key { + font-size: 1.3em; + padding-left: 5px; +} +.gbpWrapper .clear { + clear: both; +} +.gbpWrapper .borderArrow { + color: #393939; + position: absolute; + bottom: -6px; + left: -6px; + font-size: 1.3em; +} +.gbpWrapper .tooltip-inner { + color: #fff; + white-space: pre-wrap; + /* CSS3 */ + white-space: -moz-pre-wrap; + /* Firefox */ + white-space: -pre-wrap; + /* Opera <7 */ + white-space: -o-pre-wrap; + /* Opera 7 */ + word-wrap: break-word; + /* IE */ +} +/*-------------------YangUI import END-------------------*/ +/* +-------------------JointJS Graph START------------------- +.html-element { + position: absolute; + background: #3498DB; + pointer-events: none; + -webkit-user-select: none; + border-radius: 4px; + border: 2px solid #2980B9; + box-shadow: inset 0 0 5px black, 2px 2px 1px gray; + padding: 5px; + box-sizing: border-box; + z-index: 2; + pointer-events: auto; + bottom: 0; + left: 0; + right: 0; + color: #333; + height: 16px; + margin-top: 107px; + margin-left: 16px; + width: 50px !important; + height: 20px !important; +} +-------------------JointJS Graph END------------------- +*/ +/*GBP END*/ + +.gbpWrapper .btn-like-tab { + text-decoration: none; + color: #464646; + border: 0; + line-height: 32px; + padding: 0 15px; + background: transparent !important; + border-bottom: 3px solid transparent; + margin: 0 10px; + -webkit-border-radius: 0; + -moz-border-radius: 0; + -ms-border-radius: 0; + -o-border-radius: 0; + border-radius: 0; + -webkit-transition: 150ms; + transition: 150ms; + -webkit-transition: all 150ms linear; + -moz-transition: all 150ms linear; + -ms-transition: all 150ms linear; + -o-transition: all 150ms linear; + transition: all 150ms linear; +} +.gbpWrapper .btn-like-tab.btn-selected, +.gbpWrapper .btn-like-tab:hover { + border-bottom: 3px solid #1baafd; + background: transparent !important; +} + +.gbpWrapper h1, .gbpWrapper h2, .gbpWrapper h3 { + color: #393939; +} + +#page_logo { + display:none; +} + + diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.less b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.less old mode 100755 new mode 100644 similarity index 94% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.less rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.less index 8b7041729..597e5f9e1 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.less +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.less @@ -1,759 +1,759 @@ -/*GBP*/ -.pl0{padding-left: 0!important}; -.pr0{padding-right: 0!important}; - -.mt10{margin-top: 10px}; -.mt20{margin-top: 20px}; -.mt30{margin-top: 30px}; -.mt40{margin-top: 40px}; - -.mb50{margin-bottom: 50px}; -.mb0{margin-bottom: 0px!important}; - -.ml10{margin-left: 10px!important}; -.ml20{margin-left: 20px!important}; -.ml30{margin-left: 30px!important}; - -.maxHeight500{ - max-height: 500px; - overflow-y: scroll; -} - -.gbpGlobalWrapper{ - background: #f5f5f5; - margin-bottom: 0!important; - min-height: 100%; - padding-bottom: 60px; - - span, label { - color: #393939; - } - - h2{ - color: #666; - } - - .form-control, .main input[type="text"]{ - background: #fff; - color: #858585; - - &[disabled]{ - background: #eeeeee; - } - } - - - .form-control{ - &.narrow-input-left{ - width: 45%; - float: left; - } - &.narrow-input-right{ - width: 45%; - float: right; - } - } - - .row-param{ - margin-bottom: 15px; - float: left; - } - - .param-label{ - width:100%; - float: left; - } - - .ep-filter{ - margin-bottom: 20px; - DIV{ - width: 48%; - } - } - - .float-left{ - float: left; - } - - .float-right{ - float: right; - } - - .full-width{ - width: 100%; - - .btn{ - width: 50px; - } - - label{ - margin-top: 10px; - } - } -} - -.gbpWrapper{ - - .btn-primary{ - color: #ffffff; - background-color: #428bca; - border-color: #357ebd; - font-weight: normal; - - &:hover { - background-color: #1BAAFD; - border-color: #1BAAFD; - } - - &.bottom-buttons { - bottom: 0; - position: absolute; - margin-bottom: 0 !important; - background-color: #FF7300; - border-color: #FF7300; - width: 45%; - - &.back { - right:0; - margin-right: 15px; - } - - &.home { - left:0; - margin-left: 15px; - } - - &:hover { - background-color: #FF8f33; - border-color: #FF8f33; - } - - &.full-width{ - width: calc(~'100% - 30px'); - left: 0; - margin-left: 15px; - } - - &.wizard-button{ - bottom: 40px; - } - } - - &.btn-big{ - padding: 20px; - font-size: 1.5em; - white-space: normal; - } - } - - .noPadding{ - padding: 0!important; - } - - .basicLabel{ - padding: 0; - font-weight: normal; - } - - .rowWrapper{ - margin-bottom: 5px; - } - - .inline-block{ - display: inline-block; - } - - #graph{ - overflow: auto; - width: 100%; - height: 100%; - } - - .graphWrapper{ - position: relative; - - .controlPanelButtons{ - position: absolute; - top: 50px; - right: 0px; - - .line{ - margin: 5px 0; - } - } - - .btn{ - min-width: 22px; - line-height: 22px; - text-align: center; - padding: 0!important; - } - } - - //SIMPLE BOX - .simpleBox{ - .roundedCorners(5px); - border: 1px solid #e5e5e5; - background: #fff; - padding: 20px; - - h2{ - margin-top: 0; - } - } - - .sectionTitle{ - padding: 20px; - label{ - font-size: 25px; - } - } - - //LEGEND BOX - .legendBox{ - position: absolute; - top: 50px; - right: 50px; - z-index: 10; - ul{ - padding: 0; - list-style: none; - - .item{ - padding-top: 5px; - margin-bottom: 10px; - } - - .line{ - .inlineBlock; - margin: 9px 5px 0 0; - width: 50px; - - &.blue{ - border-top: 2px solid blue; - } - - &.green{ - border-top: 2px solid green; - } - } - } - } - - //MAIN NAVIGATION - .mainNavigationWrapper{ - padding-bottom: 50px; - overflow-x: scroll; - } - .mainNavigation{ - padding-top: 5%; - min-width: 1450px; - .topButtonsWrapper, .bottomButtonsWrapper{ - text-align: center; - width: 400px; - margin: 0 auto 15px; - padding: 0 0 20px; - border-bottom: 5px solid #393939; - } - - .bottomButtonsWrapper{ - border-bottom: 0; - border-top: 5px solid #393939; - padding: 20px 0 0; - margin: 15px auto 0; - } - - .middleButtonsWrapper{ - text-align: center; - - .buttonWrapper{ - margin-top: 25px; - - } - - .iconWrapper{ - .inlineBlock; - padding-top: 10px; - } - } - - .middleBox{ - .inlineBlock; - width: 500px; - height: 150px; - border-left: 5px solid #393939; - border-right: 5px solid #393939; - - .infinityIcon{ - background: transparent url('../../src/app/gbp/images/infinity-loop.tpl.html') no-repeat center center; - width: 128px; - height: 128px; - margin: 11px auto 0; - cursor: pointer; - } - } - - .buttonWrapper{ - text-align: center; - // width: 300px; - // margin: 0 auto; - .inlineBlock; - - .btn-primary{ - font-size: 2em; - padding: 25px 0; - width: 350px; - .inlineBlock; - } - - .icon-large{ - &:before{ - font-size: 5em; - } - } - } - } - - //RIGHT PANEL - aside{ - &.col-md-3{ - min-height: 800px; - - .inWrapper{ - height: 100%; - } - } - } - - .panelWrapper{ - padding: 20px 0 50px; - height: calc(~'100% - 109px'); - &.no-padd-top{ - padding-top: 0px; - } - button{ - &.btn{ - margin-bottom: 5px; - } - &.btn-list{ - margin-top: 25px; - } - &.btn-default:hover { - background-color: #e6e6e6 !important; - } - &.btn-default:focus { - background-color: #fff; - } - &.activated, &.activated:focus { - background-color: #e6e6e6 !important; - } - } - } - - .breadcrumbs{ - padding: 10px 0px; - font-weight: bold; - border: 0; - line-height: initial; - } - - section.sigmaWrapper { - div.legend{ - margin-bottom: 25px; - - span, .text{ - color: #fff; - } - - ul{ - padding: 0; - margin: 0; - list-style: none; - } - li{ - margin-bottom: 5px; - .textHidden{ - display: none; - } - .text{ - margin-left: 10px; - line-height: 18px; - } - .showChckbx{ - position: relative; - top: 2px; - left: 5px; - } - .itemWrapper{ - &:hover{ - .text{ - display: block !important; - } - } - } - - } - div.color{ - /*margin-right: 15px;*/ - width: 18px; - height: 18px; - -webkit-border-radius: 9px; - border-radius: 9px; - cursor: pointer; - } - } - } - - #graph-container{ - // background: transparent; - padding: 0; - height: 800px; - } - - .selectWrapper{ - padding-left: 0; - &.col-md-12{ - padding: 0; - margin-bottom: 5px; - } - } - - .inputWrapper{ - &.leftInput{ - padding-left: 0; - } - - &.rightInput{ - padding-right: 0; - } - } - - .separator{ - padding-bottom: 10px; - margin-top: 15px; - height: 1px; - padding-left: 0px; - padding-right: 15px; - } - - .inner-separator{ - border-bottom: 1px solid #858585; - width: 100%; - float: left; - } - - .btn-group{ - padding: 0; - } - - .formWrapper{ - margin: 20px 0; - } - - .icon-remove { - &.align-right { - float: right; - - &.padding { - margin: 5px 5px 0 0; - } - } - } - - .icon-exclamation-sign{ - &.red { - color: red; - } - } - - .sigmaWrapper{ - position: relative; - - .sigmaModalWrapper{ - position: absolute; - top: 30px; - left: 45px; - z-index: 1; - - .icon-remove{ - position: absolute; - top: 5px; - right: 5px; - } - - .tableWrapper{ - position: relative; - background: #f5f5f5; - .roundedCorners(5px); - min-width: 400px; - min-height: 100px; - margin-top: 20px; - padding: 20px; - - .dataWrapper{ - overflow-y: scroll; - max-height: 350px; - } - - .rowWrapper{ - padding: 10px; - margin-bottom: 10px; - .roundedCorners(5px); - border: 1px solid #d5d5d5; - } - } - } - } -} - -.modal-dialog { - z-index: 100; - height: 700px; - width: 700px; - background-color: white; - position: fixed; - opacity: 1; - top:50%; - left:50%; - margin:-350px 0 0 -400px; - - .modal-header { - height: 70px; - padding: 10px 15px; - } - - .modal-navigation { - float:left; - width: 150px; - height: 630px; - border-right: 1px solid #e5e5e5; - background-color: #eeeeee; - - ul { - -webkit-padding-start: 0; - list-style-type: none; - - li.navigation-item { - height: 54px; - width: 100%; - background-color: #eeeeee; - color: #666; - font-weight: bold; - padding: 20px; - - &.selected { - background-color: #428bca; - border-color: #357ebd; - color: #ffffff; - } - } - } - } - - .modal-content-container { - float: right; - width: 550px; - height: 630px; - - .content { - overflow-y: scroll; - padding: 0 50px 0 20px; - height: 580px; - } - - .bottom-navigation { - height: 50px; - bottom: 0; - float: right; - margin: 8px 30px - } - } - - - - -} - -.modal-canvas { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 10; - background-color: #000; - opacity: .15; -} - -.link-tools .tool-remove { display: none } -.link-tools .tool-options { display: none } -.connection-wrap, .marker-arrowheads { display: none } - -/*-------------------YangUI import START-------------------*/ - -@iconsRootPath : 'images/yang-ui-icons/'; -.gbpWrapper{ - .customContainer{ - border-left: 1px solid #7a7a7a; - margin: 35px 5px 5px 15px; - padding: 5px; - /*z-index: 10;*/ - width:auto; - position: relative; - &.withoutBorder{ - border-left: 0; - padding-bottom: 0; - .treeBullet.containerBullet{ - left: -25px; - top: -25px; - } - } - } - - .topContainerPart{ - margin-left: -19px; - margin-top: -28px; - margin-bottom: 10px; - } - - .treeBullet{ - font-size: 25px; - color: #7a7a7a; - position: absolute; - left: -15px; - top: 0; - &.containerBullet{ - top: -25px; - left: -25px; - } - } - - .btn-name{ - -webkit-border-radius: 5px; - border-radius: 5px; - background: transparent; - font-weight: bold; - color: @text-color; - border: 2px solid @text-color; - cursor: auto; - } - - button, div{ - &.yangButton{ - cursor: pointer; - position: relative; - width: 24px; - height: 24px; - border: 0; - margin: 2px; - .inlineBlock; - &.iconArrowDown{ - background: transparent url('@{iconsRootPath}icon-arrow-down.png') no-repeat center top; - } - &.iconArrowRight{ - background: transparent url('@{iconsRootPath}icon-arrow-right.png') no-repeat center top; - } - &.iconNext{ - background: transparent url('@{iconsRootPath}icon-next.png') no-repeat center top; - } - &.iconPrev{ - background: transparent url('@{iconsRootPath}icon-prev.png') no-repeat center top; - } - &:hover{ - background-position: center -24px; - } - &.disabled{ - .opacityDeph(0.4)!important; - &:hover{ - background-position: center top; - } - } - } - } - - .btn-slim { - padding-top: 2px; - padding-bottom: 2px; - } - - .inlineBlock { - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - *display: inline; - } - - .leaf { - margin: 5px; - padding-left: 5px; - position: relative; - } - - .leaf-label { - margin-right: 10px; - font-weight: bold; - .inlineBlock; - /*width: 170px;*/ - padding-top: 6px; - button.iconQuestion{ - margin-top: -2px; - } - - i.icon-key { - font-size: 1.3em; - padding-left: 5px; - } - } - - .clear{ - clear: both; - } - - .borderArrow{ - color: @text-color; - position: absolute; - bottom: -6px; - left: -6px; - font-size: 1.3em; - } - - .tooltip-inner{ - color: #fff; - white-space: pre-wrap; /* CSS3 */ - white-space: -moz-pre-wrap; /* Firefox */ - white-space: -pre-wrap; /* Opera <7 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* IE */ - } -} -/*-------------------YangUI import END-------------------*/ - -/* --------------------JointJS Graph START------------------- -.html-element { - position: absolute; - background: #3498DB; - pointer-events: none; - -webkit-user-select: none; - border-radius: 4px; - border: 2px solid #2980B9; - box-shadow: inset 0 0 5px black, 2px 2px 1px gray; - padding: 5px; - box-sizing: border-box; - z-index: 2; - pointer-events: auto; - bottom: 0; - left: 0; - right: 0; - color: #333; - height: 16px; - margin-top: 107px; - margin-left: 16px; - width: 50px !important; - height: 20px !important; -} --------------------JointJS Graph END------------------- -*/ - +/*GBP*/ +.pl0{padding-left: 0!important}; +.pr0{padding-right: 0!important}; + +.mt10{margin-top: 10px}; +.mt20{margin-top: 20px}; +.mt30{margin-top: 30px}; +.mt40{margin-top: 40px}; + +.mb50{margin-bottom: 50px}; +.mb0{margin-bottom: 0px!important}; + +.ml10{margin-left: 10px!important}; +.ml20{margin-left: 20px!important}; +.ml30{margin-left: 30px!important}; + +.maxHeight500{ + max-height: 500px; + overflow-y: scroll; +} + +.gbpGlobalWrapper{ + background: #f5f5f5; + margin-bottom: 0!important; + min-height: 100%; + padding-bottom: 60px; + + span, label { + color: #393939; + } + + h2{ + color: #666; + } + + .form-control, .main input[type="text"]{ + background: #fff; + color: #858585; + + &[disabled]{ + background: #eeeeee; + } + } + + + .form-control{ + &.narrow-input-left{ + width: 45%; + float: left; + } + &.narrow-input-right{ + width: 45%; + float: right; + } + } + + .row-param{ + margin-bottom: 15px; + float: left; + } + + .param-label{ + width:100%; + float: left; + } + + .ep-filter{ + margin-bottom: 20px; + DIV{ + width: 48%; + } + } + + .float-left{ + float: left; + } + + .float-right{ + float: right; + } + + .full-width{ + width: 100%; + + .btn{ + width: 50px; + } + + label{ + margin-top: 10px; + } + } +} + +.gbpWrapper{ + + .btn-primary{ + color: #ffffff; + background-color: #428bca; + border-color: #357ebd; + font-weight: normal; + + &:hover { + background-color: #1BAAFD; + border-color: #1BAAFD; + } + + &.bottom-buttons { + bottom: 0; + position: absolute; + margin-bottom: 0 !important; + background-color: #FF7300; + border-color: #FF7300; + width: 45%; + + &.back { + right:0; + margin-right: 15px; + } + + &.home { + left:0; + margin-left: 15px; + } + + &:hover { + background-color: #FF8f33; + border-color: #FF8f33; + } + + &.full-width{ + width: calc(~'100% - 30px'); + left: 0; + margin-left: 15px; + } + + &.wizard-button{ + bottom: 40px; + } + } + + &.btn-big{ + padding: 20px; + font-size: 1.5em; + white-space: normal; + } + } + + .noPadding{ + padding: 0!important; + } + + .basicLabel{ + padding: 0; + font-weight: normal; + } + + .rowWrapper{ + margin-bottom: 5px; + } + + .inline-block{ + display: inline-block; + } + + #graph{ + overflow: auto; + width: 100%; + height: 100%; + } + + .graphWrapper{ + position: relative; + + .controlPanelButtons{ + position: absolute; + top: 50px; + right: 0px; + + .line{ + margin: 5px 0; + } + } + + .btn{ + min-width: 22px; + line-height: 22px; + text-align: center; + padding: 0!important; + } + } + + //SIMPLE BOX + .simpleBox{ + .roundedCorners(5px); + border: 1px solid #e5e5e5; + background: #fff; + padding: 20px; + + h2{ + margin-top: 0; + } + } + + .sectionTitle{ + padding: 20px; + label{ + font-size: 25px; + } + } + + //LEGEND BOX + .legendBox{ + position: absolute; + top: 50px; + right: 50px; + z-index: 10; + ul{ + padding: 0; + list-style: none; + + .item{ + padding-top: 5px; + margin-bottom: 10px; + } + + .line{ + .inlineBlock; + margin: 9px 5px 0 0; + width: 50px; + + &.blue{ + border-top: 2px solid blue; + } + + &.green{ + border-top: 2px solid green; + } + } + } + } + + //MAIN NAVIGATION + .mainNavigationWrapper{ + padding-bottom: 50px; + overflow-x: scroll; + } + .mainNavigation{ + padding-top: 5%; + min-width: 1450px; + .topButtonsWrapper, .bottomButtonsWrapper{ + text-align: center; + width: 400px; + margin: 0 auto 15px; + padding: 0 0 20px; + border-bottom: 5px solid #393939; + } + + .bottomButtonsWrapper{ + border-bottom: 0; + border-top: 5px solid #393939; + padding: 20px 0 0; + margin: 15px auto 0; + } + + .middleButtonsWrapper{ + text-align: center; + + .buttonWrapper{ + margin-top: 25px; + + } + + .iconWrapper{ + .inlineBlock; + padding-top: 10px; + } + } + + .middleBox{ + .inlineBlock; + width: 500px; + height: 150px; + border-left: 5px solid #393939; + border-right: 5px solid #393939; + + .infinityIcon{ + background: transparent url('../../src/app/gbp/images/infinity-loop.tpl.html') no-repeat center center; + width: 128px; + height: 128px; + margin: 11px auto 0; + cursor: pointer; + } + } + + .buttonWrapper{ + text-align: center; + // width: 300px; + // margin: 0 auto; + .inlineBlock; + + .btn-primary{ + font-size: 2em; + padding: 25px 0; + width: 350px; + .inlineBlock; + } + + .icon-large{ + &:before{ + font-size: 5em; + } + } + } + } + + //RIGHT PANEL + aside{ + &.col-md-3{ + min-height: 800px; + + .inWrapper{ + height: 100%; + } + } + } + + .panelWrapper{ + padding: 20px 0 50px; + height: calc(~'100% - 109px'); + &.no-padd-top{ + padding-top: 0px; + } + button{ + &.btn{ + margin-bottom: 5px; + } + &.btn-list{ + margin-top: 25px; + } + &.btn-default:hover { + background-color: #e6e6e6 !important; + } + &.btn-default:focus { + background-color: #fff; + } + &.activated, &.activated:focus { + background-color: #e6e6e6 !important; + } + } + } + + .breadcrumbs{ + padding: 10px 0px; + font-weight: bold; + border: 0; + line-height: initial; + } + + section.sigmaWrapper { + div.legend{ + margin-bottom: 25px; + + span, .text{ + color: #fff; + } + + ul{ + padding: 0; + margin: 0; + list-style: none; + } + li{ + margin-bottom: 5px; + .textHidden{ + display: none; + } + .text{ + margin-left: 10px; + line-height: 18px; + } + .showChckbx{ + position: relative; + top: 2px; + left: 5px; + } + .itemWrapper{ + &:hover{ + .text{ + display: block !important; + } + } + } + + } + div.color{ + /*margin-right: 15px;*/ + width: 18px; + height: 18px; + -webkit-border-radius: 9px; + border-radius: 9px; + cursor: pointer; + } + } + } + + #graph-container{ + // background: transparent; + padding: 0; + height: 800px; + } + + .selectWrapper{ + padding-left: 0; + &.col-md-12{ + padding: 0; + margin-bottom: 5px; + } + } + + .inputWrapper{ + &.leftInput{ + padding-left: 0; + } + + &.rightInput{ + padding-right: 0; + } + } + + .separator{ + padding-bottom: 10px; + margin-top: 15px; + height: 1px; + padding-left: 0px; + padding-right: 15px; + } + + .inner-separator{ + border-bottom: 1px solid #858585; + width: 100%; + float: left; + } + + .btn-group{ + padding: 0; + } + + .formWrapper{ + margin: 20px 0; + } + + .icon-remove { + &.align-right { + float: right; + + &.padding { + margin: 5px 5px 0 0; + } + } + } + + .icon-exclamation-sign{ + &.red { + color: red; + } + } + + .sigmaWrapper{ + position: relative; + + .sigmaModalWrapper{ + position: absolute; + top: 30px; + left: 45px; + z-index: 1; + + .icon-remove{ + position: absolute; + top: 5px; + right: 5px; + } + + .tableWrapper{ + position: relative; + background: #f5f5f5; + .roundedCorners(5px); + min-width: 400px; + min-height: 100px; + margin-top: 20px; + padding: 20px; + + .dataWrapper{ + overflow-y: scroll; + max-height: 350px; + } + + .rowWrapper{ + padding: 10px; + margin-bottom: 10px; + .roundedCorners(5px); + border: 1px solid #d5d5d5; + } + } + } + } +} + +.modal-dialog { + z-index: 100; + height: 700px; + width: 700px; + background-color: white; + position: fixed; + opacity: 1; + top:50%; + left:50%; + margin:-350px 0 0 -400px; + + .modal-header { + height: 70px; + padding: 10px 15px; + } + + .modal-navigation { + float:left; + width: 150px; + height: 630px; + border-right: 1px solid #e5e5e5; + background-color: #eeeeee; + + ul { + -webkit-padding-start: 0; + list-style-type: none; + + li.navigation-item { + height: 54px; + width: 100%; + background-color: #eeeeee; + color: #666; + font-weight: bold; + padding: 20px; + + &.selected { + background-color: #428bca; + border-color: #357ebd; + color: #ffffff; + } + } + } + } + + .modal-content-container { + float: right; + width: 550px; + height: 630px; + + .content { + overflow-y: scroll; + padding: 0 50px 0 20px; + height: 580px; + } + + .bottom-navigation { + height: 50px; + bottom: 0; + float: right; + margin: 8px 30px + } + } + + + + +} + +.modal-canvas { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 10; + background-color: #000; + opacity: .15; +} + +.link-tools .tool-remove { display: none } +.link-tools .tool-options { display: none } +.connection-wrap, .marker-arrowheads { display: none } + +/*-------------------YangUI import START-------------------*/ + +@iconsRootPath : 'images/yang-ui-icons/'; +.gbpWrapper{ + .customContainer{ + border-left: 1px solid #7a7a7a; + margin: 35px 5px 5px 15px; + padding: 5px; + /*z-index: 10;*/ + width:auto; + position: relative; + &.withoutBorder{ + border-left: 0; + padding-bottom: 0; + .treeBullet.containerBullet{ + left: -25px; + top: -25px; + } + } + } + + .topContainerPart{ + margin-left: -19px; + margin-top: -28px; + margin-bottom: 10px; + } + + .treeBullet{ + font-size: 25px; + color: #7a7a7a; + position: absolute; + left: -15px; + top: 0; + &.containerBullet{ + top: -25px; + left: -25px; + } + } + + .btn-name{ + -webkit-border-radius: 5px; + border-radius: 5px; + background: transparent; + font-weight: bold; + color: @text-color; + border: 2px solid @text-color; + cursor: auto; + } + + button, div{ + &.yangButton{ + cursor: pointer; + position: relative; + width: 24px; + height: 24px; + border: 0; + margin: 2px; + .inlineBlock; + &.iconArrowDown{ + background: transparent url('@{iconsRootPath}icon-arrow-down.png') no-repeat center top; + } + &.iconArrowRight{ + background: transparent url('@{iconsRootPath}icon-arrow-right.png') no-repeat center top; + } + &.iconNext{ + background: transparent url('@{iconsRootPath}icon-next.png') no-repeat center top; + } + &.iconPrev{ + background: transparent url('@{iconsRootPath}icon-prev.png') no-repeat center top; + } + &:hover{ + background-position: center -24px; + } + &.disabled{ + .opacityDeph(0.4)!important; + &:hover{ + background-position: center top; + } + } + } + } + + .btn-slim { + padding-top: 2px; + padding-bottom: 2px; + } + + .inlineBlock { + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + zoom: 1; + *display: inline; + } + + .leaf { + margin: 5px; + padding-left: 5px; + position: relative; + } + + .leaf-label { + margin-right: 10px; + font-weight: bold; + .inlineBlock; + /*width: 170px;*/ + padding-top: 6px; + button.iconQuestion{ + margin-top: -2px; + } + + i.icon-key { + font-size: 1.3em; + padding-left: 5px; + } + } + + .clear{ + clear: both; + } + + .borderArrow{ + color: @text-color; + position: absolute; + bottom: -6px; + left: -6px; + font-size: 1.3em; + } + + .tooltip-inner{ + color: #fff; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + white-space: -pre-wrap; /* Opera <7 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* IE */ + } +} +/*-------------------YangUI import END-------------------*/ + +/* +-------------------JointJS Graph START------------------- +.html-element { + position: absolute; + background: #3498DB; + pointer-events: none; + -webkit-user-select: none; + border-radius: 4px; + border: 2px solid #2980B9; + box-shadow: inset 0 0 5px black, 2px 2px 1px gray; + padding: 5px; + box-sizing: border-box; + z-index: 2; + pointer-events: auto; + bottom: 0; + left: 0; + right: 0; + color: #333; + height: 16px; + margin-top: 107px; + margin-left: 16px; + width: 50px !important; + height: 20px !important; +} +-------------------JointJS Graph END------------------- +*/ + /*GBP END*/ \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.module.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.module.js old mode 100755 new mode 100644 similarity index 96% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.module.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.module.js index 71308d52d..39d7f5fb6 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.module.js +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.module.js @@ -1,58 +1,58 @@ -define(['angularAMD', 'app/routingConfig', 'ui-bootstrap', 'Restangular', 'angular-translate'], function() { - - var gbp = angular.module('app.gbp', ['ui.router.state','app.core', 'ui.bootstrap', 'restangular', 'pascalprecht.translate']); - - gbp.register = gbp; - - gbp.config(function ($stateProvider, $compileProvider, $controllerProvider, $provide, $translateProvider, NavHelperProvider, $filterProvider) { - - $translateProvider.useStaticFilesLoader({ - prefix: 'assets/data/locale-', - suffix: '.json' - }); - - gbp.register = { - directive : $compileProvider.directive, - controller : $controllerProvider.register, - filter: $filterProvider.register, - factory : $provide.factory, - service : $provide.service - }; - - NavHelperProvider.addControllerUrl('app/gbp/gbp.controller'); - NavHelperProvider.addToMenu('gbp', { - "link": "#/gbp/index", - "active": "main.gbp", - "title": "GBP", - "icon": "icon-level-down", - "page": { - "title": "GBP", - "description": "GBP" - } - }); - - var access = routingConfig.accessLevels; - $stateProvider.state('main.gbp', { - url: 'gbp', - abstract: true, - views : { - 'content' : { - templateUrl: 'src/app/gbp/views/root.tpl.html' - } - } - }); - - $stateProvider.state('main.gbp.index', { - url: '/index', - access: access.admin, - views: { - '': { - controller: 'gbpCtrl', - templateUrl: 'src/app/gbp/views/index.tpl.html' - } - } - }); - }); - - return gbp; -}); +define(['angularAMD', 'app/routingConfig', 'ui-bootstrap', 'Restangular', 'angular-translate'], function() { + + var gbp = angular.module('app.gbp', ['ui.router.state','app.core', 'ui.bootstrap', 'restangular', 'pascalprecht.translate']); + + gbp.register = gbp; + + gbp.config(function ($stateProvider, $compileProvider, $controllerProvider, $provide, $translateProvider, NavHelperProvider, $filterProvider) { + + $translateProvider.useStaticFilesLoader({ + prefix: 'assets/data/locale-', + suffix: '.json' + }); + + gbp.register = { + directive : $compileProvider.directive, + controller : $controllerProvider.register, + filter: $filterProvider.register, + factory : $provide.factory, + service : $provide.service + }; + + NavHelperProvider.addControllerUrl('app/gbp/gbp.controller'); + NavHelperProvider.addToMenu('gbp', { + "link": "#/gbp/index", + "active": "main.gbp", + "title": "GBP", + "icon": "icon-level-down", + "page": { + "title": "GBP", + "description": "GBP" + } + }); + + var access = routingConfig.accessLevels; + $stateProvider.state('main.gbp', { + url: 'gbp', + abstract: true, + views : { + 'content' : { + templateUrl: 'src/app/gbp/views/root.tpl.html' + } + } + }); + + $stateProvider.state('main.gbp.index', { + url: '/index', + access: access.admin, + views: { + '': { + controller: 'gbpCtrl', + templateUrl: 'src/app/gbp/views/index.tpl.html' + } + } + }); + }); + + return gbp; +}); diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.services.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.services.js old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.services.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.services.js index 064fd5c9a..ef75e0a5f --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/gbp.services.js +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/gbp.services.js @@ -1,2870 +1,2870 @@ -define(['app/gbp/gbp.module', 'app/gbp/js/joint.clean.build'], function(gbp, joint) { - - gbp.register.factory('GBPRestangular', function(Restangular, ENV) { - return Restangular.withConfig(function(RestangularConfig) { - RestangularConfig.setBaseUrl(ENV.getBaseURL("MD_SAL")); - }); - }); - - gbp.register.factory('GBPConstants', function() { - var c = { colors: {'graph' : {}}, strings: {}, jointElements: {}, objType: {}, numbers: {}}; - - c.strings.flood = 'flood'; - c.strings.bridge = 'bridge'; - c.strings.l3ctx = 'l3ctx'; - c.strings.subnet = 'subnet'; - c.strings.linklabel = 'linklabel'; - c.strings.in = 'in'; - c.strings.out = 'out'; - c.strings.bi = 'bidirectional'; - - c.strings.config = 'CONFIG'; - c.strings.oper = 'OPERATIONAL'; - c.strings.l2l3 = 'L2L3'; - c.strings.mock = 'MOCK'; - c.strings.sigmaTopoDefaultText = 'SIGMATOPODEFAULTTEXT'; - c.strings.sigmaTopoDefault = 'SIGMATOPODEFAULTTEXT'; - - c.colors[c.strings.flood] = '#DF0101'; - c.colors[c.strings.bridge] = '#0080FF'; - c.colors[c.strings.l3ctx] = '#3ADF00'; - c.colors[c.strings.subnet] = '#FF9933'; - c.colors[c.strings.sigmaTopoDefaultText] = '#fff'; - c.colors[c.strings.epg] = '#8fde70'; - c.colors[c.strings.linklabel] = '#3366CC'; - - c.colors[c.strings.flood+'-'+c.strings.bridge] = '#6666FF'; - c.colors[c.strings.bridge+'-'+c.strings.l3ctx] = '#6666FF'; - - c.colors[c.strings.subnet+'-'] = '#6666FF'; - - c.colors['graph']['subject'] = '#FFFFD4'; - c.colors['graph']['cns'] = '#8EEDFF'; - c.colors['graph']['pns'] = '#FF9C9C'; - - c.jointElements.minWidth = 100; - c.jointElements.maxWidth = 300; - c.jointElements.minHeight = 50; - c.jointElements.maxHeight = 300; - - c.objType.contract = 'contract'; - c.objType.epg = 'epg'; - c.objType.consumer = 'consumer'; - c.objType.provider = 'provider'; - c.objType.subject = 'subject'; - c.objType.rule = 'rule'; - - c.numbers.displayLabelLength = 40; - - return c; - }); - - gbp.register.factory('MockServices', function() { - - var ms = {}; - - ms.mockTopoData = function() { - var lid = 0, - nodeRaw = [0, 1, 2, 3], - linkRaw = [[0, 1], [2, 3], [3, 0], [0, 3]], - nodes = nodeRaw.map(function(data) { - return { - 'id': 'n' + data, - 'label': 'LABEL'+data, - 'size': 3, - 'x': Math.random(), - 'y': Math.random(), - 'color': GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault] - }; - }), - links = linkRaw.map(function(data) { - var obj = { - id: 'e' + lid, - source: 'n' + data[0], - target: 'n' + data[1], - color: GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault] - }; - lid = lid + 1; - return obj; - }); - - return {nodes: nodes, links: links}; - }; - - return ms; - }); - - gbp.register.factory('TopologyDataLoaders', function(GBPRestangular, GBPConstants) { - var tdl = {}; - - tdl.getSubjectsBetweenEndpointGroups = function(storage, tenantId, successCbk, errorCbk) { - var restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'ui-backend:get-subjects-between-endpoint-groups', - reqData = { "input": { "tenant-id": tenantId }}; - - if(storage) { - reqData.input['from-oper-data'] = {}; - } - - restObj.post(rpcRes, reqData).then(function(data) { - // console.info('got data', data.output); - successCbk(data); - }, function(res) { - errorCbk(res); - }); - }; - - //Policies are representing links in PGN topology - tdl.getGroupRulesBetweenEndpointGroups = function(successCbk, errorCbk) { - var restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'pgn-application:get-group-rules-between-endpoint-groups', - reqData = { "input": { "endpoint-group-pair":[] }}; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); //set topology links - }, function(res) { - errorCbk(res); - }); - }; - - //Groups are representing nodes in PGN topology - tdl.getEndpointGroups = function(successCbk, errorCbk) { - var tenantId = getId(idTypes.tenant), - restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'pgn-application:get-endpoint-groups', - reqData = { - "input": { - "endpoint-group-id":[ - { - "pgn-application:tenant-id": tenantId - } - ] - } - }; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); //set topology nodes - }, function(res) { - errorCbk(res); - }); - - }; - - tdl.getEndpointsFromEndpointGroup = function(tenantId, epgId, successCbk, errorCbk) { - var restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'ui-backend:get-endpoints-from-endpoint-group', - reqData = { - "input": { - "tenant-id": tenantId, - "endpoint-group-id":epgId - } - }; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); //set topology nodes - }, function(res) { - errorCbk(res); - }); - - }; - - tdl.getEpgTopo = function(data){ - var epgData = data.output['endpoint-group-pair-with-subject'], - nodes = [], - edges = [], - setNode = function(obj){ - var nodeObj = { - 'id': 'n' + nodes.length, - 'label': obj.name || obj.id, - 'name': obj.name, - 'size': 1, - 'x': Math.random(), - 'y': Math.random(), - 'color': GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault], - 'type': obj.type - }; - - nodes.push(nodeObj); - return nodeObj.id; - }, - setEdge = function(sourceId, destId, data, direction) { - var obj = { - 'id': 'e' + edges.length, - 'source': sourceId, - 'target': destId, - 'color': GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault], - 'data': data, - 'direction' : direction - // 'type': 'curve', - // 'size' : 100 - }; - - edges.push(obj); - }, - getObjByProp = function(val, prop, list) { - return list.filter(function(i){ - return i[prop] === val; - }); - }, - getDirection = function(subjects){ - var directions = []; - if ( subjects ) { - subjects.forEach(function(s){ - if ( s['ui-rule'] ) { - s['ui-rule'].forEach(function(rule){ - if ( rule['classifier-ref'] ) { - rule['classifier-ref'].forEach(function(classifier){ - if ( classifier.direction && directions.indexOf(classifier.direction) === -1 ){ - directions.push(classifier.direction); - } - }); - } - }); - } - }); - } - return directions.length === 1 ? directions[0] : directions.length > 1 ? 'bidirectional' : null; - - }; - - if(epgData) { - epgData.forEach(function(e){ - var cepgnId = null, - pepgnId = null; - - if ( !getObjByProp(e['consumer-endpoint-group-id'],'name', nodes).length ) { - var objCepg = { - type: 'epg', - name: e['consumer-endpoint-group-id'] - }; - cepgnId = setNode(objCepg); - } else { - cepgnId = getObjByProp(e['consumer-endpoint-group-id'],'name', nodes)[0].id; - } - if ( !getObjByProp(e['provider-endpoint-group-id'],'name', nodes).length ) { - var objPepg = { - type: 'epg', - name: e['provider-endpoint-group-id'] - }; - pepgnId = setNode(objPepg); - } else { - pepgnId = getObjByProp(e['provider-endpoint-group-id'],'name', nodes)[0].id; - } - - var direction = getDirection(e['ui-subject']); - - if ( cepgnId && pepgnId ) { - setEdge(cepgnId, pepgnId, e['ui-subject'], direction); - } - }); - } - - return { - nodes: nodes, - links: edges - }; - }; - - - tdl.getL2L3 = function(storage, tenantId, successCbk, errorCbk) { - //l2-bridge-domain - var lid = 0, - nid = 0, - getL2L3Label = function(node) { - return node.name || node.id; - }, - getSubnetLabel = function(node) { - return node['ip-prefix'] || node.id; - }, - getNodeColor = function(src) { - return GBPConstants.colors[src] || GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault]; - }, - getLinkColor = function(from, to) { - return GBPConstants.colors[from+'-'+to] || GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault]; - }, - getNodes = function(data, srcDesc, getLabelCbk) { - var nodes = data.map(function(elem) { - var obj = { - 'id': 'n' + nid, - 'label': getLabelCbk(elem), - 'uuid': elem.id, - 'size': 3, - 'x': Math.random(), - 'y': Math.random(), - 'color': getNodeColor(srcDesc), - 'elemType': srcDesc - }; - - nid += 1; - return obj; - }); - - return nodes; - }, - getLinks = function(data, srcNodes, targetNodes, fromDesc, toDesc) { - var findByUUID = function(array, uuid) { - return array.filter(function(elem) { - return elem.uuid === uuid; - })[0]; - }; - - var links = data.map(function(elem) { - var obj = null, - src = findByUUID(srcNodes, elem.id), - trg = findByUUID(targetNodes, elem.parent); - - if(src && trg) { - obj = { - 'id': 'e' + lid, - 'source': src.id, - 'target': trg.id, - 'color': getLinkColor(fromDesc, toDesc) - }; - lid += 1; - } - - return obj; - }).filter(function(elem) { - return elem !== null; - }); - - return links; - }; - - restObj = GBPRestangular.one('restconf').one(storage).one('policy:tenants').one('tenant').one(tenantId); - - restObj.get().then(function(data) { - var l2FloodNodes = getNodes(data.tenant[0]['l2-flood-domain'] || [], GBPConstants.strings.flood, getL2L3Label), - l2BridgeNodes = getNodes(data.tenant[0]['l2-bridge-domain'] || [], GBPConstants.strings.bridge, getL2L3Label), - l3ContextNodes = getNodes(data.tenant[0]['l3-context'] || [], GBPConstants.strings.l3ctx, getL2L3Label), - subnetNodes = getNodes(data.tenant[0]['subnet'] || [], GBPConstants.strings.subnet, getSubnetLabel), - l2FloodLinks = getLinks(data.tenant[0]['l2-flood-domain'] || [], l2FloodNodes, l2BridgeNodes, GBPConstants.strings.flood, GBPConstants.strings.bridge), - l2BridgeLinks = getLinks(data.tenant[0]['l2-bridge-domain'] || [], l2BridgeNodes, l3ContextNodes, GBPConstants.strings.bridge, GBPConstants.strings.l3ctx), - subnetLinks = getLinks(data.tenant[0]['subnet'] || [], subnetNodes, l2BridgeNodes.concat(l2FloodNodes).concat(l3ContextNodes), GBPConstants.strings.subnet, ''), - allNodes = l2BridgeNodes.concat(l2FloodNodes).concat(l3ContextNodes).concat(subnetNodes), - allLinks = l2BridgeLinks.concat(l2FloodLinks).concat(subnetLinks); - - successCbk(allNodes, allLinks); - }, function(res) { - errorCbk(res.data, res.status); - }); - }; - - tdl.getClassifierInstances = function() { - - }; - - return tdl; - }); - - gbp.register.factory('TopoServices', function(TopologyDataLoaders, MockServices, GBPConstants) { - - var ts = {}; - - var loaders = {}; - - var legends = {}; - - var transformPGNTopoNodes = function(data) { - return data.output['endpoint-group'].map(function(d) { - return { - id: d.id, - group: d.name, - sgt: d['security-group-tag'] - }; - }); - }; - - var transformPGNTopoLinks = function(data) { - return data.output['endpoint-group-pair-with-rules'].map(function(d) { - return { - source: d['provider-group-id'], - target: d['consumer-group-id'], - policy: d['group-rule'][0]['action-ref'].map(function(r) { - return r.name; - }) - }; - }); - }; - - var gbpLegend = { - 'epg' : GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault] - }; - - legends[GBPConstants.strings.empty] = {}; - legends[GBPConstants.strings.config] = gbpLegend; - legends[GBPConstants.strings.oper] = gbpLegend; - legends[GBPConstants.strings.mock] = gbpLegend; - legends[GBPConstants.strings.l2l3] = { - 'l2-flood': GBPConstants.colors[GBPConstants.strings.flood], - 'l2-bridge': GBPConstants.colors[GBPConstants.strings.bridge], - 'l3-context': GBPConstants.colors[GBPConstants.strings.l3ctx], - 'subnet': GBPConstants.colors[GBPConstants.strings.subnet], - 'link': GBPConstants.colors[GBPConstants.strings.subnet+'-'] - }; - - loaders[GBPConstants.strings.empty] = function(successCbk, errorCbk) { - successCbk([], []); - }; - - loaders[GBPConstants.strings.config] = function(successCbk, errorCbk, args) { - var storage = args.storage || 'config', - tenantId = args.tenantId; - - - TopologyDataLoaders.getSubjectsBetweenEndpointGroups(false, tenantId, function(data){ - var topo = TopologyDataLoaders.getEpgTopo(data); - successCbk(topo.nodes, topo.links); - //successCbk - }, errorCbk); - }; - - loaders[GBPConstants.strings.oper] = function(successCbk, errorCbk, args) { - var storage = args.storage || 'config', - tenantId = args.tenantId; - - TopologyDataLoaders.getSubjectsBetweenEndpointGroups(true, tenantId, function(data){ - var topo = TopologyDataLoaders.getEpgTopo(data); - successCbk(topo.nodes, topo.links); - //successCbk - }, errorCbk); - }; - - loaders[GBPConstants.strings.l2l3] = function(successCbk, errorCbk, args) { - var storage = args.storage || 'config', - tenantId = args.tenantId; - - if(storage && tenantId) { - TopologyDataLoaders.getL2L3(storage, tenantId, successCbk, errorCbk); - } else { - //different kind of error - errorCbk(); - } - }; - - loaders[GBPConstants.strings.mock] = function(successCbk, errorCbk) { - var data = MockServices.mockTopoData(); - successCbk(data.nodes, data.links); - }; - - ts.getConsProvLabel = function(edge, topo){ - var provName = '', - conName = ''; - - topo.nodes.forEach(function(n){ - - if ( edge.source === n.id ) { - provName = n.name; - } - - if ( edge.target === n.id ) { - conName = n.name; - } - }); - - return provName + ':' + conName; - }; - - ts.getLegend = function(type) { - if(type === null || legends.hasOwnProperty(type) === false) { - type = GBPConstants.strings.empty; - } - - return legends[type]; - }; - - ts.loadTopology = function(type, successCbk, errorCbk, args) { - if(type === null || loaders.hasOwnProperty(type) === false) { - type = GBPConstants.strings.empty; - } - - loaders[type](successCbk, errorCbk, args); - }; - - return ts; - }); - - gbp.register.factory('GPBServices', function(GBPRestangular) { - - var s = {}; - - s.getDefinitions = function(successCbk, errorCbk) { - var restObj = GBPRestangular.one('restconf').one('operational').one('policy:subject-feature-definitions'); - - restObj.get().then(function(data) { - if(data['subject-feature-definitions']) { - var classifiersDefs = data['subject-feature-definitions']['classifier-definition'] || [], - actionsDefs = data['subject-feature-definitions']['action-definition'] || []; - successCbk(classifiersDefs, actionsDefs); - } else { - //TODO log error - } - }, function(res) { - // errorCbk(res); - }); - }; - - s.getServiceFunctionChains = function(successCbk, errorCbk) { - var restObj = GBPRestangular.one('restconf').one('config').one('service-function-chain:service-function-chains'); - - restObj.get().then(function(data) { - if(data['service-function-chains']) { - successCbk(data['service-function-chains']['service-function-chain']); - } else { - //TODO log error - } - }, function(res) { - // errorCbk(res); - }); - }; - - s.getUUIDnumber = function() { - var d = new Date().getTime(); - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { - var r = (d + Math.random()*16)%16 | 0; - d = Math.floor(d/16); - return (c=='x' ? r : (r&0x3|0x8)).toString(16); - }); - }; - - s.createRestObj = function(storage) { - storage = storage || 'config'; - restObj = GBPRestangular.one('restconf').one(storage); - - return restObj; - }; - - s.send = function(restObj, reqData, successCbk, errorCbk) { - restObj.customPUT(reqData).then(function(data) { - successCbk(data); - }, function(res) { - errorCbk(res.data, res.status); - }); - }; - - s.post = function(restObj, reqData, successCbk, errorCbk) { - restObj.customPOST(reqData).then(function(data) { - successCbk(data); - }, function(res) { - errorCbk(res.data, res.status); - }); - }; - - s.delete = function(restObj, successCbk, errorCbk) { - restObj.remove().then(function(data) { - successCbk(data); - }, function(res) { - errorCbk(res.data, res.status); - }); - }; - - s.load = function(restObj, transformCallback, successCbk, errorCbk) { - restObj.get().then(function(data) { - var objs = transformCallback(data) || []; - successCbk(objs); - }, function(res) { - errorCbk(res.data, res.status); - }); - }; - - s.stripNullValues = function(obj) { - Object.keys(obj).forEach(function(k) { - if(obj[k] === null) { - delete obj[k]; - } - }); - - return obj; - }; - - s.removeEmptyElementsFromList = function(list) { - return list.filter(function(e) { - return e !== ""; - }); - }; - - s.createParamObj = function(name, type, value) { - var obj = { name: name }; - - obj[type+'-value'] = value; - - return obj; - }; - - s.getInstanceParamValue = function(param) { - return param['int-value'] || param['string-value'] || param['range-value']; - }; - - s.getDefinitionObjParams = function(defObj, id) { - var obj = defObj.filter(function(def) { - return def.id === id; - })[0], - params = (obj && obj.parameter) ? obj.parameter : []; - - return params; - - }; - - s.getPropFromListByProp = function(list, propSrc, targetValue, propDst) { - var output = null, - selectedObj = list.filter(function(e) { - return e[propSrc] === targetValue; - })[0]; - - if(selectedObj) { - if(propDst) { - output = selectedObj[propDst]; - } else { - output = selectedObj; - } - } - - return output; - }; - - return s; - - }); - - gbp.register.factory('GBPGovernanceServices', function(TopologyDataLoaders) { - var s = {}; - - var subjectInList = function(subjectName, subjectList) { - return subjectList.some(function(s) { - return s.name === subjectName; - }); - }; - - var EPG = function(epgId, tenantId) { - this.id = epgId; - this.tenantId = tenantId; - }; - - var Subject = function(name) { - this.name = name; - this.rules = []; - this.providers = []; - this.consumers = []; - - this.addProvider = function(providingEpg) { - if(this.providers.indexOf(providingEpg) === -1) { - this.providers.push(providingEpg); - } - }; - - this.addConsumer = function(consumingEpg) { - if(this.consumers.indexOf(consumingEpg) === -1) { - this.consumers.push(consumingEpg); - } - }; - - this.addRule = function(rule, classifierInstances) { - if(rule['classifier-ref'] && rule['classifier-ref'].length > 0) { - - rule['classifier-ref'].forEach(function(cr) { - //cr['parameters'] = []; - classifierInstances.forEach(function(ci) { - if(ci['name'] === cr['instance-name']) { - cr['parameters'] = ci['parameter-value']; - } - }); - }); - } - - this.rules.push(rule); - }; - }; - - var addEpg = function(epgList, epgId, tenantId) { - var addedEpg = null; - - if(epgList.some(function(epg) { - return epg.id === epgId && epg.tenantId === tenantId; - }) === false) { - addedEpg = new EPG(epgId, tenantId); - } - - if(addedEpg !== null) { - epgList.push(addedEpg); - } - - return addedEpg; - }, - addSubject = function(subject, subjects, providerEpg, consumerEpg, classifierInstances) { - //console.log('classifierInstances:', classifierInstances); - var existingSubject = subjects.filter(function(s) { - return s.name === subject.name; - })[0], - newSubject = (existingSubject === undefined); - - if(newSubject) { - existingSubject = new Subject(subject.name); - } - - existingSubject.addProvider(providerEpg); - existingSubject.addConsumer(consumerEpg); - - if(subject['ui-rule'] && subject['ui-rule'].length > 0) { - subject['ui-rule'].forEach(function(r) { - existingSubject.addRule(r, classifierInstances); - }); - } - - if(newSubject) { - subjects.push(existingSubject); - } - }, - processPairData = function(providers, consumers, subjects, pairData, classifierInstances) { - addEpg(providers, pairData['provider-endpoint-group-id'], pairData['provider-tenant-id']); - addEpg(consumers, pairData['consumer-endpoint-group-id'], pairData['consumer-tenant-id']); - - pairData['ui-subject'].forEach(function(s) { - addSubject(s, subjects, pairData['provider-endpoint-group-id'], pairData['consumer-endpoint-group-id'], classifierInstances); - }); - }; - - s.getEPGsAndSubjects = function(tenantId, classifierInstances, successCbk, errorCbk) { - TopologyDataLoaders.getSubjectsBetweenEndpointGroups(false, tenantId, - function(data) { - var epgPairs = data.output['endpoint-group-pair-with-subject'], - consumers = [], - providers = [], - subjects = []; - - if(epgPairs) { - epgPairs.forEach(function(p) { - processPairData(providers, consumers, subjects, p, classifierInstances); - }); - } - - successCbk({providers: providers, consumers: consumers, subjects: subjects}); - }, - function() { - //TODO log error - }); - }; - - return s; - }); - - gbp.register.factory('GBPTenantServices', function(GPBServices) { - - var s = {}; - - var Tenant = function(id, name, description) { - this.id = id || GPBServices.getUUIDnumber(); - this.name = name || null; - this.description = description || null; - }; - - var createBaseRestObj = function() { - return GPBServices - .createRestObj().one('policy:tenants'); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj().one('tenant').one(pathObj.tenantId); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new Tenant(rawObj.id, rawObj.name, rawObj.description); - // }); - return rawData.tenants.tenant; - }; - - var createData = function(obj) { - return { tenant : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId) { - return { - tenantId: tenantId - }; - }; - - s.createObj = function() { - return new Tenant(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.modify = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(successCbk, errorCbk) { - var restObj = createBaseRestObj(); - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPContractServices', function(GPBServices) { - - var s = {}; - - var Contract = function(id, description, parent) { - this.id = id || GPBServices.getUUIDnumber(); - this.description = description || null; - this.parent = parent || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj().one('policy:tenants').one('tenant').one(pathObj.tenantId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('contract').one(pathObj.contractId); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new Contract(rawObj.id, rawObj.description); - // }); - return rawData.tenant[0].contract; - }; - - var createData = function(obj) { - return { contract : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, contractId) { - return { - tenantId: tenantId, - contractId: contractId - }; - }; - - s.createObj = function() { - return new Contract(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPClauseServices', function(GPBServices) { - - var s = {}; - - var Clause = function(name, subjectRefs) { - this.name = name || null; - this['subject-refs'] = subjectRefs || []; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId) - .one('contract').one(pathObj.contractId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('clause').one(pathObj.clauseId); - }; - - var transformCallback = function(rawData) { - var data = null, - clauseData = rawData.contract[0].clause; - - if(clauseData) { - data = clauseData.map(function(elem) { - if(elem.hasOwnProperty('subject-refs') === false) { - elem['subject-refs'] = []; - } - return elem; - }); - } - - return data; - }; - - var createData = function(obj) { - var o = GPBServices.stripNullValues(obj); - - if(o['subject-refs']) { - o['subject-refs'] = GPBServices.removeEmptyElementsFromList(o['subject-refs']); - } - - return { clause : [ o ] }; - }; - - s.createPathObj = function(tenantId, contractId, clauseId) { - return { - tenantId: tenantId, - contractId: contractId, - clauseId: clauseId - }; - }; - - s.createObj = function() { - return new Clause(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPSubjectServices', function(GPBServices) { - - var s = {}; - - var Subject = function(name, order) { - this.name = name || null; - this.order = order || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId) - .one('contract').one(pathObj.contractId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('subject').one(pathObj.subjectId); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new Subject(rawObj.name, rawObj.order); - // }); - return rawData.contract[0].subject; - }; - - var createData = function(obj) { - return { subject : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, contractId, subjectId) { - return { - tenantId: tenantId, - contractId: contractId, - subjectId: subjectId - }; - }; - - s.createObj = function() { - return new Subject(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPRuleServices', function(GPBServices) { - - var s = {}; - - var Rule = function(name, order) { - this.name = name || null; - this.order = order || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant') - .one(pathObj.tenantId).one('contract').one(pathObj.contractId) - .one('subject').one(pathObj.subjectId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('rule').one(pathObj.ruleId); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new Rule(rawObj.name, rawObj.order); - // }); - return rawData.subject[0].rule; - }; - - var createData = function(obj) { - return { rule : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, contractId, subjectId, ruleId) { - return { - tenantId: tenantId, - contractId: contractId, - subjectId: subjectId, - ruleId: ruleId - }; - }; - - s.createObj = function() { - return new Rule(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPClassifierRefsServices', function(GPBServices) { - - var s = {}; - - var ClassifierRef = function(name, direction, instanceName, connectionTracking) { - this.name = name || null; - this.direction = direction || null; - this['instance-name'] = instanceName || null; - this['connection-tracking'] = connectionTracking || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant') - .one(pathObj.tenantId).one('contract').one(pathObj.contractId) - .one('subject').one(pathObj.subjectId) - .one('rule').one(pathObj.ruleId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('classifier-ref').one(pathObj.classifierRefId); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new ClassifierRef(rawObj.name, rawObj.direction, rawObj['instance-name']); - // }); - return rawData.rule[0]['classifier-ref']; - }; - - var createData = function(obj) { - return { 'classifier-ref' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, contractId, subjectId, ruleId, classifierRefId) { - return { - tenantId: tenantId, - contractId: contractId, - subjectId: subjectId, - ruleId: ruleId, - classifierRefId: classifierRefId - }; - }; - - s.createObj = function() { - return new ClassifierRef(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPActionRefsServices', function(GPBServices) { - - var s = {}; - - var ActionRef = function(name, order, instanceName) { - this.name = name || null; - this.order = order || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant') - .one(pathObj.tenantId).one('contract').one(pathObj.contractId) - .one('subject').one(pathObj.subjectId) - .one('rule').one(pathObj.ruleId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('action-ref').one(pathObj.actionRefId); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new ActionRef(rawObj.name, rawObj.order); - // }); - return rawData.rule[0]['action-ref']; - }; - - var createData = function(obj) { - return { 'action-ref' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, contractId, subjectId, ruleId, actionRefId) { - return { - tenantId: tenantId, - contractId: contractId, - subjectId: subjectId, - ruleId: ruleId, - actionRefId: actionRefId - }; - }; - - s.createObj = function() { - return new ActionRef(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPL2FloodDomainServices', function(GPBServices) { - - var s = {}; - - var L2FloodDomain = function(id, name, description, parent) { - this.id = id || GPBServices.getUUIDnumber(); - this.name = name || null; - this.description = description || null; - this.parent = parent || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('l2-flood-domain').one(pathObj.l2FloodDomain); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new L2FloodDomain(rawObj.id, rawObj.name, rawObj.description, rawObj.parent); - // }); - return rawData.tenant[0]['l2-flood-domain']; - }; - - var createData = function(obj) { - return { 'l2-flood-domain' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, l2FloodDomain) { - return { - tenantId: tenantId, - l2FloodDomain: l2FloodDomain - }; - }; - - s.createObj = function() { - return new L2FloodDomain(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPL2BridgeDomainServices', function(GPBServices) { - - var s = {}; - - var L2BridgeDomain = function(id, name, description, parent) { - this.id = id || GPBServices.getUUIDnumber(); - this.name = name || null; - this.description = description || null; - this.parent = parent || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant') - .one(pathObj.tenantId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('l2-bridge-domain').one(pathObj.l2BridgeDomain); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new L2BridgeDomain(rawObj.id, rawObj.name, rawObj.description, rawObj.parent); - // }); - return rawData.tenant[0]['l2-bridge-domain']; - }; - - var createData = function(obj) { - return { 'l2-bridge-domain' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, l2BridgeDomain) { - return { - tenantId: tenantId, - l2BridgeDomain: l2BridgeDomain - }; - }; - - s.createObj = function() { - return new L2BridgeDomain(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPL3ContextServices', function(GPBServices) { - - var s = {}; - - var L3Context = function(id, name, description) { - this.id = id || GPBServices.getUUIDnumber(); - this.name = name || null; - this.description = description || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('l3-context').one(pathObj.l3Context); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new L3Context(rawObj.id, rawObj.name, rawObj.description); - // }); - return rawData.tenant[0]['l3-context']; - }; - - var createData = function(obj) { - return { 'l3-context' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, l3Context) { - return { - tenantId: tenantId, - l3Context: l3Context - }; - }; - - s.createObj = function() { - return new L3Context(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPSubnetServices', function(GPBServices) { - - var s = {}; - - var Subnet = function(id, name, description, parent, ipPrefix, virtualRouterIp) { - this.id = id || GPBServices.getUUIDnumber(); - this.name = name || null; - this.description = description || null; - this.parent = parent || null; - this['ip-prefix'] = ipPrefix || null; - this['virtual-router-ip'] = virtualRouterIp || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('subnet').one(pathObj.subnet); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new L3Context(rawObj.id, rawObj.name, rawObj.description); - // }); - return rawData.tenant[0]['subnet']; - }; - - var createData = function(obj) { - return { 'subnet' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, subnet) { - return { - tenantId: tenantId, - subnet: subnet - }; - }; - - s.createObj = function() { - return new Subnet(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPGatewayServices', function(GPBServices) { - - var s = {}; - - var Gateway = function(gateway) { - this.gateway = gateway || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subnet').one(pathObj.subnetId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('gateways').one(pathObj.gateway); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new L3Context(rawObj.id, rawObj.name, rawObj.description); - // }); - return rawData.subnet[0]['gateways']; - }; - - var createData = function(obj) { - return { 'gateways' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, subnetId, gateway) { - return { - tenantId: tenantId, - subnetId: subnetId, - gateway: gateway - }; - }; - - s.createObj = function() { - return new Gateway(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPPrefixServices', function(GPBServices) { - - var s = {}; - - var Prefix = function(prefix) { - this.prefix = prefix || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subnet').one(pathObj.subnetId).one('gateways').one(pathObj.gatewayId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('prefixes').one(pathObj.prefixId); - }; - - var transformCallback = function(rawData) { - // return rawData.map(function(rawObj){ - // return new L3Context(rawObj.id, rawObj.name, rawObj.description); - // }); - return rawData.gateways[0].prefixes; - }; - - var createData = function(obj) { - return { 'prefixes' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, subnetId, gatewayId, prefixId) { - return { - tenantId: tenantId, - subnetId: subnetId, - gatewayId: gatewayId, - prefixId: prefixId ? prefixId.replace("/", "%2F") : prefixId - }; - }; - - s.createObj = function() { - return new Prefix(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPClassifierInstanceServices', function(GPBServices) { - - var s = {}; - - var ClassifierService = function(name, classifierDefId) { - this.name = name || null; - this['classifier-definition-id'] = classifierDefId || null; - this['parameter-value'] = []; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subject-feature-instances'); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('classifier-instance').one(pathObj.classfierInstanceId); - }; - - var transformCallback = function(rawData) { - return rawData['subject-feature-instances']['classifier-instance']; - }; - - var createData = function(obj) { - return { 'classifier-instance' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, classfierInstanceId) { - return { - tenantId: tenantId, - classfierInstanceId: classfierInstanceId - }; - }; - - s.createObj = function() { - return new ClassifierService(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPActionInstanceServices', function(GPBServices) { - - var s = {}; - - var ActionService = function(name, actionDefId) { - this.name = name || null; - this['action-definition-id'] = actionDefId || null; - this['parameter-value'] = []; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subject-feature-instances'); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('action-instance').one(pathObj.actionInstanceId); - }; - - var transformCallback = function(rawData) { - return rawData['subject-feature-instances']['action-instance']; - }; - - var createData = function(obj) { - return { 'action-instance' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, actionInstanceId) { - return { - tenantId: tenantId, - actionInstanceId: actionInstanceId - }; - }; - - s.createObj = function() { - return new ActionService(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - s.getDefinitions = function(successCbk, errorCbk) { - var restObj = GBPRestangular.one('restconf').one('operational').one('policy:subject-feature-definitions'); - - restObj.get().then(function(data) { - successCbk(data['subject-feature-definitions']['action-definition']); - }, function(res) { - // errorCbk(res); - }); - }; - - return s; - - }); - - gbp.register.factory('GBPEpgServices', function(GPBServices) { - - var s = {}; - - var EPG = function(name, description, intraGroupPolicy, networkDomain, id, parent) { - this.id = id || GPBServices.getUUIDnumber(); - this.name = name || null; - this.description = description || null; - this['intra-group-policy'] = intraGroupPolicy || null; - this['network-domain'] = networkDomain || null; - this.parent = parent || null; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('endpoint-group').one(pathObj.epgId); - }; - - var transformCallback = function(rawData) { - return rawData.tenant[0]['endpoint-group']; - }; - - var createData = function(obj) { - return { 'endpoint-group' : [ GPBServices.stripNullValues(obj) ] }; - }; - - s.createPathObj = function(tenantId, epgId) { - return { - tenantId: tenantId, - epgId: epgId - }; - }; - - s.createObj = function() { - return new EPG(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPConNamedSelServices', function(GPBServices) { - - var s = {}; - - var ConsumerNamedSelector = function(name, contract) { - this.name = name || null; - this.contract = contract || []; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('endpoint-group').one(pathObj.epgId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('consumer-named-selector').one(pathObj.cnsId); - }; - - var transformCallback = function(rawData) { - var data = null, - consumerData = rawData['endpoint-group'][0]['consumer-named-selector']; - - if(consumerData) { - data = consumerData.map(function(elem) { - if(elem.hasOwnProperty('contract') === false) { - elem.contract = []; - } - return elem; - }); - } - - return data; - }; - - var createData = function(obj) { - var o = GPBServices.stripNullValues(obj); - - if(o.contract) { - o.contract = GPBServices.removeEmptyElementsFromList(o.contract); - } - - return { 'consumer-named-selector' : [ o ] }; - }; - - s.createPathObj = function(tenantId, epgId, cnsId) { - return { - tenantId: tenantId, - epgId: epgId, - cnsId: cnsId - }; - }; - - s.createObj = function() { - return new ConsumerNamedSelector(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - - gbp.register.factory('GBPProNamedSelServices', function(GPBServices) { - - var s = {}; - - var ProviderNamedSelector = function(name, contract) { - this.name = name || null; - this.contract = contract || []; - }; - - var createBaseRestObj = function(pathObj) { - return GPBServices.createRestObj() - .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('endpoint-group').one(pathObj.epgId); - }; - - var createRestObj = function(pathObj) { - return createBaseRestObj(pathObj).one('provider-named-selector').one(pathObj.cnsId); - }; - - var transformCallback = function(rawData) { - var data = null, - provderData = rawData['endpoint-group'][0]['provider-named-selector']; - - if(provderData) { - data = provderData.map(function(elem) { - if(elem.hasOwnProperty('contract') === false) { - elem.contract = []; - } - return elem; - }); - } - - return data; - }; - - var createData = function(obj) { - var o = GPBServices.stripNullValues(obj); - - if(o.contract) { - o.contract = GPBServices.removeEmptyElementsFromList(o.contract); - } - - return { 'provider-named-selector' : [ o ] }; - }; - - s.createPathObj = function(tenantId, epgId, cnsId) { - return { - tenantId: tenantId, - epgId: epgId, - cnsId: cnsId - }; - }; - - s.createObj = function() { - return new ProviderNamedSelector(); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path), - reqData = createData(obj); - - GPBServices.send(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, successCbk, errorCbk) { - var restObj = createRestObj(path); - - GPBServices.delete(restObj, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = createBaseRestObj(path); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPEndpointServices', function(GPBServices) { - - var s = {}; - - var Endpoint = function(tenantId) { - this.tenant = tenantId || null; - this['network-containment'] = null; - this['endpoint-group'] = null; - this['endpoint-groups'] = []; - this.condition = []; - this['l2-context'] = null; - this['mac-address'] = null; - this['l3-address'] = []; - }; - - var createRestObj = function() { - return GPBServices.createRestObj('operations'); - }; - - var transformCallback = function(rawData) { - return rawData.endpoints.endpoint; - }; - - var createBaseData = function(obj) { - var o = GPBServices.stripNullValues(obj); - - if(o.condition) { - o.condition = GPBServices.removeEmptyElementsFromList(o.condition); - } - - if(o['endpoint-groups']) { - o['endpoint-groups'] = GPBServices.removeEmptyElementsFromList(o['endpoint-groups']); - } - - if(o['l3-address']) { - o['l3-address'] = GPBServices.removeEmptyElementsFromList(o['l3-address']); - } - - return o; - }; - - var createSendData = function(obj) { - var o = createBaseData(obj); - return { 'input': o }; - }; - - var createDeleteData = function(obj) { - var o = { - 'input': { - 'l3': obj['l3-address'], - 'l2': [ - { - 'l2-context': obj['l2-context'], - 'mac-address': obj['mac-address'] - } - ] - } - }; - - return o; - }; - - s.createObj = function(tenantId) { - return new Endpoint(tenantId); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj().one('endpoint:register-endpoint'), - reqData = createSendData(obj); - - GPBServices.post(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path).one('endpoint:unregister-endpoint'), - reqData = createDeleteData(obj); - GPBServices.post(restObj, reqData, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = GPBServices.createRestObj('operational').one('endpoint:endpoints'); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('GBPEndpointL3Services', function(GPBServices) { - - var s = {}; - - var EndpointL3 = function(tenantId) { - this.tenant = tenantId || null; - this['endpoint-group'] = null; - this['endpoint-groups'] = []; - this.condition = []; - this['l3-context'] = null; - this['ip-prefix'] = null; - this['endpoint-l2-gateways'] = []; - this['endpoint-l3-gateways'] = []; - }; - - var createRestObj = function() { - return GPBServices.createRestObj('operations'); - }; - - var transformCallback = function(rawData) { - return rawData.endpoints['endpoint-l3-prefix']; - }; - - var createBaseData = function(obj) { - var o = GPBServices.stripNullValues(obj); - - if(o.condition) { - o.condition = GPBServices.removeEmptyElementsFromList(o.condition); - } - - if(o['endpoint-groups']) { - o['endpoint-groups'] = GPBServices.removeEmptyElementsFromList(o['endpoint-groups']); - } - - if(o['endpoint-l2-gateways']) { - o['endpoint-l2-gateways'] = GPBServices.removeEmptyElementsFromList(o['endpoint-l2-gateways']); - } - - if(o['endpoint-l3-gateways']) { - o['endpoint-l3-gateways'] = GPBServices.removeEmptyElementsFromList(o['endpoint-l3-gateways']); - } - - return o; - }; - - var createSendData = function(obj) { - var o = createBaseData(obj); - return { 'input': o }; - }; - - var createDeleteData = function(obj) { - var o = { - 'input': { - 'l3-prefix': [ - { - 'l3-context': obj['l3-context'], - 'ip-prefix': obj['ip-prefix'] - } - ], - 'l2': obj['endpoint-l2-gateways'], - 'l3': obj['endpoint-l3-gateways'] - } - }; - - return o; - }; - - s.createObj = function(tenantId) { - return new EndpointL3(tenantId); - }; - - s.send = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj().one('endpoint:register-l3-prefix-endpoint'), - reqData = createSendData(obj); - - GPBServices.post(restObj, reqData, successCbk, errorCbk); - }; - - s.delete = function(path, obj, successCbk, errorCbk) { - var restObj = createRestObj(path).one('endpoint:unregister-endpoint'), - reqData = createDeleteData(obj); - - GPBServices.post(restObj, reqData, successCbk, errorCbk); - }; - - s.load = function(path, successCbk, errorCbk) { - var restObj = GPBServices.createRestObj('operational').one('endpoint:endpoints'); - - GPBServices.load(restObj, transformCallback, successCbk, errorCbk); - }; - - return s; - - }); - - gbp.register.factory('PGNServices', function(GBPRestangular) { - - var s = {}; - - var idGetter = {}; - - var idTypes = { - tenant: 'TENANT', - uuid: 'UUID', - l3ctx: 'L3CTX', - pathAction: 'PATHACTION', - accessAction: 'ACCESSACTION' - }; - - idGetter[idTypes.tenant] = function() { - return 1; - }; - - idGetter[idTypes.uuid] = function() { - return 2; - }; - - idGetter[idTypes.l3ctx] = function() { - return 3; - }; - - idGetter[idTypes.pathAction] = function() { - return 4; - }; - - idGetter[idTypes.accessAction] = function() { - return 5; - }; - - var getId = function(type) { - if(idGetter.hasOwnProperty(type)) { - return id = idGetter[type](); - } else { - throw "Cannot get idGetter for type " + type; - } - }; - - s.addReplaceEndpointGroup = function(successCbk, errorCbk, groupName, sgt, description) { - var tenantId = getId(idTypes.tenant), - uuid = getId(idTypes.uuid), - restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'pgn-application:create-or-replace-endpoint-groups', - reqData = { - "input": - { - "endpoint-group":[ - { - "pgn-application:tenant-id": tenantID, - "pgn-application:id":uuid, - "pgn-application:security-group-tag":sgt, - "pgn-application:name":groupName, - "pgn-application:description":description - } - ] - } - }; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); - }, function(res) { - errorCbk(res); - }); - }; - - s.deleteEndpointGroup = function(successCbk, errorCbk, uuid) { - var tenantId = getId(idTypes.tenant), - restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'pgn-application:delete-endpoint-groups', - reqData = { - "input": { - "endpoint-group":[ - { - "pgn-application:tenant-id": tenantId, - "pgn-application:id":uuid - } - ] - } - }; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); - }, function(res) { - errorCbk(res); - }); - }; - - s.getActions = function(successCbk, errorCbk) { - var tenantId = getId(idTypes.tenant), - pathActionId = getId(idTypes.pathAction), - accessActionId = getId(idTypes.accessAction), - restObj = GBPRestangular.one('restconf').one('config').one('policy:tenants', tenantId).one('subject-feature-instances'); - - restObj.get().then(function(data) { - successCbk(data); //TODO fill actions - }, function(res) { - errorCbk(res); - }); - }; - - s.applyPolicy = function(successCbk, errorCbk, providerId, consumerId, pathSelRule, accessCtrlRule) { - var restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'pgn-application:wire-endpoint-groups', - actionRefName = (pathSelRule ? pathSelRule : '') + (accessCtrlRule ? accessCtrlRule : ''), - reqData = { - "input": { - "endpoint-group-pair-with-rules": { - "pgn-application:provider-tenant-id": tenantID, - "pgn-application:consumer-tenant-id": tenantID, - "pgn-application:provider-group-id":providerId, - "pgn-application:consumer-group-id":consumerId, - "pgn-application:group-rule": [ - { - "action-ref": [pathSelRule, accessCtrlRule].map(function(r) { - return { "name":r }; - }), - "name":actionRefName - } - ] - } - } - }; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); //TODO reload policies - }, function(res) { - errorCbk(res); - }); - }; - - s.deletePolicy = function(successCbk, errorCbk, providerId, consumerId) { - var tenantId = getId(idTypes.tenant), - restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'pgn-application:unwire-endpoint-groups', - reqData = { - "input": - { - "endpoint-group-pair":[ - { - "pgn-application:provider-tenant-id": tenantId, - "pgn-application:consumer-tenant-id": tenantId, - "pgn-application:provider-group-id":providerId, - "pgn-application:consumer-group-id":consumerId - } - ] - } - }; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); //TODO reload policies - }, function(res) { - errorCbk(res); - }); - }; - - s.addEndPoint = function(successCbk, errorCbk, ipAddress, groupId) { - var l3ctxId = getId(idTypes.l3ctx), - tenantId = getId(idTypes.tenant), - restObj = GBPRestangular.one('restconf').one('operations'), - rpcRes = 'endpoint:register-endpoint', - reqData = { - "input": { - "endpoint-group": groupId, - "l3-address": [ - { - "ip-address": ipAddress, - "l3-context": l3ctxId - } - ], - "tenant": tenantId - } - }; - - restObj.post(rpcRes, reqData).then(function(data) { - successCbk(data); - }, function(res) { - errorCbk(res); - }); - }; - - s.getUUIDnumber = function() { - var d = new Date().getTime(); - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { - var r = (d + Math.random()*16)%16 | 0; - d = Math.floor(d/16); - return (c=='x' ? r : (r&0x3|0x8)).toString(16); - }); - }; - - return s; - }); - - gbp.register.factory('DesignGbpFactory', function(){ - - var dvf = {}; - - dvf.setMainClass = function(){ - if ( $('.gbpWrapper').length ) { - $('.gbpWrapper').closest('.col-xs-12').addClass('gbpGlobalWrapper'); - } - }; - - return dvf; - - }); - - gbp.register.factory('JointGraphOffsetFactory', function(GBPConstants){ - var jgof = {}; - - jgof.createWHObj = function(w, h) { - return {w: w || 0, h: h || 0}; - }; - - jgof.updateOffsets = function(delta, offset, margin, maximums, paper) { - offset.w = offset.w + delta.w + margin.w; - - if(offset.w >= maximums.w) { - paper.setDimensions(offset.w + 30, paper.options.height); - offset.w = offset.ow; - offset.h = offset.h + margin.h; - } - - }; - - jgof.resetOffsets = function(offset, w, h) { - offset.w = w; - offset.h = h; - }; - - jgof.getCurrentOffset = function(array, type) { - var max = 0; - array.forEach(function(item){ - max = item.attributes.position[type] > max ? item.attributes.position[type] : max; - }); - - return max; - }; - - jgof.checkObjsHoffsets = function(array, size, paper) { - var lastPosY = 0, - addOffset = false, - cellBottomOffset = 80, - setItemPosition = function(item, type) { - while (item.attributes.position[type] < size + cellBottomOffset) { - item.translate(null, cellBottomOffset); - } - }; - - array.forEach(function(item){ - addOffset = (size + cellBottomOffset) >= item.attributes.position.y; - - if ( addOffset ) { - setItemPosition(item, 'y'); - } - - if ( item.attributes.position.y + cellBottomOffset > paper.options.height ) { - paper.setDimensions(paper.options.width, paper.options.height + cellBottomOffset); - } - }); - }; - - return jgof; - }); - - gbp.register.factory('JointGraphFactory', function(GBPConstants){ - var defaulColor = 'blue'; - - var jgf = {}; - - jgf.getLabelLength = function(length) { - return length * 10 > 200 ? 200 : length * 10; - }; - - jgf.createGraph = function() { - var graph = new joint.dia.Graph(); - - var paper = new joint.dia.Paper({ - el: $('#graph'), - width: 1300, - height: 650, - model: graph, - gridSize: 1, - interactive: { vertexAdd: false } - }); - - return paper; - }; - - jgf.resetGraphDimension = function(paper, element, paddingT, paddingL){ - paddingT = paddingT ? paddingT : 0; - paddingL = paddingL ? paddingL : paddingT; - - var paperWidth = element.width() - paddingL, - paperHeight = element.height() - paddingT - 5; - - paper.setDimensions(paperWidth, paperHeight); - }; - - jgf.reloadGraph = function(graph) { - graph.clear(); - }; - - jgf.createElement = function(elementName, posx, posy, width, height, objectType, object, tooltip, bgcolor, titleName) { - var setWidth = function(width) { - return width < GBPConstants.jointElements.minWidth ? GBPConstants.jointElements.minWidth : - width > GBPConstants.jointElements.maxWidth ? GBPConstants.jointElements.maxWidth : width; - }; - - var setHeight = function(height) { - return height < GBPConstants.jointElements.minHeight ? GBPConstants.jointElements.minHeight : - height > GBPConstants.jointElements.maxHeight ? GBPConstants.jointElements.maxHeight : height; - }; - - // joint.shapes.basic.Rect = joint.shapes.basic.Generic.extend({ - joint.shapes.html = {}; - joint.shapes.html.Element = joint.shapes.basic.Generic.extend({ - - markup: '</g><text class="text1"></text><text class="text2"></text><title /></g>', - - defaults: joint.util.deepSupplement({ - type: 'html.Element', - attrs: { - 'rect': { fill: bgcolor, stroke: 'black', 'follow-scale': true, width: 80, height: 40, cursor: 'pointer' }, - '.text1': { ref: 'rect', 'ref-x': 0.5, 'ref-y': 0.3, 'y-alignment': 'middle', 'x-alignment': 'middle', cursor: 'pointer', 'font-weight' : 'bold'}, - '.text2': { ref: 'rect', 'ref-x': 0.5, 'ref-y': 0.7, 'y-alignment': 'middle', 'x-alignment': 'middle', cursor: 'pointer'}, - 'title': {text: tooltip}, - } - - }, joint.shapes.basic.Generic.prototype.defaults) - }); - - // joint.shapes.html.ElementView = joint.dia.ElementView.extend({ - - // template: [ - // '<input class="html-element" type="text" value="'+elementName+'"/>', - // '' - // ].join(''), - - // initialize: function() { - // _.bindAll(this, 'updateBox'); - // joint.dia.ElementView.prototype.initialize.apply(this, arguments); - - // this.$box = $(_.template(this.template)()); - // // Prevent paper from handling pointerdown. - // this.$box.find('input,select').on('mousedown click', function(evt) { evt.stopPropagation(); }); - // // This is an example of reacting on the input change and storing the input data in the cell model. - // this.$box.find('input').on('change', _.bind(function(evt) { - // this.model.set('input', $(evt.target).val()); - // }, this)); - // this.$box.find('button').on('click', _.bind(function(evt) { - // this.model.set('button', $('.divc').css('display','block')); - // }, this)); - // // Update the box position whenever the underlying model changes. - // this.model.on('change', this.updateBox, this); - - // this.updateBox(); - // }, - // render: function() { - // joint.dia.ElementView.prototype.render.apply(this, arguments); - // this.paper.$el.prepend(this.$box); - // this.updateBox(); - // return this; - // }, - // updateBox: function() { - // // Set the position and dimension of the box so that it covers the JointJS element. - // var bbox = this.model.getBBox(); - // // Example of updating the HTML with a data stored in the cell model. - // this.$box.css({ width: bbox.width, height: bbox.height, left: bbox.x, top: bbox.y, transform: 'rotate(' + (this.model.get('angle') || 0) + 'deg)' }); - // }, - // removeBox: function(evt) { - // this.$box.remove(); - // } - // }); - - elementName = elementName.length > 20 ? elementName.slice(0,20) + '...' : elementName; - // width = width > 200 ? 200 : width; - - // return new joint.shapes.basic.Rect({ - return new joint.shapes.html.Element({ - position: { x: posx || 0, y: posy || 0 }, - size: { width: width || GBPConstants.jointElements.minWidth, height: height || GBPConstants.jointElements.minHeight }, - attrs: { rect: { fill: bgcolor }, '.text1': { fill: 'black', text: titleName}, '.text2': { fill: 'black', text: elementName }}, - objType: objectType, - objData: object - }); - }; - - jgf.transformElement = function(element, transformX, transformY) { - return element.translate(transformX, transformY); - }; - - jgf.addItem = function(graph, item) { - graph.addCells([item]); - }; - - jgf.addItemList = function(graph, listItem) { - graph.addCells(listItem); - }; - - jgf.createLink = function(srcId, targetId, colorIn, colorOut, direction, objData) { - colorIn = colorIn || defaulColor; - colorOut = colorOut || defaulColor; - - var labelTextColor = GBPConstants.colors[GBPConstants.strings.sigmaTopoDefaultText], - labelBckColor = GBPConstants.colors[GBPConstants.strings.linklabel]; - - var linkObj = { - source: { id: srcId }, - target: { id: targetId }, - attrs: { - '.connection': { stroke: colorIn, 'stroke-width': 2, name: 'normal' }, - '.connection-wrap': { 'stroke-width': 10 } - }, - objData: objData - }; - - if(direction === 'in' || direction == 'bidirectional' || direction === undefined || direction === null) { - linkObj.attrs['.marker-target'] = { fill: colorIn, d: 'M 10 0 L 0 5 L 10 10 z' }; - } - - if(direction === 'out' || direction == 'bidirectional') { - linkObj.attrs['.marker-source'] = { fill: colorOut, d: 'M 10 0 L 0 5 L 10 10 z' }; - } - - var link = new joint.dia.Link(linkObj); - - // if(labelText) { - // link.label(0, { position: 0.3, attrs: { text: { text: labelText, fill: labelTextColor }, rect: { stroke: labelBckColor, 'stroke-width': 20 }}}); - // } - - - return link; - }; - - return jgf; - }); - - gbp.register.factory('GBPJointGraphBuilder', function(GBPRestangular, GBPConstants, JointGraphFactory, JointGraphOffsetFactory, TopologyDataLoaders){ - var jgb = {}; - - var builders = {}; - - var buildJointData = function(paper, nodes, links) { - - }; - - var setOperConfigTopoData = function(paper, data){ - var topo = TopologyDataLoaders.getEpgTopo(data); - - var offsetObj = { - ow: 100, - oh: 100, - w: 100, - h: 100 - }, - marginObj = { - w: 50, - h: 80 - }, - offsetHobj = { - pEpg: 0, - cEpg: 0, - subject: 0 - }, - itemsArray = { - epg: [] - }, - linksArray = []; - - JointGraphFactory.resetGraphDimension(paper, $('.policyGraphWrapper')); - JointGraphFactory.reloadGraph(paper.model); - - var deg2rad = function(deg){ - return deg * Math.PI / 180; - }; - - var getXYInCircle = function(elementIndex, elementsCount, paperCenterX, paperCenterY, elementWidth, elementHeight){ - var result = {x:0, y:0}; - circleMargin = 100; - r = (paperCenterX < paperCenterY ? paperCenterX : paperCenterY ) - circleMargin; - degs = 360 / elementsCount * (elementIndex+1) + 180; - rads = deg2rad(degs); - - elementWidth = elementWidth ? elementWidth : GBPConstants.jointElements.minWidth; - elementHeight = elementHeight ? elementHeight : GBPConstants.jointElements.minHeight; - - if(elementWidth < GBPConstants.jointElements.minWidth){elementWidth = GBPConstants.jointElements.minWidth;} - if(elementWidth > GBPConstants.jointElements.maxWidth){elementWidth = GBPConstants.jointElements.maxWidth;} - if(elementHeight < GBPConstants.jointElements.minHeight){elementHeight = GBPConstants.jointElements.minHeight;} - if(elementHeight > GBPConstants.jointElements.maxHeight){elementHeight = GBPConstants.jointElements.maxHeight;} - - result.x = paperCenterX + r * Math.cos(rads); - result.y = paperCenterY + r * Math.sin(rads); - - degs = degs % 360; - if(degs > 90 && degs < 270){ - result.x = result.x - elementWidth; - } - if(degs == 90 || degs == 270){ - result.x = result.x - elementWidth / 2; - } - if(degs > 180 && degs < 360){ - result.y = result.y - elementHeight; - } - if(degs === 0 || degs == 180){ - result.y = result.y - elementHeight / 2; - } - return result; - }; - - var paperCenterX = (paper.options.width) / 2; - var paperCenterY = (paper.options.height) / 2; - topo.nodes.forEach(function(i, index){ - var label = i.label, - header = 'Epg', - width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)), - color = GBPConstants.colors[GBPConstants.strings.epg]; - - var itemPos = getXYInCircle(index, topo.nodes.length, paperCenterX, paperCenterY, width, null); - var item = JointGraphFactory.createElement(label, itemPos.x, itemPos.y, width, null, GBPConstants.strings.epg , i, label, color, header); - - itemsArray.epg.push(item); - - // JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - }); - - var getItemById = function(id, array){ - var item = array.filter(function(i){ - return i.attributes.objData.id === id; - }); - - return item.length ? item[0] : null; - }; - - topo.links.forEach(function(l){ - var sourceItem = getItemById(l.source, itemsArray.epg), - targetItem = getItemById(l.target, itemsArray.epg); - - if (sourceItem && targetItem) { - var link = JointGraphFactory.createLink(sourceItem.id, targetItem.id, 'blue', 'green', l.direction, l.data); - linksArray.push(link); - } - }); - - JointGraphFactory.addItemList(paper.model, linksArray); - }; - - jgb.loadTopology = function(args, paper, type) { - if(type === null || builders.hasOwnProperty(type) === false) { - type = GBPConstants.strings.empty; - } - - builders[type](args, paper); - }; - - builders[GBPConstants.strings.empty] = function(args, paper) { - JointGraphFactory.reloadGraph(paper.model); - }; - - builders[GBPConstants.strings.config] = function(args, paper) { - var storage = args.storage || 'config', - tenantId = args.tenantId; - - - TopologyDataLoaders.getSubjectsBetweenEndpointGroups(false, tenantId, function(data){ - setOperConfigTopoData(paper, data); - }, function(){}); - }; - - builders[GBPConstants.strings.oper] = function(args, paper) { - var storage = args.storage || 'config', - tenantId = args.tenantId; - - TopologyDataLoaders.getSubjectsBetweenEndpointGroups(true, tenantId, function(data){ - setOperConfigTopoData(paper, data); - }, function(){}); - }; - - builders[GBPConstants.strings.l2l3] = function(args, paper) { - var storage = args.storage || 'config', - tenantId = args.tenantId; - - if(storage && tenantId) { - restObj = GBPRestangular.one('restconf').one(storage).one('policy:tenants').one('tenant').one(tenantId); - - restObj.get().then(function(data) { - var createLinks = function(srcList, srcItems, dstItems) { - var linkItems = srcList.map(function(srcObj) { - var linkItem = null; - if(srcObj.parent && dstItems[srcObj.parent]) { - linkItem = JointGraphFactory.createLink(srcItems[srcObj.id].id, dstItems[srcObj.parent].id, 'blue'); - } - return linkItem; - }).filter(function(linkObj) { - return linkObj !== null; - }); - - return linkItems; - }; - - var offsetObj = { - ow: 100, - oh: 100, - w: 100, - h: 100 - }, - marginObj = { - w: 50, - h: 80 - }, - itemsArray = { - l3: {}, - l2bridge: {}, - l2flood: {}, - subnets: {} - }; - - JointGraphFactory.reloadGraph(paper.model); - - data.tenant[0]['l3-context'].forEach(function(c, i) { - var label = c.name || c.id, - header = 'L3 context', - color = GBPConstants.colors[GBPConstants.strings.l3ctx], - width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); - item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.l3ctx , c, null, color, header); - - itemsArray.l3[c.id] = item; - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - }); - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h + 100); - - data.tenant[0]['l2-bridge-domain'].forEach(function(c, i) { - var label = c.name || c.id, - header = 'L2 bridge domain', - color = GBPConstants.colors[GBPConstants.strings.bridge], - width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); - item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.bridge , c, null, color, header); - - itemsArray.l2bridge[c.id] = item; - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - }); - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h + 100); - - data.tenant[0]['l2-flood-domain'].forEach(function(c, i) { - var label = c.name || c.id, - header = 'L2 flood domain', - color = GBPConstants.colors[GBPConstants.strings.flood], - width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); - item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.flood , c, null, color, header); - - itemsArray.l2flood[c.id] = item; - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - }); - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h + 100); - - data.tenant[0]['subnet'].forEach(function(c, i) { - var label = c.name || c.id, - header = 'Subnet', - color = GBPConstants.colors[GBPConstants.strings.subnet], - width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); - item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.subnet , c, null, color, header); - - itemsArray.subnets[c.id] = item; - - JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); - JointGraphFactory.addItem(paper.model, item); - }); - - JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.oh); - - var l2bridgeL3 = createLinks(data.tenant[0]['l2-bridge-domain'], itemsArray.l2bridge, itemsArray.l3); - JointGraphFactory.addItemList(paper.model, l2bridgeL3); - - var l2floodL2bridge = createLinks(data.tenant[0]['l2-flood-domain'], itemsArray.l2flood, itemsArray.l2bridge); - JointGraphFactory.addItemList(paper.model, l2floodL2bridge); - - var l2floodSubnet = createLinks(data.tenant[0]['subnet'], itemsArray.subnets, itemsArray.l2flood); - JointGraphFactory.addItemList(paper.model, l2floodSubnet); - - var l2bridgeSubnet = createLinks(data.tenant[0]['subnet'], itemsArray.subnets, itemsArray.l2bridge); - JointGraphFactory.addItemList(paper.model, l2bridgeSubnet); - - var l3Subnet = createLinks(data.tenant[0]['subnet'], itemsArray.subnets, itemsArray.l3); - JointGraphFactory.addItemList(paper.model, l3Subnet); - - }, function() { - - }); - } - }; - - - return jgb; - }); +define(['app/gbp/gbp.module', 'app/gbp/js/joint.clean.build'], function(gbp, joint) { + + gbp.register.factory('GBPRestangular', function(Restangular, ENV) { + return Restangular.withConfig(function(RestangularConfig) { + RestangularConfig.setBaseUrl(ENV.getBaseURL("MD_SAL")); + }); + }); + + gbp.register.factory('GBPConstants', function() { + var c = { colors: {'graph' : {}}, strings: {}, jointElements: {}, objType: {}, numbers: {}}; + + c.strings.flood = 'flood'; + c.strings.bridge = 'bridge'; + c.strings.l3ctx = 'l3ctx'; + c.strings.subnet = 'subnet'; + c.strings.linklabel = 'linklabel'; + c.strings.in = 'in'; + c.strings.out = 'out'; + c.strings.bi = 'bidirectional'; + + c.strings.config = 'CONFIG'; + c.strings.oper = 'OPERATIONAL'; + c.strings.l2l3 = 'L2L3'; + c.strings.mock = 'MOCK'; + c.strings.sigmaTopoDefaultText = 'SIGMATOPODEFAULTTEXT'; + c.strings.sigmaTopoDefault = 'SIGMATOPODEFAULTTEXT'; + + c.colors[c.strings.flood] = '#DF0101'; + c.colors[c.strings.bridge] = '#0080FF'; + c.colors[c.strings.l3ctx] = '#3ADF00'; + c.colors[c.strings.subnet] = '#FF9933'; + c.colors[c.strings.sigmaTopoDefaultText] = '#fff'; + c.colors[c.strings.epg] = '#8fde70'; + c.colors[c.strings.linklabel] = '#3366CC'; + + c.colors[c.strings.flood+'-'+c.strings.bridge] = '#6666FF'; + c.colors[c.strings.bridge+'-'+c.strings.l3ctx] = '#6666FF'; + + c.colors[c.strings.subnet+'-'] = '#6666FF'; + + c.colors['graph']['subject'] = '#FFFFD4'; + c.colors['graph']['cns'] = '#8EEDFF'; + c.colors['graph']['pns'] = '#FF9C9C'; + + c.jointElements.minWidth = 100; + c.jointElements.maxWidth = 300; + c.jointElements.minHeight = 50; + c.jointElements.maxHeight = 300; + + c.objType.contract = 'contract'; + c.objType.epg = 'epg'; + c.objType.consumer = 'consumer'; + c.objType.provider = 'provider'; + c.objType.subject = 'subject'; + c.objType.rule = 'rule'; + + c.numbers.displayLabelLength = 40; + + return c; + }); + + gbp.register.factory('MockServices', function() { + + var ms = {}; + + ms.mockTopoData = function() { + var lid = 0, + nodeRaw = [0, 1, 2, 3], + linkRaw = [[0, 1], [2, 3], [3, 0], [0, 3]], + nodes = nodeRaw.map(function(data) { + return { + 'id': 'n' + data, + 'label': 'LABEL'+data, + 'size': 3, + 'x': Math.random(), + 'y': Math.random(), + 'color': GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault] + }; + }), + links = linkRaw.map(function(data) { + var obj = { + id: 'e' + lid, + source: 'n' + data[0], + target: 'n' + data[1], + color: GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault] + }; + lid = lid + 1; + return obj; + }); + + return {nodes: nodes, links: links}; + }; + + return ms; + }); + + gbp.register.factory('TopologyDataLoaders', function(GBPRestangular, GBPConstants) { + var tdl = {}; + + tdl.getSubjectsBetweenEndpointGroups = function(storage, tenantId, successCbk, errorCbk) { + var restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'ui-backend:get-subjects-between-endpoint-groups', + reqData = { "input": { "tenant-id": tenantId }}; + + if(storage) { + reqData.input['from-oper-data'] = {}; + } + + restObj.post(rpcRes, reqData).then(function(data) { + // console.info('got data', data.output); + successCbk(data); + }, function(res) { + errorCbk(res); + }); + }; + + //Policies are representing links in PGN topology + tdl.getGroupRulesBetweenEndpointGroups = function(successCbk, errorCbk) { + var restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'pgn-application:get-group-rules-between-endpoint-groups', + reqData = { "input": { "endpoint-group-pair":[] }}; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); //set topology links + }, function(res) { + errorCbk(res); + }); + }; + + //Groups are representing nodes in PGN topology + tdl.getEndpointGroups = function(successCbk, errorCbk) { + var tenantId = getId(idTypes.tenant), + restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'pgn-application:get-endpoint-groups', + reqData = { + "input": { + "endpoint-group-id":[ + { + "pgn-application:tenant-id": tenantId + } + ] + } + }; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); //set topology nodes + }, function(res) { + errorCbk(res); + }); + + }; + + tdl.getEndpointsFromEndpointGroup = function(tenantId, epgId, successCbk, errorCbk) { + var restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'ui-backend:get-endpoints-from-endpoint-group', + reqData = { + "input": { + "tenant-id": tenantId, + "endpoint-group-id":epgId + } + }; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); //set topology nodes + }, function(res) { + errorCbk(res); + }); + + }; + + tdl.getEpgTopo = function(data){ + var epgData = data.output['endpoint-group-pair-with-subject'], + nodes = [], + edges = [], + setNode = function(obj){ + var nodeObj = { + 'id': 'n' + nodes.length, + 'label': obj.name || obj.id, + 'name': obj.name, + 'size': 1, + 'x': Math.random(), + 'y': Math.random(), + 'color': GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault], + 'type': obj.type + }; + + nodes.push(nodeObj); + return nodeObj.id; + }, + setEdge = function(sourceId, destId, data, direction) { + var obj = { + 'id': 'e' + edges.length, + 'source': sourceId, + 'target': destId, + 'color': GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault], + 'data': data, + 'direction' : direction + // 'type': 'curve', + // 'size' : 100 + }; + + edges.push(obj); + }, + getObjByProp = function(val, prop, list) { + return list.filter(function(i){ + return i[prop] === val; + }); + }, + getDirection = function(subjects){ + var directions = []; + if ( subjects ) { + subjects.forEach(function(s){ + if ( s['ui-rule'] ) { + s['ui-rule'].forEach(function(rule){ + if ( rule['classifier-ref'] ) { + rule['classifier-ref'].forEach(function(classifier){ + if ( classifier.direction && directions.indexOf(classifier.direction) === -1 ){ + directions.push(classifier.direction); + } + }); + } + }); + } + }); + } + return directions.length === 1 ? directions[0] : directions.length > 1 ? 'bidirectional' : null; + + }; + + if(epgData) { + epgData.forEach(function(e){ + var cepgnId = null, + pepgnId = null; + + if ( !getObjByProp(e['consumer-endpoint-group-id'],'name', nodes).length ) { + var objCepg = { + type: 'epg', + name: e['consumer-endpoint-group-id'] + }; + cepgnId = setNode(objCepg); + } else { + cepgnId = getObjByProp(e['consumer-endpoint-group-id'],'name', nodes)[0].id; + } + if ( !getObjByProp(e['provider-endpoint-group-id'],'name', nodes).length ) { + var objPepg = { + type: 'epg', + name: e['provider-endpoint-group-id'] + }; + pepgnId = setNode(objPepg); + } else { + pepgnId = getObjByProp(e['provider-endpoint-group-id'],'name', nodes)[0].id; + } + + var direction = getDirection(e['ui-subject']); + + if ( cepgnId && pepgnId ) { + setEdge(cepgnId, pepgnId, e['ui-subject'], direction); + } + }); + } + + return { + nodes: nodes, + links: edges + }; + }; + + + tdl.getL2L3 = function(storage, tenantId, successCbk, errorCbk) { + //l2-bridge-domain + var lid = 0, + nid = 0, + getL2L3Label = function(node) { + return node.name || node.id; + }, + getSubnetLabel = function(node) { + return node['ip-prefix'] || node.id; + }, + getNodeColor = function(src) { + return GBPConstants.colors[src] || GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault]; + }, + getLinkColor = function(from, to) { + return GBPConstants.colors[from+'-'+to] || GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault]; + }, + getNodes = function(data, srcDesc, getLabelCbk) { + var nodes = data.map(function(elem) { + var obj = { + 'id': 'n' + nid, + 'label': getLabelCbk(elem), + 'uuid': elem.id, + 'size': 3, + 'x': Math.random(), + 'y': Math.random(), + 'color': getNodeColor(srcDesc), + 'elemType': srcDesc + }; + + nid += 1; + return obj; + }); + + return nodes; + }, + getLinks = function(data, srcNodes, targetNodes, fromDesc, toDesc) { + var findByUUID = function(array, uuid) { + return array.filter(function(elem) { + return elem.uuid === uuid; + })[0]; + }; + + var links = data.map(function(elem) { + var obj = null, + src = findByUUID(srcNodes, elem.id), + trg = findByUUID(targetNodes, elem.parent); + + if(src && trg) { + obj = { + 'id': 'e' + lid, + 'source': src.id, + 'target': trg.id, + 'color': getLinkColor(fromDesc, toDesc) + }; + lid += 1; + } + + return obj; + }).filter(function(elem) { + return elem !== null; + }); + + return links; + }; + + restObj = GBPRestangular.one('restconf').one(storage).one('policy:tenants').one('tenant').one(tenantId); + + restObj.get().then(function(data) { + var l2FloodNodes = getNodes(data.tenant[0]['l2-flood-domain'] || [], GBPConstants.strings.flood, getL2L3Label), + l2BridgeNodes = getNodes(data.tenant[0]['l2-bridge-domain'] || [], GBPConstants.strings.bridge, getL2L3Label), + l3ContextNodes = getNodes(data.tenant[0]['l3-context'] || [], GBPConstants.strings.l3ctx, getL2L3Label), + subnetNodes = getNodes(data.tenant[0]['subnet'] || [], GBPConstants.strings.subnet, getSubnetLabel), + l2FloodLinks = getLinks(data.tenant[0]['l2-flood-domain'] || [], l2FloodNodes, l2BridgeNodes, GBPConstants.strings.flood, GBPConstants.strings.bridge), + l2BridgeLinks = getLinks(data.tenant[0]['l2-bridge-domain'] || [], l2BridgeNodes, l3ContextNodes, GBPConstants.strings.bridge, GBPConstants.strings.l3ctx), + subnetLinks = getLinks(data.tenant[0]['subnet'] || [], subnetNodes, l2BridgeNodes.concat(l2FloodNodes).concat(l3ContextNodes), GBPConstants.strings.subnet, ''), + allNodes = l2BridgeNodes.concat(l2FloodNodes).concat(l3ContextNodes).concat(subnetNodes), + allLinks = l2BridgeLinks.concat(l2FloodLinks).concat(subnetLinks); + + successCbk(allNodes, allLinks); + }, function(res) { + errorCbk(res.data, res.status); + }); + }; + + tdl.getClassifierInstances = function() { + + }; + + return tdl; + }); + + gbp.register.factory('TopoServices', function(TopologyDataLoaders, MockServices, GBPConstants) { + + var ts = {}; + + var loaders = {}; + + var legends = {}; + + var transformPGNTopoNodes = function(data) { + return data.output['endpoint-group'].map(function(d) { + return { + id: d.id, + group: d.name, + sgt: d['security-group-tag'] + }; + }); + }; + + var transformPGNTopoLinks = function(data) { + return data.output['endpoint-group-pair-with-rules'].map(function(d) { + return { + source: d['provider-group-id'], + target: d['consumer-group-id'], + policy: d['group-rule'][0]['action-ref'].map(function(r) { + return r.name; + }) + }; + }); + }; + + var gbpLegend = { + 'epg' : GBPConstants.colors[GBPConstants.strings.sigmaTopoDefault] + }; + + legends[GBPConstants.strings.empty] = {}; + legends[GBPConstants.strings.config] = gbpLegend; + legends[GBPConstants.strings.oper] = gbpLegend; + legends[GBPConstants.strings.mock] = gbpLegend; + legends[GBPConstants.strings.l2l3] = { + 'l2-flood': GBPConstants.colors[GBPConstants.strings.flood], + 'l2-bridge': GBPConstants.colors[GBPConstants.strings.bridge], + 'l3-context': GBPConstants.colors[GBPConstants.strings.l3ctx], + 'subnet': GBPConstants.colors[GBPConstants.strings.subnet], + 'link': GBPConstants.colors[GBPConstants.strings.subnet+'-'] + }; + + loaders[GBPConstants.strings.empty] = function(successCbk, errorCbk) { + successCbk([], []); + }; + + loaders[GBPConstants.strings.config] = function(successCbk, errorCbk, args) { + var storage = args.storage || 'config', + tenantId = args.tenantId; + + + TopologyDataLoaders.getSubjectsBetweenEndpointGroups(false, tenantId, function(data){ + var topo = TopologyDataLoaders.getEpgTopo(data); + successCbk(topo.nodes, topo.links); + //successCbk + }, errorCbk); + }; + + loaders[GBPConstants.strings.oper] = function(successCbk, errorCbk, args) { + var storage = args.storage || 'config', + tenantId = args.tenantId; + + TopologyDataLoaders.getSubjectsBetweenEndpointGroups(true, tenantId, function(data){ + var topo = TopologyDataLoaders.getEpgTopo(data); + successCbk(topo.nodes, topo.links); + //successCbk + }, errorCbk); + }; + + loaders[GBPConstants.strings.l2l3] = function(successCbk, errorCbk, args) { + var storage = args.storage || 'config', + tenantId = args.tenantId; + + if(storage && tenantId) { + TopologyDataLoaders.getL2L3(storage, tenantId, successCbk, errorCbk); + } else { + //different kind of error + errorCbk(); + } + }; + + loaders[GBPConstants.strings.mock] = function(successCbk, errorCbk) { + var data = MockServices.mockTopoData(); + successCbk(data.nodes, data.links); + }; + + ts.getConsProvLabel = function(edge, topo){ + var provName = '', + conName = ''; + + topo.nodes.forEach(function(n){ + + if ( edge.source === n.id ) { + provName = n.name; + } + + if ( edge.target === n.id ) { + conName = n.name; + } + }); + + return provName + ':' + conName; + }; + + ts.getLegend = function(type) { + if(type === null || legends.hasOwnProperty(type) === false) { + type = GBPConstants.strings.empty; + } + + return legends[type]; + }; + + ts.loadTopology = function(type, successCbk, errorCbk, args) { + if(type === null || loaders.hasOwnProperty(type) === false) { + type = GBPConstants.strings.empty; + } + + loaders[type](successCbk, errorCbk, args); + }; + + return ts; + }); + + gbp.register.factory('GPBServices', function(GBPRestangular) { + + var s = {}; + + s.getDefinitions = function(successCbk, errorCbk) { + var restObj = GBPRestangular.one('restconf').one('operational').one('policy:subject-feature-definitions'); + + restObj.get().then(function(data) { + if(data['subject-feature-definitions']) { + var classifiersDefs = data['subject-feature-definitions']['classifier-definition'] || [], + actionsDefs = data['subject-feature-definitions']['action-definition'] || []; + successCbk(classifiersDefs, actionsDefs); + } else { + //TODO log error + } + }, function(res) { + // errorCbk(res); + }); + }; + + s.getServiceFunctionChains = function(successCbk, errorCbk) { + var restObj = GBPRestangular.one('restconf').one('config').one('service-function-chain:service-function-chains'); + + restObj.get().then(function(data) { + if(data['service-function-chains']) { + successCbk(data['service-function-chains']['service-function-chain']); + } else { + //TODO log error + } + }, function(res) { + // errorCbk(res); + }); + }; + + s.getUUIDnumber = function() { + var d = new Date().getTime(); + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = (d + Math.random()*16)%16 | 0; + d = Math.floor(d/16); + return (c=='x' ? r : (r&0x3|0x8)).toString(16); + }); + }; + + s.createRestObj = function(storage) { + storage = storage || 'config'; + restObj = GBPRestangular.one('restconf').one(storage); + + return restObj; + }; + + s.send = function(restObj, reqData, successCbk, errorCbk) { + restObj.customPUT(reqData).then(function(data) { + successCbk(data); + }, function(res) { + errorCbk(res.data, res.status); + }); + }; + + s.post = function(restObj, reqData, successCbk, errorCbk) { + restObj.customPOST(reqData).then(function(data) { + successCbk(data); + }, function(res) { + errorCbk(res.data, res.status); + }); + }; + + s.delete = function(restObj, successCbk, errorCbk) { + restObj.remove().then(function(data) { + successCbk(data); + }, function(res) { + errorCbk(res.data, res.status); + }); + }; + + s.load = function(restObj, transformCallback, successCbk, errorCbk) { + restObj.get().then(function(data) { + var objs = transformCallback(data) || []; + successCbk(objs); + }, function(res) { + errorCbk(res.data, res.status); + }); + }; + + s.stripNullValues = function(obj) { + Object.keys(obj).forEach(function(k) { + if(obj[k] === null) { + delete obj[k]; + } + }); + + return obj; + }; + + s.removeEmptyElementsFromList = function(list) { + return list.filter(function(e) { + return e !== ""; + }); + }; + + s.createParamObj = function(name, type, value) { + var obj = { name: name }; + + obj[type+'-value'] = value; + + return obj; + }; + + s.getInstanceParamValue = function(param) { + return param['int-value'] || param['string-value'] || param['range-value']; + }; + + s.getDefinitionObjParams = function(defObj, id) { + var obj = defObj.filter(function(def) { + return def.id === id; + })[0], + params = (obj && obj.parameter) ? obj.parameter : []; + + return params; + + }; + + s.getPropFromListByProp = function(list, propSrc, targetValue, propDst) { + var output = null, + selectedObj = list.filter(function(e) { + return e[propSrc] === targetValue; + })[0]; + + if(selectedObj) { + if(propDst) { + output = selectedObj[propDst]; + } else { + output = selectedObj; + } + } + + return output; + }; + + return s; + + }); + + gbp.register.factory('GBPGovernanceServices', function(TopologyDataLoaders) { + var s = {}; + + var subjectInList = function(subjectName, subjectList) { + return subjectList.some(function(s) { + return s.name === subjectName; + }); + }; + + var EPG = function(epgId, tenantId) { + this.id = epgId; + this.tenantId = tenantId; + }; + + var Subject = function(name) { + this.name = name; + this.rules = []; + this.providers = []; + this.consumers = []; + + this.addProvider = function(providingEpg) { + if(this.providers.indexOf(providingEpg) === -1) { + this.providers.push(providingEpg); + } + }; + + this.addConsumer = function(consumingEpg) { + if(this.consumers.indexOf(consumingEpg) === -1) { + this.consumers.push(consumingEpg); + } + }; + + this.addRule = function(rule, classifierInstances) { + if(rule['classifier-ref'] && rule['classifier-ref'].length > 0) { + + rule['classifier-ref'].forEach(function(cr) { + //cr['parameters'] = []; + classifierInstances.forEach(function(ci) { + if(ci['name'] === cr['instance-name']) { + cr['parameters'] = ci['parameter-value']; + } + }); + }); + } + + this.rules.push(rule); + }; + }; + + var addEpg = function(epgList, epgId, tenantId) { + var addedEpg = null; + + if(epgList.some(function(epg) { + return epg.id === epgId && epg.tenantId === tenantId; + }) === false) { + addedEpg = new EPG(epgId, tenantId); + } + + if(addedEpg !== null) { + epgList.push(addedEpg); + } + + return addedEpg; + }, + addSubject = function(subject, subjects, providerEpg, consumerEpg, classifierInstances) { + //console.log('classifierInstances:', classifierInstances); + var existingSubject = subjects.filter(function(s) { + return s.name === subject.name; + })[0], + newSubject = (existingSubject === undefined); + + if(newSubject) { + existingSubject = new Subject(subject.name); + } + + existingSubject.addProvider(providerEpg); + existingSubject.addConsumer(consumerEpg); + + if(subject['ui-rule'] && subject['ui-rule'].length > 0) { + subject['ui-rule'].forEach(function(r) { + existingSubject.addRule(r, classifierInstances); + }); + } + + if(newSubject) { + subjects.push(existingSubject); + } + }, + processPairData = function(providers, consumers, subjects, pairData, classifierInstances) { + addEpg(providers, pairData['provider-endpoint-group-id'], pairData['provider-tenant-id']); + addEpg(consumers, pairData['consumer-endpoint-group-id'], pairData['consumer-tenant-id']); + + pairData['ui-subject'].forEach(function(s) { + addSubject(s, subjects, pairData['provider-endpoint-group-id'], pairData['consumer-endpoint-group-id'], classifierInstances); + }); + }; + + s.getEPGsAndSubjects = function(tenantId, classifierInstances, successCbk, errorCbk) { + TopologyDataLoaders.getSubjectsBetweenEndpointGroups(false, tenantId, + function(data) { + var epgPairs = data.output['endpoint-group-pair-with-subject'], + consumers = [], + providers = [], + subjects = []; + + if(epgPairs) { + epgPairs.forEach(function(p) { + processPairData(providers, consumers, subjects, p, classifierInstances); + }); + } + + successCbk({providers: providers, consumers: consumers, subjects: subjects}); + }, + function() { + //TODO log error + }); + }; + + return s; + }); + + gbp.register.factory('GBPTenantServices', function(GPBServices) { + + var s = {}; + + var Tenant = function(id, name, description) { + this.id = id || GPBServices.getUUIDnumber(); + this.name = name || null; + this.description = description || null; + }; + + var createBaseRestObj = function() { + return GPBServices + .createRestObj().one('policy:tenants'); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj().one('tenant').one(pathObj.tenantId); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new Tenant(rawObj.id, rawObj.name, rawObj.description); + // }); + return rawData.tenants.tenant; + }; + + var createData = function(obj) { + return { tenant : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId) { + return { + tenantId: tenantId + }; + }; + + s.createObj = function() { + return new Tenant(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.modify = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(successCbk, errorCbk) { + var restObj = createBaseRestObj(); + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPContractServices', function(GPBServices) { + + var s = {}; + + var Contract = function(id, description, parent) { + this.id = id || GPBServices.getUUIDnumber(); + this.description = description || null; + this.parent = parent || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj().one('policy:tenants').one('tenant').one(pathObj.tenantId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('contract').one(pathObj.contractId); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new Contract(rawObj.id, rawObj.description); + // }); + return rawData.tenant[0].contract; + }; + + var createData = function(obj) { + return { contract : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, contractId) { + return { + tenantId: tenantId, + contractId: contractId + }; + }; + + s.createObj = function() { + return new Contract(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPClauseServices', function(GPBServices) { + + var s = {}; + + var Clause = function(name, subjectRefs) { + this.name = name || null; + this['subject-refs'] = subjectRefs || []; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId) + .one('contract').one(pathObj.contractId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('clause').one(pathObj.clauseId); + }; + + var transformCallback = function(rawData) { + var data = null, + clauseData = rawData.contract[0].clause; + + if(clauseData) { + data = clauseData.map(function(elem) { + if(elem.hasOwnProperty('subject-refs') === false) { + elem['subject-refs'] = []; + } + return elem; + }); + } + + return data; + }; + + var createData = function(obj) { + var o = GPBServices.stripNullValues(obj); + + if(o['subject-refs']) { + o['subject-refs'] = GPBServices.removeEmptyElementsFromList(o['subject-refs']); + } + + return { clause : [ o ] }; + }; + + s.createPathObj = function(tenantId, contractId, clauseId) { + return { + tenantId: tenantId, + contractId: contractId, + clauseId: clauseId + }; + }; + + s.createObj = function() { + return new Clause(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPSubjectServices', function(GPBServices) { + + var s = {}; + + var Subject = function(name, order) { + this.name = name || null; + this.order = order || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId) + .one('contract').one(pathObj.contractId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('subject').one(pathObj.subjectId); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new Subject(rawObj.name, rawObj.order); + // }); + return rawData.contract[0].subject; + }; + + var createData = function(obj) { + return { subject : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, contractId, subjectId) { + return { + tenantId: tenantId, + contractId: contractId, + subjectId: subjectId + }; + }; + + s.createObj = function() { + return new Subject(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPRuleServices', function(GPBServices) { + + var s = {}; + + var Rule = function(name, order) { + this.name = name || null; + this.order = order || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant') + .one(pathObj.tenantId).one('contract').one(pathObj.contractId) + .one('subject').one(pathObj.subjectId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('rule').one(pathObj.ruleId); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new Rule(rawObj.name, rawObj.order); + // }); + return rawData.subject[0].rule; + }; + + var createData = function(obj) { + return { rule : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, contractId, subjectId, ruleId) { + return { + tenantId: tenantId, + contractId: contractId, + subjectId: subjectId, + ruleId: ruleId + }; + }; + + s.createObj = function() { + return new Rule(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPClassifierRefsServices', function(GPBServices) { + + var s = {}; + + var ClassifierRef = function(name, direction, instanceName, connectionTracking) { + this.name = name || null; + this.direction = direction || null; + this['instance-name'] = instanceName || null; + this['connection-tracking'] = connectionTracking || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant') + .one(pathObj.tenantId).one('contract').one(pathObj.contractId) + .one('subject').one(pathObj.subjectId) + .one('rule').one(pathObj.ruleId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('classifier-ref').one(pathObj.classifierRefId); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new ClassifierRef(rawObj.name, rawObj.direction, rawObj['instance-name']); + // }); + return rawData.rule[0]['classifier-ref']; + }; + + var createData = function(obj) { + return { 'classifier-ref' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, contractId, subjectId, ruleId, classifierRefId) { + return { + tenantId: tenantId, + contractId: contractId, + subjectId: subjectId, + ruleId: ruleId, + classifierRefId: classifierRefId + }; + }; + + s.createObj = function() { + return new ClassifierRef(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPActionRefsServices', function(GPBServices) { + + var s = {}; + + var ActionRef = function(name, order, instanceName) { + this.name = name || null; + this.order = order || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant') + .one(pathObj.tenantId).one('contract').one(pathObj.contractId) + .one('subject').one(pathObj.subjectId) + .one('rule').one(pathObj.ruleId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('action-ref').one(pathObj.actionRefId); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new ActionRef(rawObj.name, rawObj.order); + // }); + return rawData.rule[0]['action-ref']; + }; + + var createData = function(obj) { + return { 'action-ref' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, contractId, subjectId, ruleId, actionRefId) { + return { + tenantId: tenantId, + contractId: contractId, + subjectId: subjectId, + ruleId: ruleId, + actionRefId: actionRefId + }; + }; + + s.createObj = function() { + return new ActionRef(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPL2FloodDomainServices', function(GPBServices) { + + var s = {}; + + var L2FloodDomain = function(id, name, description, parent) { + this.id = id || GPBServices.getUUIDnumber(); + this.name = name || null; + this.description = description || null; + this.parent = parent || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('l2-flood-domain').one(pathObj.l2FloodDomain); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new L2FloodDomain(rawObj.id, rawObj.name, rawObj.description, rawObj.parent); + // }); + return rawData.tenant[0]['l2-flood-domain']; + }; + + var createData = function(obj) { + return { 'l2-flood-domain' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, l2FloodDomain) { + return { + tenantId: tenantId, + l2FloodDomain: l2FloodDomain + }; + }; + + s.createObj = function() { + return new L2FloodDomain(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPL2BridgeDomainServices', function(GPBServices) { + + var s = {}; + + var L2BridgeDomain = function(id, name, description, parent) { + this.id = id || GPBServices.getUUIDnumber(); + this.name = name || null; + this.description = description || null; + this.parent = parent || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant') + .one(pathObj.tenantId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('l2-bridge-domain').one(pathObj.l2BridgeDomain); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new L2BridgeDomain(rawObj.id, rawObj.name, rawObj.description, rawObj.parent); + // }); + return rawData.tenant[0]['l2-bridge-domain']; + }; + + var createData = function(obj) { + return { 'l2-bridge-domain' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, l2BridgeDomain) { + return { + tenantId: tenantId, + l2BridgeDomain: l2BridgeDomain + }; + }; + + s.createObj = function() { + return new L2BridgeDomain(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPL3ContextServices', function(GPBServices) { + + var s = {}; + + var L3Context = function(id, name, description) { + this.id = id || GPBServices.getUUIDnumber(); + this.name = name || null; + this.description = description || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('l3-context').one(pathObj.l3Context); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new L3Context(rawObj.id, rawObj.name, rawObj.description); + // }); + return rawData.tenant[0]['l3-context']; + }; + + var createData = function(obj) { + return { 'l3-context' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, l3Context) { + return { + tenantId: tenantId, + l3Context: l3Context + }; + }; + + s.createObj = function() { + return new L3Context(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPSubnetServices', function(GPBServices) { + + var s = {}; + + var Subnet = function(id, name, description, parent, ipPrefix, virtualRouterIp) { + this.id = id || GPBServices.getUUIDnumber(); + this.name = name || null; + this.description = description || null; + this.parent = parent || null; + this['ip-prefix'] = ipPrefix || null; + this['virtual-router-ip'] = virtualRouterIp || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('subnet').one(pathObj.subnet); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new L3Context(rawObj.id, rawObj.name, rawObj.description); + // }); + return rawData.tenant[0]['subnet']; + }; + + var createData = function(obj) { + return { 'subnet' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, subnet) { + return { + tenantId: tenantId, + subnet: subnet + }; + }; + + s.createObj = function() { + return new Subnet(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPGatewayServices', function(GPBServices) { + + var s = {}; + + var Gateway = function(gateway) { + this.gateway = gateway || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subnet').one(pathObj.subnetId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('gateways').one(pathObj.gateway); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new L3Context(rawObj.id, rawObj.name, rawObj.description); + // }); + return rawData.subnet[0]['gateways']; + }; + + var createData = function(obj) { + return { 'gateways' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, subnetId, gateway) { + return { + tenantId: tenantId, + subnetId: subnetId, + gateway: gateway + }; + }; + + s.createObj = function() { + return new Gateway(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPPrefixServices', function(GPBServices) { + + var s = {}; + + var Prefix = function(prefix) { + this.prefix = prefix || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subnet').one(pathObj.subnetId).one('gateways').one(pathObj.gatewayId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('prefixes').one(pathObj.prefixId); + }; + + var transformCallback = function(rawData) { + // return rawData.map(function(rawObj){ + // return new L3Context(rawObj.id, rawObj.name, rawObj.description); + // }); + return rawData.gateways[0].prefixes; + }; + + var createData = function(obj) { + return { 'prefixes' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, subnetId, gatewayId, prefixId) { + return { + tenantId: tenantId, + subnetId: subnetId, + gatewayId: gatewayId, + prefixId: prefixId ? prefixId.replace("/", "%2F") : prefixId + }; + }; + + s.createObj = function() { + return new Prefix(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPClassifierInstanceServices', function(GPBServices) { + + var s = {}; + + var ClassifierService = function(name, classifierDefId) { + this.name = name || null; + this['classifier-definition-id'] = classifierDefId || null; + this['parameter-value'] = []; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subject-feature-instances'); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('classifier-instance').one(pathObj.classfierInstanceId); + }; + + var transformCallback = function(rawData) { + return rawData['subject-feature-instances']['classifier-instance']; + }; + + var createData = function(obj) { + return { 'classifier-instance' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, classfierInstanceId) { + return { + tenantId: tenantId, + classfierInstanceId: classfierInstanceId + }; + }; + + s.createObj = function() { + return new ClassifierService(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPActionInstanceServices', function(GPBServices) { + + var s = {}; + + var ActionService = function(name, actionDefId) { + this.name = name || null; + this['action-definition-id'] = actionDefId || null; + this['parameter-value'] = []; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('subject-feature-instances'); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('action-instance').one(pathObj.actionInstanceId); + }; + + var transformCallback = function(rawData) { + return rawData['subject-feature-instances']['action-instance']; + }; + + var createData = function(obj) { + return { 'action-instance' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, actionInstanceId) { + return { + tenantId: tenantId, + actionInstanceId: actionInstanceId + }; + }; + + s.createObj = function() { + return new ActionService(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + s.getDefinitions = function(successCbk, errorCbk) { + var restObj = GBPRestangular.one('restconf').one('operational').one('policy:subject-feature-definitions'); + + restObj.get().then(function(data) { + successCbk(data['subject-feature-definitions']['action-definition']); + }, function(res) { + // errorCbk(res); + }); + }; + + return s; + + }); + + gbp.register.factory('GBPEpgServices', function(GPBServices) { + + var s = {}; + + var EPG = function(name, description, intraGroupPolicy, networkDomain, id, parent) { + this.id = id || GPBServices.getUUIDnumber(); + this.name = name || null; + this.description = description || null; + this['intra-group-policy'] = intraGroupPolicy || null; + this['network-domain'] = networkDomain || null; + this.parent = parent || null; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('endpoint-group').one(pathObj.epgId); + }; + + var transformCallback = function(rawData) { + return rawData.tenant[0]['endpoint-group']; + }; + + var createData = function(obj) { + return { 'endpoint-group' : [ GPBServices.stripNullValues(obj) ] }; + }; + + s.createPathObj = function(tenantId, epgId) { + return { + tenantId: tenantId, + epgId: epgId + }; + }; + + s.createObj = function() { + return new EPG(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPConNamedSelServices', function(GPBServices) { + + var s = {}; + + var ConsumerNamedSelector = function(name, contract) { + this.name = name || null; + this.contract = contract || []; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('endpoint-group').one(pathObj.epgId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('consumer-named-selector').one(pathObj.cnsId); + }; + + var transformCallback = function(rawData) { + var data = null, + consumerData = rawData['endpoint-group'][0]['consumer-named-selector']; + + if(consumerData) { + data = consumerData.map(function(elem) { + if(elem.hasOwnProperty('contract') === false) { + elem.contract = []; + } + return elem; + }); + } + + return data; + }; + + var createData = function(obj) { + var o = GPBServices.stripNullValues(obj); + + if(o.contract) { + o.contract = GPBServices.removeEmptyElementsFromList(o.contract); + } + + return { 'consumer-named-selector' : [ o ] }; + }; + + s.createPathObj = function(tenantId, epgId, cnsId) { + return { + tenantId: tenantId, + epgId: epgId, + cnsId: cnsId + }; + }; + + s.createObj = function() { + return new ConsumerNamedSelector(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + + gbp.register.factory('GBPProNamedSelServices', function(GPBServices) { + + var s = {}; + + var ProviderNamedSelector = function(name, contract) { + this.name = name || null; + this.contract = contract || []; + }; + + var createBaseRestObj = function(pathObj) { + return GPBServices.createRestObj() + .one('policy:tenants').one('tenant').one(pathObj.tenantId).one('endpoint-group').one(pathObj.epgId); + }; + + var createRestObj = function(pathObj) { + return createBaseRestObj(pathObj).one('provider-named-selector').one(pathObj.cnsId); + }; + + var transformCallback = function(rawData) { + var data = null, + provderData = rawData['endpoint-group'][0]['provider-named-selector']; + + if(provderData) { + data = provderData.map(function(elem) { + if(elem.hasOwnProperty('contract') === false) { + elem.contract = []; + } + return elem; + }); + } + + return data; + }; + + var createData = function(obj) { + var o = GPBServices.stripNullValues(obj); + + if(o.contract) { + o.contract = GPBServices.removeEmptyElementsFromList(o.contract); + } + + return { 'provider-named-selector' : [ o ] }; + }; + + s.createPathObj = function(tenantId, epgId, cnsId) { + return { + tenantId: tenantId, + epgId: epgId, + cnsId: cnsId + }; + }; + + s.createObj = function() { + return new ProviderNamedSelector(); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path), + reqData = createData(obj); + + GPBServices.send(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, successCbk, errorCbk) { + var restObj = createRestObj(path); + + GPBServices.delete(restObj, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = createBaseRestObj(path); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPEndpointServices', function(GPBServices) { + + var s = {}; + + var Endpoint = function(tenantId) { + this.tenant = tenantId || null; + this['network-containment'] = null; + this['endpoint-group'] = null; + this['endpoint-groups'] = []; + this.condition = []; + this['l2-context'] = null; + this['mac-address'] = null; + this['l3-address'] = []; + }; + + var createRestObj = function() { + return GPBServices.createRestObj('operations'); + }; + + var transformCallback = function(rawData) { + return rawData.endpoints.endpoint; + }; + + var createBaseData = function(obj) { + var o = GPBServices.stripNullValues(obj); + + if(o.condition) { + o.condition = GPBServices.removeEmptyElementsFromList(o.condition); + } + + if(o['endpoint-groups']) { + o['endpoint-groups'] = GPBServices.removeEmptyElementsFromList(o['endpoint-groups']); + } + + if(o['l3-address']) { + o['l3-address'] = GPBServices.removeEmptyElementsFromList(o['l3-address']); + } + + return o; + }; + + var createSendData = function(obj) { + var o = createBaseData(obj); + return { 'input': o }; + }; + + var createDeleteData = function(obj) { + var o = { + 'input': { + 'l3': obj['l3-address'], + 'l2': [ + { + 'l2-context': obj['l2-context'], + 'mac-address': obj['mac-address'] + } + ] + } + }; + + return o; + }; + + s.createObj = function(tenantId) { + return new Endpoint(tenantId); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj().one('endpoint:register-endpoint'), + reqData = createSendData(obj); + + GPBServices.post(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path).one('endpoint:unregister-endpoint'), + reqData = createDeleteData(obj); + GPBServices.post(restObj, reqData, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = GPBServices.createRestObj('operational').one('endpoint:endpoints'); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('GBPEndpointL3Services', function(GPBServices) { + + var s = {}; + + var EndpointL3 = function(tenantId) { + this.tenant = tenantId || null; + this['endpoint-group'] = null; + this['endpoint-groups'] = []; + this.condition = []; + this['l3-context'] = null; + this['ip-prefix'] = null; + this['endpoint-l2-gateways'] = []; + this['endpoint-l3-gateways'] = []; + }; + + var createRestObj = function() { + return GPBServices.createRestObj('operations'); + }; + + var transformCallback = function(rawData) { + return rawData.endpoints['endpoint-l3-prefix']; + }; + + var createBaseData = function(obj) { + var o = GPBServices.stripNullValues(obj); + + if(o.condition) { + o.condition = GPBServices.removeEmptyElementsFromList(o.condition); + } + + if(o['endpoint-groups']) { + o['endpoint-groups'] = GPBServices.removeEmptyElementsFromList(o['endpoint-groups']); + } + + if(o['endpoint-l2-gateways']) { + o['endpoint-l2-gateways'] = GPBServices.removeEmptyElementsFromList(o['endpoint-l2-gateways']); + } + + if(o['endpoint-l3-gateways']) { + o['endpoint-l3-gateways'] = GPBServices.removeEmptyElementsFromList(o['endpoint-l3-gateways']); + } + + return o; + }; + + var createSendData = function(obj) { + var o = createBaseData(obj); + return { 'input': o }; + }; + + var createDeleteData = function(obj) { + var o = { + 'input': { + 'l3-prefix': [ + { + 'l3-context': obj['l3-context'], + 'ip-prefix': obj['ip-prefix'] + } + ], + 'l2': obj['endpoint-l2-gateways'], + 'l3': obj['endpoint-l3-gateways'] + } + }; + + return o; + }; + + s.createObj = function(tenantId) { + return new EndpointL3(tenantId); + }; + + s.send = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj().one('endpoint:register-l3-prefix-endpoint'), + reqData = createSendData(obj); + + GPBServices.post(restObj, reqData, successCbk, errorCbk); + }; + + s.delete = function(path, obj, successCbk, errorCbk) { + var restObj = createRestObj(path).one('endpoint:unregister-endpoint'), + reqData = createDeleteData(obj); + + GPBServices.post(restObj, reqData, successCbk, errorCbk); + }; + + s.load = function(path, successCbk, errorCbk) { + var restObj = GPBServices.createRestObj('operational').one('endpoint:endpoints'); + + GPBServices.load(restObj, transformCallback, successCbk, errorCbk); + }; + + return s; + + }); + + gbp.register.factory('PGNServices', function(GBPRestangular) { + + var s = {}; + + var idGetter = {}; + + var idTypes = { + tenant: 'TENANT', + uuid: 'UUID', + l3ctx: 'L3CTX', + pathAction: 'PATHACTION', + accessAction: 'ACCESSACTION' + }; + + idGetter[idTypes.tenant] = function() { + return 1; + }; + + idGetter[idTypes.uuid] = function() { + return 2; + }; + + idGetter[idTypes.l3ctx] = function() { + return 3; + }; + + idGetter[idTypes.pathAction] = function() { + return 4; + }; + + idGetter[idTypes.accessAction] = function() { + return 5; + }; + + var getId = function(type) { + if(idGetter.hasOwnProperty(type)) { + return id = idGetter[type](); + } else { + throw "Cannot get idGetter for type " + type; + } + }; + + s.addReplaceEndpointGroup = function(successCbk, errorCbk, groupName, sgt, description) { + var tenantId = getId(idTypes.tenant), + uuid = getId(idTypes.uuid), + restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'pgn-application:create-or-replace-endpoint-groups', + reqData = { + "input": + { + "endpoint-group":[ + { + "pgn-application:tenant-id": tenantID, + "pgn-application:id":uuid, + "pgn-application:security-group-tag":sgt, + "pgn-application:name":groupName, + "pgn-application:description":description + } + ] + } + }; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); + }, function(res) { + errorCbk(res); + }); + }; + + s.deleteEndpointGroup = function(successCbk, errorCbk, uuid) { + var tenantId = getId(idTypes.tenant), + restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'pgn-application:delete-endpoint-groups', + reqData = { + "input": { + "endpoint-group":[ + { + "pgn-application:tenant-id": tenantId, + "pgn-application:id":uuid + } + ] + } + }; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); + }, function(res) { + errorCbk(res); + }); + }; + + s.getActions = function(successCbk, errorCbk) { + var tenantId = getId(idTypes.tenant), + pathActionId = getId(idTypes.pathAction), + accessActionId = getId(idTypes.accessAction), + restObj = GBPRestangular.one('restconf').one('config').one('policy:tenants', tenantId).one('subject-feature-instances'); + + restObj.get().then(function(data) { + successCbk(data); //TODO fill actions + }, function(res) { + errorCbk(res); + }); + }; + + s.applyPolicy = function(successCbk, errorCbk, providerId, consumerId, pathSelRule, accessCtrlRule) { + var restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'pgn-application:wire-endpoint-groups', + actionRefName = (pathSelRule ? pathSelRule : '') + (accessCtrlRule ? accessCtrlRule : ''), + reqData = { + "input": { + "endpoint-group-pair-with-rules": { + "pgn-application:provider-tenant-id": tenantID, + "pgn-application:consumer-tenant-id": tenantID, + "pgn-application:provider-group-id":providerId, + "pgn-application:consumer-group-id":consumerId, + "pgn-application:group-rule": [ + { + "action-ref": [pathSelRule, accessCtrlRule].map(function(r) { + return { "name":r }; + }), + "name":actionRefName + } + ] + } + } + }; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); //TODO reload policies + }, function(res) { + errorCbk(res); + }); + }; + + s.deletePolicy = function(successCbk, errorCbk, providerId, consumerId) { + var tenantId = getId(idTypes.tenant), + restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'pgn-application:unwire-endpoint-groups', + reqData = { + "input": + { + "endpoint-group-pair":[ + { + "pgn-application:provider-tenant-id": tenantId, + "pgn-application:consumer-tenant-id": tenantId, + "pgn-application:provider-group-id":providerId, + "pgn-application:consumer-group-id":consumerId + } + ] + } + }; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); //TODO reload policies + }, function(res) { + errorCbk(res); + }); + }; + + s.addEndPoint = function(successCbk, errorCbk, ipAddress, groupId) { + var l3ctxId = getId(idTypes.l3ctx), + tenantId = getId(idTypes.tenant), + restObj = GBPRestangular.one('restconf').one('operations'), + rpcRes = 'endpoint:register-endpoint', + reqData = { + "input": { + "endpoint-group": groupId, + "l3-address": [ + { + "ip-address": ipAddress, + "l3-context": l3ctxId + } + ], + "tenant": tenantId + } + }; + + restObj.post(rpcRes, reqData).then(function(data) { + successCbk(data); + }, function(res) { + errorCbk(res); + }); + }; + + s.getUUIDnumber = function() { + var d = new Date().getTime(); + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = (d + Math.random()*16)%16 | 0; + d = Math.floor(d/16); + return (c=='x' ? r : (r&0x3|0x8)).toString(16); + }); + }; + + return s; + }); + + gbp.register.factory('DesignGbpFactory', function(){ + + var dvf = {}; + + dvf.setMainClass = function(){ + if ( $('.gbpWrapper').length ) { + $('.gbpWrapper').closest('.col-xs-12').addClass('gbpGlobalWrapper'); + } + }; + + return dvf; + + }); + + gbp.register.factory('JointGraphOffsetFactory', function(GBPConstants){ + var jgof = {}; + + jgof.createWHObj = function(w, h) { + return {w: w || 0, h: h || 0}; + }; + + jgof.updateOffsets = function(delta, offset, margin, maximums, paper) { + offset.w = offset.w + delta.w + margin.w; + + if(offset.w >= maximums.w) { + paper.setDimensions(offset.w + 30, paper.options.height); + offset.w = offset.ow; + offset.h = offset.h + margin.h; + } + + }; + + jgof.resetOffsets = function(offset, w, h) { + offset.w = w; + offset.h = h; + }; + + jgof.getCurrentOffset = function(array, type) { + var max = 0; + array.forEach(function(item){ + max = item.attributes.position[type] > max ? item.attributes.position[type] : max; + }); + + return max; + }; + + jgof.checkObjsHoffsets = function(array, size, paper) { + var lastPosY = 0, + addOffset = false, + cellBottomOffset = 80, + setItemPosition = function(item, type) { + while (item.attributes.position[type] < size + cellBottomOffset) { + item.translate(null, cellBottomOffset); + } + }; + + array.forEach(function(item){ + addOffset = (size + cellBottomOffset) >= item.attributes.position.y; + + if ( addOffset ) { + setItemPosition(item, 'y'); + } + + if ( item.attributes.position.y + cellBottomOffset > paper.options.height ) { + paper.setDimensions(paper.options.width, paper.options.height + cellBottomOffset); + } + }); + }; + + return jgof; + }); + + gbp.register.factory('JointGraphFactory', function(GBPConstants){ + var defaulColor = 'blue'; + + var jgf = {}; + + jgf.getLabelLength = function(length) { + return length * 10 > 200 ? 200 : length * 10; + }; + + jgf.createGraph = function() { + var graph = new joint.dia.Graph(); + + var paper = new joint.dia.Paper({ + el: $('#graph'), + width: 1300, + height: 650, + model: graph, + gridSize: 1, + interactive: { vertexAdd: false } + }); + + return paper; + }; + + jgf.resetGraphDimension = function(paper, element, paddingT, paddingL){ + paddingT = paddingT ? paddingT : 0; + paddingL = paddingL ? paddingL : paddingT; + + var paperWidth = element.width() - paddingL, + paperHeight = element.height() - paddingT - 5; + + paper.setDimensions(paperWidth, paperHeight); + }; + + jgf.reloadGraph = function(graph) { + graph.clear(); + }; + + jgf.createElement = function(elementName, posx, posy, width, height, objectType, object, tooltip, bgcolor, titleName) { + var setWidth = function(width) { + return width < GBPConstants.jointElements.minWidth ? GBPConstants.jointElements.minWidth : + width > GBPConstants.jointElements.maxWidth ? GBPConstants.jointElements.maxWidth : width; + }; + + var setHeight = function(height) { + return height < GBPConstants.jointElements.minHeight ? GBPConstants.jointElements.minHeight : + height > GBPConstants.jointElements.maxHeight ? GBPConstants.jointElements.maxHeight : height; + }; + + // joint.shapes.basic.Rect = joint.shapes.basic.Generic.extend({ + joint.shapes.html = {}; + joint.shapes.html.Element = joint.shapes.basic.Generic.extend({ + + markup: '<g class="rotatable"><g class="scalable"><rect/><title /></g><text class="text1"></text><text class="text2"></text><title /></g>', + + defaults: joint.util.deepSupplement({ + type: 'html.Element', + attrs: { + 'rect': { fill: bgcolor, stroke: 'black', 'follow-scale': true, width: 80, height: 40, cursor: 'pointer' }, + '.text1': { ref: 'rect', 'ref-x': 0.5, 'ref-y': 0.3, 'y-alignment': 'middle', 'x-alignment': 'middle', cursor: 'pointer', 'font-weight' : 'bold'}, + '.text2': { ref: 'rect', 'ref-x': 0.5, 'ref-y': 0.7, 'y-alignment': 'middle', 'x-alignment': 'middle', cursor: 'pointer'}, + 'title': {text: tooltip}, + } + + }, joint.shapes.basic.Generic.prototype.defaults) + }); + + // joint.shapes.html.ElementView = joint.dia.ElementView.extend({ + + // template: [ + // '<input class="html-element" type="text" value="'+elementName+'"/>', + // '' + // ].join(''), + + // initialize: function() { + // _.bindAll(this, 'updateBox'); + // joint.dia.ElementView.prototype.initialize.apply(this, arguments); + + // this.$box = $(_.template(this.template)()); + // // Prevent paper from handling pointerdown. + // this.$box.find('input,select').on('mousedown click', function(evt) { evt.stopPropagation(); }); + // // This is an example of reacting on the input change and storing the input data in the cell model. + // this.$box.find('input').on('change', _.bind(function(evt) { + // this.model.set('input', $(evt.target).val()); + // }, this)); + // this.$box.find('button').on('click', _.bind(function(evt) { + // this.model.set('button', $('.divc').css('display','block')); + // }, this)); + // // Update the box position whenever the underlying model changes. + // this.model.on('change', this.updateBox, this); + + // this.updateBox(); + // }, + // render: function() { + // joint.dia.ElementView.prototype.render.apply(this, arguments); + // this.paper.$el.prepend(this.$box); + // this.updateBox(); + // return this; + // }, + // updateBox: function() { + // // Set the position and dimension of the box so that it covers the JointJS element. + // var bbox = this.model.getBBox(); + // // Example of updating the HTML with a data stored in the cell model. + // this.$box.css({ width: bbox.width, height: bbox.height, left: bbox.x, top: bbox.y, transform: 'rotate(' + (this.model.get('angle') || 0) + 'deg)' }); + // }, + // removeBox: function(evt) { + // this.$box.remove(); + // } + // }); + + elementName = elementName.length > 20 ? elementName.slice(0,20) + '...' : elementName; + // width = width > 200 ? 200 : width; + + // return new joint.shapes.basic.Rect({ + return new joint.shapes.html.Element({ + position: { x: posx || 0, y: posy || 0 }, + size: { width: width || GBPConstants.jointElements.minWidth, height: height || GBPConstants.jointElements.minHeight }, + attrs: { rect: { fill: bgcolor }, '.text1': { fill: 'black', text: titleName}, '.text2': { fill: 'black', text: elementName }}, + objType: objectType, + objData: object + }); + }; + + jgf.transformElement = function(element, transformX, transformY) { + return element.translate(transformX, transformY); + }; + + jgf.addItem = function(graph, item) { + graph.addCells([item]); + }; + + jgf.addItemList = function(graph, listItem) { + graph.addCells(listItem); + }; + + jgf.createLink = function(srcId, targetId, colorIn, colorOut, direction, objData) { + colorIn = colorIn || defaulColor; + colorOut = colorOut || defaulColor; + + var labelTextColor = GBPConstants.colors[GBPConstants.strings.sigmaTopoDefaultText], + labelBckColor = GBPConstants.colors[GBPConstants.strings.linklabel]; + + var linkObj = { + source: { id: srcId }, + target: { id: targetId }, + attrs: { + '.connection': { stroke: colorIn, 'stroke-width': 2, name: 'normal' }, + '.connection-wrap': { 'stroke-width': 10 } + }, + objData: objData + }; + + if(direction === 'in' || direction == 'bidirectional' || direction === undefined || direction === null) { + linkObj.attrs['.marker-target'] = { fill: colorIn, d: 'M 10 0 L 0 5 L 10 10 z' }; + } + + if(direction === 'out' || direction == 'bidirectional') { + linkObj.attrs['.marker-source'] = { fill: colorOut, d: 'M 10 0 L 0 5 L 10 10 z' }; + } + + var link = new joint.dia.Link(linkObj); + + // if(labelText) { + // link.label(0, { position: 0.3, attrs: { text: { text: labelText, fill: labelTextColor }, rect: { stroke: labelBckColor, 'stroke-width': 20 }}}); + // } + + + return link; + }; + + return jgf; + }); + + gbp.register.factory('GBPJointGraphBuilder', function(GBPRestangular, GBPConstants, JointGraphFactory, JointGraphOffsetFactory, TopologyDataLoaders){ + var jgb = {}; + + var builders = {}; + + var buildJointData = function(paper, nodes, links) { + + }; + + var setOperConfigTopoData = function(paper, data){ + var topo = TopologyDataLoaders.getEpgTopo(data); + + var offsetObj = { + ow: 100, + oh: 100, + w: 100, + h: 100 + }, + marginObj = { + w: 50, + h: 80 + }, + offsetHobj = { + pEpg: 0, + cEpg: 0, + subject: 0 + }, + itemsArray = { + epg: [] + }, + linksArray = []; + + JointGraphFactory.resetGraphDimension(paper, $('.policyGraphWrapper')); + JointGraphFactory.reloadGraph(paper.model); + + var deg2rad = function(deg){ + return deg * Math.PI / 180; + }; + + var getXYInCircle = function(elementIndex, elementsCount, paperCenterX, paperCenterY, elementWidth, elementHeight){ + var result = {x:0, y:0}; + circleMargin = 100; + r = (paperCenterX < paperCenterY ? paperCenterX : paperCenterY ) - circleMargin; + degs = 360 / elementsCount * (elementIndex+1) + 180; + rads = deg2rad(degs); + + elementWidth = elementWidth ? elementWidth : GBPConstants.jointElements.minWidth; + elementHeight = elementHeight ? elementHeight : GBPConstants.jointElements.minHeight; + + if(elementWidth < GBPConstants.jointElements.minWidth){elementWidth = GBPConstants.jointElements.minWidth;} + if(elementWidth > GBPConstants.jointElements.maxWidth){elementWidth = GBPConstants.jointElements.maxWidth;} + if(elementHeight < GBPConstants.jointElements.minHeight){elementHeight = GBPConstants.jointElements.minHeight;} + if(elementHeight > GBPConstants.jointElements.maxHeight){elementHeight = GBPConstants.jointElements.maxHeight;} + + result.x = paperCenterX + r * Math.cos(rads); + result.y = paperCenterY + r * Math.sin(rads); + + degs = degs % 360; + if(degs > 90 && degs < 270){ + result.x = result.x - elementWidth; + } + if(degs == 90 || degs == 270){ + result.x = result.x - elementWidth / 2; + } + if(degs > 180 && degs < 360){ + result.y = result.y - elementHeight; + } + if(degs === 0 || degs == 180){ + result.y = result.y - elementHeight / 2; + } + return result; + }; + + var paperCenterX = (paper.options.width) / 2; + var paperCenterY = (paper.options.height) / 2; + topo.nodes.forEach(function(i, index){ + var label = i.label, + header = 'Epg', + width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)), + color = GBPConstants.colors[GBPConstants.strings.epg]; + + var itemPos = getXYInCircle(index, topo.nodes.length, paperCenterX, paperCenterY, width, null); + var item = JointGraphFactory.createElement(label, itemPos.x, itemPos.y, width, null, GBPConstants.strings.epg , i, label, color, header); + + itemsArray.epg.push(item); + + // JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + }); + + var getItemById = function(id, array){ + var item = array.filter(function(i){ + return i.attributes.objData.id === id; + }); + + return item.length ? item[0] : null; + }; + + topo.links.forEach(function(l){ + var sourceItem = getItemById(l.source, itemsArray.epg), + targetItem = getItemById(l.target, itemsArray.epg); + + if (sourceItem && targetItem) { + var link = JointGraphFactory.createLink(sourceItem.id, targetItem.id, 'blue', 'green', l.direction, l.data); + linksArray.push(link); + } + }); + + JointGraphFactory.addItemList(paper.model, linksArray); + }; + + jgb.loadTopology = function(args, paper, type) { + if(type === null || builders.hasOwnProperty(type) === false) { + type = GBPConstants.strings.empty; + } + + builders[type](args, paper); + }; + + builders[GBPConstants.strings.empty] = function(args, paper) { + JointGraphFactory.reloadGraph(paper.model); + }; + + builders[GBPConstants.strings.config] = function(args, paper) { + var storage = args.storage || 'config', + tenantId = args.tenantId; + + + TopologyDataLoaders.getSubjectsBetweenEndpointGroups(false, tenantId, function(data){ + setOperConfigTopoData(paper, data); + }, function(){}); + }; + + builders[GBPConstants.strings.oper] = function(args, paper) { + var storage = args.storage || 'config', + tenantId = args.tenantId; + + TopologyDataLoaders.getSubjectsBetweenEndpointGroups(true, tenantId, function(data){ + setOperConfigTopoData(paper, data); + }, function(){}); + }; + + builders[GBPConstants.strings.l2l3] = function(args, paper) { + var storage = args.storage || 'config', + tenantId = args.tenantId; + + if(storage && tenantId) { + restObj = GBPRestangular.one('restconf').one(storage).one('policy:tenants').one('tenant').one(tenantId); + + restObj.get().then(function(data) { + var createLinks = function(srcList, srcItems, dstItems) { + var linkItems = srcList.map(function(srcObj) { + var linkItem = null; + if(srcObj.parent && dstItems[srcObj.parent]) { + linkItem = JointGraphFactory.createLink(srcItems[srcObj.id].id, dstItems[srcObj.parent].id, 'blue'); + } + return linkItem; + }).filter(function(linkObj) { + return linkObj !== null; + }); + + return linkItems; + }; + + var offsetObj = { + ow: 100, + oh: 100, + w: 100, + h: 100 + }, + marginObj = { + w: 50, + h: 80 + }, + itemsArray = { + l3: {}, + l2bridge: {}, + l2flood: {}, + subnets: {} + }; + + JointGraphFactory.reloadGraph(paper.model); + + data.tenant[0]['l3-context'].forEach(function(c, i) { + var label = c.name || c.id, + header = 'L3 context', + color = GBPConstants.colors[GBPConstants.strings.l3ctx], + width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); + item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.l3ctx , c, null, color, header); + + itemsArray.l3[c.id] = item; + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + }); + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h + 100); + + data.tenant[0]['l2-bridge-domain'].forEach(function(c, i) { + var label = c.name || c.id, + header = 'L2 bridge domain', + color = GBPConstants.colors[GBPConstants.strings.bridge], + width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); + item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.bridge , c, null, color, header); + + itemsArray.l2bridge[c.id] = item; + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + }); + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h + 100); + + data.tenant[0]['l2-flood-domain'].forEach(function(c, i) { + var label = c.name || c.id, + header = 'L2 flood domain', + color = GBPConstants.colors[GBPConstants.strings.flood], + width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); + item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.flood , c, null, color, header); + + itemsArray.l2flood[c.id] = item; + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + }); + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.h + 100); + + data.tenant[0]['subnet'].forEach(function(c, i) { + var label = c.name || c.id, + header = 'Subnet', + color = GBPConstants.colors[GBPConstants.strings.subnet], + width = Math.max(JointGraphFactory.getLabelLength(label.length), JointGraphFactory.getLabelLength(header.length)); + item = JointGraphFactory.createElement(label, offsetObj.w, offsetObj.h, width, null, GBPConstants.strings.subnet , c, null, color, header); + + itemsArray.subnets[c.id] = item; + + JointGraphOffsetFactory.updateOffsets(JointGraphOffsetFactory.createWHObj(width), offsetObj, marginObj, JointGraphOffsetFactory.createWHObj(paper.options.width, paper.options.height), paper); + JointGraphFactory.addItem(paper.model, item); + }); + + JointGraphOffsetFactory.resetOffsets(offsetObj, offsetObj.ow, offsetObj.oh); + + var l2bridgeL3 = createLinks(data.tenant[0]['l2-bridge-domain'], itemsArray.l2bridge, itemsArray.l3); + JointGraphFactory.addItemList(paper.model, l2bridgeL3); + + var l2floodL2bridge = createLinks(data.tenant[0]['l2-flood-domain'], itemsArray.l2flood, itemsArray.l2bridge); + JointGraphFactory.addItemList(paper.model, l2floodL2bridge); + + var l2floodSubnet = createLinks(data.tenant[0]['subnet'], itemsArray.subnets, itemsArray.l2flood); + JointGraphFactory.addItemList(paper.model, l2floodSubnet); + + var l2bridgeSubnet = createLinks(data.tenant[0]['subnet'], itemsArray.subnets, itemsArray.l2bridge); + JointGraphFactory.addItemList(paper.model, l2bridgeSubnet); + + var l3Subnet = createLinks(data.tenant[0]['subnet'], itemsArray.subnets, itemsArray.l3); + JointGraphFactory.addItemList(paper.model, l3Subnet); + + }, function() { + + }); + } + }; + + + return jgb; + }); }); \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/infinity-loop.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/infinity-loop.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/infinity-loop.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/infinity-loop.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-down.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-down.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-down.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-down.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-right.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-right.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-right.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-right.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-up.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-up.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-up.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-arrow-up.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-close.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-close.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-close.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-close.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-collapse-bits.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-collapse-bits.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-collapse-bits.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-collapse-bits.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-danger.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-danger.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-danger.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-danger.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-expand-bits.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-expand-bits.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-expand-bits.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-expand-bits.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-fill-data.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-fill-data.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-fill-data.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-fill-data.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-empty.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-empty.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-empty.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-empty.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full-bck.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full-bck.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full-bck.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full-bck.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-filter-full.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list-bck.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list-bck.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list-bck.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list-bck.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-list.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-next.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-next.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-next.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-next.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-plus.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-plus.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-plus.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-plus.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-prev.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-prev.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-prev.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-prev.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-question.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-question.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-question.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-question.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-view.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-view.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-view.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/images/yang-ui-icons/icon-view.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/js/backbone-min.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/backbone-min.js similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/js/backbone-min.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/backbone-min.js diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/js/geometry.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/geometry.js similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/js/geometry.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/geometry.js diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/js/joint.clean.build.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/joint.clean.build.js old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/js/joint.clean.build.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/joint.clean.build.js diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/js/joint.css b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/joint.css similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/js/joint.css rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/joint.css diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/js/lodash.min.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/lodash.min.js similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/js/lodash.min.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/lodash.min.js diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/js/vectorizer.js b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/vectorizer.js similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/js/vectorizer.js rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/js/vectorizer.js diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/action-ref.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/action-ref.tpl.html old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/action-ref.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/action-ref.tpl.html index bffc869c1..17f6e2968 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/action-ref.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/action-ref.tpl.html @@ -1,29 +1,29 @@ -<div ng-controller="actionRefCtrl" ng-init="init()"> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section ng-show="internalView.actionRef"> - <form name="actionRefForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - - <div class="rowWrapper"> - <label class="block basicLabel"><span>Name:</span> - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="actionRefForm.name.$error.required"></i> - </label> - <select class="form-control" ng-model="newActionRefObj.name" ng-options="c.name as getDisplayLabel(c, actionInstanceNames.labels) for c in actionInstanceNames.options" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'"> - <option>--</option> - </select> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newActionRefObj['order']"> - <label class="block basicLabel"><span>Order:</span> - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="errors.int32"></i> - </label> - <input class="form-control" type="text" ng-model="newActionRefObj.order" ng-disabled="internalView.edit === 'view'" ng-change="validate(newActionRefObj.order, errors)"/> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> - </form> - </section> - +<div ng-controller="actionRefCtrl" ng-init="init()"> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section ng-show="internalView.actionRef"> + <form name="actionRefForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + + <div class="rowWrapper"> + <label class="block basicLabel"><span>Name:</span> + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="actionRefForm.name.$error.required"></i> + </label> + <select class="form-control" ng-model="newActionRefObj.name" ng-options="c.name as getDisplayLabel(c, actionInstanceNames.labels) for c in actionInstanceNames.options" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'"> + <option>--</option> + </select> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newActionRefObj['order']"> + <label class="block basicLabel"><span>Order:</span> + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="errors.int32"></i> + </label> + <input class="form-control" type="text" ng-model="newActionRefObj.order" ng-disabled="internalView.edit === 'view'" ng-change="validate(newActionRefObj.order, errors)"/> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> + </form> + </section> + </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/actions.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/actions.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/actions.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/actions.tpl.html index a72314e48..cfc2833b9 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/actions.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/actions.tpl.html @@ -1,50 +1,50 @@ -<div ng-controller="actionsCtrl" ng-init="init()"> - <h2 class="text-center">Actions</h2> - -<div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="actionsView"> - <form name="actionsForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add actions</label> - - <div class="rowWrapper"> - <label class="block basicLabel">Name - <i class="icon-exclamation-sign red" tooltip="{{actionsForm.name.$error.required ? 'Required field' : actionsForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="actionsForm.name.$error.required || actionsForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" name="name" ng-required="true" ng-model="newActionObj.name" ng-disabled="edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="edit === 'view' && !newActionObj['action-definition-id']"> - <label class="block basicLabel">Definition</label> - <select class="form-control" ng-model="newActionObj['action-definition-id']" ng-options="d.id as getDisplayLabel(d, actionDefinitions.labels) for d in actionDefinitions.options" ng-disabled="edit === 'view'" ng-change="reloadDefs()"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper"> - <div ng-repeat="param in defs"> - <div class="row-param" ng-controller="paramCtrl" ng-init="init(param, newActionObj['parameter-value'])"> - <div ng-show="param.type !== 'range'"> - <label>{{ parameter.name + ' (' + parameter.type + ')' }}:</label> - <input class="form-control" type="text" ng-model="value" ng-disabled="edit === 'view'"></input> - </div> - <div ng-show="param.type === 'range'"> - <label class="param-label">{{ parameter.name + ' (' + parameter.type + ')' }}:</label> - - <input class="form-control narrow-input-left" type="text" ng-model="value.min" ng-disabled="edit === 'view'"></input> - <input class="form-control narrow-input-right" type="text" ng-model="value.max" ng-disabled="edit === 'view'"></input> - </div> - </div> - </div> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="edit === 'view'">Save</button> - </form> - </section> - - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> +<div ng-controller="actionsCtrl" ng-init="init()"> + <h2 class="text-center">Actions</h2> + +<div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="actionsView"> + <form name="actionsForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add actions</label> + + <div class="rowWrapper"> + <label class="block basicLabel">Name + <i class="icon-exclamation-sign red" tooltip="{{actionsForm.name.$error.required ? 'Required field' : actionsForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="actionsForm.name.$error.required || actionsForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" name="name" ng-required="true" ng-model="newActionObj.name" ng-disabled="edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="edit === 'view' && !newActionObj['action-definition-id']"> + <label class="block basicLabel">Definition</label> + <select class="form-control" ng-model="newActionObj['action-definition-id']" ng-options="d.id as getDisplayLabel(d, actionDefinitions.labels) for d in actionDefinitions.options" ng-disabled="edit === 'view'" ng-change="reloadDefs()"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper"> + <div ng-repeat="param in defs"> + <div class="row-param" ng-controller="paramCtrl" ng-init="init(param, newActionObj['parameter-value'])"> + <div ng-show="param.type !== 'range'"> + <label>{{ parameter.name + ' (' + parameter.type + ')' }}:</label> + <input class="form-control" type="text" ng-model="value" ng-disabled="edit === 'view'"></input> + </div> + <div ng-show="param.type === 'range'"> + <label class="param-label">{{ parameter.name + ' (' + parameter.type + ')' }}:</label> + + <input class="form-control narrow-input-left" type="text" ng-model="value.min" ng-disabled="edit === 'view'"></input> + <input class="form-control narrow-input-right" type="text" ng-model="value.max" ng-disabled="edit === 'view'"></input> + </div> + </div> + </div> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="edit === 'view'">Save</button> + </form> + </section> + + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/contract-content-static.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/contract-content-static.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/contract-content-static.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/contract-content-static.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/ep-content-static.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/ep-content-static.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/ep-content-static.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/ep-content-static.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/epg-content-static.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/epg-content-static.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/epg-content-static.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/epg-content-static.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/rule-content-static.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/rule-content-static.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/rule-content-static.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/rule-content-static.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/subject-content-static.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/subject-content-static.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/box/subject-content-static.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/box/subject-content-static.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/classifier-ref.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/classifier-ref.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/classifier-ref.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/classifier-ref.tpl.html index c1c4d4681..41d9163a5 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/classifier-ref.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/classifier-ref.tpl.html @@ -1,41 +1,41 @@ -<div ng-controller="classifierRefCtrl" ng-init="init()"> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section ng-show="internalView.classifierRef"> - <form name="classifierRefForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - - <div class="rowWrapper"> - <label class="block basicLabel"><span>Name:</span> - <i class="icon-exclamation-sign red" tooltip="{{classifierRefForm.name.$error.required ? 'Required field' : classifierRefForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="classifierRefForm.name.$error.required || classifierRefForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newClassifierRefObj.name" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newClassifierRefObj['instance-name']"> - <label class="block basicLabel"><span>Instance name:</span></label> - <select class="form-control" ng-model="newClassifierRefObj['instance-name']" ng-options="c.name as getDisplayLabel(c, instanceNames.labels) for c in instanceNames.options" ng-disabled="internalView.edit === 'view'"> - <option>--</option> - </select> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newClassifierRefObj['direction']"> - <label class="block basicLabel"><span>Direction:</span></label> - <select class="form-control" ng-model="newClassifierRefObj.direction" ng-options="c for c in formDirections" ng-disabled="internalView.edit === 'view'"> - <option>--</option> - </select> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newClassifierRefObj['connection-tracking']"> - <label class="block basicLabel"><span>Connection tracking:</span></label> - <select class="form-control" ng-model="newClassifierRefObj['connection-tracking']" ng-options="c for c in formConnectionTracking" ng-disabled="internalView.edit === 'view'"> - <option>--</option> - </select> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> - </form> - </section> - +<div ng-controller="classifierRefCtrl" ng-init="init()"> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section ng-show="internalView.classifierRef"> + <form name="classifierRefForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + + <div class="rowWrapper"> + <label class="block basicLabel"><span>Name:</span> + <i class="icon-exclamation-sign red" tooltip="{{classifierRefForm.name.$error.required ? 'Required field' : classifierRefForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="classifierRefForm.name.$error.required || classifierRefForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newClassifierRefObj.name" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newClassifierRefObj['instance-name']"> + <label class="block basicLabel"><span>Instance name:</span></label> + <select class="form-control" ng-model="newClassifierRefObj['instance-name']" ng-options="c.name as getDisplayLabel(c, instanceNames.labels) for c in instanceNames.options" ng-disabled="internalView.edit === 'view'"> + <option>--</option> + </select> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newClassifierRefObj['direction']"> + <label class="block basicLabel"><span>Direction:</span></label> + <select class="form-control" ng-model="newClassifierRefObj.direction" ng-options="c for c in formDirections" ng-disabled="internalView.edit === 'view'"> + <option>--</option> + </select> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newClassifierRefObj['connection-tracking']"> + <label class="block basicLabel"><span>Connection tracking:</span></label> + <select class="form-control" ng-model="newClassifierRefObj['connection-tracking']" ng-options="c for c in formConnectionTracking" ng-disabled="internalView.edit === 'view'"> + <option>--</option> + </select> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> + </form> + </section> + </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/classifiers.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/classifiers.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/classifiers.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/classifiers.tpl.html index d861a4497..dc4e91d87 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/classifiers.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/classifiers.tpl.html @@ -1,54 +1,54 @@ -<div ng-controller="classifiersCtrl" ng-init="init()"> - <h2 class="text-center">Classifiers</h2> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="classifiersView"> - <form name="classifierForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add classifiers</label> - - <div class="rowWrapper"> - <label class="block basicLabel">Name - <i class="icon-exclamation-sign red" tooltip="{{classifierForm.name.$error.required ? 'Required field' : classifierForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="classifierForm.name.$error.required || classifierForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" name="name" ng-required="true" ng-model="newClassifierObj.name" ng-disabled="edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="edit === 'view' && !newClassifierObj['classifier-definition-id']"> - <label class="block basicLabel">Definition</label> - <select class="form-control" ng-model="newClassifierObj['classifier-definition-id']" ng-options="d.id as getDisplayLabel(d, classifierDefinitions.labels) for d in classifierDefinitions.options" ng-change="reloadDefs()" ng-disabled="edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper clearfix"> - <div ng-repeat="param in defs"> - <div class="rowWrapper" ng-controller="paramCtrl" ng-init="init(param, newClassifierObj['parameter-value'])"> - <div ng-show="param.type !== 'range'"> - <label class="block basicLabel">{{ parameter.name + ' (' + parameter.type + ')' }}:</label> - <input class="form-control" type="text" ng-model="value" ng-disabled="edit === 'view'"></input> - </div> - <div ng-show="param.type === 'range'"> - <label class="block basicLabel">{{ parameter.name + ' (' + parameter.type + ')' }}:</label> - - <div class="col-md-6 inputWrapper leftInput"> - <input class="form-control" type="text" ng-model="value.min" ng-disabled="edit === 'view'"></input> - </div> - <div class="col-md-6 inputWrapper rightInput"> - <input class="form-control col-md-6" type="text" ng-model="value.max" ng-disabled="edit === 'view'"></input> - </div> - - </div> - </div> - </div> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="edit === 'view'">Save</button> - </form> - </section> - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> +<div ng-controller="classifiersCtrl" ng-init="init()"> + <h2 class="text-center">Classifiers</h2> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="classifiersView"> + <form name="classifierForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add classifiers</label> + + <div class="rowWrapper"> + <label class="block basicLabel">Name + <i class="icon-exclamation-sign red" tooltip="{{classifierForm.name.$error.required ? 'Required field' : classifierForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="classifierForm.name.$error.required || classifierForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" name="name" ng-required="true" ng-model="newClassifierObj.name" ng-disabled="edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="edit === 'view' && !newClassifierObj['classifier-definition-id']"> + <label class="block basicLabel">Definition</label> + <select class="form-control" ng-model="newClassifierObj['classifier-definition-id']" ng-options="d.id as getDisplayLabel(d, classifierDefinitions.labels) for d in classifierDefinitions.options" ng-change="reloadDefs()" ng-disabled="edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper clearfix"> + <div ng-repeat="param in defs"> + <div class="rowWrapper" ng-controller="paramCtrl" ng-init="init(param, newClassifierObj['parameter-value'])"> + <div ng-show="param.type !== 'range'"> + <label class="block basicLabel">{{ parameter.name + ' (' + parameter.type + ')' }}:</label> + <input class="form-control" type="text" ng-model="value" ng-disabled="edit === 'view'"></input> + </div> + <div ng-show="param.type === 'range'"> + <label class="block basicLabel">{{ parameter.name + ' (' + parameter.type + ')' }}:</label> + + <div class="col-md-6 inputWrapper leftInput"> + <input class="form-control" type="text" ng-model="value.min" ng-disabled="edit === 'view'"></input> + </div> + <div class="col-md-6 inputWrapper rightInput"> + <input class="form-control col-md-6" type="text" ng-model="value.max" ng-disabled="edit === 'view'"></input> + </div> + + </div> + </div> + </div> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="edit === 'view'">Save</button> + </form> + </section> + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/clause.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/clause.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/clause.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/clause.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/cns.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/cns.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/cns.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/cns.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/contracts.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/contracts.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/contracts.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/contracts.tpl.html index a30c032f9..f3f5ac88e --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/contracts.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/contracts.tpl.html @@ -1,46 +1,46 @@ -<div ng-controller="contractCtrl" ng-init="init()"> - - <h2 class="text-center">Contracts</h2> - - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="internalView.contract"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add contract</label> - - <div class="rowWrapper"> - <label class="block basicLabel"><span>Id:</span></label> - <input class="form-control" type="text" ng-model="newContractObj.id" disabled/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newContractObj['description']"> - <label class="block basicLabel"><span>Description:</span></label> - <input class="form-control" type="text" ng-model="newContractObj.description" ng-disabled="internalView.edit === 'view'"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newContractObj['parent']"> - <label class="block basicLabel"><span>Parent:</span></label> - <select class="form-control" ng-model="newContractObj.parent" ng-options="d.id as getDisplayLabel(d, displayLabel) for d in list" ng-disabled="internalView.edit === 'view'"> - <option>--</option> - </select> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> - </section> - - <section class="formWrapper clearfix" ng-show="selectedContract"> - <div ng-include src="view_path+'clause.tpl.html'"></div> - </section> - - <section class="formWrapper clearfix" ng-show="selectedContract"> - <div ng-include src="view_path+'subjects.tpl.html'"></div> - </section> - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> - -</div> - - +<div ng-controller="contractCtrl" ng-init="init()"> + + <h2 class="text-center">Contracts</h2> + + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="internalView.contract"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add contract</label> + + <div class="rowWrapper"> + <label class="block basicLabel"><span>Id:</span></label> + <input class="form-control" type="text" ng-model="newContractObj.id" disabled/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newContractObj['description']"> + <label class="block basicLabel"><span>Description:</span></label> + <input class="form-control" type="text" ng-model="newContractObj.description" ng-disabled="internalView.edit === 'view'"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newContractObj['parent']"> + <label class="block basicLabel"><span>Parent:</span></label> + <select class="form-control" ng-model="newContractObj.parent" ng-options="d.id as getDisplayLabel(d, displayLabel) for d in list" ng-disabled="internalView.edit === 'view'"> + <option>--</option> + </select> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> + </section> + + <section class="formWrapper clearfix" ng-show="selectedContract"> + <div ng-include src="view_path+'clause.tpl.html'"></div> + </section> + + <section class="formWrapper clearfix" ng-show="selectedContract"> + <div ng-include src="view_path+'subjects.tpl.html'"></div> + </section> + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> + +</div> + + diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/docs.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/docs.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/docs.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/docs.tpl.html index 9f69ee8e8..4b16089ae --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/docs.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/docs.tpl.html @@ -1,5 +1,5 @@ -<div> - <h2 class="text-center">Docs</h2> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpanded('basic')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="toggleExpanded('policy')">Up</button> -</div> +<div> + <h2 class="text-center">Docs</h2> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpanded('basic')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="toggleExpanded('policy')">Up</button> +</div> diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/endpoint.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/endpoint.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/endpoint.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/endpoint.tpl.html index 76dcd4413..5a233c629 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/endpoint.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/endpoint.tpl.html @@ -1,108 +1,108 @@ -<div ng-controller="endpointCtrl" ng-init="init()"> - - <h2 class="text-center">Endpoint</h2> - - <div ng-include src="view_path+'parts/crud-endpoint.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="view.endpoint"> - <form name="endpointForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['network-containment']"> - <label class="block basicLabel">Network containment:</label> - <select class="form-control" ng-model="newEndpointObj['network-containment']" ng-options="c.id as getDisplayLabel(c, networkContainment.labels) for c in networkContainment.options | orderBy:'name'" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-group']"> - <label class="block basicLabel">Endpoint group:</label> - <select class="form-control" ng-model="newEndpointObj['endpoint-group']" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-groups']"> - <label class="basicLabel">Endpoint groups:</label> - <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> - - <div ng-repeat="epGroups in newEndpointObj['endpoint-groups'] track by $index"> - <div class="selectWrapper col-md-10"> - <div class="rowWrapper"> - <select class="form-control" ng-model="epGroups" ng-change="updateLeafListEl($index, epGroups, 'endpoint-groups')" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - </div> - <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> - </div> - </div> - - <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['condition']"> - <label class="basicLabel">Condition:</label> - <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('condition')" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> - - <div ng-repeat="condition in newEndpointObj['condition'] track by $index"> - <div class="selectWrapper col-md-10"> - <div class="rowWrapper"> - <input class="form-control" type="text" ng-model="condition" ng-change="updateLeafListEl($index, condition, 'condition')" ng-disabled="view.edit === 'view'"/> - </div> - </div> - <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'condition')" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> - </div> - </div> - - <div class="rowWrapper clearfix"> - <label class="block basicLabel">L2 context: - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="endpointForm.l2context.$error.required"></i> - </label> - <select class="form-control" ng-model="newEndpointObj['l2-context']" name="l2context" ng-required="true" ng-options="c.id as getDisplayLabel(c, l2context.labels) for c in l2context.options" ng-disabled="view.edit !== 'add'"> - <option>--</option> - </select> - </div> - - <div class="rowWrapper clearfix"> - <label class="block basicLabel">MAC Address: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="endpointForm.macAddress.$error.pattern"></i> - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="endpointForm.macAddress.$error.required"></i> - </label> - <input class="form-control" type="text" name="macAddress" ng-model="newEndpointObj['mac-address']" ng-pattern="/^([0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5})$/" ng-required="true" ng-disabled="view.edit !== 'add'"/> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['l3-address']"> - <label class="basicLabel">L3 Address:</label> - <button class="btn btn-primary btn-slim" ng-click="addNewL3address()" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> - - <div ng-repeat="l3address in newEndpointObj['l3-address'] track by $index"> - <div class="separator col-md-11"> - <div class="inner-separator"></div> - </div> - <div class="selectWrapper col-md-10"> - <div class="rowWrapper"> - <label class="block basicLabel">L3 Context:</label> - <select class="form-control" ng-model="l3address['l3-context']" ng-options="c.id as getDisplayLabel(c, l3context.labels) for c in l3context.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">IP Address: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="endpointForm.ipAddress.$error.pattern"></i> - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="endpointForm.ipAddress.$error.required"></i> - </label> - <input class="form-control" type="text" ng-model="l3address['ip-address']" name="ipAddress" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/" ng-required="l3address['l3-context']" ng-disabled="view.edit === 'view'"/> - </div> - </div> - <button class="btn btn-danger col-md-2 btn-list" ng-click="deleteNewL3address($index)" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> - </div> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> - </form> - </section> - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> - +<div ng-controller="endpointCtrl" ng-init="init()"> + + <h2 class="text-center">Endpoint</h2> + + <div ng-include src="view_path+'parts/crud-endpoint.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="view.endpoint"> + <form name="endpointForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['network-containment']"> + <label class="block basicLabel">Network containment:</label> + <select class="form-control" ng-model="newEndpointObj['network-containment']" ng-options="c.id as getDisplayLabel(c, networkContainment.labels) for c in networkContainment.options | orderBy:'name'" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-group']"> + <label class="block basicLabel">Endpoint group:</label> + <select class="form-control" ng-model="newEndpointObj['endpoint-group']" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-groups']"> + <label class="basicLabel">Endpoint groups:</label> + <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> + + <div ng-repeat="epGroups in newEndpointObj['endpoint-groups'] track by $index"> + <div class="selectWrapper col-md-10"> + <div class="rowWrapper"> + <select class="form-control" ng-model="epGroups" ng-change="updateLeafListEl($index, epGroups, 'endpoint-groups')" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + </div> + <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> + </div> + </div> + + <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['condition']"> + <label class="basicLabel">Condition:</label> + <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('condition')" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> + + <div ng-repeat="condition in newEndpointObj['condition'] track by $index"> + <div class="selectWrapper col-md-10"> + <div class="rowWrapper"> + <input class="form-control" type="text" ng-model="condition" ng-change="updateLeafListEl($index, condition, 'condition')" ng-disabled="view.edit === 'view'"/> + </div> + </div> + <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'condition')" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> + </div> + </div> + + <div class="rowWrapper clearfix"> + <label class="block basicLabel">L2 context: + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="endpointForm.l2context.$error.required"></i> + </label> + <select class="form-control" ng-model="newEndpointObj['l2-context']" name="l2context" ng-required="true" ng-options="c.id as getDisplayLabel(c, l2context.labels) for c in l2context.options" ng-disabled="view.edit !== 'add'"> + <option>--</option> + </select> + </div> + + <div class="rowWrapper clearfix"> + <label class="block basicLabel">MAC Address: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="endpointForm.macAddress.$error.pattern"></i> + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="endpointForm.macAddress.$error.required"></i> + </label> + <input class="form-control" type="text" name="macAddress" ng-model="newEndpointObj['mac-address']" ng-pattern="/^([0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5})$/" ng-required="true" ng-disabled="view.edit !== 'add'"/> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['l3-address']"> + <label class="basicLabel">L3 Address:</label> + <button class="btn btn-primary btn-slim" ng-click="addNewL3address()" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> + + <div ng-repeat="l3address in newEndpointObj['l3-address'] track by $index"> + <div class="separator col-md-11"> + <div class="inner-separator"></div> + </div> + <div class="selectWrapper col-md-10"> + <div class="rowWrapper"> + <label class="block basicLabel">L3 Context:</label> + <select class="form-control" ng-model="l3address['l3-context']" ng-options="c.id as getDisplayLabel(c, l3context.labels) for c in l3context.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">IP Address: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="endpointForm.ipAddress.$error.pattern"></i> + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="endpointForm.ipAddress.$error.required"></i> + </label> + <input class="form-control" type="text" ng-model="l3address['ip-address']" name="ipAddress" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/" ng-required="l3address['l3-context']" ng-disabled="view.edit === 'view'"/> + </div> + </div> + <button class="btn btn-danger col-md-2 btn-list" ng-click="deleteNewL3address($index)" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> + </div> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> + </form> + </section> + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> + </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/epg.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/epg.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/epg.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/epg.tpl.html index c59507ef6..303e92919 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/epg.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/epg.tpl.html @@ -1,64 +1,64 @@ -<div ng-controller="epgCtrl" ng-init="init()"> - <h2 class="text-center">Endpoint groups</h2> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="internalView.epg"> - <form name="epgForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - - <div class="rowWrapper"> - <label class="block basicLabel">Id:</label> - <input class="form-control" type="text" ng-model="newEpgObj.id" ng-disabled="internalView.edit !== 'add'"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['name']"> - <label class="block basicLabel">Name: - <i class="icon-exclamation-sign red" tooltip="{{epgForm.name.$error.required ? 'Required field' : epgForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="epgForm.name.$error.required || epgForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" name="name" ng-model="newEpgObj.name" ng-required="true" ng-disabled="internalView.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['description']"> - <label class="block basicLabel">Description:</label> - <input class="form-control" type="text" ng-model="newEpgObj.description" ng-disabled="internalView.edit === 'view'"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['intra-group-policy']"> - <label class="block basicLabel">Intra group policy:</label> - <select class="form-control" ng-model="newEpgObj['intra-group-policy']" ng-options="opt for opt in igpOpts" ng-disabled="internalView.edit === 'view'"> - <option>--</option> - </select> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['network-domain']"> - <label class="block basicLabel">Network domain: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="epgForm.netDomain.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newEpgObj['network-domain']" name="netDomain" ng-pattern="/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/" ng-disabled="internalView.edit === 'view'"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['parent']"> - <label class="block basicLabel">Parent:</label> - <select class="form-control" ng-model="newEpgObj.parent" ng-options="d.id as getDisplayLabel(d, displayLabel) for d in list"> - <option>--</option> - </select> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> - </form> - </section> - - <section class="formWrapper clearfix" ng-show="selectedEpg"> - <div ng-include src="view_path+'cns.tpl.html'"></div> - </section> - - <section class="formWrapper clearfix" ng-show="selectedEpg"> - <div ng-include src="view_path+'pns.tpl.html'"></div> - </section> - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> - +<div ng-controller="epgCtrl" ng-init="init()"> + <h2 class="text-center">Endpoint groups</h2> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="internalView.epg"> + <form name="epgForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + + <div class="rowWrapper"> + <label class="block basicLabel">Id:</label> + <input class="form-control" type="text" ng-model="newEpgObj.id" ng-disabled="internalView.edit !== 'add'"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['name']"> + <label class="block basicLabel">Name: + <i class="icon-exclamation-sign red" tooltip="{{epgForm.name.$error.required ? 'Required field' : epgForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="epgForm.name.$error.required || epgForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" name="name" ng-model="newEpgObj.name" ng-required="true" ng-disabled="internalView.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['description']"> + <label class="block basicLabel">Description:</label> + <input class="form-control" type="text" ng-model="newEpgObj.description" ng-disabled="internalView.edit === 'view'"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['intra-group-policy']"> + <label class="block basicLabel">Intra group policy:</label> + <select class="form-control" ng-model="newEpgObj['intra-group-policy']" ng-options="opt for opt in igpOpts" ng-disabled="internalView.edit === 'view'"> + <option>--</option> + </select> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['network-domain']"> + <label class="block basicLabel">Network domain: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="epgForm.netDomain.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newEpgObj['network-domain']" name="netDomain" ng-pattern="/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/" ng-disabled="internalView.edit === 'view'"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newEpgObj['parent']"> + <label class="block basicLabel">Parent:</label> + <select class="form-control" ng-model="newEpgObj.parent" ng-options="d.id as getDisplayLabel(d, displayLabel) for d in list"> + <option>--</option> + </select> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> + </form> + </section> + + <section class="formWrapper clearfix" ng-show="selectedEpg"> + <div ng-include src="view_path+'cns.tpl.html'"></div> + </section> + + <section class="formWrapper clearfix" ng-show="selectedEpg"> + <div ng-include src="view_path+'pns.tpl.html'"></div> + </section> + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> + </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/gateway.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/gateway.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/gateway.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/gateway.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/delivered-policy.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/delivered-policy.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/delivered-policy.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/delivered-policy.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/epg-detail.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/epg-detail.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/epg-detail.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/epg-detail.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/expressed-policy.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/expressed-policy.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/expressed-policy.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/expressed-policy.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/main.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/main.tpl.html old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/main.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/main.tpl.html index 97185a885..21091d96e --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/main.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/main.tpl.html @@ -1,58 +1,58 @@ -<section class="col-md-3 simpleBox mt30"> - <h3 class="text-center">Health</h3> - <div class="panelWrapper clearfix"> - <button class="btn btn-primary col-md-12 btn-lg">Exception</button> - <button class="btn btn-primary col-md-12 btn-lg">Conflict</button> - </div> -</section> - -<section class="col-md-4 col-md-offset-2 simpleBox mt30"> - <div class="panelWrapper clearfix"> - <!-- Tenants list --> - <div class="rowWrapper clearfix"> - <label class="block"><span>Tenants list</span></label> - <div class="selectWrapper col-md-12"> - <select class="form-control" ng-model="selectedTenant" ng-change="setTenant(selectedTenant)" ng-options="getDisplayLabel(d, tenantDisplayLabel) for d in tenantList"> - <option value="">Select option</option> - </select> - </div> - - <div class="clear"></div> - - <div class="mt10 clearfix"> - <div class="col-md-6 pl0"> - <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpanded('expressed-policy'); setViewExpand('subMenuView','governance', true); setBreadcrumb('l2', 'Expressed policy', true);" >Expressed<br />policy</button> - </div> - <div class="col-md-6 pr0"> - <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpanded('delivered-policy'); setViewExpand('subMenuView','governance', true); setBreadcrumb('l2', 'Delivered policy', true);">Delivered<br />policy</button> - </div> - </div> - - </div> - </div> - - - <div class="panelWrapper clearfix"> - <!-- Tenants list --> - <div class="rowWrapper clearfix"> - <label class="block"><span>Renderers list</span></label> - <div class="selectWrapper col-md-12"> - <select class="form-control" ng-model="selectedRenderer" ng-change="setRenderer()" ng-options="getDisplayLabel(d, tenantDisplayLabel) for d in rendererList"> - <option value="">Select option</option> - </select> - </div> - - <div class="clear"></div> - - <div class="mt10 clearfix"> - <div class="col-md-6 pl0"> - <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView', 'renderers', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);" >Renderer<br />configuration</button> - </div> - <div class="col-md-6 pr0"> - <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpanded('renderer-state'); setBreadcrumb('l1', 'Governance', true); setBreadcrumb('l2', 'Renderer state', true);">Renderer<br />state</button> - </div> - </div> - - </div> - </div> +<section class="col-md-3 simpleBox mt30"> + <h3 class="text-center">Health</h3> + <div class="panelWrapper clearfix"> + <button class="btn btn-primary col-md-12 btn-lg">Exception</button> + <button class="btn btn-primary col-md-12 btn-lg">Conflict</button> + </div> +</section> + +<section class="col-md-4 col-md-offset-2 simpleBox mt30"> + <div class="panelWrapper clearfix"> + <!-- Tenants list --> + <div class="rowWrapper clearfix"> + <label class="block"><span>Tenants list</span></label> + <div class="selectWrapper col-md-12"> + <select class="form-control" ng-model="selectedTenant" ng-change="setTenant(selectedTenant)" ng-options="getDisplayLabel(d, tenantDisplayLabel) for d in tenantList"> + <option value="">Select option</option> + </select> + </div> + + <div class="clear"></div> + + <div class="mt10 clearfix"> + <div class="col-md-6 pl0"> + <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpanded('expressed-policy'); setViewExpand('subMenuView','governance', true); setBreadcrumb('l2', 'Expressed policy', true);" >Expressed<br />policy</button> + </div> + <div class="col-md-6 pr0"> + <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpanded('delivered-policy'); setViewExpand('subMenuView','governance', true); setBreadcrumb('l2', 'Delivered policy', true);">Delivered<br />policy</button> + </div> + </div> + + </div> + </div> + + + <div class="panelWrapper clearfix"> + <!-- Tenants list --> + <div class="rowWrapper clearfix"> + <label class="block"><span>Renderers list</span></label> + <div class="selectWrapper col-md-12"> + <select class="form-control" ng-model="selectedRenderer" ng-change="setRenderer()" ng-options="getDisplayLabel(d, tenantDisplayLabel) for d in rendererList"> + <option value="">Select option</option> + </select> + </div> + + <div class="clear"></div> + + <div class="mt10 clearfix"> + <div class="col-md-6 pl0"> + <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView', 'renderers', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);" >Renderer<br />configuration</button> + </div> + <div class="col-md-6 pr0"> + <button class="btn btn-primary col-md-12 btn-big" ng-click="toggleExpanded('renderer-state'); setBreadcrumb('l1', 'Governance', true); setBreadcrumb('l2', 'Renderer state', true);">Renderer<br />state</button> + </div> + </div> + + </div> + </div> </section> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/node-structure.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/node-structure.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/node-structure.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/node-structure.tpl.html index ff336b259..389638e4b --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/node-structure.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/node-structure.tpl.html @@ -1,37 +1,37 @@ -<div ng-controller="layerCtrl" ng-init="init(key,value)" class="{{ checkData(value, 'Object') ? 'customContainer' : '' }}"> - - <div ng-if="checkData(value, 'Object')" class="topContainerPart"> - <span class="treeBullet containerBullet" ng-if="key !== 'subject-feature-definitions'">•</span> - <button class="yangButton {{ expanded ? 'iconArrowDown' : 'iconArrowRight' }} inlineBlock" tooltip="Show / Hide container" ng-click='toggleExpanded()'></button> - <button class="btn-name btn-slim"> - {{key}} - </button> - - <div ng-if="checkData(data, 'Array')" class="listPagination inlineBlock" ng-show="data.length > 0"> - <button ng-click="shiftDisplayPrev()" ng-show="showPrevButton()" tooltip="Show previous item" class="yangButton iconPrev"></button> - <div class="paginationItemWrapper"> - <button ng-repeat="offset in displayOffsets track by $index" ng-if="currentDisplayIndex + offset > -1 && data.length > currentDisplayIndex + offset" class="btn btn-like-tab {{ (data[currentDisplayIndex + offset] === actSelected ? 'btn-selected':'') }}" ng-click="setActData(data[currentDisplayIndex + offset])" tooltip="Select this node"> - {{ data[currentDisplayIndex + offset].name }} - </button> - </div> - <button ng-click="shiftDisplayNext()" ng-show="showNextButton('listData')" tooltip="Show next item" class="yangButton iconNext"></button> - </div> - </div> - - <div class="leaf" ng-if="!checkData(value, 'Object') && !checkData(value, 'Array')"> - <span class="treeBullet" ng-if="key !== 'subject-feature-definitions'">•</span> - <span class="leaf-label col-md-2"> - {{ key }} - </span> - <span class="leaf-label col-md-9"><strong>{{value}}</strong></span> - <div class="clear"></div> - </div> - - <div ng-if="checkData(data, 'Array')" ng-repeat="(key, value) in actSelected track by $index" ng-include src="view_path+'/node-structure.tpl.html'" ng-show="expanded"> - </div> - - <div ng-if="!checkData(data, 'Array') && checkData(data, 'Object')" ng-repeat="(key, value) in data track by $index" ng-include src="view_path+'/node-structure.tpl.html'" ng-show="expanded"> - </div> - - <i class="icon-caret-down borderArrow"></i> +<div ng-controller="layerCtrl" ng-init="init(key,value)" class="{{ checkData(value, 'Object') ? 'customContainer' : '' }}"> + + <div ng-if="checkData(value, 'Object')" class="topContainerPart"> + <span class="treeBullet containerBullet" ng-if="key !== 'subject-feature-definitions'">•</span> + <button class="yangButton {{ expanded ? 'iconArrowDown' : 'iconArrowRight' }} inlineBlock" tooltip="Show / Hide container" ng-click='toggleExpanded()'></button> + <button class="btn-name btn-slim"> + {{key}} + </button> + + <div ng-if="checkData(data, 'Array')" class="listPagination inlineBlock" ng-show="data.length > 0"> + <button ng-click="shiftDisplayPrev()" ng-show="showPrevButton()" tooltip="Show previous item" class="yangButton iconPrev"></button> + <div class="paginationItemWrapper"> + <button ng-repeat="offset in displayOffsets track by $index" ng-if="currentDisplayIndex + offset > -1 && data.length > currentDisplayIndex + offset" class="btn btn-like-tab {{ (data[currentDisplayIndex + offset] === actSelected ? 'btn-selected':'') }}" ng-click="setActData(data[currentDisplayIndex + offset])" tooltip="Select this node"> + {{ data[currentDisplayIndex + offset].name }} + </button> + </div> + <button ng-click="shiftDisplayNext()" ng-show="showNextButton('listData')" tooltip="Show next item" class="yangButton iconNext"></button> + </div> + </div> + + <div class="leaf" ng-if="!checkData(value, 'Object') && !checkData(value, 'Array')"> + <span class="treeBullet" ng-if="key !== 'subject-feature-definitions'">•</span> + <span class="leaf-label col-md-2"> + {{ key }} + </span> + <span class="leaf-label col-md-9"><strong>{{value}}</strong></span> + <div class="clear"></div> + </div> + + <div ng-if="checkData(data, 'Array')" ng-repeat="(key, value) in actSelected track by $index" ng-include src="view_path+'/node-structure.tpl.html'" ng-show="expanded"> + </div> + + <div ng-if="!checkData(data, 'Array') && checkData(data, 'Object')" ng-repeat="(key, value) in data track by $index" ng-include src="view_path+'/node-structure.tpl.html'" ng-show="expanded"> + </div> + + <i class="icon-caret-down borderArrow"></i> </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/renderer-configuration.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/renderer-configuration.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/renderer-configuration.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/renderer-configuration.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/renderer-state.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/renderer-state.tpl.html old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/renderer-state.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/renderer-state.tpl.html index 16a3b393e..17ab2a24a --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/renderer-state.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/renderer-state.tpl.html @@ -1,7 +1,7 @@ -<section class="col-md-9 col-md-offset-2 simpleBox mt30"> - <div ng-controller="rendererStateCtrl"> - <div ng-if="!checkData(data, 'Array')" ng-repeat="(key, value) in data" ng-include src="view_path+'/node-structure.tpl.html'"> - </div> - </div> -</section> - +<section class="col-md-9 col-md-offset-2 simpleBox mt30"> + <div ng-controller="rendererStateCtrl"> + <div ng-if="!checkData(data, 'Array')" ng-repeat="(key, value) in data" ng-include src="view_path+'/node-structure.tpl.html'"> + </div> + </div> +</section> + diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/subject-detail.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/subject-detail.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/governance/subject-detail.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/governance/subject-detail.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/index.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/index.tpl.html old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/index.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/index.tpl.html index d52f902b7..707af51f9 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/index.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/index.tpl.html @@ -1,10 +1,10 @@ -<section class="gbpWrapper clearfix"> - - <section class="mainNavigationWrapper" ng-show="mainView.main" ng-include src="view_path+'main/main.tpl.html'"></section> - <section ng-show="mainView.governance" ng-include src="view_path+'main/governance.tpl.html'"></section> - <section ng-show="mainView['policy-renderer']" ng-include src="view_path+'main/policy-renderer.tpl.html'"></section> -</section> - - - - +<section class="gbpWrapper clearfix"> + + <section class="mainNavigationWrapper" ng-show="mainView.main" ng-include src="view_path+'main/main.tpl.html'"></section> + <section ng-show="mainView.governance" ng-include src="view_path+'main/governance.tpl.html'"></section> + <section ng-show="mainView['policy-renderer']" ng-include src="view_path+'main/policy-renderer.tpl.html'"></section> +</section> + + + + diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/l2l3.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/l2l3.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/l2l3.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/l2l3.tpl.html index 11a676b8d..648b2f0cd --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/l2l3.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/l2l3.tpl.html @@ -1,175 +1,175 @@ -<div ng-controller="l3ContextCtrl" ng-init="init()"> - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="view.l3context"> - <form name="l3ContextForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add L3 Context</label> - - - <div class="rowWrapper"> - <label class="block basicLabel">Id:</label> - <input class="form-control" type="text" ng-model="newL3ContextObj.id" disabled /> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">Name: - <i class="icon-exclamation-sign red" tooltip="{{l3ContextForm.name.$error.required ? 'Required field' : l3ContextForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="l3ContextForm.name.$error.required || l3ContextForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newL3ContextObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL3ContextObj.description"> - <label class="block basicLabel">Description:</label> - <input class="form-control" type="text" ng-model="newL3ContextObj.description" ng-disabled="view.edit === 'view'" /> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> - </form> - </section> -</div> - -<br/><br/> - -<div ng-controller="l2BridgeCtrl" ng-init="init()"> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="view.l2bridge"> - <form name="l2BridgeForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add L2 Bridge Domain</label> - - <div class="rowWrapper"> - <label class="block basicLabel">Id:</label> - <input class="form-control" type="text" ng-model="newL2BridgeObj.id" disabled /> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">Name: - <i class="icon-exclamation-sign red" tooltip="{{l2BridgeForm.name.$error.required ? 'Required field' : l2BridgeForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="l2BridgeForm.name.$error.required || l2BridgeForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newL2BridgeObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2BridgeObj.description"> - <label class="block basicLabel">Description:</label> - <input class="form-control" type="text" ng-model="newL2BridgeObj.description" ng-disabled="view.edit === 'view'" /> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2BridgeObj.parent"> - <label class="block basicLabel">Parent:</label> - <select class="form-control" ng-model="newL2BridgeObj.parent" ng-options="d.id as getDisplayLabel(d, l3context.labels) for d in l3context.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> - </form> - </section> -</div> - -<br/><br/> - -<div ng-controller="l2FloodCtrl" ng-init="init()"> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="view.l2flood"> - <form name="l2FloodForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add L2 Flood Domain</label> - - <div class="rowWrapper"> - <label class="block basicLabel">Id:</label> - <input class="form-control" type="text" ng-model="newL2FloodObj.id" disabled /> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">Name: - <i class="icon-exclamation-sign red" tooltip="{{l2FloodForm.name.$error.required ? 'Required field' : l2FloodForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="l2FloodForm.name.$error.required || l2FloodForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newL2FloodObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2FloodObj.description"> - <label class="block basicLabel">Description:</label> - <input class="form-control" type="text" ng-model="newL2FloodObj.description" ng-disabled="view.edit === 'view'" /> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2FloodObj.parent"> - <label class="block basicLabel">Parent:</label> - <select class="form-control" ng-model="newL2FloodObj.parent" ng-options="d.id as getDisplayLabel(d, l2bridge.labels) for d in l2bridge.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> - </form> - </section> -</div> - -<br/><br/> - -<div ng-controller="subnetCtrl" ng-init="init()"> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="view.subnet"> - <form name="subnetForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add Subnet</label> - - <div class="rowWrapper"> - <label class="block basicLabel">Id:</label> - <input class="form-control" type="text" ng-model="newSubnetObj.id" disabled /> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">Name: - <i class="icon-exclamation-sign red" tooltip="{{subnetForm.name.$error.required ? 'Required field' : subnetForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="subnetForm.name.$error.required || subnetForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newSubnetObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj.description"> - <label class="block basicLabel">Description:</label> - <input class="form-control" type="text" ng-model="newSubnetObj.description" ng-disabled="view.edit === 'view'"/> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj.parent"> - <label class="block basicLabel">Parent:</label> - <select class="form-control" ng-model="newSubnetObj.parent" ng-options="d.id as getDisplayLabel(d, l2L3List.labels) for d in l2L3List.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj['ip-prefix']"> - <label class="block basicLabel">IP prefix: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="subnetForm.ipPrefix.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newSubnetObj['ip-prefix']" name="ipPrefix" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))$/" ng-disabled="view.edit === 'view'" /> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj['virtual-router-ip']"> - <label class="block basicLabel">Virtual router: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="subnetForm.virtualRouter.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newSubnetObj['virtual-router-ip']" name="virtualRouter" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?$/" - ng-model="newSubnetObj['virtual-router-ip']" ng-disabled="view.edit === 'view'" /> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> - </form> - </section> - - <section class="formWrapper clearfix" ng-show="selectedSubnet"> - <div ng-include src="view_path+'gateway.tpl.html'"></div> - </section> - - <div class="formWrapper clearfix"> - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> - </div> +<div ng-controller="l3ContextCtrl" ng-init="init()"> + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="view.l3context"> + <form name="l3ContextForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add L3 Context</label> + + + <div class="rowWrapper"> + <label class="block basicLabel">Id:</label> + <input class="form-control" type="text" ng-model="newL3ContextObj.id" disabled /> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">Name: + <i class="icon-exclamation-sign red" tooltip="{{l3ContextForm.name.$error.required ? 'Required field' : l3ContextForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="l3ContextForm.name.$error.required || l3ContextForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newL3ContextObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL3ContextObj.description"> + <label class="block basicLabel">Description:</label> + <input class="form-control" type="text" ng-model="newL3ContextObj.description" ng-disabled="view.edit === 'view'" /> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> + </form> + </section> +</div> + +<br/><br/> + +<div ng-controller="l2BridgeCtrl" ng-init="init()"> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="view.l2bridge"> + <form name="l2BridgeForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add L2 Bridge Domain</label> + + <div class="rowWrapper"> + <label class="block basicLabel">Id:</label> + <input class="form-control" type="text" ng-model="newL2BridgeObj.id" disabled /> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">Name: + <i class="icon-exclamation-sign red" tooltip="{{l2BridgeForm.name.$error.required ? 'Required field' : l2BridgeForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="l2BridgeForm.name.$error.required || l2BridgeForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newL2BridgeObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2BridgeObj.description"> + <label class="block basicLabel">Description:</label> + <input class="form-control" type="text" ng-model="newL2BridgeObj.description" ng-disabled="view.edit === 'view'" /> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2BridgeObj.parent"> + <label class="block basicLabel">Parent:</label> + <select class="form-control" ng-model="newL2BridgeObj.parent" ng-options="d.id as getDisplayLabel(d, l3context.labels) for d in l3context.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> + </form> + </section> +</div> + +<br/><br/> + +<div ng-controller="l2FloodCtrl" ng-init="init()"> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="view.l2flood"> + <form name="l2FloodForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add L2 Flood Domain</label> + + <div class="rowWrapper"> + <label class="block basicLabel">Id:</label> + <input class="form-control" type="text" ng-model="newL2FloodObj.id" disabled /> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">Name: + <i class="icon-exclamation-sign red" tooltip="{{l2FloodForm.name.$error.required ? 'Required field' : l2FloodForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="l2FloodForm.name.$error.required || l2FloodForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newL2FloodObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2FloodObj.description"> + <label class="block basicLabel">Description:</label> + <input class="form-control" type="text" ng-model="newL2FloodObj.description" ng-disabled="view.edit === 'view'" /> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newL2FloodObj.parent"> + <label class="block basicLabel">Parent:</label> + <select class="form-control" ng-model="newL2FloodObj.parent" ng-options="d.id as getDisplayLabel(d, l2bridge.labels) for d in l2bridge.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> + </form> + </section> +</div> + +<br/><br/> + +<div ng-controller="subnetCtrl" ng-init="init()"> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="view.subnet"> + <form name="subnetForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add Subnet</label> + + <div class="rowWrapper"> + <label class="block basicLabel">Id:</label> + <input class="form-control" type="text" ng-model="newSubnetObj.id" disabled /> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">Name: + <i class="icon-exclamation-sign red" tooltip="{{subnetForm.name.$error.required ? 'Required field' : subnetForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="subnetForm.name.$error.required || subnetForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newSubnetObj.name" name="name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj.description"> + <label class="block basicLabel">Description:</label> + <input class="form-control" type="text" ng-model="newSubnetObj.description" ng-disabled="view.edit === 'view'"/> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj.parent"> + <label class="block basicLabel">Parent:</label> + <select class="form-control" ng-model="newSubnetObj.parent" ng-options="d.id as getDisplayLabel(d, l2L3List.labels) for d in l2L3List.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj['ip-prefix']"> + <label class="block basicLabel">IP prefix: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="subnetForm.ipPrefix.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newSubnetObj['ip-prefix']" name="ipPrefix" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))$/" ng-disabled="view.edit === 'view'" /> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newSubnetObj['virtual-router-ip']"> + <label class="block basicLabel">Virtual router: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="subnetForm.virtualRouter.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newSubnetObj['virtual-router-ip']" name="virtualRouter" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?$/" + ng-model="newSubnetObj['virtual-router-ip']" ng-disabled="view.edit === 'view'" /> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> + </form> + </section> + + <section class="formWrapper clearfix" ng-show="selectedSubnet"> + <div ng-include src="view_path+'gateway.tpl.html'"></div> + </section> + + <div class="formWrapper clearfix"> + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> + </div> </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/l3-endpoint.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/l3-endpoint.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/l3-endpoint.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/l3-endpoint.tpl.html index 16d40114b..ff6460931 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/l3-endpoint.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/l3-endpoint.tpl.html @@ -1,130 +1,130 @@ -<div ng-controller="l3EndpointCtrl" ng-init="init()"> - - <h2 class="text-center">L3 Prefix Endpoint</h2> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="view.endpoint"> - <form name="l3EndpointForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-group']"> - <label class="block basicLabel">Endpoint group:</label> - <select class="form-control" ng-model="newEndpointObj['endpoint-group']" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-groups']"> - <label class="basicLabel">Endpoint groups:</label> - <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> - - <div ng-repeat="epGroups in newEndpointObj['endpoint-groups'] track by $index"> - <div class="selectWrapper col-md-10"> - <div class="rowWrapper"> - <select class="form-control" ng-model="epGroups" ng-change="updateLeafListEl($index, epGroups, 'endpoint-groups')" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - </div> - <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> - </div> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['condition']"> - <label class="basicLabel">Condition:</label> - <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('condition')" ng-disabled="view.edit === 'view'"><i class="icon-plus"></i></button> - - <div ng-repeat="condition in newEndpointObj['condition'] track by $index"> - <div class="selectWrapper col-md-10"> - <div class="rowWrapper"> - <input class="form-control" type="text" ng-model="condition" ng-change="updateLeafListEl($index, condition, 'condition')" ng-disabled="view.edit === 'view'"/> - </div> - </div> - <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'condition')" ng-disabled="view.edit === 'view'"><i class="icon-remove"></i></button> - </div> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">L3 Context: - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="l3EndpointForm.l3context.$error.required"></i> - </label> - <select class="form-control" ng-model="newEndpointObj['l3-context']" name="l3context" ng-required="true" ng-options="c.id as getDisplayLabel(c, l3context.labels) for c in l3context.options" ng-disabled="view.edit !== 'add'"> - <option>--</option> - </select> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-l2-gateways']"> - <label class="basicLabel">L2 gateways:</label> - <button class="btn btn-primary btn-slim" ng-click="addNewL2gateways()" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> - - <div ng-repeat="l2gateways in newEndpointObj['endpoint-l2-gateways'] track by $index"> - <div class="separator col-md-11"> - <div class="inner-separator"></div> - </div> - <div class="selectWrapper col-md-10"> - <div class="rowWrapper"> - <label class="block basicLabel">L2 context:</label> - <select class="form-control" ng-model="l2gateways['l2-context']" ng-options="c.id as getDisplayLabel(c, l2context.labels) for c in l2context.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">MAC Address: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="l3EndpointForm.macAddress.$error.pattern"></i> - </label> - <input class="form-control" type="text" name="macAddress" ng-pattern="/^([0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5})$/" ng-model="l2gateways['mac-address']"/ ng-disabled="view.edit === 'view'"> - </div> - </div> - <button class="btn btn-danger col-md-2 btn-list" ng-click="deleteNewL2gateways($index)" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> - </div> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-l3-gateways']"> - <label class="basicLabel">L3 gateways:</label> - <button class="btn btn-primary btn-slim" ng-click="addNewL3gateways()" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> - - <div ng-repeat="l3gateways in newEndpointObj['endpoint-l3-gateways'] track by $index"> - <div class="separator col-md-11"> - <div class="inner-separator"></div> - </div> - <div class="selectWrapper col-md-10"> - <div class="rowWrapper"> - <label class="block basicLabel">L3 Context:</label> - <select class="form-control" ng-model="l3gateways['l3-context']" ng-options="c.id as getDisplayLabel(c, l3context.labels) for c in l3context.options" ng-disabled="view.edit === 'view'"> - <option value="">Select option</option> - </select> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">IP Address: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="l3EndpointForm.ipAddress.$error.pattern"></i> - </label> - <input class="form-control" type="text" name="ipAddress" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/" ng-model="l3gateways['ip-address']" - ng-disabled="view.edit === 'view'"/> - </div> - </div> - <button class="btn btn-danger col-md-2 btn-list" ng-click="deleteNewL3gateways($index)" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> - </div> - </div> - - <div class="clearfix"></div> - - <div class="rowWrapper"> - <label class="basicLabel">IP prefix: - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="l3EndpointForm.ipprefix.$error.pattern"></i> - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="l3EndpointForm.ipprefix.$error.required"></i> - </label> - <input class="form-control" type="text" name="ipprefix" ng-model="newEndpointObj['ip-prefix']" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))$/" ng-required="true" ng-disabled="view.edit !== 'add'" /> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-show="view.edit === 'edit' || view.edit === 'add'">Save</button> - </form> - </section> - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> - +<div ng-controller="l3EndpointCtrl" ng-init="init()"> + + <h2 class="text-center">L3 Prefix Endpoint</h2> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="view.endpoint"> + <form name="l3EndpointForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-group']"> + <label class="block basicLabel">Endpoint group:</label> + <select class="form-control" ng-model="newEndpointObj['endpoint-group']" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper clearfix" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-groups']"> + <label class="basicLabel">Endpoint groups:</label> + <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> + + <div ng-repeat="epGroups in newEndpointObj['endpoint-groups'] track by $index"> + <div class="selectWrapper col-md-10"> + <div class="rowWrapper"> + <select class="form-control" ng-model="epGroups" ng-change="updateLeafListEl($index, epGroups, 'endpoint-groups')" ng-options="c.id as getDisplayLabel(c, epg.labels) for c in epg.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + </div> + <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'endpoint-groups')" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> + </div> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['condition']"> + <label class="basicLabel">Condition:</label> + <button class="btn btn-primary btn-slim" ng-click="addNewLeafListEl('condition')" ng-disabled="view.edit === 'view'"><i class="icon-plus"></i></button> + + <div ng-repeat="condition in newEndpointObj['condition'] track by $index"> + <div class="selectWrapper col-md-10"> + <div class="rowWrapper"> + <input class="form-control" type="text" ng-model="condition" ng-change="updateLeafListEl($index, condition, 'condition')" ng-disabled="view.edit === 'view'"/> + </div> + </div> + <button class="btn btn-danger col-md-2" ng-click="deleteNewLeafListEl($index,'condition')" ng-disabled="view.edit === 'view'"><i class="icon-remove"></i></button> + </div> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">L3 Context: + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="l3EndpointForm.l3context.$error.required"></i> + </label> + <select class="form-control" ng-model="newEndpointObj['l3-context']" name="l3context" ng-required="true" ng-options="c.id as getDisplayLabel(c, l3context.labels) for c in l3context.options" ng-disabled="view.edit !== 'add'"> + <option>--</option> + </select> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-l2-gateways']"> + <label class="basicLabel">L2 gateways:</label> + <button class="btn btn-primary btn-slim" ng-click="addNewL2gateways()" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> + + <div ng-repeat="l2gateways in newEndpointObj['endpoint-l2-gateways'] track by $index"> + <div class="separator col-md-11"> + <div class="inner-separator"></div> + </div> + <div class="selectWrapper col-md-10"> + <div class="rowWrapper"> + <label class="block basicLabel">L2 context:</label> + <select class="form-control" ng-model="l2gateways['l2-context']" ng-options="c.id as getDisplayLabel(c, l2context.labels) for c in l2context.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">MAC Address: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="l3EndpointForm.macAddress.$error.pattern"></i> + </label> + <input class="form-control" type="text" name="macAddress" ng-pattern="/^([0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5})$/" ng-model="l2gateways['mac-address']"/ ng-disabled="view.edit === 'view'"> + </div> + </div> + <button class="btn btn-danger col-md-2 btn-list" ng-click="deleteNewL2gateways($index)" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> + </div> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newEndpointObj['endpoint-l3-gateways']"> + <label class="basicLabel">L3 gateways:</label> + <button class="btn btn-primary btn-slim" ng-click="addNewL3gateways()" ng-hide="view.edit === 'view'"><i class="icon-plus"></i></button> + + <div ng-repeat="l3gateways in newEndpointObj['endpoint-l3-gateways'] track by $index"> + <div class="separator col-md-11"> + <div class="inner-separator"></div> + </div> + <div class="selectWrapper col-md-10"> + <div class="rowWrapper"> + <label class="block basicLabel">L3 Context:</label> + <select class="form-control" ng-model="l3gateways['l3-context']" ng-options="c.id as getDisplayLabel(c, l3context.labels) for c in l3context.options" ng-disabled="view.edit === 'view'"> + <option value="">Select option</option> + </select> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">IP Address: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="l3EndpointForm.ipAddress.$error.pattern"></i> + </label> + <input class="form-control" type="text" name="ipAddress" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/" ng-model="l3gateways['ip-address']" + ng-disabled="view.edit === 'view'"/> + </div> + </div> + <button class="btn btn-danger col-md-2 btn-list" ng-click="deleteNewL3gateways($index)" ng-hide="view.edit === 'view'"><i class="icon-remove"></i></button> + </div> + </div> + + <div class="clearfix"></div> + + <div class="rowWrapper"> + <label class="basicLabel">IP prefix: + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="l3EndpointForm.ipprefix.$error.pattern"></i> + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="l3EndpointForm.ipprefix.$error.required"></i> + </label> + <input class="form-control" type="text" name="ipprefix" ng-model="newEndpointObj['ip-prefix']" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))$/" ng-required="true" ng-disabled="view.edit !== 'add'" /> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-show="view.edit === 'edit' || view.edit === 'add'">Save</button> + </form> + </section> + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> + </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/governance.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/governance.tpl.html old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/governance.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/governance.tpl.html index 825a04954..317d2fd97 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/governance.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/governance.tpl.html @@ -1,22 +1,22 @@ -<section ng-controller="governanceCtrl"> - <section class="col-md-9"> - - <section ng-if="contentTpl" ng-include src="view_path + 'governance/' + contentTpl + '.tpl.html'" onload="checkBroadcastCalling(contentTpl)"></section> - - </section> - - <!-- RIGHT PANEL --> - <aside class="col-md-3"> - <section class="inWrapper"> - - <!-- Menu including --> - <section ng-if="menuTpl" ng-include src="view_path + 'menu/' + menuTpl + '.tpl.html'"></section> - <section class="mb50" ng-if="menuBox" ng-include src="view_path + 'box/' + menuBox + '.tpl.html'" onload="broadcastCalling('menuBox')"></section> - </section> - </aside> - - <section ng-show="wizards.actionReferenceWizard"> - <div ng-include src="view_path+'wizards/actionReferenceWizard.tpl.html'"></div> - </section> -</section> - +<section ng-controller="governanceCtrl"> + <section class="col-md-9"> + + <section ng-if="contentTpl" ng-include src="view_path + 'governance/' + contentTpl + '.tpl.html'" onload="checkBroadcastCalling(contentTpl)"></section> + + </section> + + <!-- RIGHT PANEL --> + <aside class="col-md-3"> + <section class="inWrapper"> + + <!-- Menu including --> + <section ng-if="menuTpl" ng-include src="view_path + 'menu/' + menuTpl + '.tpl.html'"></section> + <section class="mb50" ng-if="menuBox" ng-include src="view_path + 'box/' + menuBox + '.tpl.html'" onload="broadcastCalling('menuBox')"></section> + </section> + </aside> + + <section ng-show="wizards.actionReferenceWizard"> + <div ng-include src="view_path+'wizards/actionReferenceWizard.tpl.html'"></div> + </section> +</section> + diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/main.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/main.tpl.html old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/main.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/main.tpl.html index 9cf8ca3f4..f9cfa6fb9 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/main.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/main.tpl.html @@ -1,39 +1,39 @@ -<h1 class="text-center">GBP</h1> - -<nav class="mainNavigation"> - - <div class="topButtonsWrapper"> - <div class="buttonWrapper"> - <button class="btn btn-primary btn-large" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','policySub', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Policy', true);"></i>Policy expression</button> - <i class="icon-large icon-circle-arrow-down"></i> - </div> - </div> - - <div class="middleButtonsWrapper"> - <div class="buttonWrapper"> - <button class="btn btn-primary btn-large" ng-click="toggleExpandedMM('governance', null, 'GOV_INIT'); setViewExpand('subMenuView','governance', true); setBreadcrumb('l1', 'Governance', true);">Governance</button> - <div class="iconWrapper"> - <i class="icon-large icon-circle-arrow-right"></i> - </div> - </div> - - <div class="middleBox"> - <div class="infinityIcon" ng-click="toggleExpandedMM('governance', null, 'GOV_INIT'); setBreadcrumb('l1', 'Governance', true);"></div> - </div> - - <div class="buttonWrapper"> - <div class="iconWrapper"> - <i class="icon-large icon-circle-arrow-left"></i> - </div> - <button class="btn btn-primary btn-large" ></i>Operational constraints</button> - </div> - </div> - - <div class="bottomButtonsWrapper"> - <div class="buttonWrapper"> - <i class="icon-large icon-circle-arrow-up"></i> - <button class="btn btn-primary btn-large" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView', 'renderers', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);"></i>Renderer configuration</button> - </div> - </div> - +<h1 class="text-center">GBP</h1> + +<nav class="mainNavigation"> + + <div class="topButtonsWrapper"> + <div class="buttonWrapper"> + <button class="btn btn-primary btn-large" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','policySub', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Policy', true);"></i>Policy expression</button> + <i class="icon-large icon-circle-arrow-down"></i> + </div> + </div> + + <div class="middleButtonsWrapper"> + <div class="buttonWrapper"> + <button class="btn btn-primary btn-large" ng-click="toggleExpandedMM('governance', null, 'GOV_INIT'); setViewExpand('subMenuView','governance', true); setBreadcrumb('l1', 'Governance', true);">Governance</button> + <div class="iconWrapper"> + <i class="icon-large icon-circle-arrow-right"></i> + </div> + </div> + + <div class="middleBox"> + <div class="infinityIcon" ng-click="toggleExpandedMM('governance', null, 'GOV_INIT'); setBreadcrumb('l1', 'Governance', true);"></div> + </div> + + <div class="buttonWrapper"> + <div class="iconWrapper"> + <i class="icon-large icon-circle-arrow-left"></i> + </div> + <button class="btn btn-primary btn-large" ></i>Operational constraints</button> + </div> + </div> + + <div class="bottomButtonsWrapper"> + <div class="buttonWrapper"> + <i class="icon-large icon-circle-arrow-up"></i> + <button class="btn btn-primary btn-large" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView', 'renderers', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);"></i>Renderer configuration</button> + </div> + </div> + </nav> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/policy-renderer.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/policy-renderer.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/policy-renderer.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/policy-renderer.tpl.html index 3efb4f216..4983e0dfe --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/main/policy-renderer.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/main/policy-renderer.tpl.html @@ -1,141 +1,141 @@ -<section ng-controller="policyRendererCtrl"> - <!-- TOPOLOGY --> - <section class="sigmaWrapper col-md-9"> - <section class="sigmaModalWrapper simpleBox" ng-controller="linkDataCtrl" ng-show="showTable"> - <div class="tableWrapper"> - <i class="icon-remove" ng-click="close()"></i> - - <div class="dataWrapper"> - <section ng-repeat="subject in linkData"> - <section class="header"> - <span class="block">{{ 'Subject: ' + subject.name }}</span> - </section> - - <section class="ml10" ng-repeat="rule in subject['ui-rule']"> - <label class="block">Rule:{{rule.name}}</label> - <section class="ml10" ng-repeat="classifier in rule['classifier-ref']"> - <span class="block">Classifier:</span> - <ul> - <li ng-repeat="(key, value) in classifier">{{key}}: {{value}}</li> - </ul> - </section> - <section ng-repeat="classifier in rule['action-ref']"> - <span class="block">Action:</span> - <ul> - <li ng-repeat="(key, value) in classifier">{{key}}: {{value}}</li> - </ul> - </section> - </section> - </section> - </div> - </div> - </section> - - - <section class="policyGraphWrapper"> - <div graph="graph" id="graph" grid-size="1" /> - </section> - - <div class="topoNav"> - <label class="block"><span>Topology type:</span></label> - <div class="btn-group" role="group"> - <button type="button" class="btn btn-primary" ng-click="loadTopology('CONFIG', { tenantId: selectedTenant.id })">Config</button> - <button type="button" class="btn btn-primary" ng-click="loadTopology('OPERATIONAL', { tenantId: selectedTenant.id })">Operational</button> - <button type="button" class="btn btn-primary" ng-click="loadTopology('L2L3', { tenantId: selectedTenant.id, storage: 'config' })">L2/L3</button> - </div> - </div> - - </section> - - <!-- RIGHT PANEL --> - <aside class="col-md-3"> - <section class="inWrapper"> - - <div ng-include src="view_path+'parts/breadcrumbs.tpl.html'" class="breadcrumbs clearfix"></div> - - <div class="block clearfix" style="height: 109px;"> - <!-- Tenants list --> - <div class="rowWrapper clearfix"> - <label class="block"><span>Tenants list</span></label> - <div class="selectWrapper col-md-12"> - <select class="form-control" ng-model="selectedTenant" ng-change="setTenant(selectedTenant); reloadTopo();" ng-options="getDisplayLabel(d, tenantDisplayLabel) for d in tenantList"> - <option value="">Select option</option> - </select> - </div> - </div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.basic"> - <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','policySub'); setBreadcrumb('l2', 'Policy', subMenuView.policySub);" tooltip="Show/Hide policy submenu" >Policy</button> - <section ng-show="subMenuView.policySub"> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('tenants'); setBreadcrumb('l3', 'Tenants', policyRendererView.tenants);" tooltip="CRUD for tenants" >Tenants</button> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('epg'); setBreadcrumb('l3', 'Endpoint groups', policyRendererView.epg);" tooltip="CRUD for endpoint groups">Endpoint groups</button> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('contracts'); setBreadcrumb('l3', 'Contracts', policyRendererView.contracts);" tooltip="CRUD for contracts">Contracts</button> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('l2l3'); setBreadcrumb('l3', 'L2/L3', policyRendererView.l2l3);" tooltip="CRUD for l2/l3">L2/L3</button> - </section> - - <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','renderers'); setBreadcrumb('l2', 'Renderers', subMenuView.renderers);" tooltip="Show/Hide renderers submenu" >Renderers</button> - - <section ng-show="subMenuView.renderers"> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('classifiers'); setBreadcrumb('l3', 'Classifiers', policyRendererView.classifiers);" tooltip="CRUD for classifiers">Classifiers</button> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('actions'); setBreadcrumb('l3', 'Actions', policyRendererView.actions);" tooltip="CRUD for actions">Actions</button> - </section> - - <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','endpoints'); setBreadcrumb('l2', 'Endpoints', subMenuView.endpoints);" tooltip="Show/Hide endpoints submenu">Endpoints</button> - <section ng-show="subMenuView.endpoints"> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('registerEndpoint'); setBreadcrumb('l3', 'Endpoint', policyRendererView.registerEndpoint);" tooltip="CRUD for endpoint">Endpoint</button> - <button class="btn btn-default col-md-12" ng-click="toggleExpanded('registerL3PrefixEndpoint'); setBreadcrumb('l3', 'L3 prefix endpoint', policyRendererView.registerL3PrefixEndpoint);" tooltip="CRUD for L3 prefix endpoint">L3 prefix endpoint</button> - </section> - <!-- <button class="btn btn-primary col-md-12" ng-click="toggleExpanded('docs')" >Docs</button> --> - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary bottom-buttons full-width" ng-click="toggleExpandedMM('main')" >Home</button> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.tenants"> - <div ng-include src="view_path+'tenants.tpl.html'"></div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.l2l3"> - <div ng-include src="view_path+'l2l3.tpl.html'"></div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.epg" ng-controller="epgCtrl"> - <div ng-include src="view_path+'epg.tpl.html'"></div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.contracts"> - <div ng-include src="view_path+'contracts.tpl.html'"></div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.docs"> - <div ng-include src="view_path+'docs.tpl.html'"></div> - </div> - - <div ng-controller="renderersCtrl"> - <div class="panelWrapper clearfix" ng-show="policyRendererView.classifiers" ng-controller="classifiersCtrl"> - <div ng-include src="view_path+'classifiers.tpl.html'"></div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.actions" ng-controller="actionsCtrl"> - <div ng-include src="view_path+'actions.tpl.html'"></div> - </div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.registerEndpoint"> - <div ng-include src="view_path+'endpoint.tpl.html'"></div> - </div> - - <div class="panelWrapper clearfix" ng-show="policyRendererView.registerL3PrefixEndpoint"> - <div ng-include src="view_path+'l3-endpoint.tpl.html'"></div> - </div> - - - - </section> - </aside> - - <div ng-if="wizards.accessModelWizard"> - <div ng-include src="view_path+'wizards/accessModelWizard.tpl.html'"></div> - </div> -</section> +<section ng-controller="policyRendererCtrl"> + <!-- TOPOLOGY --> + <section class="sigmaWrapper col-md-9"> + <section class="sigmaModalWrapper simpleBox" ng-controller="linkDataCtrl" ng-show="showTable"> + <div class="tableWrapper"> + <i class="icon-remove" ng-click="close()"></i> + + <div class="dataWrapper"> + <section ng-repeat="subject in linkData"> + <section class="header"> + <span class="block">{{ 'Subject: ' + subject.name }}</span> + </section> + + <section class="ml10" ng-repeat="rule in subject['ui-rule']"> + <label class="block">Rule:{{rule.name}}</label> + <section class="ml10" ng-repeat="classifier in rule['classifier-ref']"> + <span class="block">Classifier:</span> + <ul> + <li ng-repeat="(key, value) in classifier">{{key}}: {{value}}</li> + </ul> + </section> + <section ng-repeat="classifier in rule['action-ref']"> + <span class="block">Action:</span> + <ul> + <li ng-repeat="(key, value) in classifier">{{key}}: {{value}}</li> + </ul> + </section> + </section> + </section> + </div> + </div> + </section> + + + <section class="policyGraphWrapper"> + <div graph="graph" id="graph" grid-size="1" /> + </section> + + <div class="topoNav"> + <label class="block"><span>Topology type:</span></label> + <div class="btn-group" role="group"> + <button type="button" class="btn btn-primary" ng-click="loadTopology('CONFIG', { tenantId: selectedTenant.id })">Config</button> + <button type="button" class="btn btn-primary" ng-click="loadTopology('OPERATIONAL', { tenantId: selectedTenant.id })">Operational</button> + <button type="button" class="btn btn-primary" ng-click="loadTopology('L2L3', { tenantId: selectedTenant.id, storage: 'config' })">L2/L3</button> + </div> + </div> + + </section> + + <!-- RIGHT PANEL --> + <aside class="col-md-3"> + <section class="inWrapper"> + + <div ng-include src="view_path+'parts/breadcrumbs.tpl.html'" class="breadcrumbs clearfix"></div> + + <div class="block clearfix" style="height: 109px;"> + <!-- Tenants list --> + <div class="rowWrapper clearfix"> + <label class="block"><span>Tenants list</span></label> + <div class="selectWrapper col-md-12"> + <select class="form-control" ng-model="selectedTenant" ng-change="setTenant(selectedTenant); reloadTopo();" ng-options="getDisplayLabel(d, tenantDisplayLabel) for d in tenantList"> + <option value="">Select option</option> + </select> + </div> + </div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.basic"> + <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','policySub'); setBreadcrumb('l2', 'Policy', subMenuView.policySub);" tooltip="Show/Hide policy submenu" >Policy</button> + <section ng-show="subMenuView.policySub"> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('tenants'); setBreadcrumb('l3', 'Tenants', policyRendererView.tenants);" tooltip="CRUD for tenants" >Tenants</button> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('epg'); setBreadcrumb('l3', 'Endpoint groups', policyRendererView.epg);" tooltip="CRUD for endpoint groups">Endpoint groups</button> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('contracts'); setBreadcrumb('l3', 'Contracts', policyRendererView.contracts);" tooltip="CRUD for contracts">Contracts</button> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('l2l3'); setBreadcrumb('l3', 'L2/L3', policyRendererView.l2l3);" tooltip="CRUD for l2/l3">L2/L3</button> + </section> + + <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','renderers'); setBreadcrumb('l2', 'Renderers', subMenuView.renderers);" tooltip="Show/Hide renderers submenu" >Renderers</button> + + <section ng-show="subMenuView.renderers"> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('classifiers'); setBreadcrumb('l3', 'Classifiers', policyRendererView.classifiers);" tooltip="CRUD for classifiers">Classifiers</button> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('actions'); setBreadcrumb('l3', 'Actions', policyRendererView.actions);" tooltip="CRUD for actions">Actions</button> + </section> + + <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','endpoints'); setBreadcrumb('l2', 'Endpoints', subMenuView.endpoints);" tooltip="Show/Hide endpoints submenu">Endpoints</button> + <section ng-show="subMenuView.endpoints"> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('registerEndpoint'); setBreadcrumb('l3', 'Endpoint', policyRendererView.registerEndpoint);" tooltip="CRUD for endpoint">Endpoint</button> + <button class="btn btn-default col-md-12" ng-click="toggleExpanded('registerL3PrefixEndpoint'); setBreadcrumb('l3', 'L3 prefix endpoint', policyRendererView.registerL3PrefixEndpoint);" tooltip="CRUD for L3 prefix endpoint">L3 prefix endpoint</button> + </section> + <!-- <button class="btn btn-primary col-md-12" ng-click="toggleExpanded('docs')" >Docs</button> --> + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary bottom-buttons full-width" ng-click="toggleExpandedMM('main')" >Home</button> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.tenants"> + <div ng-include src="view_path+'tenants.tpl.html'"></div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.l2l3"> + <div ng-include src="view_path+'l2l3.tpl.html'"></div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.epg" ng-controller="epgCtrl"> + <div ng-include src="view_path+'epg.tpl.html'"></div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.contracts"> + <div ng-include src="view_path+'contracts.tpl.html'"></div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.docs"> + <div ng-include src="view_path+'docs.tpl.html'"></div> + </div> + + <div ng-controller="renderersCtrl"> + <div class="panelWrapper clearfix" ng-show="policyRendererView.classifiers" ng-controller="classifiersCtrl"> + <div ng-include src="view_path+'classifiers.tpl.html'"></div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.actions" ng-controller="actionsCtrl"> + <div ng-include src="view_path+'actions.tpl.html'"></div> + </div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.registerEndpoint"> + <div ng-include src="view_path+'endpoint.tpl.html'"></div> + </div> + + <div class="panelWrapper clearfix" ng-show="policyRendererView.registerL3PrefixEndpoint"> + <div ng-include src="view_path+'l3-endpoint.tpl.html'"></div> + </div> + + + + </section> + </aside> + + <div ng-if="wizards.accessModelWizard"> + <div ng-include src="view_path+'wizards/accessModelWizard.tpl.html'"></div> + </div> +</section> diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/menu/main-menu.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/menu/main-menu.tpl.html old mode 100755 new mode 100644 similarity index 99% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/menu/main-menu.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/menu/main-menu.tpl.html index 9bf8e2304..1a86da3d7 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/menu/main-menu.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/menu/main-menu.tpl.html @@ -1,31 +1,31 @@ -<div ng-include src="view_path+'parts/breadcrumbs.tpl.html'" class="breadcrumbs clearfix"></div> - -<div class="panelWrapper clearfix no-padd-top"> - <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','policy');" tooltip="Show/Hide policy submenu"></i>Policy expression</button> - <section ng-show="subMenuView.policy"> - <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','policySub', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Policy', true);" >Policy</button> - <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','renderers', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);">Renderers</button> - <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','endpoints', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Endpoints', true);">Endpoints</button> - </section> - - - - <button class="btn btn-primary col-md-12 btn-lg" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);"></i>Renderer configuration</button> - - <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','governance')" tooltip="Show/Hide governance submenu">Governance</button> - - <section ng-show="subMenuView.governance"> - <button class="btn btn-default col-md-12" ng-class="contentTpl === 'main' && mainView.governance ? 'activated' : ''" ng-click="toggleExpandedMM('governance', true, 'GOV_INIT'); setBreadcrumb('l1', 'Governance', true);" >Governance</button> - <button class="btn btn-default col-md-12" ng-class="contentTpl === 'expressed-policy' ? 'activated' : ''" ng-click="toggleExpanded('expressed-policy'); setBreadcrumb('l2', 'Expressed policy', true);" tooltip="Show expressed policy diagram">Expressed policy</button> - <button class="btn btn-default col-md-12" ng-class="contentTpl === 'delivered-policy' || contentTpl === 'epg-detail' || contentTpl === 'subject-detail' ? 'activated' : ''" ng-click="toggleExpanded('delivered-policy'); setBreadcrumb('l2', 'Delivered policy', true);" tooltip="Show delivered policy diagram">Delivered policy</button> - - <!-- <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true);" >Renderer configuration</button> --> - - <button class="btn btn-default col-md-12" ng-class="contentTpl === 'renderer-state' ? 'activated' : ''" ng-click="toggleExpanded('renderer-state'); setBreadcrumb('l1', 'Governance', true); setBreadcrumb('l2', 'Renderer state', true);">Renderer state</button> - </section> - - <button class="btn btn-primary col-md-12 btn-lg" ></i>Operational constraints</button> - - <button class="btn btn-primary bottom-buttons full-width" ng-click="toggleExpandedMM('main')" >Home</button> -</div> - +<div ng-include src="view_path+'parts/breadcrumbs.tpl.html'" class="breadcrumbs clearfix"></div> + +<div class="panelWrapper clearfix no-padd-top"> + <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','policy');" tooltip="Show/Hide policy submenu"></i>Policy expression</button> + <section ng-show="subMenuView.policy"> + <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','policySub', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Policy', true);" >Policy</button> + <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','renderers', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);">Renderers</button> + <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setViewExpand('subMenuView','endpoints', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Endpoints', true);">Endpoints</button> + </section> + + + + <button class="btn btn-primary col-md-12 btn-lg" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l1', 'Policy expression', true); setBreadcrumb('l2', 'Renderers', true);"></i>Renderer configuration</button> + + <button class="btn btn-primary col-md-12 btn-lg" ng-click="setViewExpand('subMenuView','governance')" tooltip="Show/Hide governance submenu">Governance</button> + + <section ng-show="subMenuView.governance"> + <button class="btn btn-default col-md-12" ng-class="contentTpl === 'main' && mainView.governance ? 'activated' : ''" ng-click="toggleExpandedMM('governance', true, 'GOV_INIT'); setBreadcrumb('l1', 'Governance', true);" >Governance</button> + <button class="btn btn-default col-md-12" ng-class="contentTpl === 'expressed-policy' ? 'activated' : ''" ng-click="toggleExpanded('expressed-policy'); setBreadcrumb('l2', 'Expressed policy', true);" tooltip="Show expressed policy diagram">Expressed policy</button> + <button class="btn btn-default col-md-12" ng-class="contentTpl === 'delivered-policy' || contentTpl === 'epg-detail' || contentTpl === 'subject-detail' ? 'activated' : ''" ng-click="toggleExpanded('delivered-policy'); setBreadcrumb('l2', 'Delivered policy', true);" tooltip="Show delivered policy diagram">Delivered policy</button> + + <!-- <button class="btn btn-default col-md-12" ng-click="toggleExpandedMM('policy-renderer'); setViewExpand('policyRendererView', 'basic', true);" >Renderer configuration</button> --> + + <button class="btn btn-default col-md-12" ng-class="contentTpl === 'renderer-state' ? 'activated' : ''" ng-click="toggleExpanded('renderer-state'); setBreadcrumb('l1', 'Governance', true); setBreadcrumb('l2', 'Renderer state', true);">Renderer state</button> + </section> + + <button class="btn btn-primary col-md-12 btn-lg" ></i>Operational constraints</button> + + <button class="btn btn-primary bottom-buttons full-width" ng-click="toggleExpandedMM('main')" >Home</button> +</div> + diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/breadcrumbs.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/breadcrumbs.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/breadcrumbs.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/breadcrumbs.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/crud-endpoint.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/crud-endpoint.tpl.html old mode 100755 new mode 100644 similarity index 97% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/crud-endpoint.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/crud-endpoint.tpl.html index 5685e858c..d3a99343b --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/crud-endpoint.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/crud-endpoint.tpl.html @@ -1,32 +1,32 @@ -<section class="rowWrapper clearfix" ng-controller="crudCtrl"> - <div class="inline-block full-width"> - <label class="block float-left"><span>{{ crudLabel }}</span></label> - - <button type="button" class="btn btn-primary col-md-4 float-right" ng-click="filter = !filter"><i class="icon-filter"></i></button> - </div> - - <div ng-init="filter = false" class="ep-filter" ng-show="filter"> - <div class="inline-block"> - <label class="block"><span>Endpoint group</span></label> - <input type="text" class="form-control" ng-model="q['endpoint-group']" placeholder="Filter by Endpoint groups"/> - </div> - - <div class="inline-block"> - <label class="block"><span>Network containment</span></label> - <input type="text" class="form-control" ng-model="q['network-containment']" placeholder="Filter by netw. containment"/> - </div> - </div> - - <div class="selectWrapper col-md-6"> - <select class="form-control" ng-model="selectedObj" ng-change="reload(selectedObj)" ng-options="getDisplayLabel(d, displayLabel) for d in list | filter:q"> - <option value="">Select option</option> - </select> - - </div> - - <div class="btn-group col-md-6" role="group"> - <button type="button" class="btn btn-primary col-md-4" ng-click="add()">Add</button> - <button type="button" class="btn btn-primary col-md-4" ng-click="modify()">Edit</button> - <button type="button" class="btn btn-primary col-md-4" ng-click="delete()">Delete</button> - </div> +<section class="rowWrapper clearfix" ng-controller="crudCtrl"> + <div class="inline-block full-width"> + <label class="block float-left"><span>{{ crudLabel }}</span></label> + + <button type="button" class="btn btn-primary col-md-4 float-right" ng-click="filter = !filter"><i class="icon-filter"></i></button> + </div> + + <div ng-init="filter = false" class="ep-filter" ng-show="filter"> + <div class="inline-block"> + <label class="block"><span>Endpoint group</span></label> + <input type="text" class="form-control" ng-model="q['endpoint-group']" placeholder="Filter by Endpoint groups"/> + </div> + + <div class="inline-block"> + <label class="block"><span>Network containment</span></label> + <input type="text" class="form-control" ng-model="q['network-containment']" placeholder="Filter by netw. containment"/> + </div> + </div> + + <div class="selectWrapper col-md-6"> + <select class="form-control" ng-model="selectedObj" ng-change="reload(selectedObj)" ng-options="getDisplayLabel(d, displayLabel) for d in list | filter:q"> + <option value="">Select option</option> + </select> + + </div> + + <div class="btn-group col-md-6" role="group"> + <button type="button" class="btn btn-primary col-md-4" ng-click="add()">Add</button> + <button type="button" class="btn btn-primary col-md-4" ng-click="modify()">Edit</button> + <button type="button" class="btn btn-primary col-md-4" ng-click="delete()">Delete</button> + </div> </section> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/crud.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/crud.tpl.html old mode 100755 new mode 100644 similarity index 96% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/crud.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/crud.tpl.html index f99fc070a..141bdd0df --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/crud.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/crud.tpl.html @@ -1,15 +1,15 @@ -<section class="rowWrapper clearfix" ng-controller="crudCtrl"> - <label class="block"><span>{{ crudLabel }}</span></label> - - <div class="selectWrapper col-md-6"> - <select class="form-control" ng-model="selectedObj" ng-change="reload(selectedObj)" ng-options="getDisplayLabel(d, displayLabel) for d in list"> - <option value="">Select option</option> - </select> - </div> - - <div class="btn-group col-md-6" role="group"> - <button type="button" class="btn btn-primary col-md-4" ng-click="add()">Add</button> - <button type="button" class="btn btn-primary col-md-4" ng-click="modify()">Edit</button> - <button type="button" class="btn btn-primary col-md-4" ng-click="delete()">Delete</button> - </div> +<section class="rowWrapper clearfix" ng-controller="crudCtrl"> + <label class="block"><span>{{ crudLabel }}</span></label> + + <div class="selectWrapper col-md-6"> + <select class="form-control" ng-model="selectedObj" ng-change="reload(selectedObj)" ng-options="getDisplayLabel(d, displayLabel) for d in list"> + <option value="">Select option</option> + </select> + </div> + + <div class="btn-group col-md-6" role="group"> + <button type="button" class="btn btn-primary col-md-4" ng-click="add()">Add</button> + <button type="button" class="btn btn-primary col-md-4" ng-click="modify()">Edit</button> + <button type="button" class="btn btn-primary col-md-4" ng-click="delete()">Delete</button> + </div> </section> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/param.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/param.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/parts/param.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/parts/param.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/pns.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/pns.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/pns.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/pns.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/prefix.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/prefix.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/prefix.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/prefix.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/root.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/root.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/root.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/root.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/rules.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/rules.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/rules.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/rules.tpl.html index 262ef4aa9..6bffd4004 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/rules.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/rules.tpl.html @@ -1,36 +1,36 @@ -<div ng-controller="ruleCtrl" ng-init="init()"> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section ng-show="internalView.rule"> - <form name="rulesForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - - <div class="rowWrapper"> - <label class="block basicLabel"><span>Name:</span> - <i class="icon-exclamation-sign red" tooltip="{{rulesForm.name.$error.required ? 'Required field' : rulesForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="rulesForm.name.$error.required || rulesForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newRuleObj.name" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newRuleObj['order']"> - <label class="block basicLabel"><span>Order:</span> - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="rulesForm.order.$error.required"></i> - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="errors.int32 && !rulesForm.order.$error.required"></i> - </label> - <input class="form-control" type="text" name="order" ng-required="true" ng-model="newRuleObj.order" ng-disabled="internalView.edit === 'view'" ng-change="validate(newRuleObj.order, errors)"/> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> - </form> - </section> - - <section class="formWrapper clearfix" ng-show="selectedRule"> - <div ng-include src="view_path+'action-ref.tpl.html'"></div> - </section> - - <section class="formWrapper clearfix" ng-show="selectedRule"> - <div ng-include src="view_path+'classifier-ref.tpl.html'"></div> - </section> - +<div ng-controller="ruleCtrl" ng-init="init()"> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section ng-show="internalView.rule"> + <form name="rulesForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + + <div class="rowWrapper"> + <label class="block basicLabel"><span>Name:</span> + <i class="icon-exclamation-sign red" tooltip="{{rulesForm.name.$error.required ? 'Required field' : rulesForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="rulesForm.name.$error.required || rulesForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newRuleObj.name" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newRuleObj['order']"> + <label class="block basicLabel"><span>Order:</span> + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="rulesForm.order.$error.required"></i> + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="errors.int32 && !rulesForm.order.$error.required"></i> + </label> + <input class="form-control" type="text" name="order" ng-required="true" ng-model="newRuleObj.order" ng-disabled="internalView.edit === 'view'" ng-change="validate(newRuleObj.order, errors)"/> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> + </form> + </section> + + <section class="formWrapper clearfix" ng-show="selectedRule"> + <div ng-include src="view_path+'action-ref.tpl.html'"></div> + </section> + + <section class="formWrapper clearfix" ng-show="selectedRule"> + <div ng-include src="view_path+'classifier-ref.tpl.html'"></div> + </section> + </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/subjects.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/subjects.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/subjects.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/subjects.tpl.html index e88e34be0..1973ebe47 --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/subjects.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/subjects.tpl.html @@ -1,31 +1,31 @@ -<div ng-controller="subjectCtrl" ng-init="init()"> - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section ng-show="internalView.subject"> - <form name="subjectForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - - <div class="rowWrapper"> - <label class="block basicLabel"><span>Name:</span> - <i class="icon-exclamation-sign red" tooltip="{{subjectForm.name.$error.required ? 'Required field' : subjectForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="subjectForm.name.$error.required || subjectForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" ng-model="newSubjectObj.name" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newSubjectObj['order']"> - <label class="block basicLabel"><span>Order:</span> - <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="subjectForm.order.$error.required"></i> - <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="errors.int32 && !subjectForm.order.$error.required"></i> - </label> - <input class="form-control" type="text" name="order" ng-required="true" name="order" ng-model="newSubjectObj.order" ng-disabled="internalView.edit === 'view'" ng-change="validate(newSubjectObj.order, errors)"/> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> - </form> - </section> - - <section class="formWrapper clearfix" ng-show="selectedSubject"> - <div ng-include src="view_path+'rules.tpl.html'"></div> - </section> +<div ng-controller="subjectCtrl" ng-init="init()"> + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section ng-show="internalView.subject"> + <form name="subjectForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + + <div class="rowWrapper"> + <label class="block basicLabel"><span>Name:</span> + <i class="icon-exclamation-sign red" tooltip="{{subjectForm.name.$error.required ? 'Required field' : subjectForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="subjectForm.name.$error.required || subjectForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" ng-model="newSubjectObj.name" name="name" ng-required="true" ng-disabled="internalView.edit !== 'add'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="internalView.edit === 'view' && !newSubjectObj['order']"> + <label class="block basicLabel"><span>Order:</span> + <i class="icon-exclamation-sign red" tooltip="Required field" ng-show="subjectForm.order.$error.required"></i> + <i class="icon-exclamation-sign red" tooltip="Invalid pattern" ng-show="errors.int32 && !subjectForm.order.$error.required"></i> + </label> + <input class="form-control" type="text" name="order" ng-required="true" name="order" ng-model="newSubjectObj.order" ng-disabled="internalView.edit === 'view'" ng-change="validate(newSubjectObj.order, errors)"/> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="internalView.edit === 'view'">Save</button> + </form> + </section> + + <section class="formWrapper clearfix" ng-show="selectedSubject"> + <div ng-include src="view_path+'rules.tpl.html'"></div> + </section> </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/tenants.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/tenants.tpl.html old mode 100755 new mode 100644 similarity index 98% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/tenants.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/tenants.tpl.html index 73096ee05..95228f77e --- a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/tenants.tpl.html +++ b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/tenants.tpl.html @@ -1,38 +1,38 @@ -<div ng-controller="tenantCtrl" ng-init="init()"> - - <h2 class="text-center">Tenants</h2> - - - <div ng-include src="view_path+'parts/crud.tpl.html'"></div> - - <section class="formWrapper clearfix" ng-show="view.tenant"> - <form name="tenantForm" novalidate="novalidate"> - <i class="icon-remove align-right" ng-click="close()"></i> - <label class="block">Add Tenant</label> - - <div class="rowWrapper"> - <label class="block basicLabel">Id:</label> - <input class="form-control" type="text" ng-model="newTenantObj.id" disabled/> - </div> - - <div class="rowWrapper"> - <label class="block basicLabel">Name: - <i class="icon-exclamation-sign red" tooltip="{{tenantForm.name.$error.required ? 'Required field' : tenantForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="tenantForm.name.$error.required || tenantForm.name.$error.pattern"></i> - </label> - <input class="form-control" type="text" name="name" ng-model="newTenantObj.name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> - </div> - - <div class="rowWrapper" ng-hide="view.edit === 'view' && !newTenantObj.description"> - <label class="block basicLabel">Description:</label> - <input class="form-control" type="text" ng-model="newTenantObj.description" ng-disabled="view.edit === 'view'"/> - </div> - - <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> - </form> - </section> - - <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> - <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> - <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> - +<div ng-controller="tenantCtrl" ng-init="init()"> + + <h2 class="text-center">Tenants</h2> + + + <div ng-include src="view_path+'parts/crud.tpl.html'"></div> + + <section class="formWrapper clearfix" ng-show="view.tenant"> + <form name="tenantForm" novalidate="novalidate"> + <i class="icon-remove align-right" ng-click="close()"></i> + <label class="block">Add Tenant</label> + + <div class="rowWrapper"> + <label class="block basicLabel">Id:</label> + <input class="form-control" type="text" ng-model="newTenantObj.id" disabled/> + </div> + + <div class="rowWrapper"> + <label class="block basicLabel">Name: + <i class="icon-exclamation-sign red" tooltip="{{tenantForm.name.$error.required ? 'Required field' : tenantForm.name.$error.pattern ? 'Value must start with letter followed by letters and digits without space' : ''}}" ng-show="tenantForm.name.$error.required || tenantForm.name.$error.pattern"></i> + </label> + <input class="form-control" type="text" name="name" ng-model="newTenantObj.name" ng-required="true" ng-disabled="view.edit === 'view'" ng-pattern="/^[a-zA-Z]([a-zA-Z0-9\-_.])*$/"/> + </div> + + <div class="rowWrapper" ng-hide="view.edit === 'view' && !newTenantObj.description"> + <label class="block basicLabel">Description:</label> + <input class="form-control" type="text" ng-model="newTenantObj.description" ng-disabled="view.edit === 'view'"/> + </div> + + <button class="btn btn-primary col-md-12" ng-click="save()" ng-hide="view.edit === 'view'">Save</button> + </form> + </section> + + <button class="btn btn-primary bottom-buttons full-width wizard-button" ng-click="showWizard('accessModelWizard')"><i class="icon-magic"></i>Access Model Wizard</button> + <button class="btn btn-primary col-md-12 bottom-buttons home" ng-click="toggleExpandedMM('main')">Home</button> + <button class="btn btn-primary col-md-12 bottom-buttons back" ng-click="setViewExpand('policyRendererView', 'basic', true); setBreadcrumb('l3', null, false);">Back</button> + </div> \ No newline at end of file diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/wizards/accessModelWizard.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/wizards/accessModelWizard.tpl.html old mode 100755 new mode 100644 similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/wizards/accessModelWizard.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/wizards/accessModelWizard.tpl.html diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/views/wizards/actionReferenceWizard.tpl.html b/groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/wizards/actionReferenceWizard.tpl.html similarity index 100% rename from groupbasedpolicy-ui/module/src/main/resources/gbp/views/wizards/actionReferenceWizard.tpl.html rename to groupbasedpolicy-old-ui/module/src/main/resources/gbp/views/wizards/actionReferenceWizard.tpl.html diff --git a/groupbasedpolicy-ui/pom.xml b/groupbasedpolicy-old-ui/pom.xml old mode 100755 new mode 100644 similarity index 90% rename from groupbasedpolicy-ui/pom.xml rename to groupbasedpolicy-old-ui/pom.xml index a90ba5bb7..9f9ed01a2 --- a/groupbasedpolicy-ui/pom.xml +++ b/groupbasedpolicy-old-ui/pom.xml @@ -11,8 +11,8 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.opendaylight.groupbasedpolicy</groupId> - <artifactId>groupbasedpolicy-ui</artifactId> - <name>groupbasedpolicy-ui</name> + <artifactId>groupbasedpolicy-old-ui</artifactId> + <name>groupbasedpolicy-old-ui</name> <description>Resources</description> <version>0.4.0-SNAPSHOT</version> <packaging>pom</packaging> diff --git a/pom.xml b/pom.xml index e729b8a53..990686bab 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ <module>neutron-mapper</module> <module>neutron-ovsdb</module> <module>ui-backend</module> - <module>groupbasedpolicy-ui</module> + <module>groupbasedpolicy-old-ui</module> <module>distribution-karaf</module> <module>features</module> <module>sxp-mapper</module> -- 2.36.6